I work on a Mac but I need to be able to test my sites on a Windows computer, namely because I need to make sure the 40% or so people who are using IE won’t have the site break on their crappy browser. Since I work on localhost (my local machine), I could upload my site to a remote server and test it on another computer running Windows. This is slow, and I want to test it on the same machine so that changes appear instantly. The solution:
  1. Install Windows in a virtual machine on your Mac (Parallels, VMWare Fusion or the brilliant, free, fast and multi-OS VirtualBox)
  2. Export your Wordpress database from phpMySQL. Make a backup of the `.sql` file.
  3. Open your text editor (BBEdit, Textmate, Espresso, TextEdit (pre-installed)) and replace all occurrences of your localhost URL with your local IP address. For example, `http://localhost/mysite` becomes ``. Notice the lack of a trailing forward-slash!
  4. Drop/Delete all tables in your database in phpMySQL and upload the modified `.sql` file.
  5. Now in your Virtual Machine on Windows, enable a shared network with the host (your Mac)
  6. Access `` on your Mac and in the Windows Virtual Machine
Any changes you make are reflected in the Windows Virtual Machine immediately since it accesses the same files. Make sure to change your router settings to ensure that your local IP address is static.
UPDATE: Use the Tag Editor for creating inline tags. The approach below is now depreciated.
As of Crayon 1.8.3, you can have inline Crayons floating in the middle of sentences for quick snippets. You can use them like you’d use code tags. Here’s the code in the editor:
Here's an example of a floating {php} echo 'Crayon'; {/php} right in the middle of a sentence. Neat!
They work like Mini Tags which use square brackets but instead Inline Tags use curly brackets. You can also use them like [php inline="true"]...[/php] or $[crayon lang="xml" inline="true"]...[/crayon] as well. Also, I’ve added a new feature to make `backquotes` into code. Easy! Oh, and one more thing - you can have Crayons (both normal and inline) in comments :) You can download the beta release now. All these tag settings are now in their own section in Settings > Crayon.
Here’s a 512px x 512px App Icon Template for general use. I built it on this template. I removed all the clutter surrounding it and kept it as a single file. Ideally you don’t want to have more than one image to edit.

Download Template PSD

To export for different devices, follow these specs outlined by Apple in their Human Interface Guidelines: Just go Save For Web & Devices in Photoshop and resize the image before exporting. Simple!
DeviceImage Height/Width
iPhone/iPod Touch57px
iPhone/iPod Touch Retina114px
iPad Retina?
In 1.7.24 I’ve added Ruby and Ruby on Rails as a language on Crayon. Even cooler, I’ve added the <% ... %> and similar delimiter tags for eRuby/RHTML. Using Multiple Language Highlighting in Crayon, you can choose HTML as the base language with the lang="html" attribute or the $[html]...[/html] Mini Tag and then through in some eRuby syntax. The red bits are Ruby, all else is XHTML. Note you can do the same thing with PHP tags, CSS tags and JavaScript tags. Here’s the shortcode I used:
Some HTML first.

    <% 3.times do %>
  • list item
  • <% end %> % $s("ewfwe")
<%= "print something" %> Tada. [/html]
Here’s some Ruby: And the shortcode:
$[rb toolbar="always"]
def create_set_and_get(initial_value=0) # Note the default value of 0
  closure_value = initial_value
  return Proc.new {|x| closure_value = x}, Proc.new { closure_value }
setter, getter = create_set_and_get  # ie. returns two values
getter.call # => 21
#You can also use a parameter variable as a binding for the closure. 
#So the above can be rewritten as...
def create_set_and_get(closure_value=0)
  return proc {|x| closure_value = x } , proc { closure_value }

proc {|arg| print arg}
Proc.new {|arg| print arg}
lambda {|arg| print arg}
# introduced in Ruby 1.9
->(arg) {print arg}

# In an object instance variable (denoted with '@'), remember a block.
def remember(&a_block)
  @block = a_block
# Invoke the above method, giving it a block which takes a name.
remember {|name| puts "Hello, #{name}!"}
# When the time is right (for the object) -- call the closure!
# => "Hello, Jon!"

Here’s a simple stack to store any ol’ object in Objective-C.
//	Generic Stack v1.0
//  By Aram Kocharyan. http://localsite.com/ak/


static const int kFMStackDefaultCapacity = 10;

