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
/** | |
* AngularJS service to validate spanish document id. | |
* Returns the type of document and checks its validity. | |
* | |
* Usage: | |
* angular | |
* .module('myApp', [ 'validate-spanish-id' ]) | |
* .controller('myController', function(ValidateSpanishID){ | |
* ValidateSpanishID.validate( str ); | |
* }) |
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
/** | |
* AngularJS service to validate spanish document id. | |
* Returns the type of document and checks its validity. | |
* | |
* Usage: | |
* angular | |
* .module('myApp', [ 'validate-spanish-id' ]) | |
* .controller('myController', function(ValidateSpanishID){ | |
* ValidateSpanishID.validate( str ); | |
* }) |
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 UserTrackingSrv(ids) { | |
var self = this; | |
var appIDs = ids; | |
var userID; | |
var userLogged = false; | |
var ic; | |
this.init = function() { | |
if (appIDs.analyticsID !== undefined) { |
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
/** | |
* Patch the console methods in order to provide timestamp information | |
* | |
* Usage: | |
* > console.log('ok') | |
* 2012-09-06T11:52:56.769Z ok true | |
* | |
* Note: | |
* The patch will only be applied with the first call. | |
* |
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
package: { | |
// config here... | |
// etc. | |
} |
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* naturalNumbers() { | |
let i = 0; | |
while(true) { | |
yield 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
function* fib(a, b) { | |
let c = 0 | |
yield a | |
yield b | |
while (true) { | |
c = a + b | |
a = b | |
b = c | |
yield c | |
} |
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 take(n, iterable) { | |
let result = [], i = 0 | |
while (i < n) { | |
result.push(iterable.next().value) | |
i++ | |
} | |
return result | |
} |
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 takeWhile(conditionFn, iterable) { | |
let result = [] | |
let value = take(1, iterable) | |
while (conditionFn(value)) { | |
result = result.concat(value) | |
value = take(1, iterable) | |
} | |
return result | |
} |
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* fib(a, b) { | |
let c = 0 | |
yield a | |
yield b | |
while (true) { | |
c = a + b | |
a = b | |
b = c | |
yield c |
OlderNewer