Skip to content

Instantly share code, notes, and snippets.

View deathbob's full-sized avatar

Bob Larrick deathbob

View GitHub Profile
#example with a formatted date and a boolean
xml.instruct!
xml.declare! :DOCTYPE, :plist, :PUBLIC, "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
xml.plist("version" => 1.0) do |plist|
plist.dict do |wrapper|
@occasions.each do |occasion|
wrapper.key occasion.id
wrapper.dict do |dict|
dict.key 'ccd_remote_id' # required id from the system of record (rails db in this case)
require 'active_support'
DEPLOY_CONFIG = YAML::load(File.open("config/deploy.yml"))
default_run_options[:pty] = true
#
# General Deployment settings
#
set :application, DEPLOY_CONFIG['application']
set :repository, DEPLOY_CONFIG['repository'] || 'master'
set :scm, :git
require File.join(File.dirname(__FILE__),'..','lib','rack','hapong')
require 'rack/cache'
# Test response when in development mode
# if Merb.environment == 'development'
# use Rack::Lint
# end
# handle OPTIONS / requests without invoking any handlers
use Rack::HAPong
namespace :deploy do
# To avoid having to add a password for sudo, visudo and add
# deployusername ALL=(ALL) NOPASSWD: /etc/init.d/unicorn reload
task :start do
sudo "/etc/init.d/unicorn start"
end
task :stop do
sudo "/etc/init.d/unicorn stop"
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)
@deathbob
deathbob / Guardfile
Created June 23, 2011 21:27 — forked from brentkirby/Guardfile
Guard + Rspec + Spork
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'rspec', :version => 2,
:cli => '--colour --drb --format documentation --fail-fast',
:all_after_pass => false,
:all_on_start => false,
:keep_failed => false,
:notify => true do
watch(%r{^spec/.+_spec\.rb$})
@deathbob
deathbob / gist:1102763
Created July 24, 2011 15:59 — forked from ianterrell/gist:1102751
Meta module madness
module Foo
def bar
@bar ||= self.snakes
end
def bar=(val)
@bar = val
end
end
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"

A Friendlier Approach for CSS Color Manipulation

By Chris Eppstein and Michael Parenteau

These ideas build on ones proposed by Tab Atkins but expand the concepts to apply to any color value, not just named colors.

They provide the full power of Sass's color system while preserving a more human-readable system when multiple transformations are applied because the arguments are closer to the operations.

# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email [email protected].
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {