Skip to content

Instantly share code, notes, and snippets.

@LucasMoffitt
LucasMoffitt / gist:11018418
Last active August 29, 2015 14:00
Windows 8.1 C# PasswordVault Wrapper
public static class VaultManager
{
private const string VaultKeyResource = "My App Or Something...";
private static readonly PasswordVault Vault = new PasswordVault();
public static string Username
{
get
{
try
@kellective
kellective / poem-journey-of-the-void.txt
Created September 9, 2014 10:19
Journey of the void - Ben Goertzel
This is a snippit of a long text from 'The Journey of the Void' - Ben Goertzel
Who am I, a mere conglomeration of particles --
an organism flashing in and out of existence --
a web of learned and inherited patterns --
to explain the universe as a whole?
And yet,
@themasch
themasch / gist:8186786046bf8ced2d58
Created June 30, 2015 14:11
node-bencode benchmarks 30.06.15
node 0.10.39
decode to buffer
13,172 op/s » bencode
13,310 op/s » bencoding
16,289 op/s » dht_bencode
686 op/s » bncode
11,969 op/s » dht
encode buffer
@creationix
creationix / module.js
Created April 19, 2011 04:27
A super simple module system for browsers. Assumes all source files are concatenated and in browser.
define.defs = {};
define.modules = {};
function define(name, fn) {
define.defs[name] = fn;
}
function require(name) {
if (define.modules.hasOwnProperty(name)) return define.modules[name];
if (define.defs.hasOwnProperty(name)) {
var fn = define.defs[name];
define.defs[name] = function () { throw new Error("Circular Dependency"); };
@creationix
creationix / twostep.js
Created December 27, 2011 17:56
Request for Comments on new API for Step
module.exports = TwoStep;
var slice = Array.prototype.slice;
function Group(callback) {
this.args = [null];
this.left = 0;
this.callback = callback;
this.isDone = false;
}
@bga
bga / z.js
Created February 27, 2012 12:31 — forked from heapwolf/z.js
z
var match = []
var _finalizeExpr = function(match) {
var vs = match[0]
var _iter = match[1]
var _done = match[2]
var i = 0
var _iterWrappper = function() {
if(i === vs.length) {
@slevithan
slevithan / real-xregexp.js
Created April 4, 2012 14:28
Grammatical pattern for real numbers using XRegExp.build
// Creating a grammatical pattern for real numbers using XRegExp.build
/*
* Approach 1: Make all of the subpatterns reusable
*/
var lib = {
digit: /[0-9]/,
exponentIndicator: /[Ee]/,
digitSeparator: /[_,]/,
@abozhilov
abozhilov / gist:2594795
Created May 4, 2012 13:27
State machine
var GO = 'GO',
OK = 'OK',
SIGN = 'SIGN',
LZERO = 'LZERO',
INT = 'INT',
FRAC = 'FRAC',
FDIG = 'FDIG',
EXP = 'EXP',
XSIGN = 'XSIGN',
EDIG = 'EDIG',
@rwaldron
rwaldron / device.js
Created May 10, 2012 16:21
Fat Arrows and Classes-as-Prototype-sugar make a beautiful future for JavaScript
var stream = require("fake-stream-lib"),
Emitter = require("events").EventEmitter,
util = require("util");
// Today...
function Device( opts ) {
this.value = null;
local floor = require('math').floor
local table = require 'table'
-- For encoding numbers using modified base 64 for compact etags
local digits = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "A", "B", "C", "D", "E", "F",
"G", "H", "I", "J", "K", "L", "M", "N",
"O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z", "a", "b", "c", "d",