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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>content</key> | |
<string><p> | |
${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}<br /> | |
${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.text_field :${1/(\w*).*/$1/ig}${TM_RAILS_TEMPLATE_END_RUBY_EXPR} | |
</p></string> | |
<key>name</key> |
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 Post < ActiveRecord::Base | |
attr_accessor :comment # fake attribute used for spam trapping | |
validates_length_of :comment, :in => 0..1 | |
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
# | |
# bash completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names |
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
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# | |
# To use: | |
# rails project_name -m http://gist.github.com/raw/248940/c31e540b1b68236697fe8c0f32e6b83a39978797/Rails%20MongoMapper%20Template.rb | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" |
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 Harmony | |
# Allows accessing config variables from harmony.yml like so: | |
# Harmony[:domain] => harmonyapp.com | |
def self.[](key) | |
unless @config | |
raw_config = File.read(RAILS_ROOT + "/config/harmony.yml") | |
@config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys | |
end | |
@config[key] | |
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
tell application "System Events" | |
if exists process "Skype" then | |
tell application "Skype" | |
send command "SET USERSTATUS ONLINE" script name "AppleScript status setter" | |
end tell | |
end if | |
end tell | |
-- "MODES": ONLINE, DND, AWAY |
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
# To use: | |
# rails project_name -m http://gist.github.com/raw/401285/963cbb5d75644d545d0b81be02b1656b365932e7/rails-template.rb | |
# download helper | |
require 'net/http' | |
def download(url, target_dir = "") | |
domain = url.match(/:\/\/([a-z\.]*)/)[1] | |
filename = url.match(/\/([a-z\.]*)$/)[1] | |
path = url.match(/:\/\/[a-z\.]*(.*)/)[1] |
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 'pp' | |
require 'rubygems' | |
require 'mongo_mapper' | |
MongoMapper.database = 'testing' | |
class Rating | |
include MongoMapper::EmbeddedDocument | |
key :user_id, ObjectId |
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 an incomplete implementation. | |
module MongoMapper | |
module NestedAttributes | |
def self.included(base) | |
base.extend(ClassMethods) | |
base.send :include, InstanceMethods | |
end | |
module ClassMethods | |
def accepts_nested_attributes_for(*attr_names) |
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
# configure these defaults based on Your needs : | |
JS_FILES_DIR = 'public/javascripts' # the javascripts base directory | |
EXCLUDED_JS_FILES = %W{ cache/* test/* } # excluded from compilation | |
OUT_FILE_JS_EXT_PREFIX = ".min" # override with `rake ... OUT_EXT=_pack` | |
COMPILER_JAR = "lib/jars/build/compiler.jar" # adjust the jar path ! | |
# only required if running under JRuby - will compile multiple files | |
# faster as it does not need to run system `java -jar ...` commands. | |
COMPILER_MAIN_CLASS = "com.google.javascript.jscomp.CommandLineRunner" |
OlderNewer