This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Router.map(function() { | |
this.resource('post', { path: '/posts/:post_id' }); | |
}); | |
App.PostRoute = Ember.Route.extend({ | |
model: function(params) { | |
return this.store.find('post', params.post_id); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git-recent | |
# | |
# Call 'git fetch' and log all remote branches that have any activity | |
# in the past n days (default=3). | |
# | |
# Place this script in your PATH, chmod +x it, and git will allow you to magically do: | |
# $ git recent (days) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ValueObject < Struct | |
def self.[](*args) | |
if args.length > 0 | |
new(*args) | |
else | |
new(:null) | |
end | |
end | |
def [](*args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
true | |
repro.rb:16:in `block in <main>': uninitialized constant B (NameError) | |
from repro.rb:13:in `initialize' | |
from repro.rb:13:in `new' | |
from repro.rb:13:in `<main>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Border Radius | |
@mixin round($radius: 4px) { | |
-moz-border-radius: $radius; | |
-webkit-border-radius: $radius; | |
border-radius: $radius; | |
} | |
// Box Shadow | |
@mixin shadow($shadow1: 0 0 4px #0A0A0A, $shadow2:false, $shadow3:false, $shadow4:false, $shadow5:false) { | |
$params: $shadow1; | |
@if $shadow2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2.0.0dev :175 > @three = Three.new | |
# => #<Three:0x007fad66054540> | |
# 2.0.0dev :176 > @three.my_method | |
# im in class three | |
# im in the module | |
# im in class two | |
# im in class one | |
# @three.my_method_2 | |
# <Three:0x108ca55e0> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'em-proxy' | |
TARGET = ARGV[0] ? ARGV[0].to_sym : :mysql | |
puts "Starting proxy on port 4000." | |
puts "Passing requests port 4100 (mysql) and port 4200 (postgres). Responses are returned from #{TARGET}." | |
Proxy.start(:host => "0.0.0.0", :port => 4000, :debug => true) do |conn| | |
@start = Time.now | |
@data = Hash.new("") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this is to patch a bug with the jquery.ui.tabs API | |
// http://bugs.jqueryui.com/ticket/4941 | |
// http://bugs.jqueryui.com/ticket/8637 | |
// it has to do with the <base href> tag in <head> and jquery.ui.tabs | |
// being smart about figuring out weather to AJAX a tab or not | |
;(function() { | |
var tabsInitialised = false; | |
var _tabs = $.fn.tabs; | |
var updateBaseHrefs = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($){ | |
$.fn.textExtents = function(options){ | |
var spans = $('span:visible', this); | |
var heightMax = parseInt($(this).css('max-height')); | |
var widthMax = parseInt($(this).css('max-width')); | |
var fontSize = parseInt($(this).css('font-size')); /* max font size */ | |
do{ | |
var textHeight = 0; | |
var textWidth = 0; | |
$(spans).each(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JSON-encoded error and redirect results for Devise controllers. | |
# This overrides an internal method of Devise, so be careful when updating Devise! | |
# | |
# Usage: | |
# | |
# class Users::RegistrationsController < Devise::RegistrationsController | |
# include DeviseJsonAdapter | |
# end | |
# | |
# devise_for :users, :controllers => { :registrations => "users/registrations" } |