Skip to content

Instantly share code, notes, and snippets.

View RichFromGalvanize's full-sized avatar
🖥️
Devin'

Richard Key RichFromGalvanize

🖥️
Devin'
View GitHub Profile
@RichFromGalvanize
RichFromGalvanize / app.js
Created June 9, 2013 23:34
Print Environment Variables for a node Express application.
var express = require('express'),
app = express();
app.get('/', function(req, res) {
res.contentType('application/json');
res.send(process.env);
});
app.listen(process.env.PORT);
@RichFromGalvanize
RichFromGalvanize / gist:5873044
Last active January 4, 2019 07:48
An image piping example using Node.js, express, and request...BOOYA!
var request = require('request');
var express = require('express');
var app = express();
app.get('/goofy', function(req, res) {
request('http://images1.wikia.nocookie.net/__cb20120715102950/disney/images/a/a5/Disneygoofy2012.jpeg').pipe(res);
});
app.get('/loop', function(req, res) {
res.render('mypage');
@RichFromGalvanize
RichFromGalvanize / modulus.itermcolors
Last active August 29, 2015 13:56
Modulus Item2 Color Scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.12156862765550613</real>
<key>Green Component</key>
<real>0.12156862765550613</real>
@RichFromGalvanize
RichFromGalvanize / script.js
Last active August 29, 2015 13:59
Simple MongoDB CLI command to get the number of fields in each collection of a DB.
db.getCollectionNames().forEach(function(name) {
print(name + ' - ' + Object.keys(db[name].findOne() || {}).length);
});
@RichFromGalvanize
RichFromGalvanize / cache.js
Created May 7, 2014 15:12
Simple Node.js Cache Module
module.exports = function() {
var cache = {},
expires = 1000 * 60 * 60; // default expiration, 1 hour
var isValid = function(key) {
if(!cache.hasOwnProperty(key) || cache[key].expires <= Date.now()) {
return false;
}
return true;
About 2017
by Richard Key
Revolutions or Jupiter Ascending?
Live-tweeting the conf. Stay tuned!
Two states: working or crashing.
Great apps and really great people.
I care about it Star Wars Connect.
If so where can I submit a couple?