This file contains 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
define(['knockout', 'clamp'], function(ko, $clamp) { | |
'use strict'; | |
var textKey = 'originalClampText'; | |
ko.bindingHandlers.clamp = { | |
update: function(element, valueAccessor, allBindings) { | |
var defaultText; |
This file contains 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 readline = require('readline'); | |
function Scope(variables, parent) { | |
this.variables = variables || {}; | |
this.parent = parent; | |
} | |
Scope.prototype.find = function(name) { | |
return this.variables.hasOwnProperty(name) ? | |
this.variables[name] : |
This file contains 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
interface SomeInterface { | |
(a : string, b : number, c : boolean) : void | |
} | |
function SomeFunction : SomeInterface() { | |
} | |
// Would be the same as |
This file contains 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
/** | |
* Just a type to store deferred observables. | |
* | |
* When the deferred is resolved, it'll set the value of the observable | |
* to result of the deferred. | |
* | |
* @param {Function} observable The function to use for the | |
* observable | |
* @param {$.Deferred} deferred The deferred value | |
* @param {Boolean} shouldSetObsValue Should we set the value of the |
This file contains 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
<?php | |
/** | |
* Immutable String class that uses arrays to represent | |
* strings. | |
* | |
* Currently useless as we have no unicode friendly way to split a string | |
* into characters | |
* | |
* @todo Find a unicode-friendly way to split strings |
This file contains 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
/*------------------------------------*\ | |
$FLAG | |
\*------------------------------------*/ | |
.flag { | |
display: table; | |
width: 100%; | |
} | |
.flag--inline { |
This file contains 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
/** | |
* Returns a function that uses it's first argument as the context | |
* for a callback | |
* @param {Function} callback The callback to call | |
* @return {Function} | |
*/ | |
function context(callback) { | |
return function() { | |
var args = Array.prototype.slice.call(arguments); | |
var context = args.shift() || this; |
This file contains 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
/** | |
* Protect a callback based on a condition | |
* @param {Function} protector The condition to protect with | |
* @param {Function} protectee The callback to protect | |
* @param {Boolean} not Should the protector protect using | |
* true or false results | |
* @param {mixed} context Optional context to call protector | |
* and protectee with | |
* @return {Function} The protected callback | |
*/ |
This file contains 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
(function($) { | |
$.fn.shush = function($btn) { | |
// First, validation | |
// Cache global variables | |
var $form = $(this); | |
// Default $btn to input[type=submit] | |
$btn = $btn || 'input[type=submit]'; |
This file contains 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
window.onerror = (function(old) { | |
return function() { | |
var args = [].slice.call(arguments); | |
for (var i = 0, l = arguments.length; i < l; i++) { | |
if (args[i] instanceof Error) { | |
window._errs.push(args[i]); | |
} |