Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Time for a change

Fabio Crisci piuccio

:octocat:
Time for a change
View GitHub Profile
@piuccio
piuccio / adapter.js
Created May 27, 2015
karma-jspm load only some tests
View adapter.js
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 () {
@piuccio
piuccio / gist:dd38e85e3f3d42ed1acb
Created Sep 14, 2015
Log press action on facia tool
View gist:dd38e85e3f3d42ed1acb
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 / application-logger.xml
Created Sep 14, 2015
Log what happens in AWS
View application-logger.xml
<logger name="com.amazonaws" level="TRACE" />
<logger name="org.apache.http.wire" level="TRACE" />
@piuccio
piuccio / Controller.scala
Last active Oct 12, 2015
Handle query strings in scala
View Controller.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 / console.js
Last active Dec 12, 2015
hashspace Plain text template with binding modifiers
View console.js
// 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 / console.js
Last active Dec 12, 2015
hashspace Basic template insert
View console.js
// The model is accessible with the name `vscope`
// To refresh a template, call `refresh()`
json.set(vscope, "message", 'Have a nice refresh.');
log();
hsp.refresh();
@piuccio
piuccio / console.js
Last active Dec 12, 2015
hashspace Foreach loop and json interaction
View console.js
// The model is accessible with the name `vscope`
//
// `json` has also methods to handle arrays
// - push
// - splice
// - shift
json.push(vscope.things, "Mangos");
log();
hsp.refresh();
@piuccio
piuccio / console.js
Created Feb 6, 2013
hashspace Event callbacks as literals
View console.js
// Event callbacks don't need a refresh, they trigger one automatically
log();
@piuccio
piuccio / console.js
Created Feb 7, 2013
hashspace Event listeners on scope objects
View console.js
// Click on the fruit name toggles the fruit's edible property
View charCodeAt.js
'a'.charCodeAt(0);
// 97
Buffer.from('a').toString('hex')
// 61
You can’t perform that action at this time.