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
| for D in $(curl https://www.gov.uk/bank-holidays.json | \ | |
| jq '.["england-and-wales"].events[] | .date') ;do \ | |
| echo "new DateTime($D)," ; done | |
| # Renders this: | |
| new DateTime("2012-01-02"), | |
| new DateTime("2012-04-06"), | |
| // ... snip | |
| new DateTime("2015-12-28"), |
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
| def command(note) do | |
| "play -qn synth 2 pluck #{note}" | |
| end |
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 java.util.concurrent.CountDownLatch; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.LinkedBlockingQueue; | |
| import java.util.concurrent.ThreadPoolExecutor; | |
| import java.util.concurrent.TimeUnit; | |
| import java.util.concurrent.atomic.AtomicReference; | |
| public class CallbackB { | |
| /** |
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 java.util.ArrayList; | |
| import java.util.Iterator; | |
| import java.util.List; | |
| import java.util.concurrent.Callable; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.Future; | |
| import java.util.concurrent.LinkedBlockingQueue; | |
| import java.util.concurrent.ThreadPoolExecutor; | |
| import java.util.concurrent.TimeUnit; |
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
| (def open-for-business? (atom true)) | |
| (def haircut-count (agent 0)) | |
| (def waiting-room (ref [])) | |
| (def waiting-room-size 3) | |
| (defn open-shop [duration] | |
| (do (Thread/sleep duration) (swap! open-for-business? not))) | |
| (defn add-customers [] | |
| (future |
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
| Dependency | |
| ========== | |
| http://github.com/downloads/xetorthio/jedis/jedis-1.3.0.jar/qr_code | |
| Client | |
| ========= | |
| logback-test.xml |
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
| /* | |
| (1) The findOne method stopped working | |
| (2) I get a weird ClassCastException from MegaPoll to MegaPoll, even though I use a custom context and define dao as a val. | |
| Polls now get persisted as: | |
| */ | |
| { | |
| "_id":ObjectId("4fe18acb286f6aca172f95bb"), | |
| "_typeHint":"util.mongo.MegaPoll", |
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
| // see http://stackoverflow.com/questions/11130684/modify-xml-in-scala-without-mutation | |
| import scala.xml._ | |
| import scala.xml.transform._ | |
| object BlankReplacer extends BasicTransformer { | |
| override def transform(n: Node): NodeSeq = n match { | |
| case <blank/> => { | |
| <input name={ "blank.%d" }/> | |
| } |
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
| case class ResponsePoll( | |
| id: Long, | |
| name: String, | |
| created: Option[Long], | |
| question: String, | |
| option_a: Option[String], | |
| option_b: Option[String], | |
| image_a: Option[String], | |
| image_b: Option[String], | |
| expires: Option[Long], |
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
| // <snip> | |
| lazy val libratoUsername = Play.maybeApplication.flatMap(_.configuration.getString("librato.username")).getOrElse("tech@domain.tld") | |
| lazy val libratoAPIkey = Play.maybeApplication.flatMap(_.configuration.getString("librato.apikey")).getOrElse("blanked-out") | |
| lazy val libratoFrequency = Play.maybeApplication.flatMap(_.configuration.getInt("librato.frequency")).getOrElse(120) | |
| LibratoReporter.enable(LibratoReporter.builder(libratoUsername, libratoAPIkey, "yack"), libratoFrequency, java.util.concurrent.TimeUnit.SECONDS) | |
| // </snip> |
OlderNewer