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
/** | |
* @param {number[][]} intervals | |
* @return {number[]} | |
*/ | |
var findRightInterval = function(intervals) { | |
// collecting and sort tne ends with their index | |
const starts = intervals.map(([start], index) => ({ start, index })).sort((a, b) => a.start - b.start) | |
return intervals.map(([_, end]) => { | |
const startIndex = findMinimumStart(starts, end) |
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
const fs = require("fs"); | |
// The execution order of the setTimeout and setImmedate callbacks are non-deterministic. | |
setTimeout(() => { | |
console.info("setTimeout in main"); | |
}, 0); | |
setImmediate(() => { | |
console.info("setImmediate in main"); |
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
TOKEN="[PERSONAL-ACCESS-TOKEN]" | |
curl -u "$TOKEN:x-oauth-basic" -s https://api.github.com/user/repos?visibility=private | | |
awk '/ssh_url/ {print $2}' | | |
sed 's/[\"\,]//g' | | |
xargs -L1 git clone |
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 HIGH_PRI = 'is%3Aopen+is%3Aissue+label%3A%22High+Pri%22', | |
MEDIUM_PRI = 'is%3Aopen+is%3Aissue+label%3A%22Medium+Pri%22', | |
LOW_PRI = 'is%3Aopen+is%3Aissue+label%3A%22Low+Pri%22', | |
documentID = 'GOOGLE_DOCUMENT_ID'; | |
function getIssueCount(query, open) { | |
var page = UrlFetchApp.fetch('https://github.com/adobe-photoshop/spaces-design/issues?q=' + query), | |
content = page.getContentText(), |
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
console.time("documentID"); | |
_spaces.ps.descriptor.get({ | |
"_multiGetRef": [ | |
{ | |
"_propertyList": [ | |
"documentID" | |
] | |
}, | |
{ | |
"_range": "document", |
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
{ | |
"name": "transform", | |
"descriptor": { | |
"null": { | |
"_ref": [ | |
{ | |
"_ref": "layer", | |
"_id": 19 | |
}, | |
{ |
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
batchPlay: ([ | |
{ | |
"name": "select", | |
"descriptor": { | |
"null": { | |
"_ref": [ | |
{ | |
"_ref": "layer", | |
"_id": 7 | |
}, |
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 detectNewOpenDocument = function () { | |
return Promise.delay(50).bind(this) | |
.then(function () { | |
return documentActions._getDocumentByRef(documentLib.referenceBy.current); | |
}) | |
.then(function (doc) { | |
var currentDocumentID = this.flux.store("application").getCurrentDocumentID(); | |
if (doc.documentID === currentDocumentID) { | |
throw "Retry"; | |
} |
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 Item = React.createClass({ | |
propTypes: { | |
document: React.PropTypes.object.required | |
}, | |
_handleDrag: function(position){ | |
this.setState({ | |
dragging: true, | |
dragPosition: position | |
}); |
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
// Yellow - Decorator for method | |
function isFruit(name){ | |
return ['banana', 'apple'].indexOf(name) !== -1; | |
} | |
function not(fn){ | |
return function(){ | |
return !fn.apply(null, arguments); | |
}; | |
} |
NewerOlder