Skip to content

Instantly share code, notes, and snippets.

Simeon Vincent dotproto

Block or report user

Report or block dotproto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dotproto
dotproto / binary-utils.js
Last active Dec 30, 2015
Utilities for working with binary values in JavaScript.
View binary-utils.js
// Numbers greater than (Math.pow(2,32) - 1) are subject to unexpected results
// bit-level operations. For example,
//
// (Math.pow(2,32) >> 1 === 0) // True
// (Math.pow(2,32) + 1 >> 1 === 0) // True
// (Math.pow(2,32) + 2 >> 1 === 1) // True
//
// As such, all methods defined here will throw an error on values above this safe limit.
var INT_MAX = Math.pow(2, 32) - 1;
var BYTE_MAX = 8;
@dotproto
dotproto / introducing_gloggy.md
Last active Jan 4, 2016
POST: Introducing Gloggy
View introducing_gloggy.md

Introducing Gloggy

Gloggy is a super simple (albiet terribly named) blogging system that runs on top of GitHub's Pages and Gists features.

View introducing_gloggy.md

Introducing Gloggy

Gloggy is a super simple (albiet terribly named) blogging system that runs on top of GitHub's Pages and Gists features.

@dotproto
dotproto / gloggy_fork.md
Last active Aug 29, 2015 — forked from dotproto/introducing_gloggy.md
POST: This is a test of a multi-line gist description. This is totally a hack. I'm sorry GitHub.
View gloggy_fork.md

Introducing Gloggy

Gloggy is a super simple (albiet terribly named) blogging system that runs on top of GitHub's Pages and Gists features.

View app.js
var express = require('express');
var app = express();
// Load routes
require('./src/routes')(app);
@dotproto
dotproto / include.js
Last active Aug 29, 2015
Module-root relative file includes for Node.js
View include.js
var fs = require('fs');
var path = require('path');
var parentModulePath = path.dirname(module.parent.filename);
// Recursively traverse up a given path tree checking for a file's existence.
function rstat(dir, filename, endPath) {
// End the search at endPath if provided, otherwise default to root
endPath = endPath || path.resolve('/');
var target = path.join(dir, filename);
@dotproto
dotproto / block-1.js
Created Jul 28, 2014
This is only a test
View block-1.js
(function() {
console.log("You're the best around");
console.log("Nothing's ever gonna keep you down");
})()
@dotproto
dotproto / apply.js
Last active Aug 29, 2015
Function application as a service
View apply.js
function buildApply() {
var args = Array.prototype.slice.call(arguments, 0);
var fn = args.shift();
// proxy function
return function bindProxy() {
var proxyArgs = Array.prototype.slice.call(arguments, 0);
return fn.apply(null, args.concat(proxyArgs));
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am svincent on github.
  • I am simeon (https://keybase.io/simeon) on keybase.
  • I have a public key whose fingerprint is 9C9B 5CCA 4B4A A1EE 69E3 2BCF 0CE9 6BFE 064E 3BFC

To claim this, I am signing this object:

View getPushIdTimestamp.js
var getPushIdTimestamp = (function getPushIdTimestamp() {
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
return function getTimestampFromId(id) {
var time = 0;
var data = id.substr(0, 8);
for (var i = 0; i < 8; i++) {
time = time * 64 + PUSH_CHARS.indexOf(data[i]);
}
You can’t perform that action at this time.