Skip to content

Instantly share code, notes, and snippets.

Avatar

Sönke Rohde srohde

View GitHub Profile
@srohde
srohde / websocket.coffee
Created Nov 15, 2013
proof of concept node.js socket implementation
View websocket.coffee
WebSocketServer = require('ws').Server
websocket = null
wss = new WebSocketServer
server: server
console.log('websocket server created')
clients = {}
wss.on 'connection', (ws) ->
View .zshrc
# 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
View terminal.sh
# 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 Dec 7, 2012
Node test with ShouldJS
View apiTest.coffee
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 Oct 12, 2015
My Sublime Text 2 preferences
View Preferences.sublime-settings
{
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.hogan"
}
],
"font_face": "Source Code Pro Light",
"gutter": true,
View install_redis.sh
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 Apr 18, 2012
Setup Redis as Node.js Express Session Storage
View app.coffee
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 Feb 28, 2012
Hogan.js client side code in CoffeeScript
View client.coffee
contactsList = new Hogan.Template T.contacts
$('#content').append(contactsList.render {contacts:[{name:"Foo"}, {name:"Bar"}]})
@srohde
srohde / route.coffee
Created Feb 28, 2012
Node.js server-side compile Hogan.js templates
View route.coffee
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
View ListScrollToBottomExample.as
<?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;
You can’t perform that action at this time.