Skip to content

Instantly share code, notes, and snippets.

View workmad3's full-sized avatar

David Workman workmad3

View GitHub Profile
# add to Gemfile
gem 'decent_exposure' # https://github.com/voxdolo/decent_exposure
gem 'responders' # https://github.com/plataformatec/responders
#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") }
@workmad3
workmad3 / after.vimrc
Last active December 28, 2015 16:39 — forked from anonymous/after.vimrc
" 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"
" }}}
@workmad3
workmad3 / comment..rb
Last active December 27, 2015 12:49 — forked from andyh/comment..rb
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
@workmad3
workmad3 / gist:7218203
Last active December 26, 2015 21:49 — forked from anonymous/gist:7218182
<%= 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>
@workmad3
workmad3 / riak_wrapper.rb
Last active December 25, 2015 20:09 — forked from gerep/riak_wrapper.rb
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
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
respond_to do |format|
format.html
format.xls do
render :xls => "some_filename", :template => "reports/#{params[:id]}.xls.writeexcel"
end
end
@workmad3
workmad3 / replace.rb
Created December 4, 2012 17:04
Replace " with '
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
# 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
email
password 'secret'
password_confirmation 'secret'
phone '0999711333'