Skip to content

Instantly share code, notes, and snippets.

View srohde's full-sized avatar

Sönke Rohde srohde

View GitHub Profile
@srohde
srohde / websocket.coffee
Created November 15, 2013 01:44
proof of concept node.js socket implementation
WebSocketServer = require('ws').Server
websocket = null
wss = new WebSocketServer
server: server
console.log('websocket server created')
clients = {}
wss.on 'connection', (ws) ->
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# robbyrussell
@srohde
srohde / terminal.sh
Last active December 12, 2015 10:08
# show hidden files
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
# clear terminal cache
sudo rm -f /private/var/log/asl/*.asl
# open canary with cross-domain access
open -a /Applications/Google\ Chrome\ Canary.app --args --allow-file-access-from-files --disable-web-security
@srohde
srohde / apiTest.coffee
Created December 7, 2012 00:27
Node test with ShouldJS
should = require 'should'
api = require '../../routes/api'
describe 'api', ->
describe '#login()', ->
it 'should login a user', (done) ->
api.login.should.be.a 'function'
api.login
query:
@srohde
srohde / Preferences.sublime-settings
Last active October 12, 2015 06:18
My Sublime Text 2 preferences
{
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.hogan"
}
],
"font_face": "Source Code Pro Light",
"gutter": true,
@srohde
srohde / install_redis.sh
Created April 18, 2012 20:57
Install Redis
cd redis-2.4.10
make
sudo mv src/redis-server /usr/bin/
sudo mv src/redis-cli /usr/bin/
redis-server
@srohde
srohde / app.coffee
Created April 18, 2012 20:52
Setup Redis as Node.js Express Session Storage
express = require 'express'
RedisStore = require('connect-redis')(express)
# Heroku redistogo connection
if process.env.REDISTOGO_URL
rtg = require('url').parse process.env.REDISTOGO_URL
redis = require('redis').createClient rtg.port, rtg.hostname
redis.auth rtg.auth.split(':')[1] # auth 1st part is username and 2nd is password separated by ":"
# Localhost
else
@srohde
srohde / client.coffee
Created February 28, 2012 03:24
Hogan.js client side code in CoffeeScript
contactsList = new Hogan.Template T.contacts
$('#content').append(contactsList.render {contacts:[{name:"Foo"}, {name:"Bar"}]})
@srohde
srohde / route.coffee
Created February 28, 2012 03:15
Node.js server-side compile Hogan.js templates
Hogan = require 'hogan'
fs = require 'fs'
# The templates route generates the JavaScript file
# for the server side compiled Hogan templates.
exports.templates = (req, res) ->
compileTemplate = (template, callback) ->
filename = __dirname + '/../templates/' + template + '.hogan'
fs.readFile filename, (err, contents) ->
if err
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="applicationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.IList;
import mx.events.FlexEvent;