Skip to content

Instantly share code, notes, and snippets.

Open to new opportunities

Glenn 'devalias' Grant 0xdevalias

Open to new opportunities
View GitHub Profile
eligrey / object-watch.js
Created Apr 30, 2010 polyfill in ES5
View object-watch.js
* polyfill
* 2012-04-03
* By Eli Grey,
* Public Domain.
koshigoe /
Created Feb 11, 2011
Like tmpfs in Mac OSX
# This program has two feature.
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
# Usage:
# $0 <dir> <size>
casualjim / resque.scala
Created Mar 17, 2011
A resque implementation in scala with akka actors and scala-redis
View resque.scala
package com.mojolly.backchat
package redis
package resque
import com.mojolly.backchat.redis.resque.Resque.{ResqueWorkerActor}
import net.liftweb.json._
import JsonAST._
import JsonDSL._
import com.redis.ds.{ RedisDeque, RedisDequeClient }
schacon / gist:942899
Created Apr 26, 2011
delete all remote branches that have already been merged into master
View gist:942899
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
unnitallman / gist:944011
Created Apr 27, 2011
sqlite with activerecord outside rails
View gist:944011
require 'active_record'
ActiveRecord::Base.logger =
ActiveRecord::Base.colorize_logging = false
:adapter => "sqlite3",
:dbfile => ":memory:"
bitboxer /
Created May 8, 2011
create a sparsebundle for mac os backups
# A bash script to create a time machine disk image suitable for
# backups with OS X 10.6 (Snow Leopard)
# This script probably only works for me, so try it at your own peril!
# Use, distribute, and modify as you see fit but leave this header intact.
# (R) sunkid - September 5, 2009
# This will create a time machine ready disk image named with your
# computer's name with a maximum size of 600GB and copy it to
# /Volumes/backup. The image "file" (it's a directory, really) will
View 3nightclubs.scala
* Part Zero : 10:15 Saturday Night
* (In which we will see how to let the type system help you handle failure)...
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0)
import scalaz._
import Scalaz._
nictuku / gist:997386
Created May 29, 2011
golang union types.
View gist:997386
// Objective: demonstrate that there are more use cases
// for union types than previously thought.
// Interface inference.
// We already have type inference, so this would be very Go-like:
type typeA int
func (x typeA) A() {}
func (x typeB) C() {}
View transactions.markdown


As your business logic gets complex you may need to implement transactions. The classic example is a bank funds transfer from account A to account B. If the withdrawal from account A fails then the deposit to account B should either never take place or be rolled back.


All the complexity is handled by ActiveRecord::Transactions. Any model class or instance has a method named .transaction. When called and passed a block, that block will be executed inside a database transaction. If there's an exception raised, the transaction will automatically be rolled back.


clintel / gist:1155906
Created Aug 19, 2011
Fenced code in bullet lists with GitHub-flavoured MarkDown??
View gist:1155906

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    More Code