Skip to content

Instantly share code, notes, and snippets.

Dave Myron contentfree

  • Seattle, WA
Block or report user

Report or block contentfree

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
contentfree / Different run using gdb to collect some info
Last active Oct 12, 2015
Deadlock during Backburner test on OSX
View Different run using gdb to collect some info
(gdb) call (void) close(1)
(gdb) call (void) close(2)
(gdb) shell tty
(gdb) call (int) open("/dev/ttys002", 1, 0)
$1 = 1
(gdb) call (int) open("/dev/ttys002", 2, 0)
$2 = 2
(gdb) t a
Please specify a thread ID list
contentfree / jobs.rake
Last active Dec 16, 2015
Daemonizing DelayedJob from a rake task. Useful for using DelayedJob outside of Rails (Hizzah Padrino!) Note: Requires rake >= 10.1 for TaskArguments#extras
View jobs.rake
namespace :jobs do
desc <<-EOD
Start delayed_job worker daemon. Requires passing start|stop|restart|reload|run|zap|status
to rake via `rake jobs:daemon[start]`. To pass arguments to Delayed::Command, call rake
like `rake jobs:daemon["--queue=something start"]` (Note the quotes wrapping the arguments!).
Available flags are: queues queue min_priority max_priority number_of_workers pid-dir
identifier monitor sleep-delay read-ahead prefix exit-on-complete
task :daemon, [:argv] => :environment do |t, args|
# If we have anything in args.extras we need to combined it with args[:argv]
contentfree / gist:1837753
Created Feb 15, 2012 — forked from tvandervossen/gist:1231476
Mobile Safari viewport sizes on iOS 4.3 and 5
View gist:1837753
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
View compute_public_url.rb
# Wrapper around Rails' compute_public_path for generating fully-qualified URLs to assets
def compute_public_url( filename, dir, ext = filename.split('.').last )
path = compute_public_path(filename, dir, ext)
contentfree / gist:149347
Created Jul 17, 2009
Clearfix SASS Macro
View gist:149347
* html &
:height 1px
* + html &
:display inline-block
:content "."
:display block
:height 0
:clear both
View delayed_job init script
#!/usr/bin/env ruby
# description: A startup script to automatically start workers for delayed_job
APP_NAME = 'worker_startup_script'
APP_DIR = '<%= @node[:delayed_job][:app_path] %>'
unless %w(start stop restart status).include? ARGV.first
puts "Usage: #{APP_NAME} start|stop|status|restart 4 (for 4 workers - start and restart only)"
View apache_static_site.rb
pool :apache_static_site do
cloud :web do
#keypair 'id_rsa' # Change this to the name of your keypair if it's not id_rsa
instances 1
enable :haproxy # Also sets up Apache2
has_file "/var/www/index.htm" do
content "<h1>Hello world!</h1>"
owner 'www-data'
View gist:82527
# The models
class User < ActiveRecord::Base
has_many :things
accepts_nested_attributes_for :things
class Thing < ActiveRecord::Base
belongs_to :user
validates_presence_of :user_id
validates_presence_of :name # For clarity below
You can’t perform that action at this time.