Skip to content

Instantly share code, notes, and snippets.

View emberian's full-sized avatar

emberian

View GitHub Profile
/* Code: */
#include <ctype.h>
#define speed 35
#define word_time (speed * 3)
#define short_time (speed)
#define long_time (speed * 3)
#define space_time (speed * 7)
#define letter_pause (speed * 3)
#define long_pin 12
@emberian
emberian / kbdark
Created December 30, 2011 03:41
cmr's favorite colorscheme
*background: #000000
*foreground: #e2d1e3
*cursorColor: #6a6a6a
!black
*color0: #080f0c
*color8: #000000
!red
*color1: #5f0000
*color9: #73000c
@emberian
emberian / chat.js
Created January 16, 2012 14:48
creationix chat
var Net = require('net');
var crypto = require('crypto');
var clients = [];
var clientNames = {};
Net.createServer(function (client) {
clients.push(new Client(client));
}).listen(1337);
function Client(socket) {
@emberian
emberian / utf8.js
Created February 13, 2012 02:57
Javascript UTF8
var Utf8 = {
// public method for url encoding
encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
@emberian
emberian / gist:1813914
Created February 13, 2012 05:23 — forked from anonymous/gist:1813906
TheAbacus - pastebin.com/qY1e6sjm
// JavaScript Document
function Temp() {
var test = "testing";
}
Temp.prototype.init = function() {
test = this.test;
$.ajax({ //IE errors here.
url: "xd_subnav.xml",
dataType: "xml",
function foo(bar) {
if (bar) {
var baz = "hello"
}
console.log(baz)
}
var result = async asyncCall(foo);
doStuff.whatever(result);
@emberian
emberian / gist:2019014
Created March 12, 2012 01:00 — forked from anonymous/gist:2018992
a guest on Mar 11th, 2012 - pastebin.com/0DWetuis
function secondsFromTime(string){
var split = string.split(":")
var seconds = parseInt(split.pop())
if (seconds !== NaN) {
var minutes = parseInt(split.pop())
if (minutes !== NaN) {
var hours = parseInt(split.pop())
if (hours !== NaN) {
return hours * 60 * 60 + minutes * 60 + seconds
@emberian
emberian / foo.coffee
Created March 13, 2012 02:03 — forked from anonymous/gist:2026105
a guest on Mar 12th, 2012 - pastebin.com/QAzuZUDr
response_handler = (response)=>
buf = null
ptr = 0
response.on "data", (chunk) =>
if not buf
if response.headers['content-length']
buf = new Buffer(parseInt(response.headers['content-length'],10)+2)
else
buf = ''
js> var a = {}
js> a.foo = "bar"
"bar"
js> a.a = a
({foo:"bar", a:{foo:"bar", a:{}}})
js> a
({foo:"bar", a:{foo:"bar", a:{}}})