Skip to content

Instantly share code, notes, and snippets.

// Snagged from Prototype
window.Inflector = {
camelize: function(s) {
var parts = s.split('-'), len = parts.length;
if (len == 1) return parts[0];
var camelized = s.charAt(0) == '-'
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
: parts[0];
package_assets: on # (on, off, always)
embed_assets: on # (on, off, datauri)
compress_assets: on # (on, off)
gzip_assets: on # (on, off)
template_function: _.template # (defaults to the built-in micro-templating)
package_path: packages # (defaults to assets)
javascript_compressor: closure # (yui, closure)
compressor_options:
compilation_level: ADVANCED_OPTIMIZATIONS
~/Desktop/document_cloud/jammit(master) > gem push jammit-0.1.1.gem
Pushing gem to Gemcutter...
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link href="/stylesheets/reset.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/960.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/screen.css" media="screen" rel="stylesheet" type="text/css" />
// Add a Mustache.js templating function to your JavaScript:
Mustache.template = function(templateString) {
return function() {
return Mustache.to_html(templateString, arguments[0], arguments[1]);
};
};
// And then, in assets.yml, you can set "template_function" to "Mustache.template".
[user]
name =
email =
[color]
branch = auto
diff = auto
status = auto
interactive = auto
[alias]
co = checkout
SELECT distinct on (documents.id) documents.*
FROM "documents"
WHERE (documents.id in (
(select document_id from metadata where
(metadata.kind = E'person' and
to_tsvector('english', metadata.value) @@ plainto_tsquery(E'bush')))
intersect
(select document_id from metadata where
(metadata.kind = E'city' and
to_tsvector('english', metadata.value) @@ plainto_tsquery(E'washington')))))
#!/usr/bin/env ruby -rubygems
require 'restclient'
require 'json'
RestClient.post('http://localhost:9173/jobs',
{:job => {
'action' => 'scrape',
class Scrape < CloudCrowd::Action
# Extract the title from an HTML page.
def process
html = File.read(input_path)
match = html.match(/<title>(.*)<\/title>/i)
match ? match[1] : "Untitled"
end
end
$.fn.extend({
// When the next click or keypress happens, anywhere on the screen, hide the
// element. 'clickable' makes the element and its contents clickable without
// hiding. The 'onHide' callback runs when the hide fires, and has a chance
// to cancel it.
autohide : function(options) {
var me = this;
options = _.extend({clickable : null, onHide : null}, options || {});
me._autoignore = true;
// Extend the JQuery namespace with core utility methods for DOM manipulation.
$.extend({
// Quick-create a dom element with attributes.
el : function(tagName, attributes) {
var el = document.createElement(tagName);
$(el).attr(attributes);
return el;
},