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 M | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def cm; puts 'I am a class method'; end | |
end | |
module InstanceMethods | |
def im; puts 'I am an instance method'; 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
$('.entry_content').scroll(function () { | |
var self = $(this); | |
self.css('height', (parseInt(self.css('height').slice(0,-2)) + 10) + 'px'); | |
}); |
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 String | |
def true? | |
self == 'true' || self == '1' | |
end | |
def false? | |
self == 'false' || self == '0' | |
end | |
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
require 'rubygems' | |
require 'fog' | |
# https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key | |
YOUR_AWS_ACCESS_KEY_ID='your_key' | |
YOUR_AWS_SECRET_ACCESS_KEY='your_key' | |
connection = Fog::Storage.new({ | |
:provider => 'AWS', | |
:aws_access_key_id => YOUR_AWS_ACCESS_KEY_ID, |
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
{ | |
"Statement": [ | |
{ | |
"Sid": "Stmt1355727169912", | |
"Action": [ | |
"s3:ListAllMyBuckets" | |
], | |
"Effect": "Allow", | |
"Resource": "arn:aws:s3:::*" | |
}, |
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
function animationPipe(queue, element) { | |
return $.when(queue).pipe(function(){ | |
return $(element).fadeIn(800); | |
}); | |
}; | |
var spanList = $('li span').hide(); | |
var queue = $.Deferred().resolve(); | |
for (var i = 0; i < spanList.length; i++) { |
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
def wait_for_ajax(timeout = Capybara.default_wait_time) | |
page.wait_until(timeout) do | |
page.evaluate_script 'jQuery.active == 0' | |
end | |
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
def rspec? | |
__FILE__ != $0 | |
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
>show variables like 'character_set_database'; | |
+--------------------------+-------------------------------------------------------+ | |
| Variable_name | Value | | |
+--------------------------+-------------------------------------------------------+ | |
| character_set_database | latin1 | | |
+--------------------------+-------------------------------------------------------+ | |
>alter database {database_name} default character set utf8; |
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
% brew tap homebrew/versions | |
% brew install tomcat6 |
OlderNewer