Skip to content

Instantly share code, notes, and snippets.

View fiveisprime's full-sized avatar
🖤

Matt Hernandez fiveisprime

🖤
View GitHub Profile
@fiveisprime
fiveisprime / iifenosemi.js
Created January 27, 2015 16:03
IIFE without semicolons
var m = 'Hello from IIFE!'
void function () {
console.log(m)
}()
@fiveisprime
fiveisprime / tpb-loop.js
Last active August 29, 2015 14:11
Async for loops in JavaScript
var request = require('request')
, counter = 0;
!function getResource() {
request('http://thepiratebay.se/torrent/' + counter, function (err, response) {
if (200 === response.statusCode) {
console.log('Found something at http://thepiratebay.se%s', response.req.path);
}
if (counter++ < 10000000) {
@fiveisprime
fiveisprime / route.js
Created October 21, 2014 21:50
Iron Router with Cloud Storage on Modulus.
this.route('app-storage', {
path : '/app-storage/:path(*)',
where : 'server',
action: function () {
return this.response.end(
fs.readFileSync(path.join(process.env.CLOUD_DIR, this.params.path))
);
}
});
@fiveisprime
fiveisprime / job.md
Last active August 29, 2015 14:07
Senior Software Engineer

Node.js Engineer

Are you a server-side engineer with experience using JavaScript and Node.js?

Modulus is looking for an experienced, creative, and ambitious Engineer to design and build server-side components of an exciting Node.js PaaS product to simplify the development, deployment and management of business applications on-premise or on any Cloud, on any platform and on any device with minimal IT complexity and low total cost of ownership.

This candidate must have an interest in joining a start-up development team within an established company located in our Cincinnati, OH office. You will be working on Modulus, the easiest way to deploy and run Node.js applications.

Critical Education & Experience required;

@fiveisprime
fiveisprime / gist:46c272cb5c1fe1875f82
Created October 2, 2014 16:11
Meteor 0.8.1 deploy error.
$ modulus deploy
Welcome to Modulus
You are logged in as [email protected]
Please choose which project to use:
[?] project 1
Selecting Project
Meteor project detected...
Determining Meteor version...
Meteor version: 0.8.1
@fiveisprime
fiveisprime / align.rb
Created July 16, 2014 14:30
Align : operators (textmate)
#!/usr/bin/env ruby
#
# Assignment block tidier, version 0.1.
#
# Copyright Chris Poirier 2006.
# Licensed under the Academic Free License version 3.0.
#
# This script can be used as a command for TextMate to align all
# of the equal signs within a block of text. When using it with
# TextMate, set the command input to "Selected Text" or "Document",
@fiveisprime
fiveisprime / cors.js
Last active August 29, 2015 14:02
CORS
// This
app.all('*', function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
// Or this
app.use(function (req, res, next) {
@fiveisprime
fiveisprime / index.js
Last active August 29, 2015 14:00
ShaSum transform. Generate a hash with the specified algorithm from stream data.
var Transform = require('readable-stream').Transform;
var crypto = require('crypto');
var util = require('util');
var fs = require('fs');
function ShaSum(hash) {
if (!(this instanceof Transform)) {
return new ShaSum(hash);
}
@fiveisprime
fiveisprime / run.js
Created April 22, 2014 01:41
Recursive run.
!function runGet(url) {
request(url, function (err, response, body) {
if (err) {
throw err;
}
if (body.url) {
runGet(body.url);
}
});
@fiveisprime
fiveisprime / .zshrc
Last active August 29, 2015 13:59
npm version aliases.
alias patch='ggpur && npm version patch && ggpush --tags'
alias minor='ggpur && npm version minor && ggpush --tags'
alias major='ggpur && npm version major && ggpush --tags'