Skip to content

Instantly share code, notes, and snippets.

View glenjamin's full-sized avatar

Glen Mailer glenjamin

View GitHub Profile
{
"absolute": true,
"item": [
{
"text": "",
"value": [null, "2024-12-25T00:00:00Z"]
}
]
}
@glenjamin
glenjamin / index.js
Last active February 19, 2016 16:09
Get Font Styles
var getComputedStyle = require('computed-style');
var fontStyles = ['font-family', 'font-size', 'font-weight', 'font-style'];
module.exports = function getFontStyles(domElement) {
return {
element: domElement,
styles: extractFontStyles(domElement)
}
}
@glenjamin
glenjamin / client.js
Created December 13, 2011 10:45 — forked from makeusabrew/client.js
Asynchronous recursive self executing ping function
/**
* Assume our client object manages all communication with the server and other wonderful stuff
*/
var Client = function(socket) {
var that = {};
that.ping = function(limit, callback) {
var results = [];
return _ping(1, results, limit, callback);
};
@glenjamin
glenjamin / gist:1214146
Created September 13, 2011 15:40 — forked from bronson/gist:1214062
which is the nicer validation syntax?
// What's the best syntax to validate a JSON object?
var addr = { NamePrefixText: "Dr.", FirstName: "Lex", LastName: "Luthor",
Address: ["5 Upper Ter"], CityName: "SF" };
Validate(addr, Address); // returns true if valid, errors go in an error object like AR
// Here are some possibilities:
// implicit type
var Address = {
var Db = require('mongodb').Db,
Connection = require('mongodb').Connection,
Server = require('mongodb').Server;
var db = new Db('mongo-test', new Server("localhost", Connection.DEFAULT_PORT, {}), {native_parser:false});
var context = this;
var onConnect = function(err, db) {
db.dropDatabase(function() {