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 test(iterations) { | |
console.log(`Testing with ${iterations} iterations`); | |
const originalArray = []; | |
console.time('data'); | |
for (let i = 0; i < 1000; i++) { | |
originalArray.push(i); | |
} | |
console.timeEnd('data'); |
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
export abstract class BaseModel { | |
public static mapFromObject<TModel>(obj: any, modelFactory?: () => TModel): TModel { | |
if (!angular.isObject(obj)) return null; | |
var result = angular.isFunction(modelFactory) ? modelFactory() : new (this as any)(); | |
angular.forEach(obj, (val, key) => result[key] = val); | |
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 NameSpaceIterator; | |
(function (NameSpaceIterator) { | |
function graph(namespace, depth) { | |
if (depth === void 0) { depth = 0; } | |
var result = ""; | |
for (var key in namespace) { | |
if (namespace.hasOwnProperty(key)) { | |
var val = namespace[key]; | |
if (val !== null && typeof val === "object") { | |
result += "" + getSpaces(depth) + key + "\n"; |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace dk.odense.EnPlan.Utils | |
{ | |
public class WeightedSearch<TValue> | |
{ | |
private readonly List<TValue> _list; | |
private readonly List<Func<TValue, string, int>> _weights = new List<Func<TValue, string, int>>(); |