Skip to content

Instantly share code, notes, and snippets.

@chrismytton
chrismytton / license
Created January 5, 2011 21:42 — forked from defunkt/license
#!/bin/sh
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > MIT-LICENSE
set -e
echo "Copyright (c) `date +%Y` `git config --global user.name`"
echo '
Permission is hereby granted, free of charge, to any person obtaining
@chrismytton
chrismytton / Capfile
Created February 11, 2011 21:56
Capistrano with rvm, bundler and git
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
@chrismytton
chrismytton / index.coffee
Created March 4, 2011 01:38
Stitch handlebars compiler
fs = require 'fs'
module.exports = (module, filename) ->
source = fs.readFileSync filename, 'utf8'
content = """
module.exports = Handlebars.compile(#{JSON.stringify source});
"""
module._compile content, filename
<?php
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>helloworld</artifactId>
<dependencies>
<dependency>
@chrismytton
chrismytton / php.vim
Created November 1, 2011 15:07
PHP settings for vim (place in ~/.vim/after/ftplugin/php.vim)
setlocal expandtab
setlocal tabstop=4
setlocal shiftwidth=4
setlocal softtabstop=4
@chrismytton
chrismytton / 01_basic.js
Created January 14, 2012 14:51
Bookmarklet templates for #rusichackday
/**
* Basic bookmarklet template.
*
* Change the `iframeSrc` variable to point to your space's new idea
* page. You can adjust the iframe styles and position using the
* `iframeStyle` variable.
*
* For turning this script into a bookmarklet, you should probably take
* a look at https://gist.github.com/1856012.
*/
@chrismytton
chrismytton / net.hecticjeff.firewall.plist
Created January 19, 2012 19:03
Firewall rule to proxy requests on port 80 to nginx on port 8080
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.hecticjeff.firewall</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
@chrismytton
chrismytton / index.html
Created January 20, 2012 19:00
html5 (mini) boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title></title>

See this article for more details.

I was having problems getting capybara to run with :js => true, turns out that transactional fixtures are to blame.

class Example
  def booom
    raise "Boom"
  end
end