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/ruby | |
# USAGE: | |
# ./validate_md5.rb /path/to/file Exp3ct3dD1G35t | |
require 'digest/md5' | |
expected_digest = ARGV[1] | |
computed_digest = Digest::MD5.hexdigest(File.open(ARGV[0]).read) |
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
Ajax.InPlaceEditorWithEmptyText = Class.create(Ajax.InPlaceEditor, { | |
initialize: function($super, element, url, options) { | |
if (!options.emptyText) options.emptyText = "Click to Edit"; | |
if (!options.emptyClassName) options.emptyClassName = "inplaceeditor-empty"; | |
$super(element, url, options); | |
this.checkEmpty(); |
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
# BSTimer | |
# - A simple task timing class. It allows you to time the execution of any inline block or proc. | |
# Author: Bradley J. Spaulding | |
# Created On: 2010-10-11 | |
# Last Updated: 2010-10-19 | |
# | |
class BSTimer | |
def self.time(num_trials = 1, &block) | |
results = [] |
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
# Inspired by Ryan Bates pro RailsCast "Presenters from Scratch" | |
# This is a proof of concept for 'automagically' creating presenter objects | |
# | |
# This assumes you have presenter objects that follow the convention | |
# Object => ObjectPresenter | |
# | |
# It intercepts the 'render' method in the controller, and does some | |
# introspection to see if there is a presenter defined for the class | |
# of the instance variable being looked at. If so, it makes a presenter | |
# and adds it as an instance variable |
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
package org.myorg; | |
import java.io.IOException; | |
import java.util.*; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.conf.*; | |
import org.apache.hadoop.io.*; | |
import org.apache.hadoop.mapred.*; | |
import org.apache.hadoop.util.*; |
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
var exports = {}; | |
var module = {}; | |
function require(id) { | |
if ( 'undefined' === typeof arguments.callee.require_stack ) { arguments.callee.require_stack = []; } | |
var require_stack = arguments.callee.require_stack; | |
if ( 'undefined' === typeof arguments.callee.modules ) { arguments.callee.modules = {}; } | |
var modules = arguments.callee.modules; | |
// if currently requiring module 'id', return partial exports |
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 | |
# Pseudo Code | |
# - http://stackoverflow.com/questions/2049230/convert-rgba-color-to-rgb | |
# | |
# Source => Target = (BGColor + Source) = | |
# Target.R = ((1 - Source.A) * Source.R) + (Source.A * BGColor.R) | |
# Target.G = ((1 - Source.A) * Source.G) + (Source.A * BGColor.G) | |
# Target.B = ((1 - Source.A) * Source.B) + (Source.A * BGColor.B) |
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 'webrick' | |
include WEBrick | |
HTTPUtils::DefaultMimeTypes["appcache"] = "text/cache-manifest" | |
HTTPUtils::DefaultMimeTypes["js"] = "text/javascript" | |
HTTPUtils::DefaultMimeTypes["mp3"] = "audio/mpeg3" | |
server = HTTPServer.new(:Port => 9090, :DocumentRoot => Dir::pwd) |
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
#!/bin/bash | |
# | |
# jenkins-post-receive | |
# | |
# Configuraton | |
# ------------ | |
# jenkins-post-receive.enabled | |
# [OPTIONAL] Defaults to off (false). Treated as a boolean with git config --bool. | |
# | |
# jenkins-post-receive.jenkins-cli-jar-path |
OlderNewer