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 validate(models, form) { | |
var validator = form.kendoValidator().getKendoValidator(); | |
_.extend(validator.options.rules, getValidationShims(validator, models, form, validationError)) | |
return validator.validate() | |
} | |
function validationError(text, models){ | |
return text + '\n' + _.pluck(models, 'ServiceType').join('\n') |
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(window, _undefined){ | |
if ( window === _undefined ) | |
throw new Error('SoundManager requries a window object!'); | |
// here be the lib code | |
// use can attach what you must to the window object here! | |
if ( typeof module === "object" && module && typeof module.exports === "object" ) { | |
//CommonJs | |
// the "strict" way is to never expose as a global object if possible, so no sm2 on the window |
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
Promise.castEmitter = function (item, resolveEvents, rejectEvents) { | |
var methods = { | |
on: _.has(item, 'on') ? 'on' : 'bind', | |
off: _.has(item, 'off') ? 'off' : _.has(item, 'removeListener') ? 'removeListener' : 'unbind' | |
}; | |
function unbindAll(events, fn) { | |
for (var i = 0; i < events.length; i++) |
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 xhr = $.ajax({}).then(null, function(){}) | |
var promise = Promise.cast(xhr) | |
xhr.abort() |
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
request('http://ugenr.dk/', function (error, response, html) { | |
if (!error && response.statusCode == 200) { | |
var $ = cheerio.load(html); | |
$('span#ugenr').each(function(i, element){ | |
var ugeNr = $(this).text(); | |
ugeNr = ugeNr.split(" "); | |
ugeNr = ugeNr[1] | |
request('http://skema1.domain.com/services/elevSkema.ashx?idx=randomNumber&week='+ugeNr, secondCallback); |
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 getDay(callback) { | |
request('http://www.timeanddate.com/', function date(error, response, html){ | |
if (!error && response.statusCode == 200) { | |
var $ = cheerio.load(html); | |
$('span#ij1').each(function(i, element){ | |
var dag = $(this).text(); | |
console.log(dag); | |
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 joinClasses(){ | |
var args = [].slice.call(arguments, 0) | |
return args.reduce(function(current, next){ | |
if(!current) return next | |
if( next) return (current ? current + " " : "") + next | |
}) | |
} |
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
'use strict'; | |
var React = require('react') | |
, hasOwn = Object.prototype.hasOwnProperty | |
, version = React.version.split('.').map(parseFloat) | |
, RESERVED = { | |
className: resolve(joinClasses), | |
children: function(){}, | |
key: function(){}, | |
ref: function(){}, | |
style: resolve(extend) |
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
// my thing | |
Thing = { | |
addPromise: function(fn){ | |
Promise.resolve(fn.call(this, 'input')) | |
.then(function(val){ | |
//do wahtever | |
}) | |
}, |
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
compose([your, code, looks, like, shit]); | |
function compose(_chain) { | |
chain = _chain.reverse(); | |
(function next(index, args) { | |
args.push(callback) | |
if(index < chain.length) | |
chain[index].apply(this, args) |
OlderNewer