Skip to content

Instantly share code, notes, and snippets.

View piuccio's full-sized avatar
:octocat:
Time for a change

Fabio Crisci piuccio

:octocat:
Time for a change
View GitHub Profile
@piuccio
piuccio / console.js
Last active December 12, 2015 04:39
hashspace Plain text template with binding modifiers
// In this console you can interact with the model
// without causing a recompilation of the template
//
// The model is accessible with the name `vscope`
// You can display it calling `log()`
// You can interact with it using the `json` helper
// To refresh a template, call `refresh()`
//
// Try for instance the following code
// Hint: Press Ctrl+Space to execute it
@piuccio
piuccio / Controller.scala
Last active October 12, 2015 14:17
Handle query strings in scala
val queryString = {request.queryString.filter(_._2.exists(_.nonEmpty)).map { p =>
"%s=%s".format(p._1, p._2.head.urlEncoded)
} ++ List(s"api-key=$key")}.mkString("&")
@piuccio
piuccio / application-logger.xml
Created September 14, 2015 09:59
Log what happens in AWS
<logger name="com.amazonaws" level="TRACE" />
<logger name="org.apache.http.wire" level="TRACE" />
@piuccio
piuccio / gist:dd38e85e3f3d42ed1acb
Created September 14, 2015 09:50
Log press action on facia tool
val f = FaciaPressQueue.enqueue(PressJob(FrontPath(path), Draft, forceConfigUpdate = Option(true)))
f.onComplete{
case Success(_) => Logger.info("successful queued " + path)
case Failure(t) => Logger.info(s"failed with $path $t")
}
@piuccio
piuccio / adapter.js
Created May 27, 2015 14:14
karma-jspm load only some tests
var filterTests = document.location.search.match(/[\?\&]test=[a-z-\.]+/gi).map(function (test) {
return (test.split('=')[1] + '.spec.js').toLowerCase();
}) || [];
var filterLoadedTests = filterTests.length ? function (spec) {
var found = false;
filterTests.forEach(function (test) {
found = found || spec.toLowerCase().indexOf(test) !== -1;
});
return found;
} : function () {