Skip to content

Instantly share code, notes, and snippets.

View jstultz's full-sized avatar

Jacob Stultz jstultz

View GitHub Profile
irb(main):002:0> a.private
=> 0
irb(main):003:0> a.private = 0
=> 0
irb(main):004:0> a.changes
=> {}
irb(main):005:0> a.private = false
=> false
irb(main):006:0> a.changes
=> {"private"=>[0, 0]}

A sentence like this and another on a new line

fadsjkl23jkl43jkl 324j3kljkl 234jj
def toScalaFuture[A](twitterFuture: Future[A]): ScalaFuture[A] = {
val promise = ScalaPromise[A]()
twitterFuture.respond {
case Return(a) => promise.success(a)
case Throw(e) => promise.failure(e)
}
promise.future
}
{"ingraphs_avg"=>68214.2222222222, "ingraphs_max"=>69968.0, "ingraphs_min"=>66395.0, "host"=>"herp.durp", "label"=>"hurp.durp.derp", "stack"=>false, "data"=>[[1423008120000, 66395.0], [1423008180000, 67511.0], [1423008240000, 69968.0], [1423008300000, 66725.0], [1423008360000, 67931.0], [1423008420000, 69043.0], [1423008480000, 68983.0], [1423008540000, 67969.0], [1423008600000, 69403.0], [1423008660000, nil]], "ingraphs_prv"=>69403.0}
class RichThing(val _underlying_Thing: Thing) extends Thing.Proxy {
def doRichStuff: Unit
...
}
class Foo
def operation
...
end
end
class FooRetryWrapper
def initialize(foo)
@foo = foo
end
I think one realllly cool thing about github gists is that the non-adjustable input box is wider than the non-adjustable display box
[access "refs/*"]
read = group Administrators
- read = group Anonymous Users
+ read = block group Anonymous Users
def create() = Action(parse.json) { implicit request =>
request.body.validate[UserPass].asOpt.flatMap { userPass =>
UserService.find(userPass.username).map { user =>
if (BCryptPasswordHasher.matches(user.password, userPass.password)) {
Ok(Json.toJson(UserService.getAuthToken(user)))
}
else Unauthorized("Invalid credentials submitted.")
}
}.getOrElse(Unauthorized("InvalidCredentials submitted."))
}