Skip to content

Instantly share code, notes, and snippets.

View kulicuu's full-sized avatar

J Wylie Woodcock kulicuu

View GitHub Profile
@klovadis
klovadis / gist:5170446
Created March 15, 2013 14:59
Two Lua scripts for Redis to turn HGETALL and HMGET into dictionary tables
-- gets all fields from a hash as a dictionary
local hgetall = function (key)
local bulk = redis.call('HGETALL', key)
local result = {}
local nextkey
for i, v in ipairs(bulk) do
if i % 2 == 1 then
nextkey = v
else
result[nextkey] = v
@durango
durango / app.js
Created December 3, 2012 15:41 — forked from katanacrimson/app.js
nodejs app - expressjs 3.0 + socket.io v9 + passport + redis
var express = require('express'),
passport = require('passport'),
LocalStrategy = require('passport-local').Strategy,
connect = require('connect'),
http = require('http'),
path = require('path'),
util = require('util'),
fs = require('fs'),
redis = require('redis'),
cookie = require('cookie'),
@leostera
leostera / pack.coffee
Created September 13, 2012 16:01
SocketStream Asset Packager with Event Triggering
# Asset Packer
# ------------
# Packs all CSS, JS and HTML assets declared in the ss.client.define() call to be sent upon initial connection
# Other code modules can still be served asynchronously later on
log = console.log
require('colors')
fs = require('fs')
pathlib = require('path')
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@AnsonT
AnsonT / coffee-jquery.jade
Created July 29, 2011 18:04
Client-side Coffeescript with Jade and JQuery
!!! 5
html(lang='en')
head
title Title
script(type='text/javascript', src='javascripts/jquery.js')
script(type='text/javascript', src='http://jashkenas.github.com/coffee-script/extras/coffee-script.js')
:coffeescript
$(document).ready -> alert 'Hello World'
@ryanflorence
ryanflorence / static_server.js
Last active September 22, 2026 22:43
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active September 4, 2026 08:57
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh