Skip to content

Instantly share code, notes, and snippets.

View sintaxi's full-sized avatar
🔥
GSD

Brock Whitten sintaxi

🔥
GSD
View GitHub Profile
@silentrob
silentrob / stream_mp4
Created April 8, 2011 04:45
Connect Stream mp4 Example
require('connect').createServer(
connect.static(__dirname + '/videos', { maxAge: 0 }),
function(req, res) {
res.setHeader('Content-Type', 'text/html');
res.end('<video width="300px" src="/OLD_BOY.mp4" controls="controls" autoplay="autoplay"></video>');
}
).listen(process.env.PORT || 4000);
@sintaxi
sintaxi / server.js
Created April 8, 2011 19:15
a simple reverse proxy using Node
var http = require("http"),
util = require("util")
http.createServer(function(req, rsp){
var regex = /^\/(v1|v2)/g
var matches = req.url.match(regex)
if((matches && matches[0] === "/v1") || (req.headers["x-api-version"] === "v1"))
var port = 8001
@sintaxi
sintaxi / server.js
Created April 20, 2011 18:46
example of how to make calls in parallel
var http = require("http")
// expensive call
// takes 2 sec
function name(cb){
setTimeout(function(){ cb("Brock") }, 2000)
}
// expensive call
// takes 2 sec
@sintaxi
sintaxi / application.js
Created April 21, 2011 21:00
simple chat client using redis pub/sub
var q= function(s){ return document.getElementById(s) }
function send(){
var input = q('text');
socket.send(input.value);
input.value = '';
}
var socket = new io.Socket(null, {
port: 8001,
@guybrush
guybrush / nodeconf_2011.md
Created May 6, 2011 07:22
a list of slides from nodeconf 2011
@soplakanets
soplakanets / password.js
Created May 19, 2011 13:20
Password hashing for node.js
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt);
return salt + hash;
}
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@sintaxi
sintaxi / gmail.md
Created July 25, 2011 23:40
walkthrough on how to make multiple gmail accounts work together

Gmail Harmony

With the introduction of Google Plus. Managing multiple gmail accounts has become a big pain in the ass. What I have done is consolidated all my email accounts into my main gmail account that I use for G+, analytics, etc. This process expects that you have one main gmail account such as "example@gmail.com" and one or more Google App accounts "henry@example.com". This solution may not work for you but it has helped me a lot.

The end result of this setup is that all your email goes to one inbox but it is

@visnup
visnup / StackScript.sh
Created August 23, 2011 17:45
node.js knockout 2011 StackScript
#!/bin/bash
# <UDF name="ssh_key" Label="Paste in your public SSH key" default="" example="" optional="false" />
# root ssh keys
mkdir /root/.ssh
echo $SSH_KEY >> /root/.ssh/authorized_keys
chmod 0700 /root/.ssh
# update to latest
var memLeaker = [
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +