Skip to content

Instantly share code, notes, and snippets.

View javierav's full-sized avatar
😎

Javier Aranda javierav

😎
View GitHub Profile
@tomdale
tomdale / gist:2494968
Created April 26, 2012 01:10
Ember.js View Context Change

View Context Changes

The rules for how Ember.js evaluates Handlebars templates have recently changed, and you may need to update your application's templates to ensure they continue working..

Template Contexts

Remember that a template is always evaluated against a context object. When you render a template, values are looked up from that object. For example:

Hello, {{firstName}} {{lastName}}!
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@jeffreyiacono
jeffreyiacono / Rakefile
Created February 8, 2012 20:15
rake task for precompiling assets using sprockets within a sinatra app + view helpers
require 'rubygems'
require 'bundler'
Bundler.require
require './application'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] do
end
@jgorset
jgorset / gist:1747655
Created February 5, 2012 19:41
How Sprockets works with JST and EJS templates
// This document distills the magic that happens when you create a file with the ".jst"
// and ".ejs" extensions anywhere on your asset path in Ruby on Rails, courtesy of the
// Sprockets library (https://github.com/sstephenson/sprockets).
//
// For the purpose of this example, imagine that you have created a template for
// messages in `app/assets/javascripts/backbone/templates/messages/message.jst.ejs`
// with the following contents:
//
// <h1><%= user.full_name %></h1>
// <p><%= body %></p>
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created November 28, 2011 01:50
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@ryanlecompte
ryanlecompte / gist:1283413
Created October 13, 2011 04:50
Providing an ActiveRecord-like before_filter capability to arbitrary Ruby classes
# First the end result of what we want:
class Foo
before_hook :whoa
before_hook :amazing
def test
puts "This is kinda cool!"
end
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon