Skip to content

Instantly share code, notes, and snippets.

View artisonian's full-sized avatar

Leroy Campbell artisonian

View GitHub Profile
[
{"id": "b001", "name": "Acme Broadcasting", "published": true, "type": "broadcaster", "parent": null},
{"id": "m001", "name": "Boston", "published": false, "type": "market", "parent": "b001"},
{"id": "s001", "name": "WQXZ", "published": false, "type": "station", "parent": "m001"},
{"id": "s002", "name": "WPYT", "published": true, "type": "station", "parent": "m001"},
{"id": "m002", "name": "New Jersey", "published": true, "type": "market", "parent": "b001"},
{"id": "s003", "name": "WPYT", "published": false, "type": "station", "parent": "m002"},
{"id": "b002", "name": "American Broadcasters", "published": false, "type": "broadcaster", "parent": null},
{"id": "m003", "name": "Atlanta", "published": false, "type": "market", "parent": "b002"},
{"id": "s004", "name": "WXYZ", "published": true, "type": "station", "parent": "m003"},
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
)
package main
import (
"bytes"
"compress/zlib"
"crypto/sha1"
"fmt"
"io/ioutil"
"os"
"path"
{
"bitwise": true,
"camelcase": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
function get(url) {
// Return a new promise.
return new Promise(function(resolve, reject) {
// Do the usual XHR stuff
var req = new XMLHttpRequest();
req.open('GET', url);
req.onload = function() {
// This is called even on 404 etc
// so check the status
# For MacOS:
.DS_Store
# For TextMate
*.tmproj
tmtags
.tm_properties
# For emacs:
*~
> winston-mongodb@0.4.3 test /Users/leroy/repos/git/winston-mongodb
> vows test/*-test.js --spec
♢ winston-mongodb
An instance of the MongoDB Transport when passed valid options
✓ should have the proper methods defined
An instance of the MongoDB Transport the log() method when passed primitive metadata
@artisonian
artisonian / sha256-test.js
Created March 14, 2014 15:23
SHA-256 example
'use strict';
var assert = require('assert');
var fs = require('fs');
var crypto = require('crypto');
var stream = require('stream');
var littleSha = crypto.createHash('sha256');
var message = new Buffer('this is a small message');
@artisonian
artisonian / shortid.js
Created March 14, 2014 15:27
Generate random strings with crypto.randomBytes
'use strict';
var crypto = require('crypto');
var stream = require('stream');
function radixId (radix, callback) {
crypto.randomBytes(4, function (err, buf) {
if (err) { return callback(err); }
try {
@artisonian
artisonian / example.js
Last active January 7, 2016 03:36
Hash it, then compress it!
'use strict';
var hashpress = require('./hashpress');
var obj = {
username: 'foo',
likes: ['cats', 'candy'],
quote: "I don't always program JavaScript...but when I do, I use Node.js"
};