Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am nkijak on github.
* I am st_nkijak (https://keybase.io/st_nkijak) on keybase.
* I have a public key ASDu6k62ZXweQQ0f3rKE3zMB7FXfAWk_5zHLee3Vmlvmowo
To claim this, I am signing this object:
### Keybase proof
I hereby claim:
* I am nkijak on github.
* I am nkijak (https://keybase.io/nkijak) on keybase.
* I have a public key ASDhOHnYz9YCYaLphAZItSzFKk0_X2u6iX_EMPFTpjzAWwo
To claim this, I am signing this object:
var events = [{"event": circuitStarted, value: { name: "A"}, when: <timestamp>}
{"event": exerciseComplete, value: {id: "exID 1", "count": 150}, when:<timestamp>}
{"event": circuitStarted, value: { name: "B"}, when: <timestamp>}
{"event": exerciseComplete, value: {id: "exID 2", "count": 20}, when:<timestamp>}
{"event": exerciseComplete, value: {id: "exID 3", "count": 6}, when:<timestamp>}
{"event": circuitComplete, value: { name: "B"}, when: <timestamp>}
{"event": circuitStarted, value: { name: "B"}, when: <timestamp>}
{"event": exerciseComplete, value: {id: "exID 2", "count": 18}, when:<timestamp>}
{"event": exerciseComplete, value: {id: "exID 3", "count": 5}, when:<timestamp>}
{"event": circuitComplete, value: { name: "B"}, when: <timestamp>}
case class User(val age: Int, val weight: Int)
val tooYoung: PartialFunction[User, String] = { case User(age, _) if age < 18 => "Too young" }
val tooLight: PartialFunction[User, String] = { case User(_, weight) if weight < 100 => "Too Light" }
val validations = Set(tooYoung, tooLight)
val validator = validations.reduce((a,b) => a orElse b)
Seq(User(10,90)).collect(validator)
@nkijak
nkijak / app.partial.js
Created July 9, 2014 21:53
Module responsible for urls past app setup base
var routes = require('./routes/index');
var movies = require('./routes/movies');
var timeline = require('./routes/timeline');
var app = express();
// view engine setup
// all the normal setup stuff
@nkijak
nkijak / directiveSpec.js
Last active January 17, 2016 16:52
Angular Directive template unit testings
describe('directives', function() {
beforeEach(angular.mock.module('dgmt.ui.elements'));
var rootScope;
var element;
describe('speech-bubble', function(){
beforeEach(angular.mock.module('/templates/speechBubble.html'));
beforeEach(inject(function($compile, $rootScope) {
rootScope = $rootScope;
//definitions
{version:1,
id: <objId>
key-that-means-workout: {
//however you represet the whole nested tree
exercise: 12329-218231-12321-128184923,
expected: 12
}
}
@nkijak
nkijak / DependencyInjection.js
Created October 1, 2013 14:44
Dependency Injection a la angular with "$" variables denoting wired values
function regex(func) {return new RegExp(func.name+"\\(([$?\\w+, ?]*)\\)");}
function meta(func) {
var matches = regex(func).exec(func.toString().replace(" ", ""));
var args = matches[1].split(",");
return {name: func.name, args: args.map(function(arg){ return arg.replace(" ", ""); })};
}
function wrapper(func, factory) {
var args = meta(func).args;
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<performanceMonitorData>
<resultCategory name="JVM Data - Operating System">
<resultRow>
<product name="casmrBlade29" />
<qualifiers />
<result>
<chart name="hour">
<image>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHwAAAAeCAYAAADuInrvAAADEklEQVR42u2avUt6URjH+xt6sXfSCgqMIiiQkDKSaCloKCScRLChoCGhpaGhhoYaGoKCCpJwaUjUgmhQIrEIB0XJgqBXQiwisfe+cc74g36l3nt7uc9nc/Dc5/C993n5npMFmbK6uirLfWfJVfDCwkLMzs6S4HLh+PgYFRUVGB0dJcHlQiwWQ0NDA8xmM15eXkhwOZBIJNDe3o6uri4kk0kSXA48Pz/DaDSiqakJ19fXJLgceHt7g9VqRXV1NU5PT0lwuTA9PY2SkhKEQiESXC6srKxAoVBge3v7T+0rHo+T4B+xubmJ3NxcrK2t/Yn92O125Ofnk+D/Y39/HwUFBZibm/u1ezg7O0NnZyfUajX8fj8J/hlHR0coLy/H2NjYr2tCmZOYk5PDY396eqIa/lWurq5QX1+P/v5+vL6+/vh4Dw4OoNVqodFoEA6HqWlLh7u7O7S1taG7uxv39/c/1k+YmJhAdnY2ZmZm+FdOXXoGsLRoMBjQ3NyMm5ubHxXb3t4eamtr0dHRgZOTExrLhKyNQ0NDqKmpwfn5+bfHw+zg4eFh3oHbbDaaw8VicnISpaWliEQi3xbD1tYWVCoV+vr6+EHQVyDBM2B5eZkbND6fT9LnsnJiMpn4C+d2u1P6LwmeIRsbG9ygcTqdkjyP3dRh3sDAwABvJFOFBBeA3d1dX
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<performanceMonitorData>
<category name="JVM Data - Memory">
<resultRow>
<product name="casmr 105" />
<qualifiers />
<result />
</resultRow>
<resultRow>
<product name="casmr 105" />