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 hamming (n) { | |
// TODO: Program me | |
var hammedNumbers = []; | |
var startIndex = 1; | |
while(hammedNumbers.length < n) | |
{ | |
var primeFactors = calcPrimeFactors(startIndex); | |
var largestPrime = primeFactors[primeFactors.length - 1]; |
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 moveZeros = function (arr) { | |
var zeros = []; | |
var foo = arr.filter(function(value) { | |
var isZero = value === 0; | |
if(isZero) { zeros.push(0); } | |
return value !== 0; | |
}) | |
return foo.concat(zeros); | |
} |
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 anarchy = function () { | |
var len = "htgnel".split("").reverse().join(""); | |
return 'I can write numbers like, ' + ["."][len] + ", " + [".","."][len] + ", " + [".",".","."][len] + "."; | |
} |
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 once(fn) { | |
var isUsed = false; | |
return function(){ | |
if(!isUsed) | |
{ | |
isUsed = true; | |
var arg = Array.prototype.slice.call(arguments, 0).reverse()[0]; | |
fn(arg); | |
return arg; | |
} |
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 once(fn) { | |
var isUsed = false; | |
return function(param){ | |
if(!isUsed) | |
{ | |
isUsed = true; | |
fn(param); | |
return param; | |
} | |
} |
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
/*jslint devel: true */ | |
/*jslint browser: true, nomen: true */ | |
/*global jQuery, cf*/ | |
(function IIFE($, cf) { | |
"use strict"; | |
cf.FormValidation = function formValidation(formSelectors) { | |
var self = this; | |
function html5ValidationSupported() { |
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 theBlobMock = new Mock<ITheBlob>(); | |
VS | |
var theBlob = new TheBlob( | |
new SCP(new S(), new AP(new SP(new S(), new AL(new S()))), new SCS()), | |
new S(), | |
new CP(new S()), | |
new MP(new S()), | |
new AP(new SP(new S(), new AL(new S()))), |
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
protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType) | |
{ | |
var moduleName = bindingContext.ValueProvider.GetValue(bindingContext.ModelName + ".ModuleName"); | |
var moduleTypes = new Dictionary<string, Type> | |
{ | |
{ "SearchDetails", typeof(SearchDetailsProfileModule) }, | |
{ "SubscriptionType", typeof(SelectedSubscriptionsProfileModule) }, | |
{ "PausePeriod", typeof(PausePeriodProfileModule) }, | |
{ "UserProfile", typeof(UserDetailsProfileModule)} |
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.pubSub = window.pubSub || {}; | |
(function IFEE(pubSub) { | |
'use strict'; | |
var eventStore = {}, lastId = 0; | |
pubSub.subscribe = function sub(topic, func) { | |
if (!eventStore.hasOwnProperty(topic)) { | |
eventStore[topic] = {}; // Was using an array but this seems better for unsub perf. |
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
model.Countries = | |
(profile.Countries.GroupBy( | |
x => x.ContinentName, | |
y => y, | |
(key, g) => | |
new | |
{ | |
Key = key, | |
Value = | |
g.Select( |
OlderNewer