Skip to content

Instantly share code, notes, and snippets.

@appleton
appleton / terminal-theme.js
Last active November 23, 2018 12:42
A blink.sh theme
const black = '#272c33'
const red = '#e06b74'
const green = '#98c378'
const yellow = '#e5c07a'
const blue = '#60aeee'
const magenta = '#c677dc'
const cyan = '#56b6c1'
const white = '#abb1bf'
const lightBlack = '#31353f'
const lightRed = '#f97782'
@appleton
appleton / config.js
Created March 23, 2018 16:57
Hyper config
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@appleton
appleton / keybase.md
Last active June 7, 2016 15:47
keybase.md

Keybase proof

I hereby claim:

  • I am appleton on github.
  • I am appltn (https://keybase.io/appltn) on keybase.
  • I have a public key whose fingerprint is 5C33 F217 E61F F737 CE04 50E8 E464 B0E0 241C 31E4

To claim this, I am signing this object:

@appleton
appleton / callback.rb
Created October 28, 2013 15:31
Denormalizing statesman state onto the parent model.
#...
after_transition do |parent, transition|
parent.state = transition.to_state
parent.save!
end
#...
@appleton
appleton / pngquan_dir.zsh
Created January 30, 2013 15:56
Run all pngs in the current directory and subdirectories through [pngquant](http://pngquant.org/)
function pngquant_dir() {
if (( $+commands[pngquant] )); then
# Using 1000 here because OSX does so this gives consistent results
bytes_per_kb=1000
total_saved=0
for file in **/*.png; do
before_size=`wc -c < $file`
before_size=$(($before_size / $bytes_per_kb))
@appleton
appleton / Rakefile
Created December 18, 2012 09:53
A Rakefile to help managing a Jekyll site. Fill out your own ssh config in the CONFIG hash. Note that publish requires that you have ssh keys set up with your server, this doesn't work with ssh passwords (because I didn't need it).
require 'pty'
CONFIG = {
:remote => {
:host => 'my.ssh-host.com',
:user => 'my-ssh-username',
:path => 'path-to/site/root'
},
:posts => 'local/posts/directory'
}
@appleton
appleton / if_equal.coffee
Created April 26, 2012 11:45
Conditional comparison for Handlebars
Handlebars.registerHelper 'if_equal', (val1, val2, fn) ->
if val1 == val2
return fn()
else if fn.inverse
return fn.inverse()
@appleton
appleton / canvas-troll.js
Created February 27, 2012 14:22
Troll any canvas element
var canvas = document.getElementsByTagName('canvas'),
img = new Image();
img.onload = function(){
Array.prototype.slice.call(canvas).forEach(function(el){
el.getContext('2d').drawImage(img, 0, 0);
});
};
img.src = 'http://thegurglingcod.typepad.com/.a/6a00d8341c387d53ef0148c84decb8970c-320wi';
@appleton
appleton / serve.js
Created January 29, 2012 17:48
Serve a static site from node.js handy for local development
var http = require('http'),
fs = require('fs');
http.createServer(function(req, res){
var path = (req.url === '/' ? './index.html' : '.' + req.url);
fs.readFile(path, 'utf-8', function(err, data){
if(!err){
console.log('Serving: ', req.url);
res.writeHead(200);
res.end(data);

Coding Rails with Homebrew

Right now, this assumes you are using Snow Leopard.

Install Homebrew

Homebrew is MacPorts (or APT) without the suck. http://github.com/mxcl/homebrew