🤹♂️
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
gem 'sass-rails', :git => 'https://github.com/rails/sass-rails.git' | |
gem 'compass', :git => 'https://github.com/chriseppstein/compass.git', :branch => 'rails31' |
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($){ | |
var touch = {}, touchTimeout; | |
function parentIfText(node){ | |
return 'tagName' in node ? node : node.parentNode; | |
} | |
function swipeDirection(x1, x2, y1, y2){ | |
var xDelta = Math.abs(x1 - x2), yDelta = Math.abs(y1 - y2); | |
if (xDelta >= yDelta) { |
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 String | |
def dedent | |
indent = lines.reject(&:empty?).map { |line| line.index(/\S/) }.compact.min | |
gsub /^ {1,#{indent.to_i}}/, '' | |
end unless method_defined? :dedent | |
def redent prefix | |
prefix = " " * prefix if prefix.is_a? Numeric | |
dedent.gsub! /^(?=[ \t]*\S+)/, prefix | |
end unless method_defined? :redent |
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
#compdef gem gem1.9 | |
gem_general_flags=("(-h --help)"{-h,--help}"[Get help on this command]" | |
"(-V --verbose)"{-V,--verbose}"[Set the verbose level of output]" | |
"(-q --quiet)"{-q,--quiet}"[Silence commands]" | |
"--config-file[Use this config file instead of default]:file:_files" | |
"--backtrace[Show stack backtrace on errors]" | |
"--debug[Turn on Ruby debugging]" | |
$nul_arg | |
) |
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
# Save this somewhere, then run `ruby-build path/to/1.9.2-p290-loadpatch` | |
build_package_apply_loadpatch() { | |
{ curl "https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch" | patch | |
} >&4 2>&1 | |
} | |
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz" | |
install_package "ruby-1.9.2-p290" "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz" apply_loadpatch standard | |
install_package "rubygems-1.8.10" "http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz" ruby |
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
import sys | |
from string import ascii_letters as letters | |
ops = ('+', '-', '*', '/', '^') | |
cases = int(sys.stdin.readline().strip()) | |
for line in sys.stdin: | |
stack = [[]] | |
for c in line.strip(): | |
if c == '(': | |
stack.append([]) | |
elif c == ')': |
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
def psuedorandoms seed | |
Enumerator.new do |yielder| | |
loop do | |
seed = Digest::MD5.digest(seed) | |
seed.unpack("Q*").each do |number| | |
yielder.yield number.to_f / 2**64 | |
end | |
end | |
end | |
end |
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
module RSpec::Rails::Matchers::Assign | |
private | |
# +nodoc+ | |
class AssignMatcher | |
attr_accessor :actual, :operator, :expected | |
def initialize scope, name, expected=nil | |
@scope = scope | |
@name = name |
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
FactoryGirl.define do | |
factory :business | |
factory :client do | |
business | |
first "Homer" | |
end | |
factory :appointment do | |
client |
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
# Adds SASS rendering support to Rails actionview (from controllers) | |
module Sass::Rails::Views | |
class Railtie < ::Rails::Railtie | |
initializer "sass-rails-views" do | |
# Tell ActionView we can handle SASS templates | |
ActionView::Template.register_template_handler :sass, Sass::Rails::Views::Template | |
end | |
# Create a SASS file as a rails template | |
class Template |