Skip to content

Instantly share code, notes, and snippets.

View btd's full-sized avatar

Denis Bardadym btd

  • AWS
  • Deutschland, München
View GitHub Profile

Keybase proof

I hereby claim:

  • I am btd on github.
  • I am btd (https://keybase.io/btd) on keybase.
  • I have a public key whose fingerprint is 37E2 D8C5 8F2D 2E5F 74FB DE17 585D 9D99 C7B7 5B01

To claim this, I am signing this object:

> ({ id: 10 }).should.be.an.asset();
AssertionError: expected { id: 10 } to be asset
expected { id: 10 } to have property path
> ({ id: '10' }).should.be.an.asset();
AssertionError: expected { id: '10' } to be asset
expected '10' to be a number
@btd
btd / asset.js
Created December 25, 2015 15:08
Assertion.add('asset', function() {
this.params = { operator: 'to be asset' };
this.obj.should.have.property('id').which.is.a.Number();
this.obj.should.have.property('path');
});
test('we should not fail, by idea', () => {
assert.notEqual(magicHappenHere(), MAGIC_HERE);
});
test('it should fail', () => {
assert.equal(magicHappenHere(), MAGIC_NUMBER + 1);
});
test('we should not fail', () => {
assert.equal(magicHappenHere(), MAGIC_NUMBER);
});
@btd
btd / magic.js
Last active December 25, 2015 14:33
const MAGIC_NUMBER = 42;
function magicHappenHere() {
return MAGIC_NUMBER;
}
@btd
btd / Rec.scala
Created May 14, 2015 09:12
Simple scala record
package record
class Col[T](
val name: String,
private var value: Option[T] = None,
private var initialValue: Option[T] = None
) {
def apply(v: T): Unit = apply(v, false)
/*jslint undef: true, nomen: true, eqeqeq: true, plusplus: true, newcap: true, immed: true, browser: true, devel: true, passfail: false */
/*global window: false, readConvertLinksToFootnotes: false, readStyle: false, readSize: false, readMargin: false, Typekit: false, ActiveXObject: false */
var dbg = (typeof console !== 'undefined') ? function(s) {
console.log("Readability: " + s);
} : function() {};
/*
* Readability. An Arc90 Lab Experiment.
* Website: http://lab.arc90.com/experiments/readability