Skip to content

Instantly share code, notes, and snippets.

Patrick Mulder mulderp

Block or report user

Report or block mulderp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5135267
class Chef::Resource::Script
def log_code command
if Chef::Config[:log_level] == :debug
code "{ #{command}; _ret=$?; echo \"Exit status was $_ret.\"; exit $_ret; } 2>&1 |
tee /var/log/#{@command.to_s.gsub(/ /,"_")}.log; exit ${PIPESTATUS[0]}"
else
code command
end
end
end
View gist:5134887
-rw-r--r-- 1 root root 2067 Mar 11 11:37 install_rvm.log
-rw-r--r-- 1 root root 1349 Mar 11 11:37 install_rvm_requirements.log
-rw-r--r-- 1 root root 302 Mar 11 11:37 uninstall_ruby-1.9.3-p374.log
-rw-r--r-- 1 root root 3742 Mar 11 11:39 install_ruby-1.9.3-p374.log
-rw-r--r-- 1 root root 850 Mar 11 11:39 package_ruby-1.9.3-p374.log
-rw-r--r-- 1 root root 300 Mar 11 11:39 uninstall_ruby-2.0.0-rc1.log
-rw-r--r-- 1 root root 3779 Mar 11 11:43 install_ruby-2.0.0-rc1.log
-rw-r--r-- 1 root root 845 Mar 11 11:43 package_ruby-2.0.0-rc1.log
@mulderp
mulderp / gist:5125458
Last active Dec 14, 2015
centering some divs
View gist:5125458
.content {
width: 600px;
margin: 0 auto 0;
margin-bottom: 0;
}
.sidebar {
position: fixed;
left: 15px;
View gist:3794314
require 'spec_helper'
require 'vcr'
require 'fakeweb'
require 'pry'
VCR.configure do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.hook_into :fakeweb
end
@mulderp
mulderp / gist:3775577
Created Sep 24, 2012
trying to do some data cleaning on JS framework survey
View gist:3775577
f = File.open("./Mini-SurveyWhatMVFrameworkDoYouUseAndWhy.csv")
framework_pros = {"Angular" => [], "Backbone" => [], "Ember" => []}
framework_cons = {"Angular" => [], "Backbone" => [], "Ember" => []}
f.readlines.each do |l|
row = l.split(";")
if row[0].match(/Angu|angu/)
framework_pros["Angular"] << row[1]
framework_cons["Angular"] << row[2]
elsif row[0].match(/Back/)
framework_pros["Backbone"] << row[1]
View gist:3696707
require 'socket'
def local_ip
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily
UDPSocket.open do |s|
s.connect '64.233.187.99', 1
s.addr.last
end
ensure
Socket.do_not_reverse_lookup = orig
@mulderp
mulderp / gist:3613287
Created Sep 3, 2012
Spine / Rails template
View gist:3613287
gem("rspec-rails", :group => "test")
gem("cucumber-rails", :group => "test")
gem("spine-rails")
gem("eco")
gem("mongoid")
if yes?("Would you like to install Devise?")
gem("devise")
generate("devise:install")
model_name = ask("What would you like the user model to be called? [user]")
@mulderp
mulderp / gist:3032032
Created Jul 2, 2012
console stubs for backbone
View gist:3032032
object = { a: '1', b: '2' }
object.sub_scope = { x: '1', y: '2' }
Todomvc =
init: ->
view = new Todomvc.AppView()
view.initialize(object)
class Todomvc.AppView
initialize: (object) ->
@mulderp
mulderp / gist:1879401
Created Feb 21, 2012
Possible spec for newsfeed with Streama
View gist:1879401
describe "Activity.publish" do
it "pushes activity to public newsfeed" do
@activity = Activity.publish(:share, {:actor => user, :object => link, :target_object => newsfeed, :receivers => @send_to}) ## @send_to ==> could be replaced with Activity.public_audience ??
@activity.receivers.size.should == 2
end
end
View gist:1477923
{ "_id" : ObjectId("4ee8e90bb9eab0492d000002"), "format" : { "_id" : ObjectId("4ee8e8f9b9eab0492d000001"), "height" : 12, "width" : 8 }, "pages" : 124, "title" : "Kochen" }
You can’t perform that action at this time.