const compose = (...fns) =>
fns.reduceRight((prevFn, nextFn) =>
(...args) => nextFn(prevFn(...args)),
value => value
);
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
license: lgpl-3.0 |
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 solution(A) { | |
//other shore bank | |
A.push(1); | |
//array with shortest paths for each leaf/bank | |
var reachable = []; | |
for(var i = 0; i<A.length; i++){ | |
reachable.push(-1); | |
} |
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 solution(K, A) { | |
var possibleRopesCount = 0; | |
var fromPrev = 0; | |
for (var i = 0; i<A.length; i++){ | |
if((fromPrev + A[i]) >= K){ | |
possibleRopesCount++; | |
fromPrev = 0; | |
} else { |
##git merge –strategy=theirs (closest we can get)
get a temp copy of the branch you want to 'clone' into another
git checkout -b tmp <branch to copy from>
merge our version of the branch into the upstream with ours strategy
git merge --strategy=ours
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
-
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
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
angular.module('AppServices') | |
.factory 'UrlShortener', ($q, $rootScope) -> | |
gapiKey = 'APP_KEY' | |
gapi_deferred = $q.defer() | |
gapi_loaded = gapi_deferred.promise | |
gapi.client.setApiKey(gapiKey) | |
gapi.client.load 'urlshortener', 'v1', -> | |
$rootScope.$apply -> | |
gapi_deferred.resolve('loaded') |
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
/** | |
* Split a string into chunks of the given size | |
* @param {String} string is the String to split | |
* @param {Number} size is the size you of the cuts | |
* @return {Array} an Array with the strings | |
*/ | |
function splitString (string, size) { | |
var re = new RegExp('.{1,' + size + '}', 'g'); | |
return string.match(re); | |
} |