Skip to content

Instantly share code, notes, and snippets.

View chip's full-sized avatar

Chip Castle chip

View GitHub Profile
@chip
chip / start.sh
Created March 27, 2016 02:38 — forked from so0k/start.sh
meteor up
#!/bin/bash
APPNAME=<%= appName %>
APP_PATH=/opt/$APPNAME
BUNDLE_PATH=$APP_PATH/current
ENV_FILE=$APP_PATH/config/env.list
PORT=<%= port %>
USE_LOCAL_MONGO=<%= useLocalMongo? "1" : "0" %>
# remove previous version of the app, if exists
@chip
chip / icon-generator.py
Created March 25, 2016 17:37 — forked from wreiske/icon-generator.py
Creates all the needed icons for Android and iOS + mobile-config.js for Meteor
import os
from progressbar import ProgressBar, Percentage, Bar, ETA
print "----------------- Icon Generator ------------------"
print "Usage: icon-generator.py"
print "See files_ios { } in icon-generator.py"
print "icon-ios.png and icon-android.png"
print "---------------------------------------------------"
input_ios = './icon-ios.png'
@chip
chip / Sizes.md
Created March 10, 2016 22:15 — forked from jperl/Sizes.md
Meteor App Icon and Launch Screen Size Guide

###Icons

Name Size
iphone_2x 120x120
iphone_3x 180x180
ipad 76x76
ipad_2x 152x152
android_ldpi 36x36
android_mdpi 48x48
@chip
chip / object-creation.md
Created February 23, 2016 01:56 — forked from benpriebe/object-creation.md
Douglas Crockford - Create Object Recipe (2014)

Douglas Crockford showed a slide showing how he creates JavaScript objects in 2014.

He no longer uses Object.create(), avoids 'this' and doesn't even care about memory reduction by using prototypes.

https://www.youtube.com/watch?v=bo36MrBfTk4 (skip ahead to 35 mins for relevant section)

Here is the pattern described on the slide:

function constructor(spec) {
@chip
chip / gist:8a8a5e59909f94014c72
Created October 30, 2015 14:24 — forked from toamitkumar/gist:952211
Inspect and test routes on console (Rails 3)
$ rails console
Loading development environment (Rails 3.0.6)
ruby-1.8.7-p334 :001 > r = Rails.application.routes
Gives you a handle of all the routes (config/routes.rb)
#Inspect a named route:
ruby-1.8.7-p334 :005 > r.recognize_path(app.destroy_user_session_path)
=> {:action=>"destroy", :controller=>"sessions"}
@chip
chip / constructor.js
Last active February 15, 2021 18:40
classless javascript
// http://stackoverflow.com/questions/27595749/douglas-crockford-on-class-free-oop-in-javascript
// https://www.youtube.com/watch?v=PSGEjv3Tqo0#t=1395
//
// Per Douglas Crockford (but requries ES6 support)
// function constructor(spec) {
// let {member} = spec,
// {other} = other_constructor(spec),
// method = function () {
// // accesses member, other, method, spec
// };
hash = { 'foo' => 'bar' }
# Version 1
hash = Hash[hash.map { |k, v| [k.to_sym, v] }]
# Version 2
hash = hash.reduce({}) do |memo, (k, v)|
memo.tap { |m| m[k.to_sym] = v }
end
@chip
chip / shared-file-system-skyo.md
Created July 23, 2014 01:15
Shared file system for Skyo

The most common options for appear to be Amazon's S3 and Rackspace Cloud Files services. Although S3 is the most reliable service, it makes more sense for Skyo to use Rackspace since the site is already on their network.

  1. The basic idea is to sign up for an account and create a container to hold the file assets. Once that is done you can upload the assets using an FTP client such as Cyberduck, although there are probably other options.

  2. Reference assets using the container url, which will be something like http://c186397.r00.cf1.rackcdn.com. We can always put this into a YAML configuration file and reference it as something like Settings.cdn_url or something similar. Alernatively, we can optionally reference something like images.skyo.com by setting up a CNAME, provided that someone who has access to the skyo.com domain will add

# Simple 16 step drum machine experiment with Node and CoffeeScript
# by Peter Cooper - @peterc
#
# Inspired by Giles Bowkett's screencast at
# http://gilesbowkett.blogspot.com/2012/02/making-music-with-javascript-is-easy.html
#
# Screencast demo of this code at http://www.youtube.com/watch?v=qWKkEaKL6DQ
#
# Required:
# node, npm and coffee-script installed
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.deb
sudo dpkg -i elasticsearch-1.1.1.deb