View compile
#!/bin/bash
# usage: bin/compile <build-dir> <cache-dir> <env-dir>
mkdir -p "$1" "$2"
build=$(cd "$1/" && pwd)
cache=$(cd "$2/" && pwd)
export buildpack=$(dirname $(dirname $0))
# CF Common
export BUILDPACK_PATH=$buildpack
View shell-colors-vim-hybrid.sh
#!/bin/sh
# Shell colors for vim-hybrid - Shell color setup script
# Luan Santos (http://luansantos.com)
if [ "${TERM%%-*}" = 'linux' ]; then
# This script doesn't support linux console (use 'vconsole' template instead)
return 2>/dev/null || exit 0
fi
color017="00/00/5f"
View Hybrid.itermcolors
<?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.20179691910743713</real>
<key>Green Component</key>
<real>0.1818026602268219</real>
View git-stories.bash
#!/usr/bin/env bash
function get_story()
{
curl -X GET -H "X-TrackerToken: $TOKEN" "https://www.pivotaltracker.com/services/v5/projects/$PROJECT_ID/stories/$1" 2>/dev/null
}
stories=`git log $1 | egrep -o "\[\w* ?#(\d+)\]" | egrep -o "\d+" | sort -u`
for story_id in $stories; do
echo -n "[#$story_id] - "
View sound_player_view.js
Ember.SoundPlayerManager = Ember.StateManager.extend({
initialState: 'preparing',
preparing: Ember.State.create({
ready: function(manager, context) {
manager.transitionTo('unloaded');
}
}),
unloaded: Ember.State.create({
View sound_player_view_spec.js
describe('Ember.SoundPlayerView', function() {
var player;
beforeEach(function() {
player = Ember.SoundPlayerView.create({ url: '/__spec__/fixtures/song.mp3' });
waitForReady();
});
afterEach(function() {
player.get('sound').stop();
View app.js
App = Ember.Application.create();
App.Store = DS.Store.extend({
adapter: 'DS.FixtureAdapter'
});
App.Router.map(function () {
this.resource('songs');
this.resource('song', { path: '/song/:song_id' });
});
View 20130520015455_create_temp_arrays.rb
class CreateTempArrays < ActiveRecord::Migration
def change
create_table :temp_arrays do |t|
t.string :array
t.boolean :sorted
t.integer :parent_id, :integer
t.timestamps
end
end
View gist:4196192
# Learn Metaprogramming
yes.
View hstored.rb
module HStored
module ClassMethods
def field(key, options = {})
key = key.to_s
scope "has_#{key}", lambda { |value| where("properties @> (? => ?)", key, value) }
define_method(key) do
return options[:default] if options[:default] && !(properties && properties[key])
property = properties && properties[key]