Skip to content

Instantly share code, notes, and snippets.

Thomas Parslow almost

Block or report user

Report or block almost

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:428711
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
main = do
xmonad $ defaultConfig {
modMask = mod4Mask -- Rebind Mod to the Windows key
almost / boids.js
Created Sep 8, 2011
Javascript Jungle Boids!
View boids.js
// Boids
// Thomas Parslow
// Adapted from:
(function() {
var SCALE = 20;
var HOW_MANY = 8;
var RULE_SCALE = 250;
var CLOSE_ENOUGH = 150*4;
almost /
Created Nov 26, 2011
The beginnings of a declarative model syntax for CoffeeScript.
# The beginnings of a declarative model syntax for CoffeeScript.
# SEE:
# Thomas Parslow
# Email:
# Twitter: @almostobsolete
# The top part is the setup, see below that for the demo
# To see this run right away try copy pasting it into the 'Try
# CoffeeScript' box at
class Post extends Model
@field 'title', default: 'New post!'
@field 'body'
# the default is supplied as a closure which is evaluated at object
# creation time
@field 'created_at', default: -> new Date()
class User extends Model
@field 'username'
@field 'twitter'
# Create a new user
user = new User(username: 'tom', twitter: 'almostobsolete')
# Bind to the change event for the title property
user.bind 'change:username', (value) =>
alert "Username updated to #{value}"
# Print out details of posts when they are created by the user
user.bind 'posts:add', (post) =>
alert "Post '#{post.get('title')}' created at #{post.get('created_at')}"
# Change the user's username (which will trigger the event bound above)
class Model
# This is the CoffeeScript syntax to declare a class method
@field: (name, options) ->
@fields ?= {}
@fields[name] = options || {}
constructor: (attributes) =>
@attributes = {}
# Copy in attributes passed in or defaults from the fields as
# appropriate
for name, options of @constructor.fields
View gist:1760582
## chainDeferred
# Take two jQuery Deferred objects and chain one on to the other. So
# anything that happens to the first one is proxied on the second one.
# Returns the source (for method call chaining)
module.chainDeferred = (source, destination) ->
-> destination.resolveWith(@, arguments),
-> destination.rejectWith(@, arguments),
almost / agggh
Created Feb 13, 2012 — forked from alexanderhosford/agggh
Browser detection?
View agggh
<script type="text/javascript">
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
if (ffversion>=5)
document.write(" FF 5.x or above")
else if (ffversion>=4)
document.write(" FF 4.x or above")
else if (ffversion>=3)
document.write(" FF 3.x or above")
almost / gist:1884579
Created Feb 22, 2012
CouchDB: M2M link via non-primary keys.
View gist:1884579
// I have meetings like this:
"type": "meeting"
"_id": "MEETINGID",
"emails": ["", ""]
// Lots of others things
// I have users like this:
almost / gist:1887280
Created Feb 22, 2012
Here you go josh
View gist:1887280
// ViewTestViewController.m
// ViewTest
// Created by Joshua Theed on 10/01/2012.
// Copyright 2012 __MyCompanyName__. All rights reserved.
#import "ViewRecordsViewController.h"
#import "CustomTableViewCell.h"
You can’t perform that action at this time.