This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OOPS VIOLATION OF LISKOV!! Bad bad | |
Rectangle { | |
width(val) = _width = val | |
height(val) = _height = val | |
area() = width() * height() | |
} | |
test_area(rect: Rectangle) { | |
rect.width(4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Tennis Kata in OCaml! *) | |
type player = PlayerOne | PlayerTwo | |
type point = Love | Fifteen | Thirty | |
type score = | |
| Points of point * point |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var compose = require("fn.js").compose; | |
var pipeline = require("fn.js").pipeline; | |
var partial = require("fn.js").partial; | |
var insertCss = require("insert-css"); | |
insertCss("body { padding: 20px } \ | |
.selected { font-weight: bold; color: red; font-family: Consolas; font-size: 18px; }\ | |
.important { color: blue }"); | |
// string, string returns DomElement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prototype of task guard implemented in a more functional style. | |
var Promise = require("q").Promise; | |
var pipeline = require("fn.js").pipeline; | |
var partial = require("fn.js").partial; | |
// STATE OF THE WORLD, CHANGES GO HERE: | |
var STATE; | |
function createState(isDisposed) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prototype of task guard implemented in a more functional style. | |
var Promise = require("q").Promise; | |
var pipeline = require("fn.js").pipeline; | |
var partial = require("fn.js").partial; | |
// STATE OF THE WORLD, CHANGES GO HERE: | |
var STATE; | |
function createState(isDisposed) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (length >= 3 && isIndeterminate) { | |
isIndeterminate = false; | |
} else if (length > 0 && length < 3 && !isIndeterminate) { | |
that.hasError(true); | |
} else { | |
that.isQueryTextInvalid(true); | |
that.hasError(false); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.applyBindingsToDescendants = (function (original) { | |
return function (childBindingContext, element) { | |
var insertionNodes = ko.utils.domData.get(element, "insertionNodes"); | |
original.apply(ko, arguments); | |
if (insertionNodes) { | |
transcludeInto(element, insertionNodes); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sweet.js macros for privacy sugar. | |
Below could be rewritten using es6 weakmaps. | |
*/ | |
macro privacy { | |
rule {} => { | |
var id = ++privates.id | |
var privMap = {} | |
this.__id = id | |
privates[id] = privMap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requirejs aka "AMD" module | |
define(["./utils", "./userService"], function (utils, userService) { | |
// everthing in here is my module | |
}); | |
define(function (require) { | |
var utils = require("./utils"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
form(data-bind="submit: signIn") | |
block content | |
+signInErrorMessage() | |
+signInInputs() | |
+signInSubmitButton() |
NewerOlder