Skip to content

Instantly share code, notes, and snippets.

View jstrachan's full-sized avatar

James Strachan jstrachan

View GitHub Profile
apiVersion: v1
kind: BuildConfig
metadata:
name: pv-checker
spec:
runPolicy: Serial
source:
git:
ref: master
uri: https://github.com/rawlingsj/pv-checker.git
# put this in your .bash_profile to set the title to be the working directory
export PROMPT_COMMAND=''
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
from( "direct:test-no-ep" ).to( "drools://node/ksession1?action=insertBody" );
from( "direct:test-with-ep" ).to( "drools://node/ksession1?action=insertBody&entryPoint=ep1" );
from( "direct:test-message" ).to( "drools://node/ksession1?action=insertMessage" );
from( "direct:test-exchange" ).to( "drools://node/ksession1?action=insertExchange" );
@jstrachan
jstrachan / gist:5135696
Last active December 14, 2015 19:19 — forked from purplefox/gist:5135685
// Clearly this won't actually work since obs2 would need to be final but then you can't assign it inside the handler
MyEventBus eb = new MyEventBus();
Observable obs1 = eb.send("foo", "msg1");
Observable obs2 = obs1.mapMany(new Func1<String, String>() {
@Override
public void call(String str) {
System.out.println("Got result: " + str);
Tuple3 {
inline def forEach(fn: Function<Any?,Unit>):Unit = {
fn.invoke(this._1)
fn.invoke(this._2)
fn.invoke(this._3)
}
}
kotlin code:
val builder = HtmlBuilder(usersLocale).useLongDates()
"foo $a bar $b".build(builder)
Creates a function
fun template1(out: HtmlBuilder, a: String, b: Foo): Unit {
out.append("foo ")
out.append(a)
out.append(" bar ")
#
val name = "Foo"
val blah = "Something"
class #{name} extends #{interfaces.mkString(" with ")}
# for( method <- methods )
def #{method.name}() =
println
:string
Here
Doc style
new $ {
// replace contents
$("table.people").contents {
for (p <- people) {
$("td.name") = p.name
$("td.address") = p.customer.address
}
// replace entire stuff
$("foo") {
val xml =
<table class="people">
<thead>
<tr>
<th>Name</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
object transformer extends Transformer {
$(".people") { node =>
val odd = node.$("tr.odd")
val even = node.$("tr.even")
var c=0
people.flatMap { p =>
c += 1
transform(if (c%2 == 0) even else odd) { t =>
$(".name").contents = p.name
$(".location").contents = p.location