This file contains hidden or 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
1.9.3-p194 :001 > a = [1, 2, 3, 4] | |
=> [1, 2, 3, 4] | |
1.9.3-p194 :002 > a.last | |
=> 4 | |
1.9.3-p194 :003 > |
This file contains hidden or 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
/** | |
* Mulit-byte Unserialize | |
* | |
* UTF-8 will screw up a serialized string | |
* | |
* @access private | |
* @param string | |
* @return string | |
*/ | |
function mb_unserialize($string) { |
This file contains hidden or 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
product = Product.new | |
product.name = "Hello" | |
product.save! |
This file contains hidden or 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
1.9.3p194 :001 > [1,2,3,4,5,6].in_groups(4,false) | |
=> [[1, 2], [3, 4], [5], [6]] |
This file contains hidden or 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
# Do not refactor, it is a bad practice. YOLO | |
# Not understanding why or how something works is always good. YOLO | |
# Do not ever test your code yourself, just ask. YOLO | |
# No one is going to read your code, at any point don't comment. YOLO | |
# Why do it the easy way when you can reinvent the wheel? Future-proofing is for pussies. YOLO |
This file contains hidden or 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
Spork.each_run do | |
require 'factory_girl_rails' | |
# reload all the models | |
Dir["#{Rails.root}/app/models/**/*.rb"].each do |model| | |
load model | |
end | |
end |
This file contains hidden or 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
Spork.each_run do | |
... | |
# Hack to ensure models get reloaded by Spork - remove as soon as this is fixed in Spork. | |
# Silence warnings to avoid all the 'warning: already initialized constant' messages that | |
# appear for constants defined in the models. | |
silence_warnings do | |
Dir["#{Rails.root}/app/models/**/*.rb"].each {|f| load f} | |
end | |
end |
This file contains hidden or 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
C runs the command self-insert-command, which is an interactive built-in function in `C source code'. | |
It is bound to many ordinary text characters. | |
(self-insert-command N) | |
Insert the character you type. | |
Whichever character you type to run this command is inserted. | |
Before insertion, `expand-abbrev' is executed if the inserted character does | |
not have word syntax and the previous character in the buffer does. |
This file contains hidden or 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
C runs the command self-insert-command, which is an interactive built-in function in `C source code'. | |
It is bound to many ordinary text characters. | |
(self-insert-command N) | |
Insert the character you type. | |
Whichever character you type to run this command is inserted. | |
Before insertion, `expand-abbrev' is executed if the inserted character does | |
not have word syntax and the previous character in the buffer does. |
This file contains hidden or 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
C runs the command self-insert-command, which is an interactive built-in function in `C source code'. | |
It is bound to many ordinary text characters. | |
(self-insert-command N) |