Skip to content

Instantly share code, notes, and snippets.

View marshallshen's full-sized avatar

Marshall Shen marshallshen

View GitHub Profile
@marshallshen
marshallshen / demo.js
Created March 13, 2017 21:39 — forked from russau/demo.js
Lambda function for ElasticTranscoder
console.log('Loading event');
var AWS = require('aws-sdk');
exports.handler = function(event, context) {
console.log('Received event:');
console.log(JSON.stringify(event, null, ' '));
// Get the object from the event and show its content type
var bucket = event.Records[0].s3.bucket.name;
var key = event.Records[0].s3.object.key;
var output = Math.random().toString(36).substring(7) + ".webm";
@marshallshen
marshallshen / launch_sublime_from_terminal.markdown
Created July 15, 2016 18:53 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

context 'performance' do
before do
require 'benchmark'
@posts = []
@users = []
8.times do |n|
user = Factory.create(:user)
@users << user
aspect = user.aspects.create(:name => 'people')
connect_users(@user, @aspect0, user, aspect)
require 'csv'
module Exporter
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ]
DESTINATION_FOLDER = "tmp/"
def self.included(klass)
klass.extend ClassLevelMethods
end
(use 'incanter.core)
;; basic arithmetic
($= 7 + 8 - 2 * 6 / 2) ; => 9
;; add 5 to each element of the vector [1 2 3]
($= [1 2 3] + 5) ; => (6 7 8)
@marshallshen
marshallshen / gist:4120753
Created November 20, 2012 20:16 — forked from bclinkinbeard/gist:2698389
D3.js scatterplot in CoffeeScript
dataset = []
w = 500
h = 400
padding = 30
dataset.push [ Math.random() * w, Math.random() * h ] for [0..50]
svg = d3.select("body")
.append("svg")
.attr("width", w)