This file contains hidden or 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 'time' | |
| def dropbox(dir) | |
| File.join("~/Dropbox", dir) | |
| end | |
| DOWNLOADS_DIR = "~/Downloads" | |
| PENDING_DIR = dropbox("Desktop/Pending") |
This file contains hidden or 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
| object TicTacToe { | |
| sealed trait Player | |
| case object X extends Player | |
| case object O extends Player | |
| sealed trait Fin3 | |
| case object I1 extends Fin3 | |
| case object I2 extends Fin3 | |
| case object I3 extends Fin3 |
This file contains hidden or 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
| Hello from the command line |
This file contains hidden or 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
| ;; use uniquify | |
| (require 'uniquify) | |
| (setq | |
| uniquify-buffer-name-style 'post-forward | |
| uniquify-separator ":") |
This file contains hidden or 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
| implicit val arbitraryDate: Arbitrary[DateTime] = Arbitrary { | |
| val gmt = DateTimeZone.UTC | |
| for { | |
| year <- Gen.choose(1970, 2050) | |
| month <- Gen.choose(1, 12) | |
| day <- Gen.choose(1, 28) // TODO: there is a better way to get the number of days in a month -- see: http://www.exampledepot.com/egs/java.util/GetDaysInMonth.html | |
| hour <- Gen.choose(0, 23) | |
| minute <- Gen.choose(0, 59) | |
| second <- Gen.choose(0, 59) | |
| millis <- Gen.choose(0, 999) |
This file contains hidden or 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 'chef/resource/deploy' | |
| require 'chef/provider/deploy/revision' | |
| class Chef | |
| class Resource | |
| class Deploy | |
| def before_rollback(arg=nil, &block) | |
| arg ||= block | |
| set_or_return(:before_rollback, arg, :kind_of => [Proc, String]) |
This file contains hidden or 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
| package eg | |
| import com.typesafe.config.ConfigFactory | |
| import akka.actor.{ ActorRef, Props, Deploy, Actor, ActorSystem, Address, AddressFromURIString } | |
| import akka.remote.RemoteScope | |
| class HelloActor extends Actor { | |
| def receive = { | |
| case _ => println("hello") | |
| } | |
| } |
This file contains hidden or 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
| import Control.OldException(catchDyn,try) | |
| import DBus | |
| import DBus.Connection | |
| import DBus.Message | |
| import XMonad | |
| import XMonad.Config.Gnome | |
| import XMonad.Util.EZConfig | |
| import XMonad.Hooks.DynamicLog |
This file contains hidden or 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
| import Control.OldException(catchDyn,try) | |
| import DBus | |
| import DBus.Connection | |
| import DBus.Message | |
| import XMonad | |
| import XMonad.Config.Gnome | |
| import XMonad.Util.EZConfig | |
| import XMonad.Hooks.DynamicLog |
This file contains hidden or 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
| ;;;###autoload | |
| (defun gist-region-or-buffer (&optional private) | |
| "Post either the current region, or if mark is not set, the current buffer as a new paste at gist.github.com | |
| Copies the URL into the kill ring. | |
| With a prefix argument, makes a private paste." | |
| (interactive "P") | |
| (condition-case nil | |
| (gist-region (point) (mark) private) | |
| (mark-inactive (gist-buffer private)))) |