Skip to content

Instantly share code, notes, and snippets.

@markhuge
markhuge / README.md
Last active March 25, 2016 12:57
Fix failing node deployments on AWS Elastic Beanstalk

Fix failing node deployments on AWS Elastic Beanstalk

Elastic beanstalk runs npm install with a system user that has no homedir. During the npm install step, it's expecting a $HOME env variable for the npm cache (which doesn't exist). add this file to your project's .ebextensions directory to have it use root's homedir as a temporary path.

This workaround was provided by AWS support, but it doesn't appear to be documented anywhere. Determining root cause on this was a massive pain in the ass. Sharing this so others don't need to feel the pain.

@markhuge
markhuge / gist:6038456
Created July 19, 2013 11:22
Handlebars Helper - Time Since <date>
Handlebars.registerHelper 'timesince', (date) ->
seconds = Math.floor((new Date() - new Date(date)) / 1000)
interval = Math.floor seconds / 31536000
if interval > 1
return new Handlebars.SafeString interval + " years"
interval = Math.floor seconds / 2592000
if interval > 1
return new Handlebars.SafeString interval + " months"
@markhuge
markhuge / travis.yml
Last active August 29, 2015 14:09 — forked from tgrrtt/travis.yml
# Set up notification options
notifications:
email:
recipients:
- one@example.com
- other@example.com
# change is when the repo status goes from pass to fail or vice versa
on_success: change
on_failure: always
  • When this app is started with node index, a SIGINT (Ctrl+c) is caught by the app and it continues running.
  • When this app is started with npm start, a SIGINT causes npm to exit, detaching the still running node process from the foreground.
@markhuge
markhuge / chef.template.erb
Last active August 29, 2015 14:07
Node.js app Upstart Script example
# <%= @app_name %>.conf
# This file is generated by Chef for <%= node[:fqdn] %>
description "<%= @app_name %>"
start on filesystem or runlevel [2345]
stop on runlevel [06]
expect fork
respawn
@markhuge
markhuge / class.js
Last active August 29, 2015 14:04
Javascript prototypal pitfalls
// Pseudoclassical class pattern
// Constructor
function myThing() {
// under the hood 'this' is mapped to a new object
// created from myThing's prototype and NOT to myThing
this.name = "myThing";
}

Keybase proof

I hereby claim:

  • I am markhuge on github.
  • I am markhuge (https://keybase.io/markhuge) on keybase.
  • I have a public key whose fingerprint is 6450 7421 25CF B80C C9EA 6BB6 8EA2 79E6 5667 3B23

To claim this, I am signing this object: