Skip to content

Instantly share code, notes, and snippets.

View alexy's full-sized avatar

Alexy Khrabrov alexy

View GitHub Profile
#!/bin/sh
SCALAC_CLASSPATH="/home/marko/.m2/repository/org/scala-lang/scala-compiler/2.8.0.RC1/scala-compiler-2.8.0.RC1.jar:/home/marko/.m2/repository/org/scala-lang/scala-library/2.8.0.RC1/scala-library-2.8.0.RC1.jar"
exec java -cp $SCALAC_CLASSPATH -Dscala.boot.class.path=$SCALAC_CLASSPATH scala.tools.nsc.CompileServer $@
@retronym
retronym / mvn2sbt.scala
Created May 3, 2010 17:17
mvn2sbt: quick hack to turn <dependencies> into SBT
object scala {
val version = "SCALA_VERSION$"
}
val xml = <dependencies>
<dependency>
<groupId>org.scalanlp</groupId>
<artifactId>scalala_${scala.version}</artifactId>
<version>0.3.1</version>
</dependency>
@inkdeep
inkdeep / _pm_irbrc.rb
Created August 14, 2010 19:49
Useful method to print an objects methods in an irb/console session.
# pm - Print methods of objects in irb/console sessions.
# Goes in ~./irbrc
#
begin # Utility methods
def pm(obj, *options) # Print methods
methods = obj.methods
methods -= Object.methods unless options.include? :more
filter = options.select {|opt| opt.kind_of? Regexp}.first
methods = methods.select {|name| name =~ filter} if filter
@jmlacroix
jmlacroix / aws_cf_invalidate.rb
Created September 21, 2010 03:14 — forked from nbibler/amazon_cloudfront_invalidation.rb
Command line script to invalidate cloudfront objects
require 'rubygems'
require 'hmac-sha1'
require 'net/https'
require 'base64'
s3_access='S3_ACCESS_KEY'
s3_secret='S3_SECRET_KEY'
cf_distribution='CLOUDFRONT_DISTRIBUTION_ID'
if ARGV.length < 1
(defun my-indent-line ()
"Make single-semicolon lisp comments indent like ;;-comments.
Mostly cribbed from `lisp-indent-line'."
(interactive)
(let ((indent (calculate-lisp-indent)) shift-amt end
(beg (progn (beginning-of-line) (point))))
(skip-chars-forward " \t")
(if (or (looking-at "\\s<\\s<") (not (looking-at "\\s<")))
(lisp-indent-line)
(if (listp indent) (setq indent (car indent)))
@nilswloka
nilswloka / mail-link.scpt
Created October 25, 2010 20:28
Create message link for org-mode
@mccv
mccv / ensime-sbt.scala
Created December 15, 2010 18:12
.ensime generating task for sbt
// generate ensime config
lazy val genEnsime = task (args => {
if (args.length == 1) {
genEnsimeConstructor(args(0).toString)
} else {
task { Some("Usage: gen-ensime <project package name>") }
}
}) describedAs("Generate a .ensime file for this project")
def genEnsimeConstructor(packageName: String) = task {
@canton7
canton7 / gist:1053846
Created June 29, 2011 13:35
git push, tracking, and push.default

git clone path/to/test/repo.git

push.default = matching (the default)

git config push.default matching

git branch -a
   * master
@kmizu
kmizu / GrepUsage.scala
Created July 1, 2011 22:16
Add grep method to any collection that holds String.
scala> import PimpGrepToCollection._
import PimpGrepToCollection._
scala> List("123", "156", "C").grep("\\d"){_.toInt}
res0: List[Int] = List(123, 156)
scala> Set("123", "456", "XXX").grep("\\d"){_.toInt}
res1: scala.collection.immutable.Set[Int] = Set(123, 456)
scala> Vector("A", "100", "XXX").grep("\\d"){_.toInt}
@mythz
mythz / basic-fsharp-gtk-demo.fs
Created September 15, 2011 05:16
Basic F# demo using Mono Gtk#
let btnUp = new Button("Increment", Visible=true)
let btnDown = new Button("Decrement", Visible=true)
let lbl = new Label(Text=" Count: 0", Visible=true)
Event.merge
(btnUp.Clicked |> Event.map (fun _ -> +1))
(btnDown.Clicked |> Event.map (fun _ -> -1))
|> Event.scan (+) 0
|> Event.map (sprintf " Count: %d")
|> Event.add (fun s -> lbl.Text <- s)