Skip to content

Instantly share code, notes, and snippets.

View merbjedi's full-sized avatar

Jacques Crocker merbjedi

View GitHub Profile
CONFIG = Rails.root.join("config", "config.yml").open{ |file| YAML::load(file) }
// jquery fire() allows you to easily trigger jquery events with named arguments
// e.g. $(".myelement").fire("customEvent", {arg1: "say", arg2: "hello"});
// in your event, just use e.arg1, and e.arg2 to access these variables
;(function($) {
$.fn.fire = function(eventName, arguments){
var arguments = arguments || {};
arguments["type"] = eventName;
this.trigger(arguments);
}
};
= uniform-element
margin: 0
padding: 0
*
margin: 0
padding: 0
// much more...
Loaded suite /Users/jc/.rvm/gems/ruby-1.8.7-p249%rails3/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.....................................EE..EE.........EEEEEEE...................................EEEEE.........................EE...........E.........................................................................................................................E.FFFF..............................EE..EEEEEEEEF..EE.E...EEEFEE...E.EE...E.......EEF.E..E.....E...E..................EEEEE...EEEE.............................................................................................................EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.EEEEEEEEEEEEEEEEEE.................E.......................................FFFEEEEEEEEEEEEEEEEEEEEE.EEEEE..EEEEEEEFEE..E.E.E.EE.EEE.EEEE..EEEEEEEEE...................................................................FE..........................................EE..........EEEEEE................EEE.E..E..............................................................DEPRECATION WARNING:
Ok, so I want to wrap all my classes in a module, so they dont pollute the global namespace,
and I can later refactor them into reusable apps.
Say the name of my app is MobileBookstore. The only way to work around load_missing_constant
is to organize your app like this:
app/
helpers/
mobile_bookstore/
books_helper.rb
en:
errors:
# The default format use in full error messages.
format: "{{attribute}} {{message}}"
# The values :model, :attribute and :value are always available for interpolation
# The value :count is available when applicable. Can be used for pluralization.
messages:
inclusion: "is not included in the list"
exclusion: "is reserved"
Gem::Specification.new do |s|
s.name = %q{liquid}
s.version = "2.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Tobias Luetke"]
s.date = %q{2009-04-13}
s.description = %q{A secure non evaling end user template engine with aesthetic markup.}
s.email = %q{[email protected]}
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
[jc@macbookpro ~]# rvm info
rvm 0.1.7 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]
system:
uname: "Darwin jc-macbookpro.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov 3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386"
shell: "bash"
version: "3.2.48(1)-release"
ruby:
module WebbyHelpers
def link_to(title, path = "", options = {})
super title, path, :attrs => options
end
def image_tag(path, options = {})
"<img src=\"#{path}\" #{tag_options(options)} />"
end
def lorem(*args)
def test_content_tag_with_newlines
assert_equal(<<HTML, render(<<HAML, :action_view))
<div class="foobar" id="barfoo">INNER</div>
HTML
= content_tag :div,
"INNER",
:class => "foobar",
:id => "barfoo"
HAML
end