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 r=[],i=1;for(;i<101;i++)r.push(((i%3?'':'fizz')+((i%5)?'':'buzz'))||i);console.log(r); |
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 React = require("react"); | |
var ReactDOM = require("react-dom"); | |
var _ = require('lodash'); | |
/* | |
This component is meant to facilitate side to side slide transitions. | |
It's props are: | |
goToIndex : the index of the slide to show, REQUIRED | |
duration : the duration of the sliding, REQUIRED | |
easing : the css easing type, also known as the transition-timing-fuction, DEFAULTS to 'ease-in-out' |
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 NOT EXISTS(SELECT * FROM sys.columns WHERE Name = N'columnName' AND Object_ID = Object_ID(N'tableName')) | |
BEGIN | |
-- Column Exists | |
END |
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
function get(obj, path, defaultValue) { | |
if (typeof path === "string") { | |
path = path.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'); | |
} | |
// end of the line (found nothing) | |
if (obj === undefined) { | |
return defaultValue; | |
} | |
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
(function(_){ | |
function makePath(path){ | |
return path.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'); | |
}; | |
_.mixin({ | |
get: function (obj, path, defaultValue) { | |
if (_.isString(path)) { | |
path = split(path); | |
} | |
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.rockout.fromJS = function fromJS(target) { | |
target = ko.toJS(target); | |
if (_.isPlainObject(target)) { | |
var result = {}; | |
_.each(target, function (item, key) { | |
if (!_.isFunction(item)) { | |
result[key] = fromJS(item); | |
} | |
}); | |
return result; |
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 mongoose = require('mongoose'); | |
var Deferred = require("JQDeferred"); | |
var _ = require("lodash"); | |
function when() { | |
var arrayOfPromises = _.isArray(arguments[0]) ? arguments[0] : arguments; | |
var dfds = _.map(arrayOfPromises,function(promise){ | |
var dfd = new Deferred(); |
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
function formatAddress(obj, context) { | |
// this allows you to pass in a context and keys instead of values | |
if (arguments.length >= 2) { | |
if (context) { | |
obj = { | |
address: _.map(obj.address, function (item) { | |
return context[item]; | |
}), | |
city: context[obj.city], |
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
public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property) | |
{ | |
return ApplyOrder<T>(source, property, "OrderBy"); | |
} | |
public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> source, string property) | |
{ | |
return ApplyOrder<T>(source, property, "OrderByDescending"); | |
} | |
public static IOrderedQueryable<T> ThenBy<T>(this IOrderedQueryable<T> source, string property) | |
{ |
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
// overrwrite the built in text binding handler to allow for formatting | |
var origTextHandler = ko.bindingHandlers.text; | |
var newTextHandler = { | |
init: origTextHandler.init, | |
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) { | |
var bindings = allBindings(); | |
if (bindings.format) { |