@interface FMStack : NSObject {
	NSMutableArray *stack;

+ (id)stack;
+ (id)stackWithCapacity:(int)capacity;
- (id)initWithCapacity:(int)capacity;

- (void)push:(id)object;
- (id)pop;
- (void)clear;
- (int)count;

//	Generic Stack v1.0
//  By Aram Kocharyan. http://localsite.com/ak/

#import "FMStack.h"

@implementation FMStack

+ (id)stack {
	return [[[self alloc] init] autorelease];

+ (id)stackWithCapacity:(int)capacity {
	return [[[self alloc] initWithCapacity:capacity] autorelease];

- (id)init {
    return [self initWithCapacity:kFMStackDefaultCapacity];

- (id)initWithCapacity:(int)capacity {
	self = [super init];
    if (self) {
		stack = [[NSMutableArray alloc] initWithCapacity:capacity];
	return self;

- (void)push:(id)object {
	[stack addObject:object];

- (id)pop {
	id object = [stack lastObject];
	NSAssert(object != nil, @"Nothing to pop from stack");
	[stack removeObject:object];
	return object;

- (void)clear {
	[stack removeAllObjects];

- (int)count {
	return [stack count];

Some themes use a page template containing a custom loop. The issue is:
Since your theme uses a page to load a totally different query from the page it visits there’s no way for Crayon to know what you’re going to request until it reads your has_posts() request. By that time, the header is already written so there’s no chance to enqueue themes and fonts that you’ve used in your Crayons. Fortunately I’ve added a feature so that they are embedded each time if needed. This is a bit more inefficient I think, but it works by adding the required css right before each Crayon. This issue won’t occur on any other page on the site because direct links to pages and posts containing Crayons will load just fine with enqueuing, which is why the other pages worked for you.
The solution is added in 1.7.17 and 1.7.19. 1.7.17 now uses the the_posts filter by default (again) rather than the wp action which checks just the main wp query. The setting that fixes the issue is this: It basically turns off enqueuing and prints the css in front of Crayon’s whenever it encounters a page. Posts will continue to enqueue themes in the head as usual.
If you have a CSS with an !important rule and you want to specify an inline rule to override this, you can set the style attribute like this: .attr('style', 'width:200px !important;') but I’ve found a better way and added a new jQuery function for it. jQuery.style(name, value, priority); You can use it to get values with .style(‘name’) just like .css(‘name’), get the CSSStyleDeclaration with .style(), and also set values - with the ability to specify the priority as ‘important’. See https://developer.mozilla.org/en/DOM/CSSStyleDeclaration. Here’s a demo:
var div = $('someDiv');
div.style('color', 'red');
div.style('color', 'blue', 'important');
Here’s the output:
Here’s my function:
// For those who need them (< IE 9), add support for CSS functions
var isStyleFuncSupported = CSSStyleDeclaration.prototype.getPropertyValue != null;
if (!isStyleFuncSupported) {
	CSSStyleDeclaration.prototype.getPropertyValue = function(a) {
        return this.getAttribute(a);
    CSSStyleDeclaration.prototype.setProperty = function(styleName, value, priority) {
        var priority = typeof priority != 'undefined' ? priority : '';
        if (priority != '') {
	        // Add priority manually
			var rule = new RegExp(RegExp.escape(styleName) + '\s*:\s*' + RegExp.escape(value) + '(\s*;)?', 'gmi');
			this.cssText = this.cssText.replace(rule, styleName + ': ' + value + ' !' + priority + ';');
    CSSStyleDeclaration.prototype.removeProperty = function(a) {
        return this.removeAttribute(a);
    CSSStyleDeclaration.prototype.getPropertyPriority = function(styleName) {
    	var rule = new RegExp(RegExp.escape(styleName) + '\s*:\s*[^\s]*\s*!important(\s*;)?', 'gmi');
        return rule.test(this.cssText) ? 'important' : '';

// Escape regex chars with 
RegExp.escape = function(text) {
    return text.replace(/[-[]{}()*+?.,\^$|#s]/g, "\$&");

// The style function
jQuery.fn.style = function(styleName, value, priority) {
	// DOM node
	var node = this.get(0);
	// Ensure we have a DOM node 
	if (typeof node == 'undefined') {
	// CSSStyleDeclaration
	var style = this.get(0).style;
	// Getter/Setter
	if (typeof styleName != 'undefined') {
		if (typeof value != 'undefined') {
			// Set style property
			var priority = typeof priority != 'undefined' ? priority : '';
			style.setProperty(styleName, value, priority);
		} else {
			// Get style property
			return style.getPropertyValue(styleName);
	} else {
		// Get CSSStyleDeclaration
		return style;
See https://developer.mozilla.org/en/DOM/CSSStyleDeclaration for examples of how to read and set the CSS values. My issue was that I had already set !important for the width in my CSS to avoid conflicts with other theme CSS, but any changes I made to the width in jQuery would be unaffected since they would be added to the style attribute.

// Add to RegExp prototype
RegExp.prototype.execAll = function(string) {
	var matches = [];
	var match = null;
	while ( (match = this.exec(string)) != null ) {
		var matchArray = [];
		for (var i in match) {
			if (parseInt(i) == i) {
	return matches;

// Example
var someTxt = 'abc123 def456 ghi890';
var results = /[a-z]+(d+)/g.execAll(someTxt);

// Output
[["abc123", "123"],
 ["def456", "456"],
 ["ghi890", "890"]]

I’ve put together a script that converts CSS to JSON and back to CSS. I’ll be using it to build a Theme Editor in Crayon.
// To JSON, ignoring order of comments etc
var json = CSSJSON.toJSON(cssString);

// To JSON, keeping order of comments etc
var json = CSSJSON.toJSON(cssString, true);
// To CSS
var css = CSSJSON.toCSS(jsonObject);
The sample.html file that demonstrates the script, along with the script itself, can be found on GitHub: https://github.com/aramkocharyan/CSSJSON
If you’re testing a game on a device, it’s good to disable NSLogs, since you’re not going to read them unless you’ve got it plugged into Xcode and viewing the debugger. I usually test on the device once I’m satisfied it works in the Simulator.
    #define NSLog(...)
If you still want to have the NSLogs on the device:
    #define NSLog(...)