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
# add to Gemfile | |
gem 'decent_exposure' # https://github.com/voxdolo/decent_exposure | |
gem 'responders' # https://github.com/plataformatec/responders |
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
#temporary for testing | |
## move the response file into your recipe as either a template or cookbook file | |
##FileUtils.cp(node[:response_file], File.join("#{tmpDir}","client")) | |
cookbook_file "#{tmp_dir}/oracle_response_file" | |
execute "oracleInstall" do | |
command "#{tmpDir}/client/setup.exe -silent -responseFile \"#{tmpDir}/client/Oracle11gR2_rsp.rsp\" -logLevel finest -ignoreSysPrereqs -noconsole" | |
action :run | |
not_if { ::File.exists?("C:/oracle/product/11.2.0/client_1/bin") } |
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
" Extra packages {{{ | |
Bundle "nono/vim-handlebars" | |
Bundle "leshill/vim-json" | |
Bundle "tpope/vim-bundler" | |
Bundle "fholgado/minibufexpl.vim" | |
Bundle "wavded/vim-stylus" | |
Bundle "altercation/vim-colors-solarized" | |
Bundle 'AutoTag' | |
Bundle "SuperTab" | |
" }}} |
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 self.create_from_parent(parent_type, parent_id, comment_params, current_account) | |
parent = parent_type.constantize | |
raise ActiveRecord::RecordNotFound unless parent.reflect_on_association(:comments).klass == self | |
parent.find(parent_id).comments.create(comment_params.merge(account: current_account)) | |
rescue NameError | |
raise ActiveRecord::RecordNotFound | |
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
<%= link_to "passes/Tara-Evans-01-10-2013.jpg", class: "example-image-link", data: {lightbox: "gallery"}, title: "Well done Tara, first time with only one minor" do %> | |
<%= image_tag("passes/Tara-Evans-01-10-2013.jpg", alt: "Tara Evans", width: "220", height: "147")%> | |
<p> | |
Tara Evans <br /> | |
Passed 1 October 2013 | |
</p> | |
</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
class RiakWrapper | |
def initialize | |
walk_server = WalkServer.first | |
@client = Riak::Client.new(:protocol => "pbc", :host => walk_server.host, :pb_port => walk_server.pb_port) | |
end | |
def exists?(key, bucket_name) | |
bucket(bucket_name).exists?(key) | |
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
Failures: | |
1) Micropost should not be valid when user_id is not present | |
Failure/Error: it { should_not be_valid } | |
expected #<Micropost id: 1, content: "lorem ipsum", user_id: 1, created_at: "2013-10-09 11:10:10", updated_at: "2013-10-09 11:10:10"> not to be valid |
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
respond_to do |format| | |
format.html | |
format.xls do | |
render :xls => "some_filename", :template => "reports/#{params[:id]}.xls.writeexcel" | |
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 replacer(filename, find = ?", replace = ?') | |
File.open(filename, "r+") do |file| | |
file.each do |line| | |
file.seek(-line.bytes.to_a.size, IO::SEEK_CUR) | |
file.write line.gsub(find, replace) | |
end | |
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
# spec/factories/users.rb | |
FactoryGirl.define do | |
sequence(:email) { |n| "user#{n}@puppa.pup" } | |
sequence(:partitaiva) { 11.times.map { (0..9).to_a.sample }.join } | |
factory :user do | |
password 'secret' | |
password_confirmation 'secret' | |
phone '0999711333' |