Skip to content

Instantly share code, notes, and snippets.

View ppcano's full-sized avatar

Pepe Cano ppcano

View GitHub Profile
@dudleyf
dudleyf / gist:1477124
Created December 14, 2011 15:52
Handlebars Rake::Pipeline filter
require "json"
class HandlebarsFilter < Rake::Pipeline::Filter
def initialize(&block)
block ||= proc { |input| input.sub(/\.handlebars$/, '.js') }
super(&block)
end
def generate_output(inputs, output)
inputs.each do |input|
output.write "return Ember.Handlebars.compile(#{input.read.to_json})"
@rauchg
rauchg / ms.md
Created December 21, 2011 00:25
Milliseconds conversion utility.
@nicholasjhenry
nicholasjhenry / AssetFile
Created January 4, 2012 00:42
AssetFile for Rake Pipeline for use with ember.js/handlebars
require "json"
require "rake-pipeline-web-filters"
input "assets"
output "public"
class HandlebarsFilter < Rake::Pipeline::Filter
def initialize(&block)
block ||= proc { |input| input.sub(/\.handlebars$/, '.js') }
super(&block)
@dudleyf
dudleyf / AssetFile
Created January 4, 2012 00:46 — forked from nicholasjhenry/AssetFile
AssetFile for Rake Pipeline for use with ember.js/handlebars
require "json"
require "rake-pipeline-web-filters"
input "assets"
output "public"
class HandlebarsFilter < Rake::Pipeline::Filter
def initialize(&block)
block ||= proc { |input| input.sub(/\.handlebars$/, '.js') }
super(&block)
@tj
tj / emit.sh
Created January 10, 2012 23:59
grep .emit() calls
#!/usr/bin/env bash
echo
find ${1:-.} -name "*.js" \
| xargs cat \
| grep '.emit(' \
| sed 's/.*.emit(//g' \
| sed -E "s/,|'|); *$//g" \
| awk '{
@wagenet
wagenet / Assetfile.rb
Created January 13, 2012 20:37
Ember Handlebars Precompile
require 'execjs'
class HandlebarsFilter < Filter
class << self
def contents
@@contents ||= [File.read("headless-ember.js"), File.read("ember.js")].join("\n")
end
def context
@@context ||= ExecJS.compile(contents)
(function(exports) {
window.DS = SC.Namespace.create();
})({});
(function(exports) {
DS.Adapter = SC.Object.extend({
commit: function(store, commitDetails) {
commitDetails.updated.eachType(function(type, array) {
@wycats
wycats / gist:1627976
Created January 17, 2012 18:26
How to debug dynamic loading
export DYLD_PRINT_OPTS="1"
export DYLD_PRINT_ENV="1"
export DYLD_PRINT_LIBRARIES="1"
export DYLD_PRINT_LIBRARIES_POST_LAUNCH="1"
export DYLD_PRINT_APIS="1"
export DYLD_PRINT_BINDINGS="1"
export DYLD_PRINT_INITIALIZERS="1"
export DYLD_PRINT_REBASINGS="1"
export DYLD_PRINT_SEGMENTS="1"
export DYLD_PRINT_STATISTICS="1"
@tj
tj / ansi.js
Created February 9, 2012 01:26
var fg = {
30: 'fg-black'
, 31: 'fg-red'
, 32: 'fg-green'
, 33: 'fg-yellow'
, 34: 'fg-blue'
, 35: 'fg-magenta'
, 36: 'fg-cyan'
, 37: 'fg-white'
@bobspryn
bobspryn / Assetfile.rb
Created February 16, 2012 23:04
AssetFile
require "json"
require "uglifier"
require "rake-pipeline-web-filters"
# this gives you concat, coffee_script, and minispade methods
require "rake-pipeline-web-filters/helpers"
class ImportFilter < Rake::Pipeline::Filter
def generate_output(inputs, output)
inputs.each do |input|