I've made a command which will list all colours in a CSS file as a list of
swatches.
At the minute it only does Hex colours also I would like it if you could
click
colours and it would jump to them in your document but I lack the ruby
skills as I'm sure you will notice from the shoddy
"colourArrayToTrim.each" bit.
Anyway some people might find it useful
input:entire document
output:show as HTML
activation:Key cmd+shift+opt+ctrl+c (ALL modifiers + C, to show ALL
colours ;) )
scope: source.css
Code as follows:
#!/usr/bin/env ruby
file = STDIN.read
fileName = ENV['TM_FILENAME']
hex = Regexp.new(/(#(\d|[a-f]|[A-F]){3,6})/)
colourArrayToTrim = file.scan(hex)
colourArray = []
colourArrayToTrim.each { |colour|
colourArray.push colour.shift
}
puts '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Colours</title>
<style type="text/css" media="screen">
a {
color: #000;
text-decoration: none;
line-height: 22px;
border: 1px solid #fff;
padding: 2px;
}
a:hover {
background-color: #EFEFEF;
border: 1px solid #999;
}
.colourRow {
display: block;
margin-top: 5px;
margin-bottom: 5px;
width:160px;
margin-right: 10px;
float:left;
}
.swatch {
width: 20px;
height: 20px;
display: block;
border: 1px solid #666;
margin-right: 10px;
float: left;
}
.swatch div {
width: 18px;
height: 18px;
border: 1px solid #fff;
}
</style>
</head>
<body>'
puts "<h2>Colours used #{fileName}</h2>"
colourArray.each { |colour|
puts "
<a href='' class='colourRow'>
<div class='swatch'>
<div style='background-color:#{colour};'></div>
</div>
#{colour}
</a>
"
}
puts "
</body>
</html>
"
Hi,
Just wondering how I go about altering the setup to have folding
block comments in a PHP file? I only need to fold doc-block type
comments which I see have been designated as effectively ^/**$ - I'm
not worried about blocks within functions. My doc comments can be
quite voluminous, and it's frustrating seeing huge swathes of
comments and little class xxxx {... stubs when I want to get an over
view of the entire file...
;-)
R
Hi,
I'm experiencing some trouble running the auto-reload feature of Skim.
It seems that Skim doesn't wait for the pdf to be closed by the TxMt
command.
Looks like it was trying to reload the file as soon as a single bit
is added to it, imho.
What's more, a warning popup tells me Skim is "Unable to open the
file", but when TxMt is done compiling (displaying the # of errors
and warnings in the output window), I can reload the file successfully.
Have you ever noticed such a behaviour, Skim users?
Any ideas of workarounds?
Xavier Cambar
I use the Diff bundle a lot. I regularly do a 'svn diff | mate'
command prior to check-ins. One of the things I typically do with
larger sets of files is collapse all the diffs so there is one file
per line. I can then examine each group of changes, and once happy
with the review (or as they get committed), I will delete the
collapsed "line".
This is a tedious process because the foldings for a diff are not
automatically done for me. This is one of many cases I've found where
the folding separators cannot be described properly since the close
of the fold is not a match for anything in particular, just the fact
that a new fold is starting. (Another such case is for Markdown-- I'd
like to provide foldings for the "# ..." header, down to the next
available "# ..." header, but I can't express that.)
So what I do is start at the top of the file, then hit Option+Shift
+⇣ which will select just that one file's diff somehow (I haven't
investigated how TextMate knows to skip down to the next "Index..."
line like that. Does it do so based on the lines identified as
separators?). Then I hit ⌘+F1 to fold the selection.
Again this is very tedious, especially for a large diff. I would be
very happy if someone found a way to automate this process. Ideally,
it should be possible to describe a folding marker whose end is
identified by the start of a new fold, but I don't think it's
possible today.
-Brad
Hi,
Just wondering how I submit some snippets for the PHP bundle? They're
small, but I'm using them all the time.
( ${2:'$1'}=>${4:'$3'},$0
tab-triggered on (,
and the more general
, ${2:'$1'}=>${4:'$3'},$0
tab-triggered on ,,
They make typing hashed lists really very much quicker for me.
Or am I missing an altogether quicker way?
R
--
Richard Dyce MA (Cantab.) MBCS MIET
http://dyce.com
Hello all,
When I try to run the patch documented at http://macromates.com/wiki/
Blogging/WordPress, I get the following error:
burt:~/Desktop michael$ patch < wp-xmlrpc-mw-gmt-patch
patching file xmlrpc.php
Hunk #1 FAILED at 669.
Hunk #2 FAILED at 740.
2 out of 2 hunks FAILED -- saving rejects to file xmlrpc.php.rej
I'm assuming this means that my file is not patched correctly. I'm
running the latest Wordpress (2.2) but I'm not aware of any changes
that were made to the xmlrpc.php file from previous versions. Here is
what comes up in the xmlrpc.php.rej file (sorry for all the code)...
***************
*** 669,675 ****
if ($postdata['post_date'] != '') {
- $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']);
$categories = array();
$catids = wp_get_post_cats('', $post_ID);
--- 669,686 ----
if ($postdata['post_date'] != '') {
+ /* BEGIN PATCH */
+ /* Convert post_date to GMT so receiving applications can
+ safely adjust it to the user's local time zone.
+ Using post_date_gmt instead of post_date does *not* work,
+ since it is (wrongly) adjusted for the gmt_offset *twice*. */
+ /* Old code:
+ $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']); */
+ $post_date = mysql2date('Y-m-d H:i:s', $postdata['post_date']);
+ $post_date = get_gmt_from_date($post_date);
+ $post_date = str_replace('-', '', $post_date);
+ $post_date = str_replace(' ', 'T', $post_date);
+ /* END PATCH */
$categories = array();
$catids = wp_get_post_cats('', $post_ID);
***************
*** 729,736 ****
}
foreach ($posts_list as $entry) {
-
- $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$categories = array();
$catids = wp_get_post_cats('', $entry['ID']);
foreach($catids as $catid) {
--- 740,759 ----
}
foreach ($posts_list as $entry) {
+
+ /* BEGIN PATCH */
+ /* Convert post_date to GMT so receiving applications can
+ safely adjust it to the user's local time zone.
+ Using post_date_gmt instead of post_date does *not* work,
+ since it is (wrongly) adjusted for the gmt_offset *twice*. */
+ /* Old code:
+ $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); */
+ $post_date = mysql2date('Y-m-d H:i:s', $entry['post_date']);
+ $post_date = get_gmt_from_date($post_date);
+ $post_date = str_replace('-', '', $post_date);
+ $post_date = str_replace(' ', 'T', $post_date);
+ /* END PATCH */
+
$categories = array();
$catids = wp_get_post_cats('', $entry['ID']);
foreach($catids as $catid) {
Can anybody diagnose this problem? I would appreciate it very much.
Thanks!
Michael
P.S. Great work on the blogging bundle! I love it!
Consider the following code:
=================
#include <Cocoa/Cocoa.h>
#include "MyClass.h"
@implementation MyClass
- (id) init
{
return self;
}
#ifndef _DEMO_
- (void) setSerialNumber: (NSString *) aSerialNumber
{
serialNumber = [aSerialNumber copy];
}
#endif
- (NSString *) description
{
return @"A MyClass";
}
@end
=================
The name of the method setSerialNumber: is not highlighted, and it
does not appear in the function popup. Removing the #ifndef cures
both problems.
Is there something I can do? Is there a later version of the Obj-C
bundle that covers this?
— F
Hari, you might be able to easily answer this, but I'm posting this
question here in case someone else knows as well...
I'm trying to typeset a document entirely in Greek. Document body,
section/chapter headers, everything. I have TeXniscope installed,
using teTeX (and relevant packages) installed through macports.
\usepackage[utf8]{inputenc} at the top produces errors for every
character in the document, in the form of:
./untitled.tex:50: Package inputenc Error: Unicode char \u8:Δ not set
up for us with LaTeX.
etc. I definitely came across this problem before, but I don't
remember if I eventually solved it or if I found it couldn't be
solved... Anything I can try to resolve this? (or typeset everything
in... ugh.. M$ w*rd??)
Thanks,
Constantinos
--
What's your Dream?
Make it happen with www.dostpost.com