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 'spec_helper' | |
describe ArticlesController, :type => :controller do | |
describe "GET index" do | |
get :index | |
response.should be_successful | |
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
# encoding: utf-8 | |
require 'active_support/all' | |
Time.zone = Time.zone_default = "UTC" | |
t = "2008-04-01".to_time | |
p t.zone, t.to_time.zone #=> "UTC" and "WEST". Question is, why not "UTC" and "UTC"? |
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
# encoding: utf-8 | |
DOTIW_LIB_PATH = File.join(File.dirname(__FILE__), '..', 'lib') | |
$:.unshift DOTIW_LIB_PATH unless $:.include? DOTIW_LIB_PATH | |
$:.unshift File.dirname(__FILE__) | |
require 'active_support' | |
require 'active_support/core_ext/time/zones' | |
require 'ruby-debug' |
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
# encoding: UTF-8 | |
require 'ruby-debug' | |
require 'openssl' | |
def crypt(value, padding = OpenSSL::PKey::RSA::NO_PADDING) | |
public_key = get_rsa_key 'public.pem' | |
public_key.public_encrypt value, padding | |
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 'openssl' | |
class MyEncryptor | |
KEY = "\xE9v\f\xC3\xBD\x8EH\xBD.G\x17\x84\xD5K\xDB\xE5\r\x8D0\xEC\xBF9\xA2\xAF\x9Bp\xFEd\xAA\x8DH\x99" | |
IV = "\x94\x19\xB7\x96\xC7\xFC\x92:_4\xB4\xF6\xCE\xED\xB9\xD0" | |
def self.encrypt(text) | |
self.aes_wrapper(:encrypt, text) | |
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
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:$PATH | |
export DISPLAY=:0.0 | |
export EDITOR='mate -w' | |
######### | |
# Alias # | |
######### | |
# File system | |
alias lsl='ls -lah' |
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 'spec_helper' | |
context Post do | |
subject { Factory.build(:post) } | |
describe "accessible attributes" do | |
it "defines the attributes that are mass assignable" do | |
Post._accessible_attributes.to_a == ["user_id", "title", "body"] |
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 Arel | |
module SqlCompiler | |
class GenericCompiler | |
def select_sql | |
projections = @relation.projections | |
@engine = engine |
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 ActiveRecordAttributesEquality | |
def self.included(klass) | |
klass.class_eval do | |
def ==(other) | |
return false unless other.is_a? self.class | |
if self.new_record? && other.new_record? | |
self.attributes == other.attributes | |
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
(rdb:4) pp Rails.configuration | |
#<Rails::Application::Configuration:0x00000100920e90 | |
@allow_concurrency=false, | |
@cache_classes=false, | |
@cache_store= | |
[:file_store, | |
"/Users/dba/work/gnomeslab.com/programming/oauth2-ruby-server-rails-example/tmp/cache/"], | |
@consider_all_requests_local=true, | |
@dependency_loading=true, | |
@encoding="utf-8", |
NewerOlder