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 User < ActiveRestClient::Base | |
before_filter do |name, request| | |
request.headers["Authorization"] = request.get_params[:authorization] | |
end | |
get :find, "/users/:id" | |
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
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.1.1' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.3' | |
# Use Uglifier as compressor for JavaScript assets |
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 "faraday" | |
class Customer < ActiveRestClient::Base | |
base_url "http://requestb.in" | |
ActiveRestClient::Base.faraday_config do |faraday| | |
faraday.adapter(:net_http) | |
faraday.options.timeout = 20 | |
faraday.headers['User-Agent'] = "ActiveRestClient/#{ActiveRestClient::VERSION}" | |
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 'autotest/redgreen' | |
require 'autotest/timestamp' | |
module Autotest::Growl | |
def self.growl title, msg, img, pri=0, sticky="" | |
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}" | |
end | |
Autotest.add_hook :ran_command do |at| |
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
# This file is copied to ~/spec when you run 'ruby script/generate rspec' | |
# from the project root directory. | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) | |
require 'spec/autorun' | |
require 'spec/rails' | |
Spec::Runner.configure do |config| | |
# If you're not using ActiveRecord you should remove these | |
# lines, delete config/database.yml and disable :active_record |
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
## main file | |
<div id="eula_table_id"> | |
<%= render :partial => "config/eula_list" %> | |
</div> | |
<div class="form-row"> | |
<%= link_to_remote "Add new end user license agreement", | |
{ :update => "eula_table_id", # you may not need this :update parameter | |
:before => "$('#add-user-spinner').show();" + |
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 IO | |
def encrypted_read(filename) | |
puts filename | |
end | |
alias_method :non_encrypted_read, :read | |
alias_method :read, :encrypted_read | |
end | |
#>> IO.read('a') |
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' | |
require 'digest/sha1' | |
class Test | |
def self.decrypt(content, password) | |
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc") | |
cipher.decrypt | |
cipher.key = Digest::SHA1.hexdigest(password) | |
cipher.update(content) | |
cipher.final |
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
[MacBook] [2009-06-18 13:24:10] [14502] [FATAL] /!\ FAILSAFE /!\ 18/06/2009 | |
Status: 500 Internal Server Error | |
Expected /Users/andy/Sites/fdj-production/app/helpers/cms/component_helper.rb to define Cms::ComponentHelper | |
/Users/andy/Sites/fdj-production/vendor/rails/activesupport/lib/active_support/dependencies.rb:426:in `load_missing_constant' | |
/Users/andy/Sites/fdj-production/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing' | |
/Users/andy/Sites/fdj-production/vendor/rails/activesupport/lib/active_support/inflector.rb:361:in `constantize' | |
/Users/andy/Sites/fdj-production/vendor/rails/activesupport/lib/active_support/inflector.rb:360:in `each' | |
/Users/andy/Sites/fdj-production/vendor/rails/activesupport/lib/active_support/inflector.rb:360:in `constantize' | |
/Users/andy/Sites/fdj-production/vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb:162:in `constantize' | |
/Users/andy/Sites/fdj-production/vendor/rails/actionpack/lib/actio |
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 Vehicle | |
cattr_accessor :name | |
end | |
class Car < Vehicle | |
end | |
Car.name = "John" | |
#=> "John" |
OlderNewer