Skip to content

Instantly share code, notes, and snippets.

View bradgessler's full-sized avatar

Brad Gessler bradgessler

View GitHub Profile
#!/usr/bin/env ruby
require 'rubygems'
require 'aws/s3' # sudo gem install aws-s3
require 'logger'
require 'optparse'
AWS::S3::Base.establish_connection!(
:access_key_id => 'TODO',
:secret_access_key => 'TODO'
)
$.extend({
poller: function(originalOptions){
$.extend({
interval: 0 /* Use this if you want to setup a short poller */
}, originalOptions);
var applyRepoll = function(callback){
return function(){
if(typeof callback === 'function'){
callback.apply(originalOptions, arguments);
#!/usr/bin/env ruby
require 'rubygems'
require 'beanstalk-client'
host = ENV['host'] || 'localhost:11300'
stat = File.basename(__FILE__).split('_').last
# stat = 'watching' # watching jobs-reserve jobs-ready using jobs-buried waiting jobs-delayed jobs-urgen
B = Beanstalk::Connection.new(host)
tubes = B.list_tubes
# Spell checking ruby env
# !!!! IMPORTANT Be sure you have iSpell installed: sudo port install ispell !!!!
require 'stringio'
begin
require 'simplecc'
rescue LoadError
# to satisfy rdoc
class Continuation #:nodoc:
/* @override http://blog.bradgessler.com/stylesheets/polleverywhere.css */
.peTitle {
text-align: left !important;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.peOptions { padding: 10px 5px 15px !important; }
.peWidget {
-moz-border-radius: 10px !important;
-webkit-border-radius: 10px !important;
$.extend({
poller: function(originalOptions){
var applyRepoll = function(callback){
return function(){
if(typeof callback === 'function'){
callback.apply(originalOptions, arguments);
}
$.poller(originalOptions);
};
};
class Switch
def initialize(obj, &block)
@obj, @procs = obj, []
instance_eval(&block)
@proc = @procs.detect{|p| p.call }
end
def call
@proc.call if @proc
end
#### From the Shell...
~ $ cat /Volumes/localhost/polleverywhere/vendor/plugins/deep_cloning/lib/deep_cloning.rb
#### The series of HTTP requests that took place...
------------------Request ------------------
PROPFIND /polleverywhere/vendor/plugins/acts_as_infinite HTTP/1.1
Host: localhost:5000
def button_tag_menu(value, options={}, &block)
options[:onclick] = "$(this).up('.menuButton').down('.menu').show();"
%{
<div class="menuButton">
#{button_tag(value, options)}
<div class="menu" style="display: none;">
#{capture(&block)}
</div>
</div>
}
# Creates an array out of the words in a string
>> %w[one two three]
=> ["one", "two", "three"]
# Executes a system command and captures the output as a string
>> %x[ls]
=> "Applications\nDesktop\nDocuments\nDownloads\nDropbox\nLibrary\nMovies\nMusic\nPictures\nProjects\nPublic\nSites\nVirtual Machines\npe\n"
# Creates a regexp object
>> %r{(\w+)\.html}