This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Boids | |
// Thomas Parslow | |
// [email protected] | |
// | |
// Adapted from: http://www.kfish.org/boids/pseudocode.html | |
(function() { | |
var SCALE = 20; | |
var HOW_MANY = 8; | |
var RULE_SCALE = 250; | |
var CLOSE_ENOUGH = 150*4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The beginnings of a declarative model syntax for CoffeeScript. | |
# SEE: http://almostobsolete.net/declarative-models-in-coffeescript.html | |
# Thomas Parslow | |
# Email: [email protected] | |
# 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 http://jashkenas.github.com/coffee-script/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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) -> | |
source.then( | |
-> destination.resolveWith(@, arguments), | |
-> destination.rejectWith(@, arguments), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I have meetings like this: | |
{ | |
"type": "meeting" | |
"_id": "MEETINGID", | |
"emails": ["[email protected]", "[email protected]"] | |
// Lots of others things | |
} | |
// I have users like this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewTestViewController.m | |
// ViewTest | |
// | |
// Created by Joshua Theed on 10/01/2012. | |
// Copyright 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import "ViewRecordsViewController.h" | |
#import "CustomTableViewCell.h" |
OlderNewer