Skip to content

Instantly share code, notes, and snippets.

View dacbd's full-sized avatar
💭
Fitting 🟥 into 🟢

Daniel Barnes dacbd

💭
Fitting 🟥 into 🟢
View GitHub Profile
@dacbd
dacbd / js-test.js
Created September 11, 2012 22:58
javascript references values pointers Oh My! idk
var a = "test"
var b = a;
b = "not a test"
console.log(a);
console.log(b);
/*
test
not a test
*/
@dacbd
dacbd / example.js
Created September 18, 2012 20:24
NodeJS net TCP server-client example
var net = require("net"); //nodejs version of imports
var server = new net.Server(); // a new raw tcp server
server.on("connection", function(client) { // on connection event, when someone connects
console.log("server connections: " + server.connections); // write number of connection to the command line
client.on("data", function (data) { //event when a client writes data to the server
console.log("Server received data: " + data); // log what the client sent
});
});
@dacbd
dacbd / google.js
Created September 27, 2012 17:29
google geocoding api example
var request = require("request");
request.get({
url: "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"
}, function (err, res) {
console.log(err);
console.log(res.body);
});
/* output
null
@dacbd
dacbd / crypt.js
Created September 27, 2012 20:05
SJCL ecc encrypt/decrypt
var data = {
herp: "derp"
};
//Make the keys.
var temp = sjcl.ecc.elGamal.generateKeys(384, 1);
//to encrypt with publickey:
var pubjson = temp.pub.serialize();
var point = sjcl.ecc.curves["c" + pubjson.curve].fromBits(pubjson.point);
@dacbd
dacbd / test.js
Created October 23, 2012 19:21
jsquiz
// javascript quiz
//1
(function(){
return typeof arguments;
})()
//2
var f = function g(){ return 23; };
@dacbd
dacbd / .vimrc
Last active October 12, 2015 20:08
vim
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
colorscheme darkerdesert
syntax on
filetype on
au BufWinEnter,BufRead,BufNewFile *.go set filetype=go
set foldmethod=indent
set foldnestmax=10
@dacbd
dacbd / yourObject.js
Created December 15, 2012 05:10
Example Thoonk lua scripting object
var thoonk = require("thoonk");
var yourObject = function (thoonk) {
tm.ThoonkBaseInterface.call(this, thoonk);
};
yourObject.prototype = Object.create(tm.ThoonkBaseInterface.prototype);
yourObject.prototype.objtype = "yourObject_1";
yourObject.prototype.scriptdir = __dirname + '/scripts';
yourObject.prototype.version = '1';
@dacbd
dacbd / README.md
Last active December 15, 2015 13:09

##startTest

{
    message: "name of the test",
    progress: 0, //number 0 - 100
    id: "name of api, ie. locker, geo, messages"
}

##success

@dacbd
dacbd / words.json
Created March 29, 2013 23:20
words
{"words":["the","i","to","a","it","that","and","you","is","for","of","in","just","on","have","with","it's","be","i'm","@bear","was","not","@henrik","my","this","@adam","we","so","do","but","if","@baldwin","me","like","what","about","@eric","at","are","that's",":)","can","-","all","an","up","now","get","or","out","think","don't","oh","they","as","some","haha","one","from","lol","your","know","see","no","good","when","@fritzy","there","@lance","@team","did","should","going","will","would","i'll","go","yeah","need","he","got","thanks","how","time","make","more","want","@nlf","back","@jenn","then","ok","chat","stuff","thing","could","sure","too","them","great","new","really","@julie","yes","@amy","right","has","/me","something","by","yeah,","use","way","work","cool","because","@luke","also","those","email","been","didn't","ok,","still","i've","people","pretty","had","k","you're","were","into","other","does","actually","awesome","only","well","any","bit","him","test","very","send","probably","@mel","app","nice","@
@dacbd
dacbd / backup.sh
Last active December 16, 2015 20:19
tar backup s3 upload
#!/bin/bash
#Daniel Barnes, daniel@andyet.net
backupdir=$1
backupname=$2
date=`date +%F`
if [$3 == ""]; then
servername=`dnsdomainname -A`
else
servername=$3
fi