Skip to content

Instantly share code, notes, and snippets.

View michaeldv's full-sized avatar

Michael Dvorkin michaeldv

  • Cupertino, California
View GitHub Profile
1) Consider the following HTML:
<div id="content" class="foo">
<div class="bar">
<a href="/foobar">Foobar</a>
</div>
</div>
And the CSS for this page is:
#
# background.rb
#
# a minimalist toolset for managing arbitrary background tasks in rails.
# background.rb handles
#
# - daemonization
# - cli tools for start/stop/restart/pid, etc
# - ensuring only one process is running at a time
# - processing loop with responsive sleep (wakes on signal)
[aaron@higgins ~]$ irb
irb(main):001:0> File.write('hello.rb', 'class Foo; def bar; 1 + 1; end end')
=> 34
irb(main):002:0> RubyVM::InstructionSequence.compile_file 'hello.rb'
=> <RubyVM::InstructionSequence:<main>@hello.rb>
irb(main):003:0> puts _.disasm
== disasm: <RubyVM::InstructionSequence:<main>@hello.rb>================
0000 trace 1 ( 1)
0002 putspecialobject 3
0004 putnil
@cowboy
cowboy / jquery.ba-farthest-descendant.js
Created June 1, 2011 21:24
jQuery Farthest Decendant: Dedicated to Kris Borchers
/*!
* jQuery Farthest Decendant - v0.2pre - 6/1/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
;(function($) {
@cowboy
cowboy / unreleased.md
Created June 1, 2011 20:05
Unreleased stuff...

This list will hopefully shrink faster than it can grow. (yeah, right)

jQuery

jQuery deparam / deparam+ / sortObject (WIP)
https://gist.github.com/1025817

jQuery infiniteScroller (WIP)

jQuery scrollinout event

@ndbroadbent
ndbroadbent / gist:971255
Created May 13, 2011 20:29
Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
#!/bin/bash
#
# => $ sudo apt-get install -y --force-yes curl; sudo su - -c "bash < <(curl -sL http://is.gd/..........)"
#
# Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
# --------------------------------------------------------------------------
#
# Steps:
#
# *) Install required packages (git, postgresql, etc.)
@bartimaeus
bartimaeus / company.rake
Created February 18, 2011 14:43
Part of my FatFreeCRM migration rake task. I've added custom fields and roles to this install of FatFreeCRM. The files used by this rake task are generated by another task that downloads them and converts then to csv files using the pipe "|" as the delimi
# Store rake tasks specific to [company]
namespace :[company] do
# Migrate [Company]'s data into the new CRM
namespace :migrate do
require 'progressbar'
desc "Run all [company] migration tasks"
task :all => [:config, :users, :comments, :accounts]
This.rubyforge_project = 'codeforpeople'
This.author = "Ara T. Howard"
This.email = "ara.t.howard@gmail.com"
This.homepage = "http://github.com/ahoward/#{ This.lib }"
task :default do
puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
end
# instead of setting all paths individually, you set all of them relative to
# another root, say my_gem/lib/rails/engine this way
if defined?(Rails)
module MyGem
class Engine < Rails::Engine
paths.path = MyGem.engine_dir