-
The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]
-
jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]
-
Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]
-
The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]
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
#In app/models/tableless.rb | |
class Tableless < ActiveRecord::Base | |
def self.columns | |
@columns ||= []; | |
end | |
def self.column(name, sql_type = nil, default = nil, null = true) | |
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, | |
sql_type.to_s, null) | |
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
# | |
# Reference: http://rubygems.rubyforge.org/rdoc/Gem/Specification.html | |
# | |
# Another reference, which displays all of the defaults and shows useful | |
# examples: http://docs.rubygems.org/read/chapter/20 | |
# | |
Gem::Specification.new do |s| | |
# This gem’s name. Required. | |
s.name = 'my-gem' |
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
$rlevel = [] | |
alias :orig_require :require | |
def require(file) | |
puts "#{$rlevel.join}#{file}" | |
$rlevel << "-" | |
req = orig_require(file) | |
$rlevel.pop | |
req | |
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
// Simple JavaScript Templating | |
// John Resig - http://ejohn.org/ - MIT Licensed | |
// http://ejohn.org/blog/javascript-micro-templating/ | |
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || |
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
#Change this: | |
ActionController::Base.class_eval do | |
def perform_action | |
perform_action_without_rescue | |
end | |
end | |
#to: |
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
ip = 12 | |
arr = [1, 3, 5, 7, 9, 10, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 34, 35, 36] | |
index = arr.length | |
min = 0; max = arr.length | |
while (min + 1 != max) do | |
index = (min + max) / 2 | |
if ip < arr[index] | |
max = index | |
else |
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
var currentMedia = false; | |
// Get photo | |
Ti.Media.showCamera({ | |
mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO], | |
success: function(event) { | |
var cropRect = event.cropRect; | |
currentMedia = event.media; | |
}, | |
error:function(error) { |
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
Then /^(.+) and I confirm dialog box$/ do |step| | |
bypass_confirm_dialog | |
Then step | |
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
# redis-cli -p 6379 | |
redis 127.0.0.1:6379> SET visits 1 | |
OK | |
redis 127.0.0.1:6379> GET visits | |
"1" | |
redis 127.0.0.1:6379> INCR visits | |
(integer) 2 | |
redis 127.0.0.1:6379> exit |
OlderNewer