I suspect that some trig calculations could make this very general.
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
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery => case Rails.env | |
when "production" then ["http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js", "application", "etc"] | |
when "development" then %w(jquery jquery-ui jquery-typewatch rails application) | |
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
#!/bin/bash | |
# | |
# mkv2m4v inputfile.mkv | |
# | |
# Given an MKV container with H.264 video & AC3 or DTS audio, converts | |
# quickly to an iPad-compatible MP4 container without re-encoding the | |
# video (so it must already be in an iPad-compatible resolution); the | |
# audio is downmixed to stereo with Dynamic Range Compression. | |
# | |
ME=$(basename $0) |
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
$ sudo su - | |
# mkdir /etc/resolver | |
# cat > /etc/resolver/test | |
nameserver 127.0.0.1 | |
port 2155 | |
^D | |
^D | |
$ brew install dnsmasq | |
$ dnsmasq --port=2155 --no-resolv --address=/.test/127.0.0.1 | |
$ ping foo.test |
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
# Add all gems in the global gemset to the $LOAD_PATH so they can be used in rails3 console with bundler | |
if defined?(::Bundler) | |
$LOAD_PATH.concat Dir.glob("#{ENV['rvm_path']}/gems/#{ENV['rvm_ruby_string']}@global/gems/*/lib") | |
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
class Model < ParentModel | |
include Foo::Bar | |
extend Bar::Baz | |
acts_as_authentic | |
dsl_specific_flags | |
module InternalModule | |
... | |
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 ActiveRecord | |
module ConnectionAdapters | |
module DatabaseStatements | |
# | |
# Run the normal transaction method; when it's done, check to see if there | |
# is exactly one open transaction. If so, that's the transactional | |
# fixtures transaction; from the model's standpoint, the completed | |
# transaction is the real deal. Send commit callbacks to models. | |
# | |
# If the transaction block raises a Rollback, we need to know, so we don't |
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 DeepFetch | |
def deep_fetch(*keys, &fetch_default) | |
throw_fetch_default = fetch_default && lambda {|key, coll| | |
args = [key, coll] | |
# only provide extra block args if requested | |
args = args.slice(0, fetch_default.arity) if fetch_default.arity >= 0 | |
# If we need the default, we need to stop processing the loop immediately | |
throw :df_value, fetch_default.call(*args) | |
} | |
catch(:df_value){ |
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
require 'sass' | |
module Sass::Script::Functions | |
def svg_circle(radius, color, circle_type) | |
img = if circle_type.value == "disc" | |
%Q{<circle cx="#{radius.value}" cy="#{radius.value}" r="#{radius.value}" | |
stroke-width="0" fill="#{color}"/>} | |
else | |
%Q{<circle cx="#{radius.value}" cy="#{radius.value}" r="#{radius.value}" | |
stroke="#{color}" stroke-width="1" fill="white"/>} |
OlderNewer