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
$ cat .git/hooks/post-checkout | |
#!/bin/sh | |
mvn clean compile |
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 "sequel/extensions/connection_validator" | |
# https://github.com/jeremyevans/sequel/blob/master/lib/sequel/extensions/connection_validator.rb | |
module Rack | |
class SequelConnectionValidator | |
def initialize(app, db) | |
@app = app | |
@db = db | |
@db.extension(:connection_validator) |
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
def future # :block: | |
thread = Thread.new do | |
Thread.current.abort_on_exception = false | |
yield | |
end | |
lambda { thread.value } | |
end | |
def compose(proc) # :block: |
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
(defn char-sequence [char-seqable] | |
(let [char-seq (seq char-seqable)] | |
(reify CharSequence | |
(charAt [this i] (nth char-seq i)) | |
(length [this] (count char-seq)) | |
(toString [this] (String. (char-array char-seq))) | |
; (subSequence [this start end] ...) | |
))) |
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
def authorizationPlugin: BrokerPlugin = { | |
val dsl = new AuthorizationDSL; import dsl._ | |
val system = Set(User("system")) | |
entry(Queue(">"), r = system, w = system, a = system) | |
entry(Topic(">"), r = system, w = system, a = system) | |
Seq("test").foreach { basename => | |
val client = Set(User(basename + "-client")) |
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
function Follow-File([string] $path) { Get-Content -Path $path -Wait -Tail 10 } |
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
(defmacro throwf [class-name format & args] | |
`(throw (new ~class-name (format ~format ~@args)))) | |
; Before: | |
(throw (IllegalArgumentException. (format "Invalid value: %s" value))) | |
; After: | |
(throwf IllegalArgumentException "Invalid value: %s" value) |
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 "libvirt" | |
def vm_sync_shutdown(name) | |
conn = Libvirt::open("qemu:///system") | |
dom = conn.lookup_domain_by_name(name) | |
# TODO: Use dom.state instead of dom.info.state when it gets available |
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
public static IEnumerable<T> Cons<T>(T head, IEnumerable<T> tail) | |
{ | |
yield return head; | |
foreach (var t in tail) yield return t; | |
} |
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
#lang rackjure | |
(require net/url) | |
(define js-lisps* | |
(~>> "https://gitorious.org/moritz-stuff/js-lisps/blobs/raw/master/js-lisps.sxml" | |
string->url | |
get-pure-port | |
read)) |