Skip to content

Instantly share code, notes, and snippets.

foo="1.jar:2.jar:3.jar"
echo ${foo[@]//.jar}
# => 1:2:3
def ears
yield self
end
module SetChain
NONDESTRUCTIVE = false
# Usage:
# foo.set_chain [:transaction, :response, :result, :score], [Transaction.new, ResponseType.new, Result.new, "42"]
# foo.transaction.response.result.score # => "42"
def set_chain(fields, values, destructive = true)
fields.zip(values).inject(self) do |member, (field, value)|
setter = "#{field}="
if destructive
@karlin
karlin / gist:789830
Created January 21, 2011 15:23
Diff XML files in SoapUI with Groovy, ignoring GUID and timestamp differences
// In each testcase script assertion:
//
import FileCompare
FileCompare.compareWithExpected(context, messageExchange)
// In our Script Library:
//
package filecompare
class FileCompare {
@karlin
karlin / clever_girl.rb
Created May 9, 2012 19:38
Must-have rspec helper method by dcrosby42
def clever_girl
pending <<-EOVR
__ ______
,^.__.>--"~~'_.--~_)~^.
_L^~ ~ (~ _.-~ \\. |\\
CLEVER GIRL.... ,-~ __ __,^"/\\_A_/ /' \\
/ ,-" "~~" _) \\ ~_,^ /\\
// / ,-~\\ x~" \\._"-~ ~ _Y
Y' Y. (__.// / " , "\\_r ' ]
J-._l_>---r{ ~ \\__/ \\ _/
@karlin
karlin / gist:3051281
Created July 5, 2012 04:11
Window Overlay Adorner Overrides
private static readonly Brush screenBrush_ = new SolidColorBrush(Color.FromArgb(0x7f, 0x7f, 0x7f, 0x7f));
protected override void OnRender(DrawingContext drawingContext)
{
drawingContext.DrawRectangle(screenBrush_, null, WindowRect());
base.OnRender(drawingContext);
}
protected override Geometry GetLayoutClip(Size layoutSlotSize)
{
@karlin
karlin / gist:3286626
Created August 7, 2012 15:58
Google Hurdle Doodle in a Bottle
var el=document.getElementById('hplogo').children[0];
setInterval(function() {
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent("keydown", true, true, null, false, false, false, false, 37, 0);
el.dispatchEvent(evt);
el.click();
evt.initKeyEvent("keypress", true, true, null, false, false, false, false, 37, 0);
el.dispatchEvent(evt);
el.click();
evt.initKeyEvent("keyup", true, true, null, false, false, false, false, 37, 0);
@karlin
karlin / index.html
Created December 18, 2012 04:39 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
.chart {
width: 350px;
}
</style>
</head>
@karlin
karlin / config.json
Created December 18, 2012 21:31
Another Inlet
{"description":"Another Inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.35552325581395344,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false}
@karlin
karlin / index.html
Created February 15, 2013 22:10
A CodePen by Karlin Fox. kpi - bullet graph of some key performance metrics
<div style="float:right">
<input id="metric" value="week_billable"/>
<input id="h" type="range" min="0" max="120"/>
</div>
<div class="header"></div>