Skip to content

Instantly share code, notes, and snippets.

View benjie's full-sized avatar

Benjie benjie

View GitHub Profile
@benjie
benjie / something_like_this.sh
Created April 17, 2015 20:49
Members Area rough instructions
git clone https://github.com/somakeit/somakeit-members-area.git
cd somakeit-members-area
npm install
./node_modules/.bin/members migrate
./node_modules/.bin/members seed
npm start
@benjie
benjie / dalek
Last active August 29, 2015 14:20
Dalek Notes
#!/bin/sh
### BEGIN INIT INFO
# Provides: dalek
# Required-Start: $local_fs $syslog $bluetooth
# Required-Stop: $local_fs $syslog $bluetooth
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Description: Dalek control software
### END INIT INFO
@benjie
benjie / README.md
Created May 15, 2012 13:53
`git bisect` demo using CoffeeScript 1.3.2 "=> super" bug

To run this,

git clone git://github.com/jashkenas/coffee-script.git
cd coffee-script

Copy test.sh into the coffee-script directory, then

git bisect start
# git checkout 1.3.2

sh test.sh # FAIL -> BAD

@benjie
benjie / XMPP-vs-Pim.md
Created June 15, 2012 09:19
Jabber/Pidgin vs Pim

Jabber/Pidgin vs Pim

This table compares Jaber/Pidgin (which compares reasonably to most XMPP client/servers) to Pim. Note we're comparing against how we expect Pim to be in early 2013 - not Pim as it currently stands today (15th June 2012). Note however that many of the features have already been implemented in basic forms, so we'll add an asterisk* to entries that aren't currently up to par, but we expect to be by early 2013.

@benjie
benjie / certificate-chain.coffee
Created June 28, 2012 14:22
Commented Certificate Chain Code
# Require the https/fs modules
# Akin to Apache's configuration directive:
# LoadModule ssl_module libexec/libssl.so
# (Apache's FS module is built in, I think)
https = require 'https'
fs = require 'fs'
# List the certificate chain files
# (with Apache you might put these 4 files into 1 file, called your certificate chain)
files = [
@benjie
benjie / README.md
Created June 28, 2012 19:05
How NOT to write a RegExp

The below code (regexp-freeze.coffee) makes V8 lock up (both NodeJS and Chrome). It's my fault for nesting repeats (+), but it would be nice if V8 (or it's RegExp library) detected this lock-up in some way - I don't think there's many situations in which it's okay for a RegExp to take more than a second on a 134byte string on a modern desktop computer...

How not to write it:

/`((?:[^\\`\n]+|(?:\\[^\n]))+)`/g

How to write it:

@benjie
benjie / lighting5.spec.coffee
Created November 5, 2012 15:32
JS vs Coffee for node-rfxcom tests
rfxcom = require("../lib")
matchers = require("./matchers")
FakeSerialPort = require("./helper")
beforeEach ->
@addMatchers toHaveSent: matchers.toHaveSent
fakeSerialPort = new FakeSerialPort()
device = new rfxcom.RfxCom "/dev/ttyUSB0", {port: fakeSerialPort}
describe "Lighting5 class", ->
lighting5 = undefined
@benjie
benjie / event-listener.coffee
Created April 9, 2012 13:37
CoffeeScript EventListener class
# To use this, just do `EventListener.infect(YourClassHere)`
class EventListener
@infect: (Class) ->
Class::unlistenAll = EventListener::unlistenAll
Class::listenTo = EventListener::listenTo
Class::listenOnceTo = EventListener::listenOnceTo
Class::unlistenTo = EventListener::unlistenTo
unlistenAll: (destroy = true)->
@benjie
benjie / sorted.txt
Last active December 12, 2015 02:19
Possible bytes where no binary zeros can touch.
# Sorted, and matched against LightwaveRF unitcodes.
1111 1111
1111 1110
1111 1101
1111 1011
1111 1010 !!!
1111 0111
1111 0110 - Unit 1
1111 0101 !!!
@benjie
benjie / README.md
Created March 12, 2013 10:37
Fat arrow binding inheritance bug in CoffeeScript 1.6.1

This bug has already been fixed in CoffeeScript master - I'd use 1.5.0 until an update to 1.6.1 is available.

To run this,

git clone git://github.com/jashkenas/coffee-script.git
cd coffee-script

Copy test.sh into the coffee-script directory, then

git bisect start