Skip to content

Instantly share code, notes, and snippets.

View jacquescrocker's full-sized avatar

Jacques Crocker jacquescrocker

View GitHub Profile
@ryanflorence
ryanflorence / render-multiple-outlets-ember.html
Last active September 20, 2019 02:18
Render templates into multiple outlets with ember.js and the new router.
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Render Multiple Outlets</title>
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/handlebars.js"></script>
<script src="js/vendor/ember.js"></script>
<script src="js/vendor/ember-data.js"></script>
</head>
scope '/api' do
resources :users, except: [:edit]
end
root to: 'ember#index'
get '*path' => 'ember#index'
@remi
remi / natural_dates.rb
Created November 5, 2012 22:11
Natural Dates in Ruby
#!/usr/bin/env ruby
require "date"
class Fixnum
Date::MONTHNAMES[1..-1].each_with_index do |month, index|
define_method month.downcase do |year|
Date.new(year, index+1, self)
end
end
end
@josevalim
josevalim / 0_README.md
Created September 13, 2012 21:52
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

@jimsynz
jimsynz / why.md
Created June 25, 2012 23:12
Hamlbars nested conditions

You wrote:

= hb 'if content.condition1' do
  = hb 'if content.condition2' do
    %p Some paragraph
    = hb 'else'
      %p another paragraph
  = hb 'else'
 %p third paragraph
@jimtla
jimtla / underscoreR.coffee
Created May 6, 2012 21:51
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"
module GGeocode
### ref: http://code.google.com/apis/maps/documentation/geocoding/
GGeocode::Version = '0.0.3'
def GGeocode.version
GGeocode::Version
end
require 'net/http'
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@timtyrrell
timtyrrell / gist:1903287
Created February 24, 2012 19:52
1.9.3 ruby debug install
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0
OR if Falcon the last one is use the one below (or whatever)
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0-falcon
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.