This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Async Loader v1.0.0 | |
var include = function(scripts, done) { | |
if (typeof scripts === 'string') scripts = [scripts]; | |
var loading = function() { scripts.pop() && !scripts.length && done && done.call(); }; | |
scripts.forEach(function (script) { | |
var el = document.createElement('script'); | |
el.addEventListener('load', loading), el.async = true, el.src = script; | |
document.head.appendChild(el); | |
}); | |
return arguments.callee; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EventEmitter = require('events').EventEmitter; | |
module.exports = function() { | |
var queue = new EventEmitter(); | |
var locked = false; | |
this.lock = function lock(fn) { | |
if (locked) { | |
queue.once('ready', function() { lock(fn); }); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stackTrace() { | |
$stack = debug_backtrace(); | |
$output = 'Stack trace:' . PHP_EOL; | |
$stackLen = count($stack); | |
for ($i = 1; $i < $stackLen; $i++) { | |
$entry = $stack[$i]; | |
$func = $entry['function'] . '('; | |
$argsLen = count($entry['args']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCCType(ccnumber) { | |
var visaRE = /^4[0-9]{12}(?:[0-9]{3})?$/; | |
var mastercardRE = /^5[1-5][0-9]{14}$/; | |
var amexRE = /^3[47][0-9]{13}$/; | |
var discoverRE = /^6(?:011|5[0-9]{2})[0-9]{12}$/; | |
var dinersclubRE = /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/; | |
var jcbRE = /^(?:2131|1800|35\d{3})\d{11}$/; | |
ccnumber = (ccnumber || '').replace(/[ -]/g, ''); | |
if (ccnumber.match(visaRE)) return 'visa'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BitArray(options) { | |
var USABLE_BITS = 32; | |
if (options.data) { | |
this.data = options.data; | |
} else if (options.bits) { | |
var count = Math.ceil(options.bits / USABLE_BITS); | |
this.data = new Array(count); | |
for (var i = 0; i < count; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public synchronized float[] solveWithDeviceMemory() { | |
// Allocate native (device) memory for the input data | |
CLBuffer<Float> bufIn = _context.createFloatBuffer(CLMem.Usage.Input, _input.length); | |
// Allocate native (device) memory for the output data | |
CLBuffer<Float> bufOut = _context.createFloatBuffer(CLMem.Usage.Output, _input.length); | |
// Map input/output buffers for implicit copy | |
Pointer<Float> ptrIn = bufIn.map(_queue, CLMem.MapFlags.Write); | |
Pointer<Float> ptrOut = bufOut.map(_queue, CLMem.MapFlags.Read); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
FB_TOKEN = '...' | |
MAX_PAGES = 10 | |
def scrape_page(page): | |
all_data = [] | |
url = ('https://graph.facebook.com' + page + '?limit=50&access_token=' + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: CloudFormation deployment | |
hosts: local | |
connection: local | |
user: root | |
gather_facts: false | |
tags: | |
- initialize | |
tasks: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readCSV(filename, eachCallback, doneCallback) { | |
var error; | |
var reader = require('readline').createInterface({ | |
input: require('fs').createReadStream(filename), | |
output: null, | |
terminal: false | |
}); | |
reader.on('line', function(line) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2017 John Hurliman <jhurliman.org> | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |