Skip to content

Instantly share code, notes, and snippets.

View rickmzp's full-sized avatar

Rick Martínez rickmzp

  • LineLeap
  • New York, NY
  • 07:54 (UTC -05:00)
  • X @rickmzp
View GitHub Profile
module ApplicationHelper
def inside_layout(layout, &block)
@template.instance_variable_set("@content_for_layout", capture(&block))
layout = layout.to_s.include?("/") ? layout : "layouts/#{layout}" if layout
buffer = eval("_erbout", block.binding)
buffer.concat(@template.render(:file => layout))
end
end
Responses to http://twitter.com/malcolli/status/1494274656
1. Supergrass - Alright
No idea
2. It's Tricky - Run DMC
Not Road Trip.. that was 2000... hrmmm
3. The Man in Me - Bob Dylan
No idea
# Assume the app name is the current dir name
application = File.basename(Dir.pwd)
# Create the repository
run 'rm -rf .git' if File.exists?('.git') && yes?("This folder already has a git repository. Would you like to delete it?")
git :init
# Create the deploy file
file "config/deploy.rb", <<-FILE
set :application, "#{application}"
# suspenders.rb
# from Nathan Esquenazi
# based on Suspenders by Thoughtbot
#====================
# PLUGINS
#====================
plugin 'hoptoad_notifier', :git => "git://github.com/thoughtbot/hoptoad_notifier.git"
plugin 'squirrel', :git => "git://github.com/thoughtbot/squirrel.git"
# suspenders.rb
# from Nathan Esquenazi
# based on Suspenders by Thoughtbot
#====================
# PLUGINS
#====================
plugin 'hoptoad_notifier', :git => "git://github.com/thoughtbot/hoptoad_notifier.git"
plugin 'squirrel', :git => "git://github.com/thoughtbot/squirrel.git"
# get app name
app_name = ask("What's the name of your app?")
# clean up files
run "rm -rf public/javascripts/* public/stylesheets"
# compass
run "compass --rails . -f 960 -r ninesixty"
# git setup
Test
@rickmzp
rickmzp / serialize_matcher.rb
Created July 14, 2011 23:07 — forked from txus/serialize_matcher.rb
RSpec matcher for serialized ActiveRecord columns
# RSpec matcher to spec serialized ActiveRecord attributes.
#
# Usage:
#
# describe Post do
# it { should serialize(:data) } # serialize :data
# it { should serialize(:registers).as(Array) } # serialize :registers, Array
# it { should serialize(:options).as(Hash) } # serialize :options, Hash
# end
diff --git a/lib/ohai/plugins/rackspace.rb b/lib/ohai/plugins/rackspace.rb
index ee44065..0812206 100644
--- a/lib/ohai/plugins/rackspace.rb
+++ b/lib/ohai/plugins/rackspace.rb
@@ -36,7 +36,7 @@ end
def has_rackspace_mac?
network[:interfaces].values.each do |iface|
unless iface[:arp].nil?
- return true if iface[:arp].value?("00:00:0c:07:ac:01")
+ return true if iface[:arp].value?("00:00:0c:07:ac:01") or iface[:arp].value?("00:00:0c:9f:f0:01")
@rickmzp
rickmzp / gist:1323454
Created October 28, 2011 20:29 — forked from esteigler/gist:1323445
my updates
require "fog"
require "nokogiri"
def name
@name ||= new_resource.name + "."
end
def value
@value ||= new_resource.value
end