Skip to content

Instantly share code, notes, and snippets.

Kevin Reilly kevireilly

  • California, USA
Block or report user

Report or block kevireilly

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
@kevireilly
kevireilly / blake2-fs-stream.js
Last active Jul 8, 2016
Example of streaming a file to blake2
View blake2-fs-stream.js
'use strict';
// Dependencies
const blake2 = require('blake2'),
fs = require('fs');
// Setup the blake2eb hash
const hash = new blake2.Hash('blake2b');
hash.setEncoding('hex');
View file.js
function getOutput(requestID, _poolName) {
var url = SEARCH_URL + '/' + requestID + '/output';
request.get(url, function(err, response, body) {
if (err) {
console.error("Error requesting URL", url, err);
} else {
if (body) {
console.log("Writing json response to " + _poolName + ".json");
writeJSON(_poolname, body);
} else {
View app.js
app.get("/api", function(req, res) {
if (req.query.lon === "" || req.query.lat === ""
|| req.query.lon = null || req.query.lat = null) { // handle undefined as well
res.sendStatus(404).json({ error: 'Latitude and longitude are required' });
} else {
console.log(req.query);
res.json(req.query);
}
});
@kevireilly
kevireilly / Function.prototype.bind.js
Created May 9, 2015
Polyfill for Function.prototype.bind
View Function.prototype.bind.js
(function(){
if (!Function.prototype.bind) {
var Empty = function(){};
Function.prototype.bind = function bind(that) { // .length is 1
var target = this;
if (typeof target !== "function") {
throw new TypeError("Function.prototype.bind called on incompatible " + target);
}
var args = Array.prototype.slice.call(arguments, 1); // for normal call
var binder = function () {
@kevireilly
kevireilly / eventhook.js
Created Jan 25, 2013
EventHook: Simple library for modifiable EventEmitters
View eventhook.js
/*
* ____ _ _ ____ _ _ ___ _ _ ____ ____ _ _
* |___ | | |___ |\ | | |__| | | | | |_/
* |___ \/ |___ | \| | | | |__| |__| | \_
*
* Simple library for modifiable EventEmitters
*
* Depends on the async module
* https://github.com/caolan/async
* npm install async
You can’t perform that action at this time.