This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'rubygems' | |
require 'hpricot' | |
username = "<username>" | |
password = "<password>" | |
tix = Hpricot(IO.popen("curl https://trac.zenbe.com/report/7 --basic -u #{username}:#{password} -k -s")) | |
(tix/"table.listing.tickets"/"tbody"/"tr").each do |row| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code is MIT licensed: http://creativecommons.org/licenses/MIT/ | |
// Zenbe Inc (2009). | |
// Ensure our Zenbe namespaces exist. | |
window.zen = window.zen || {}; | |
window.zen.util = window.zen.util || {}; | |
/** | |
* The DropManager class provides a pleasant API for observing HTML5 drag-n-drop | |
* events, cleaning up the data that they return, and triggering the appropriate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a class="ktc_search_button" style="display: block; background: #2f6088; font-family: 'Trebuchet MS'; font-size: 1.1em; text-decoration: none; padding: 4px 7px; color: white; border: 1px solid white; -moz-box-shadow: 2px 2px 2px #555; -webkit-box-shadow: 2px 2px 2px #555; box-shadow: 2px 2px 2px #555; -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; -webkit-gradient" href="javascript:(function(){if(window.KTC){return KTC.Politician.run();};window.KTC_ROOT='http://know-thy-congressman.com';var script=document.createElement('script');script.src='http://know-thy-congressman.com/javascripts/know-thy-congressman.js';document.getElementsByTagName('head')[0].appendChild(script);})();"> | |
<script type="text/javascript"> | |
window.KTC_SEARCH = "Artur Davis"; | |
</script> | |
<span>Open Artur Davis' Factsheet</span> | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rest_client' | |
require 'cgi' | |
@threads = [] | |
@mp3s = [] | |
@page = 1 | |
Dir.mkdir('mp3s') unless File.exists?('mp3s') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'cgi' | |
@threads = [] | |
@mp3s = [] | |
@page = 1 | |
Dir.mkdir('mp3s') unless File.exists?('mp3s') | |
@threads << Thread.new do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's count all the words in Shakespeare. | |
RestClient.post('http://localhost:9173/jobs', | |
{:job => { | |
'action' => 'word_count', | |
'inputs' => [ | |
'http://www.gutenberg.org/dirs/etext97/1ws3010.txt', # All's Well That Ends Well | |
'http://www.gutenberg.org/dirs/etext99/1ws3511.txt', # Anthony and Cleopatra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -rubygems | |
require 'restclient' | |
require 'json' | |
# Let's count all the words in Shakespeare. | |
RestClient.post('http://localhost:9173/jobs', | |
{:job => { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A WordCount, the canonical MapReduce Demo. Depends on the 'wc' utility. | |
class WordCount < CloudCrowd::Action | |
# Count the words in a single book. | |
def process | |
(`wc -w #{input_path}`).match(/\A\s*(\d+)/)[1].to_i | |
end | |
# Sum the total word count. | |
def merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The GraphicsMagick action, dependent on the `gm` command, is able to perform | |
# any number of GraphicsMagick conversions on an image passed in as an input. | |
# The options hash should specify the +name+ for the particular step (which is | |
# appended to the resulting image filename) the +command+ (eg. convert, mogrify), | |
# the +options+ (to the command, eg. -shadow -blur), and the +extension+ which | |
# will determine the resulting image type. Optionally, you may also specify | |
# +input+ as the name of a previous step; doing this will use the result of | |
# that step as the source image, otherwise each step uses the original image | |
# as its source. | |
class GraphicsMagick < CloudCrowd::Action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Depends on working pdftk, gm (GraphicsMagick), and pdftotext (Poppler) commands. | |
# Splits a pdf into batches of N pages, creates their thumbnails and icons, | |
# as specified in the Job options, gets the text for every page, and merges | |
# it all back into a tar archive for convenient download. | |
# | |
# See <tt>examples/process_pdfs_example.rb</tt> for more information. | |
class ProcessPdfs < CloudCrowd::Action | |
# Split up a large pdf into single-page pdfs. Batch them into 'batch_size' | |
# chunks for processing. The double pdftk shuffle fixes the document xrefs. |