Skip to content

Instantly share code, notes, and snippets.

View ktoso's full-sized avatar
🗻
Life is Study!

Konrad `ktoso` Malawski ktoso

🗻
Life is Study!
View GitHub Profile
system ~/projects/rubyflux $ cat blah.rb
def method_missing(name, args)
puts name
end
foo
bar
baz
system ~/projects/rubyflux $ rake run[blah.rb]
anonymous
anonymous / Keys.scala
Created December 18, 2012 10:30
Generate a file containing sbt version information during the build. Using this, you can achieve a very simple version of ktoso/git-commit-id-maven-plugin
val genVersionFile = TaskKey[Unit](
"gen-version-file",
"Generates a file in target containing the apps version"
)
val query = ScalasticSearch.boolQuery(
cond (
must(
'nickname -> "Superman", // is equivalent to...
term('nickname -> "Superman"), // this
term("nickname" -> "Superman") // or this
),
should(
'nickname -> "Superman", // is equivalent to...
term('nickname -> "Superman"), // this
@schmmd
schmmd / binary.scala
Created October 8, 2011 04:57
scala binary tree
/* contravariance required so Empty can be used with Nodes ( Nothing <: T ) */
class Tree[+T]
case object Empty extends Tree[Nothing]
case class Node[T](val elem: T, val left: Tree[T], val right: Tree[T]) extends Tree[T]
def inOrder[T](t: Tree[T]): List[T] = t match {
case Empty => Nil
case Node(e, left, right) => inOrder(left) ::: List(e) ::: inOrder(right)
}
@dt
dt / install_flatmap_reminder.sh
Created July 18, 2011 21:58
In case you occasionally forget to flatMap that shit
brew install growlnotify
cat >> ~/.bashrc <<EOF
#flatMapThatShit reminder
if [ -f /tmp/flatMapThatShit ]; then
kill \`cat /tmp/flatMapThatShit\`
fi
while true; do if [[ \$RANDOM%12 -eq 0 ]]; then growlnotify -a TextEdit "Is that scala?" -m "flatMap that shit"; fi; sleep 300; done &
apply plugin: 'groovy'
sourceCompatibility = 1.5
version = '0.1-SNAPSHOT'
repositories {
mavenRepo(urls: 'http://repository.codehaus.org/')
mavenCentral()
}