These are the JavaScript rules I've been living by and don't expect you to agree or follow them.
I use it. If you don't, read these:
# (...) | |
Rails.boot! | |
# The code below allow to use Thin as the webserver | |
if $0 == 'script/server' | |
# commands/server.rb (#45) is not cooperative, so we patch Rack itself | |
require 'rack' | |
module Rack::Handler | |
class << self |
#!/usr/bin/env bash | |
INSTALL_DIR="${INSTALL_DIR:-/opt/local}" | |
VERSION=$2 | |
YAML_VERSION="0.1.4" | |
APP_NAME="ruby" | |
URL="http://ftp.ruby-lang.org/pub/ruby/ruby-$VERSION.tar.bz2" | |
YAML_URL="http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz" | |
PREFIX="$INSTALL_DIR/$APP_NAME/$VERSION" | |
YAML_PREFIX="$INSTALL_DIR/yaml" |
require 'RMagick' | |
require 'capybara' | |
require 'launchy' | |
module Capybara::Recording | |
def start_recording | |
system "rm -f tmp/*" | |
end | |
def save_recording |
#!/usr/bin/env ruby | |
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/ | |
puts "\e[31mPlease focus and remove your :focus tags before committing :)" | |
exit 1 | |
end |
class Application < ActiveRecord::Base | |
attr_accessible :checksum, :name, :size, :configuration_attributes | |
has_one :configuration, :dependent => :destroy | |
accepts_nested_attributes_for :configuration, :allow_destroy => :true | |
after_initialize :create_new_configuration | |
private |
<%= form_for @application, :html => { :class => 'form-horizontal' } do |f| %> | |
<div class="control-group"> | |
<%= f.label :name, :class => 'control-label' %> | |
<div class="controls"> | |
<%= f.text_field :name, :class => 'text_field' %> | |
</div> | |
</div> | |
<div class="control-group"> | |
<%= f.label :checksum, :class => 'control-label' %> | |
<div class="controls"> |
class Person < ActiveRecord::Base | |
include Tire::Model::Search | |
include Tire::Model::Callbacks | |
has_many :addresses | |
accepts_nested_attributes_for :addresses, :allow_destroy => true | |
def to_indexed_json | |
{ | |
:addresses => adresses.map{|p| p.name}.compact.reject(&:blank?).uniq, |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
require 'machinist/active_record' | |
require 'machinist/caching/active_record' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
spec_support = Rails.root.join("spec/support/**/*.rb") |
My iTunes Match Track upgrading and process info: | |
If you have less than 25,000 tracks: | |
1. First let iTunes Match do its things and find all possible matches in your library and finish uploading any non-matching tracks. | |
2. Once its done, make a new Smart Playlist (I made a folder for all my Smart iTunes Match Related Playlists) | |
Name this one: iCloud-Upgradeable | |
Criteria: | |
MATCH ALL: | |
Bit Rate is less than 256kbps |
These are the JavaScript rules I've been living by and don't expect you to agree or follow them.
I use it. If you don't, read these: