Skip to content

Instantly share code, notes, and snippets.

View seanhess's full-sized avatar

Sean Hess seanhess

View GitHub Profile
@seanhess
seanhess / EntityAfter.js
Created November 16, 2011 04:18
AS Examples
// Use a pure function to do your fancy stuff! (note that we CAN'T do all that manipulation in an as block)
// uses the parameter style of asyncifying modules
Entity.findByProgram = as(Entity, AugmentedProgram, function(Entity, AugmentedProgram, programId) {
var programs = AugmentedProgram.findByProgram(programId)
var entitiesWithOffsets = programs.map(function(program) {
var entity = Entity.findByName(program.name)
return {offset: program.offset, entity: entity} // we'll need both to sort, below
})
return Entity.groupByOffset(entitiesWithOffsets)
})
var path = require('path')
var fs = require('fs')
// FS EXAMPLE - concat all js files in dir and save to destFile
// This is normal node.js code
function concatJsFiles(dir, destFile, cb) {
fs.readdir(dir, function(err, files) {
if (err) return cb(err)
// Filter *.js files
@seanhess
seanhess / ListWriter.hs
Created January 13, 2012 21:18
ListWriter.hs
data ListWriter = ListWriter [String]
runListWriter :: ListWriter -> [String]
runListWriter (ListWriter xs) = xs
execListWriter :: ListWriter -> [String]
execListWriter = runListWriter
instance Monad ListWriter where
return a = ListWriter []
@seanhess
seanhess / make.txt
Created January 26, 2012 14:45
ghc make
~$ ghc --make Hello.hs
Linking Hello ...
Undefined symbols for architecture x86_64:
"_locale_charset", referenced from:
_localeEncoding in libHSbase-4.4.1.0.a(PrelIOUtils.o)
"_iconv_close", referenced from:
_hs_iconv_close in libHSbase-4.4.1.0.a(iconv.o)
(maybe you meant: _hs_iconv_close)
"_iconv", referenced from:
_hs_iconv in libHSbase-4.4.1.0.a(iconv.o)
@seanhess
seanhess / port.log
Created April 4, 2012 15:21
port log
Apr 4 08:46:20 squid Installer[513]: @(#)PROGRAM:Install PROJECT:Install-686.3
Apr 4 08:46:20 squid Installer[513]: @(#)PROGRAM:Installer PROJECT:Installer-530
Apr 4 08:46:20 squid Installer[513]: Hardware: MacBookPro8,3 @ 2.20 GHz (x 8), 8192 MB RAM
Apr 4 08:46:20 squid Installer[513]: Running OS Build: Mac OS X 10.7.3 (11D50d)
Apr 4 08:46:20 squid Installer[513]: Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
Apr 4 08:46:20 squid Installer[513]: Env: TMPDIR=/var/folders/q1/xlvxykrx4558krd_ghgpxxlw0000gn/T/
Apr 4 08:46:20 squid Installer[513]: Env: SHELL=/bin/bash
Apr 4 08:46:20 squid Installer[513]: Env: HOME=/Users/seanhess
Apr 4 08:46:20 squid Installer[513]: Env: USER=seanhess
Apr 4 08:46:20 squid Installer[513]: Env: LOGNAME=seanhess
@seanhess
seanhess / Watchers.coffee
Created April 12, 2012 22:52
Watchers.coffee
define [
'text!views/start/Watchers.html'
'views/View'
'cs!models/Watchers'
'cs!views/start/Watcher'
], (template, View, WatchersCollection, Watcher) ->
class Watchers extends View
template: template
initialize: () ->
@seanhess
seanhess / failure.txt
Created April 24, 2012 19:58
cabal update failure
~$ cabal install cabal cabal-install
Resolving dependencies...
cabal: cannot configure unix-2.4.2.0. It requires base >=4.2 && <4.4
For the dependency on base >=4.2 && <4.4 there are these packages:
base-4.2.0.0, base-4.2.0.1, base-4.2.0.2, base-4.3.0.0 and base-4.3.1.0.
However none of them are available.
base-4.2.0.0 was excluded because base-4.5.0.0 was selected instead
base-4.2.0.0 was excluded because of the top level dependency base -any
base-4.2.0.1 was excluded because base-4.5.0.0 was selected instead
base-4.2.0.1 was excluded because of the top level dependency base -any
@seanhess
seanhess / campfire.coffee
Created May 2, 2012 14:09
trello campfire
request = require 'request'
# curl -u TOKEN:X -H 'Content-Type: application/json' -d '{"message":{"body":"Hello"}}' https://DOMAIN.campfirenow.com/room/ROOMID/speak.json
exports.room = room = (account, room, token) ->
send = (message, cb) ->
query =
url: "https://#{token}:X@#{account}.campfirenow.com/room/#{room}/speak.json"
json:
{Model, Document} =
# make a db a-la mongodb-wrapper or mongolian
class Users extends Model
users = new Users db.collection 'users'
user = users.create {name: "Sean"}
user.save (err) ->
@seanhess
seanhess / .vimrc
Created June 8, 2012 22:39
sean vimrc
let mapleader = "\<space>"
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
call pathogen#infect()
syntax on
filetype plugin indent on
filetype plugin on