Skip to content

Instantly share code, notes, and snippets.

althaffe / index.js
Created Feb 18, 2018
Cosmic JS add to bucket
View index.js
let content = ''
items.forEach(item => {
content+= `${item.title} x ${item.count}, `
const params = {
type_slug: 'orders',
title: name,
content: content,
metafields: [
althaffe / gist:f9acd57f4cdc8e4a4d48f5eb910c188b
Last active Feb 18, 2018
Configuration for vue-stripe-checkout element.
View gist:f9acd57f4cdc8e4a4d48f5eb910c188b
import Vue from 'vue';
import VueStripeCheckout from 'vue-stripe-checkout';
const options = {
key: process.env.STRIPE_PUBLIC_KEY,
image: '',
locale: 'auto',
currency: 'USD',
billingAddress: true,
panelLabel: 'Pay {{amount}}'
View .env
View server.js
var express = require('express')
var path = require('path')
var serveStatic = require('serve-static')
app = express()
app.use(serveStatic(__dirname + "/dist"))
var port = process.env.PORT || 5000
console.log('server started '+ port)
View .env
althaffe /
Created Dec 1, 2017 — forked from kentbrew/
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

View gist:abd84f2509c60052154a

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.


Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

althaffe /
Created Feb 24, 2014 — forked from jookyboi/
Rails-related Gems and guides to accelerate your web project.


  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
You can’t perform that action at this time.