repo
stringclasses
192 values
path
stringlengths
4
115
func_name
stringlengths
0
45
original_string
stringlengths
74
24k
language
stringclasses
1 value
code
stringlengths
74
24k
code_tokens
listlengths
23
4.2k
docstring
stringlengths
2
23.7k
docstring_tokens
listlengths
1
810
sha
stringclasses
192 values
url
stringlengths
90
200
partition
stringclasses
1 value
summary
stringlengths
6
313
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
SAP/openui5
src/sap.ui.core/src/sap/ui/events/F6Navigation.js
navigate
function navigate(oSource, aScopes, bForward) { if (!aScopes || aScopes.length == 0) { aScopes = [document]; } if (!isContained(aScopes, oSource)) { return; } var oSouceGroup = findClosestGroup(oSource), $AllTabbables = filterStaticAreaContent(jQuery(aScopes).find(':sapTabbable').addBack(':sapTabbable'), aScopes), $FirstTabbableInScope = $AllTabbables.first(), $Tabbables = filterStaticAreaContent(findTabbables(oSource, aScopes, bForward), aScopes), oGroup, $Target; if (bForward) { //Find the first next tabbable within another group for (var i = 0; i < $Tabbables.length; i++) { oGroup = findClosestGroup($Tabbables[i]); if (oGroup != oSouceGroup) { $Target = jQuery($Tabbables[i]); break; } } //If not found, end of scope (e.g. page) is reached -> Focus the first tabbable scope (e.g. page) element if (!$Target || !$Target.length) { $Target = $FirstTabbableInScope; } } else { $Target = findFirstTabbableOfPreviousGroup($FirstTabbableInScope, $Tabbables, oSouceGroup, true); if (!$Target || !$Target.length) { //No other group found before -> find first element of last group in the scope (e.g. page) if ($AllTabbables.length == 1) { //Only one tabbable element -> use it $Target = jQuery($AllTabbables[0]); } else if ($AllTabbables.length > 1) { oSouceGroup = findClosestGroup($AllTabbables.eq(-1)); oGroup = findClosestGroup($AllTabbables.eq(-2)); if (oSouceGroup != oGroup) { //Last tabbable scope (e.g. page) element and the previous tabbable scope (e.g. page) element have different groups -> last tabbable scope (e.g. page) element is first tabbable element of its group $Target = $AllTabbables.eq(-1); } else { //Take last tabbable scope (e.g. page) element as reference and start search for first tabbable of the same group $Target = findFirstTabbableOfPreviousGroup($FirstTabbableInScope, $AllTabbables, oSouceGroup, false); } } } } if ($Target && $Target.length) { var oTarget = $Target[0], oEvent = null, oCustomGroup = findClosestCustomGroup(oTarget); if (oCustomGroup && oCustomGroup.id) { var oControl = sap.ui.getCore().byId(oCustomGroup.id); if (oControl) { oEvent = jQuery.Event("BeforeFastNavigationFocus"); oEvent.target = oTarget; oEvent.source = oSource; oEvent.forward = bForward; oControl._handleEvent(oEvent); } } if (!oEvent || !oEvent.isDefaultPrevented()) { oTarget.focus(); } } }
javascript
function navigate(oSource, aScopes, bForward) { if (!aScopes || aScopes.length == 0) { aScopes = [document]; } if (!isContained(aScopes, oSource)) { return; } var oSouceGroup = findClosestGroup(oSource), $AllTabbables = filterStaticAreaContent(jQuery(aScopes).find(':sapTabbable').addBack(':sapTabbable'), aScopes), $FirstTabbableInScope = $AllTabbables.first(), $Tabbables = filterStaticAreaContent(findTabbables(oSource, aScopes, bForward), aScopes), oGroup, $Target; if (bForward) { //Find the first next tabbable within another group for (var i = 0; i < $Tabbables.length; i++) { oGroup = findClosestGroup($Tabbables[i]); if (oGroup != oSouceGroup) { $Target = jQuery($Tabbables[i]); break; } } //If not found, end of scope (e.g. page) is reached -> Focus the first tabbable scope (e.g. page) element if (!$Target || !$Target.length) { $Target = $FirstTabbableInScope; } } else { $Target = findFirstTabbableOfPreviousGroup($FirstTabbableInScope, $Tabbables, oSouceGroup, true); if (!$Target || !$Target.length) { //No other group found before -> find first element of last group in the scope (e.g. page) if ($AllTabbables.length == 1) { //Only one tabbable element -> use it $Target = jQuery($AllTabbables[0]); } else if ($AllTabbables.length > 1) { oSouceGroup = findClosestGroup($AllTabbables.eq(-1)); oGroup = findClosestGroup($AllTabbables.eq(-2)); if (oSouceGroup != oGroup) { //Last tabbable scope (e.g. page) element and the previous tabbable scope (e.g. page) element have different groups -> last tabbable scope (e.g. page) element is first tabbable element of its group $Target = $AllTabbables.eq(-1); } else { //Take last tabbable scope (e.g. page) element as reference and start search for first tabbable of the same group $Target = findFirstTabbableOfPreviousGroup($FirstTabbableInScope, $AllTabbables, oSouceGroup, false); } } } } if ($Target && $Target.length) { var oTarget = $Target[0], oEvent = null, oCustomGroup = findClosestCustomGroup(oTarget); if (oCustomGroup && oCustomGroup.id) { var oControl = sap.ui.getCore().byId(oCustomGroup.id); if (oControl) { oEvent = jQuery.Event("BeforeFastNavigationFocus"); oEvent.target = oTarget; oEvent.source = oSource; oEvent.forward = bForward; oControl._handleEvent(oEvent); } } if (!oEvent || !oEvent.isDefaultPrevented()) { oTarget.focus(); } } }
[ "function", "navigate", "(", "oSource", ",", "aScopes", ",", "bForward", ")", "{", "if", "(", "!", "aScopes", "||", "aScopes", ".", "length", "==", "0", ")", "{", "aScopes", "=", "[", "document", "]", ";", "}", "if", "(", "!", "isContained", "(", "...
Finds the next/previous (bForward) element in the F6 chain starting from the given source element within the given scopes and focus it
[ "Finds", "the", "next", "/", "previous", "(", "bForward", ")", "element", "in", "the", "F6", "chain", "starting", "from", "the", "given", "source", "element", "within", "the", "given", "scopes", "and", "focus", "it" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/F6Navigation.js#L152-L224
train
Navigates to the given tabbable element.
[ 30522, 3853, 22149, 1006, 9808, 8162, 3401, 1010, 2004, 16186, 2015, 1010, 28939, 2953, 7652, 1007, 1063, 2065, 1006, 999, 2004, 16186, 2015, 1064, 1064, 2004, 16186, 2015, 1012, 3091, 1027, 1027, 1014, 1007, 1063, 2004, 16186, 2015, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
muaz-khan/RecordRTC
RecordRTC.js
GifRecorder
function GifRecorder(mediaStream, config) { if (typeof GIFEncoder === 'undefined') { var script = document.createElement('script'); script.src = 'https://cdn.webrtc-experiment.com/gif-recorder.js'; (document.body || document.documentElement).appendChild(script); } config = config || {}; var isHTMLObject = mediaStream instanceof CanvasRenderingContext2D || mediaStream instanceof HTMLCanvasElement; /** * This method records MediaStream. * @method * @memberof GifRecorder * @example * recorder.record(); */ this.record = function() { if (typeof GIFEncoder === 'undefined') { setTimeout(self.record, 1000); return; } if (!isLoadedMetaData) { setTimeout(self.record, 1000); return; } if (!isHTMLObject) { if (!config.width) { config.width = video.offsetWidth || 320; } if (!config.height) { config.height = video.offsetHeight || 240; } if (!config.video) { config.video = { width: config.width, height: config.height }; } if (!config.canvas) { config.canvas = { width: config.width, height: config.height }; } canvas.width = config.canvas.width || 320; canvas.height = config.canvas.height || 240; video.width = config.video.width || 320; video.height = config.video.height || 240; } // external library to record as GIF images gifEncoder = new GIFEncoder(); // void setRepeat(int iter) // Sets the number of times the set of GIF frames should be played. // Default is 1; 0 means play indefinitely. gifEncoder.setRepeat(0); // void setFrameRate(Number fps) // Sets frame rate in frames per second. // Equivalent to setDelay(1000/fps). // Using "setDelay" instead of "setFrameRate" gifEncoder.setDelay(config.frameRate || 200); // void setQuality(int quality) // Sets quality of color quantization (conversion of images to the // maximum 256 colors allowed by the GIF specification). // Lower values (minimum = 1) produce better colors, // but slow processing significantly. 10 is the default, // and produces good color mapping at reasonable speeds. // Values greater than 20 do not yield significant improvements in speed. gifEncoder.setQuality(config.quality || 10); // Boolean start() // This writes the GIF Header and returns false if it fails. gifEncoder.start(); if (typeof config.onGifRecordingStarted === 'function') { config.onGifRecordingStarted(); } startTime = Date.now(); function drawVideoFrame(time) { if (self.clearedRecordedData === true) { return; } if (isPausedRecording) { return setTimeout(function() { drawVideoFrame(time); }, 100); } lastAnimationFrame = requestAnimationFrame(drawVideoFrame); if (typeof lastFrameTime === undefined) { lastFrameTime = time; } // ~10 fps if (time - lastFrameTime < 90) { return; } if (!isHTMLObject && video.paused) { // via: https://github.com/muaz-khan/WebRTC-Experiment/pull/316 // Tweak for Android Chrome video.play(); } if (!isHTMLObject) { context.drawImage(video, 0, 0, canvas.width, canvas.height); } if (config.onGifPreview) { config.onGifPreview(canvas.toDataURL('image/png')); } gifEncoder.addFrame(context); lastFrameTime = time; } lastAnimationFrame = requestAnimationFrame(drawVideoFrame); if (config.initCallback) { config.initCallback(); } }; /** * This method stops recording MediaStream. * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee. * @method * @memberof GifRecorder * @example * recorder.stop(function(blob) { * img.src = URL.createObjectURL(blob); * }); */ this.stop = function(callback) { callback = callback || function() {}; if (lastAnimationFrame) { cancelAnimationFrame(lastAnimationFrame); } endTime = Date.now(); /** * @property {Blob} blob - The recorded blob object. * @memberof GifRecorder * @example * recorder.stop(function(){ * var blob = recorder.blob; * }); */ this.blob = new Blob([new Uint8Array(gifEncoder.stream().bin)], { type: 'image/gif' }); callback(this.blob); // bug: find a way to clear old recorded blobs gifEncoder.stream().bin = []; }; var isPausedRecording = false; /** * This method pauses the recording process. * @method * @memberof GifRecorder * @example * recorder.pause(); */ this.pause = function() { isPausedRecording = true; }; /** * This method resumes the recording process. * @method * @memberof GifRecorder * @example * recorder.resume(); */ this.resume = function() { isPausedRecording = false; }; /** * This method resets currently recorded data. * @method * @memberof GifRecorder * @example * recorder.clearRecordedData(); */ this.clearRecordedData = function() { self.clearedRecordedData = true; clearRecordedDataCB(); }; function clearRecordedDataCB() { if (gifEncoder) { gifEncoder.stream().bin = []; } } // for debugging this.name = 'GifRecorder'; this.toString = function() { return this.name; }; var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); if (isHTMLObject) { if (mediaStream instanceof CanvasRenderingContext2D) { context = mediaStream; canvas = context.canvas; } else if (mediaStream instanceof HTMLCanvasElement) { context = mediaStream.getContext('2d'); canvas = mediaStream; } } var isLoadedMetaData = true; if (!isHTMLObject) { var video = document.createElement('video'); video.muted = true; video.autoplay = true; isLoadedMetaData = false; video.onloadedmetadata = function() { isLoadedMetaData = true; }; setSrcObject(mediaStream, video); video.play(); } var lastAnimationFrame = null; var startTime, endTime, lastFrameTime; var gifEncoder; var self = this; }
javascript
function GifRecorder(mediaStream, config) { if (typeof GIFEncoder === 'undefined') { var script = document.createElement('script'); script.src = 'https://cdn.webrtc-experiment.com/gif-recorder.js'; (document.body || document.documentElement).appendChild(script); } config = config || {}; var isHTMLObject = mediaStream instanceof CanvasRenderingContext2D || mediaStream instanceof HTMLCanvasElement; /** * This method records MediaStream. * @method * @memberof GifRecorder * @example * recorder.record(); */ this.record = function() { if (typeof GIFEncoder === 'undefined') { setTimeout(self.record, 1000); return; } if (!isLoadedMetaData) { setTimeout(self.record, 1000); return; } if (!isHTMLObject) { if (!config.width) { config.width = video.offsetWidth || 320; } if (!config.height) { config.height = video.offsetHeight || 240; } if (!config.video) { config.video = { width: config.width, height: config.height }; } if (!config.canvas) { config.canvas = { width: config.width, height: config.height }; } canvas.width = config.canvas.width || 320; canvas.height = config.canvas.height || 240; video.width = config.video.width || 320; video.height = config.video.height || 240; } // external library to record as GIF images gifEncoder = new GIFEncoder(); // void setRepeat(int iter) // Sets the number of times the set of GIF frames should be played. // Default is 1; 0 means play indefinitely. gifEncoder.setRepeat(0); // void setFrameRate(Number fps) // Sets frame rate in frames per second. // Equivalent to setDelay(1000/fps). // Using "setDelay" instead of "setFrameRate" gifEncoder.setDelay(config.frameRate || 200); // void setQuality(int quality) // Sets quality of color quantization (conversion of images to the // maximum 256 colors allowed by the GIF specification). // Lower values (minimum = 1) produce better colors, // but slow processing significantly. 10 is the default, // and produces good color mapping at reasonable speeds. // Values greater than 20 do not yield significant improvements in speed. gifEncoder.setQuality(config.quality || 10); // Boolean start() // This writes the GIF Header and returns false if it fails. gifEncoder.start(); if (typeof config.onGifRecordingStarted === 'function') { config.onGifRecordingStarted(); } startTime = Date.now(); function drawVideoFrame(time) { if (self.clearedRecordedData === true) { return; } if (isPausedRecording) { return setTimeout(function() { drawVideoFrame(time); }, 100); } lastAnimationFrame = requestAnimationFrame(drawVideoFrame); if (typeof lastFrameTime === undefined) { lastFrameTime = time; } // ~10 fps if (time - lastFrameTime < 90) { return; } if (!isHTMLObject && video.paused) { // via: https://github.com/muaz-khan/WebRTC-Experiment/pull/316 // Tweak for Android Chrome video.play(); } if (!isHTMLObject) { context.drawImage(video, 0, 0, canvas.width, canvas.height); } if (config.onGifPreview) { config.onGifPreview(canvas.toDataURL('image/png')); } gifEncoder.addFrame(context); lastFrameTime = time; } lastAnimationFrame = requestAnimationFrame(drawVideoFrame); if (config.initCallback) { config.initCallback(); } }; /** * This method stops recording MediaStream. * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee. * @method * @memberof GifRecorder * @example * recorder.stop(function(blob) { * img.src = URL.createObjectURL(blob); * }); */ this.stop = function(callback) { callback = callback || function() {}; if (lastAnimationFrame) { cancelAnimationFrame(lastAnimationFrame); } endTime = Date.now(); /** * @property {Blob} blob - The recorded blob object. * @memberof GifRecorder * @example * recorder.stop(function(){ * var blob = recorder.blob; * }); */ this.blob = new Blob([new Uint8Array(gifEncoder.stream().bin)], { type: 'image/gif' }); callback(this.blob); // bug: find a way to clear old recorded blobs gifEncoder.stream().bin = []; }; var isPausedRecording = false; /** * This method pauses the recording process. * @method * @memberof GifRecorder * @example * recorder.pause(); */ this.pause = function() { isPausedRecording = true; }; /** * This method resumes the recording process. * @method * @memberof GifRecorder * @example * recorder.resume(); */ this.resume = function() { isPausedRecording = false; }; /** * This method resets currently recorded data. * @method * @memberof GifRecorder * @example * recorder.clearRecordedData(); */ this.clearRecordedData = function() { self.clearedRecordedData = true; clearRecordedDataCB(); }; function clearRecordedDataCB() { if (gifEncoder) { gifEncoder.stream().bin = []; } } // for debugging this.name = 'GifRecorder'; this.toString = function() { return this.name; }; var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); if (isHTMLObject) { if (mediaStream instanceof CanvasRenderingContext2D) { context = mediaStream; canvas = context.canvas; } else if (mediaStream instanceof HTMLCanvasElement) { context = mediaStream.getContext('2d'); canvas = mediaStream; } } var isLoadedMetaData = true; if (!isHTMLObject) { var video = document.createElement('video'); video.muted = true; video.autoplay = true; isLoadedMetaData = false; video.onloadedmetadata = function() { isLoadedMetaData = true; }; setSrcObject(mediaStream, video); video.play(); } var lastAnimationFrame = null; var startTime, endTime, lastFrameTime; var gifEncoder; var self = this; }
[ "function", "GifRecorder", "(", "mediaStream", ",", "config", ")", "{", "if", "(", "typeof", "GIFEncoder", "===", "'undefined'", ")", "{", "var", "script", "=", "document", ".", "createElement", "(", "'script'", ")", ";", "script", ".", "src", "=", "'https...
______________ GifRecorder.js GifRecorder is standalone calss used by {@link RecordRTC} to record video or canvas into animated gif. @license {@link https://github.com/muaz-khan/RecordRTC#license|MIT} @author {@link http://www.MuazKhan.com|Muaz Khan} @typedef GifRecorder @class @example var recorder = new GifRecorder(mediaStream || canvas || context, { onGifPreview: function, onGifRecordingStarted: function, width: 1280, height: 720, frameRate: 200, quality: 10 }); recorder.record(); recorder.stop(function(blob) { img.src = URL.createObjectURL(blob); }); @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} @param {MediaStream} mediaStream - MediaStream object or HTMLCanvasElement or CanvasRenderingContext2D. @param {object} config - {disableLogs:true, initCallback: function, width: 320, height: 240, frameRate: 200, quality: 10}
[ "______________", "GifRecorder", ".", "js", "GifRecorder", "is", "standalone", "calss", "used", "by", "{" ]
3c6bad427b9da35c1cf617199ed13dda056c38ba
https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L4545-L4805
train
Gif recorder.
[ 30522, 3853, 21025, 19699, 8586, 8551, 2121, 1006, 2865, 21422, 1010, 9530, 8873, 2290, 1007, 1063, 2065, 1006, 2828, 11253, 21025, 18940, 16044, 2099, 1027, 1027, 1027, 1005, 6151, 28344, 1005, 1007, 1063, 13075, 5896, 1027, 6254, 1012, 34...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
airyland/vux
src/components/orientation/orientation.js
bind
function bind (fn, context) { return fn.bind ? fn.bind(context) : function () { fn.apply(context, arguments) } }
javascript
function bind (fn, context) { return fn.bind ? fn.bind(context) : function () { fn.apply(context, arguments) } }
[ "function", "bind", "(", "fn", ",", "context", ")", "{", "return", "fn", ".", "bind", "?", "fn", ".", "bind", "(", "context", ")", ":", "function", "(", ")", "{", "fn", ".", "apply", "(", "context", ",", "arguments", ")", "}", "}" ]
绑定方法上下文 @method bind @param {Function} fn @param {Object} context @return {Function} @private
[ "绑定方法上下文" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/orientation/orientation.js#L49-L53
train
bind function to context
[ 30522, 3853, 14187, 1006, 1042, 2078, 1010, 6123, 1007, 1063, 2709, 1042, 2078, 1012, 14187, 1029, 1042, 2078, 1012, 14187, 1006, 6123, 1007, 1024, 3853, 1006, 1007, 1063, 1042, 2078, 1012, 6611, 1006, 6123, 1010, 9918, 1007, 1065, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/node/FindInFilesDomain.js
offsetToLineNum
function offsetToLineNum(textOrLines, offset) { if (Array.isArray(textOrLines)) { var lines = textOrLines, total = 0, line; for (line = 0; line < lines.length; line++) { if (total < offset) { // add 1 per line since /n were removed by splitting, but they needed to // contribute to the total offset count total += lines[line].length + 1; } else if (total === offset) { return line; } else { return line - 1; } } // if offset is NOT over the total then offset is in the last line if (offset <= total) { return line - 1; } else { return undefined; } } else { return textOrLines.substr(0, offset).split("\n").length - 1; } }
javascript
function offsetToLineNum(textOrLines, offset) { if (Array.isArray(textOrLines)) { var lines = textOrLines, total = 0, line; for (line = 0; line < lines.length; line++) { if (total < offset) { // add 1 per line since /n were removed by splitting, but they needed to // contribute to the total offset count total += lines[line].length + 1; } else if (total === offset) { return line; } else { return line - 1; } } // if offset is NOT over the total then offset is in the last line if (offset <= total) { return line - 1; } else { return undefined; } } else { return textOrLines.substr(0, offset).split("\n").length - 1; } }
[ "function", "offsetToLineNum", "(", "textOrLines", ",", "offset", ")", "{", "if", "(", "Array", ".", "isArray", "(", "textOrLines", ")", ")", "{", "var", "lines", "=", "textOrLines", ",", "total", "=", "0", ",", "line", ";", "for", "(", "line", "=", ...
Copied from StringUtils.js Returns a line number corresponding to an offset in some text. The text can be specified as a single string or as an array of strings that correspond to the lines of the string. Specify the text in lines when repeatedly calling the function on the same text in a loop. Use getLines() to divide the text into lines, then repeatedly call this function to compute a line number from the offset. @param {string | Array.<string>} textOrLines - string or array of lines from which to compute the line number from the offset @param {number} offset @return {number} line number
[ "Copied", "from", "StringUtils", ".", "js", "Returns", "a", "line", "number", "corresponding", "to", "an", "offset", "in", "some", "text", ".", "The", "text", "can", "be", "specified", "as", "a", "single", "string", "or", "as", "an", "array", "of", "stri...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/node/FindInFilesDomain.js#L68-L94
train
offsetToLineNum - offset to the last line of the file
[ 30522, 3853, 16396, 3406, 4179, 19172, 1006, 3793, 2953, 12735, 1010, 16396, 1007, 1063, 2065, 1006, 9140, 1012, 18061, 11335, 2100, 1006, 3793, 2953, 12735, 1007, 1007, 1063, 13075, 3210, 1027, 3793, 2953, 12735, 1010, 2561, 1027, 1014, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/utils/is-ie11.js
getInternetExplorerVersion
function getInternetExplorerVersion () { var version = -1; var userAgent = navigator.userAgent; var re; if (navigator.appName === 'Microsoft Internet Explorer') { re = new RegExp('MSIE ([0-9]{1,}[\\.0-9]{0,})'); if (re.exec(userAgent) != null) { version = parseFloat(RegExp.$1); } } else if (navigator.appName === 'Netscape') { re = new RegExp('Trident/.*rv:([0-9]{1,}[\\.0-9]{0,})'); if (re.exec(userAgent) != null) { version = parseFloat(RegExp.$1); } } return version; }
javascript
function getInternetExplorerVersion () { var version = -1; var userAgent = navigator.userAgent; var re; if (navigator.appName === 'Microsoft Internet Explorer') { re = new RegExp('MSIE ([0-9]{1,}[\\.0-9]{0,})'); if (re.exec(userAgent) != null) { version = parseFloat(RegExp.$1); } } else if (navigator.appName === 'Netscape') { re = new RegExp('Trident/.*rv:([0-9]{1,}[\\.0-9]{0,})'); if (re.exec(userAgent) != null) { version = parseFloat(RegExp.$1); } } return version; }
[ "function", "getInternetExplorerVersion", "(", ")", "{", "var", "version", "=", "-", "1", ";", "var", "userAgent", "=", "navigator", ".", "userAgent", ";", "var", "re", ";", "if", "(", "navigator", ".", "appName", "===", "'Microsoft Internet Explorer'", ")", ...
https://stackoverflow.com/a/17907562
[ "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "17907562" ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/is-ie11.js#L2-L14
train
Get the version of Internet Explorer
[ 30522, 3853, 2131, 18447, 11795, 12870, 2595, 24759, 5686, 2099, 27774, 1006, 1007, 1063, 13075, 2544, 1027, 1011, 1015, 1025, 13075, 5310, 4270, 3372, 1027, 20532, 1012, 5310, 4270, 3372, 1025, 13075, 2128, 1025, 2065, 1006, 20532, 1012, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
function( /* result, actual, expected, message */ ) { var assert = this, currentTest = ( assert instanceof Assert && assert.test ) || QUnit.config.current; // Backwards compatibility fix. // Allows the direct use of global exported assertions and QUnit.assert.* // Although, it's use is not recommended as it can leak assertions // to other tests from async tests, because we only get a reference to the current test, // not exactly the test where assertion were intended to be called. if ( !currentTest ) { throw new Error( "assertion outside test context, in " + sourceFromStacktrace( 2 ) ); } if ( currentTest.usedAsync === true && currentTest.semaphore === 0 ) { currentTest.pushFailure( "Assertion after the final `assert.async` was resolved", sourceFromStacktrace( 2 ) ); // Allow this assertion to continue running anyway... } if ( !( assert instanceof Assert ) ) { assert = currentTest.assert; } return assert.test.push.apply( assert.test, arguments ); }
javascript
function( /* result, actual, expected, message */ ) { var assert = this, currentTest = ( assert instanceof Assert && assert.test ) || QUnit.config.current; // Backwards compatibility fix. // Allows the direct use of global exported assertions and QUnit.assert.* // Although, it's use is not recommended as it can leak assertions // to other tests from async tests, because we only get a reference to the current test, // not exactly the test where assertion were intended to be called. if ( !currentTest ) { throw new Error( "assertion outside test context, in " + sourceFromStacktrace( 2 ) ); } if ( currentTest.usedAsync === true && currentTest.semaphore === 0 ) { currentTest.pushFailure( "Assertion after the final `assert.async` was resolved", sourceFromStacktrace( 2 ) ); // Allow this assertion to continue running anyway... } if ( !( assert instanceof Assert ) ) { assert = currentTest.assert; } return assert.test.push.apply( assert.test, arguments ); }
[ "function", "(", "/* result, actual, expected, message */", ")", "{", "var", "assert", "=", "this", ",", "currentTest", "=", "(", "assert", "instanceof", "Assert", "&&", "assert", ".", "test", ")", "||", "QUnit", ".", "config", ".", "current", ";", "// Backwar...
Exports test.push() to the user API
[ "Exports", "test", ".", "push", "()", "to", "the", "user", "API" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L1282-L1306
train
Push an assertion to the test stack.
[ 30522, 3853, 1006, 1013, 1008, 2765, 1010, 5025, 1010, 3517, 1010, 4471, 1008, 1013, 1007, 1063, 13075, 20865, 1027, 2023, 1010, 2783, 22199, 1027, 1006, 20865, 6013, 11253, 20865, 1004, 1004, 20865, 1012, 3231, 1007, 1064, 1064, 24209, 349...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
shipshapecode/shepherd
src/js/utils/modal.js
createModalOverlay
function createModalOverlay() { const containerElement = _createModalContainer(); const defsElement = document.createElementNS(svgNS, 'defs'); const maskContainer = _createMaskContainer(); const maskRect = _createMaskRect(); const maskOpening = _createMaskOpening(); const maskConsumer = _createMaskConsumer(); maskContainer.appendChild(maskRect); maskContainer.appendChild(maskOpening); defsElement.appendChild(maskContainer); containerElement.appendChild(defsElement); containerElement.appendChild(maskConsumer); return containerElement; }
javascript
function createModalOverlay() { const containerElement = _createModalContainer(); const defsElement = document.createElementNS(svgNS, 'defs'); const maskContainer = _createMaskContainer(); const maskRect = _createMaskRect(); const maskOpening = _createMaskOpening(); const maskConsumer = _createMaskConsumer(); maskContainer.appendChild(maskRect); maskContainer.appendChild(maskOpening); defsElement.appendChild(maskContainer); containerElement.appendChild(defsElement); containerElement.appendChild(maskConsumer); return containerElement; }
[ "function", "createModalOverlay", "(", ")", "{", "const", "containerElement", "=", "_createModalContainer", "(", ")", ";", "const", "defsElement", "=", "document", ".", "createElementNS", "(", "svgNS", ",", "'defs'", ")", ";", "const", "maskContainer", "=", "_cr...
Generates an SVG with the following structure: ```html <svg id="shepherdModalOverlayContainer" xmlns="http://www.w3.org/2000/svg"> <defs> <mask id="shepherdModalMask" x="0" y="0" width="100%" height="100%" > <rect x="0" y="0" width="100%" height="100%" fill="#FFFFFF"/> <!-- This element will "punch a hole" through the mask by preventing it from rendering within the perimeter --> <rect id="shepherdModalMaskOpening"/> </mask> </defs> <rect x="0" y="0" width="100%" height="100%" mask="url(#shepherdModalMask)"/> </svg> ```
[ "Generates", "an", "SVG", "with", "the", "following", "structure", ":", "html", "<svg", "id", "=", "shepherdModalOverlayContainer", "xmlns", "=", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "2000", "/", "svg", ">", "<defs", ">", "<mask", "id", ...
0cb1c63fb07b58796358f6d33da5f6405e2b05f4
https://github.com/shipshapecode/shepherd/blob/0cb1c63fb07b58796358f6d33da5f6405e2b05f4/src/js/utils/modal.js#L107-L124
train
Creates a modal overlay
[ 30522, 3853, 3443, 5302, 9305, 7840, 8485, 1006, 1007, 1063, 9530, 3367, 11661, 12260, 3672, 1027, 1035, 3443, 5302, 9305, 8663, 18249, 2121, 1006, 1007, 1025, 9530, 3367, 13366, 11246, 13665, 1027, 6254, 1012, 3443, 12260, 3672, 3619, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
grpc/grpc
examples/node/dynamic_codegen/route_guide/route_guide_server.js
recordRoute
function recordRoute(call, callback) { var point_count = 0; var feature_count = 0; var distance = 0; var previous = null; // Start a timer var start_time = process.hrtime(); call.on('data', function(point) { point_count += 1; if (checkFeature(point).name !== '') { feature_count += 1; } /* For each point after the first, add the incremental distance from the * previous point to the total distance value */ if (previous != null) { distance += getDistance(previous, point); } previous = point; }); call.on('end', function() { callback(null, { point_count: point_count, feature_count: feature_count, // Cast the distance to an integer distance: distance|0, // End the timer elapsed_time: process.hrtime(start_time)[0] }); }); }
javascript
function recordRoute(call, callback) { var point_count = 0; var feature_count = 0; var distance = 0; var previous = null; // Start a timer var start_time = process.hrtime(); call.on('data', function(point) { point_count += 1; if (checkFeature(point).name !== '') { feature_count += 1; } /* For each point after the first, add the incremental distance from the * previous point to the total distance value */ if (previous != null) { distance += getDistance(previous, point); } previous = point; }); call.on('end', function() { callback(null, { point_count: point_count, feature_count: feature_count, // Cast the distance to an integer distance: distance|0, // End the timer elapsed_time: process.hrtime(start_time)[0] }); }); }
[ "function", "recordRoute", "(", "call", ",", "callback", ")", "{", "var", "point_count", "=", "0", ";", "var", "feature_count", "=", "0", ";", "var", "distance", "=", "0", ";", "var", "previous", "=", "null", ";", "// Start a timer", "var", "start_time", ...
recordRoute handler. Gets a stream of points, and responds with statistics about the "trip": number of points, number of known features visited, total distance traveled, and total time spent. @param {Readable} call The request point stream. @param {function(Error, routeSummary)} callback The callback to pass the response to
[ "recordRoute", "handler", ".", "Gets", "a", "stream", "of", "points", "and", "responds", "with", "statistics", "about", "the", "trip", ":", "number", "of", "points", "number", "of", "known", "features", "visited", "total", "distance", "traveled", "and", "total...
cc75d93818410e2b0edd0fa3009a6def9ac403ca
https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/dynamic_codegen/route_guide/route_guide_server.js#L147-L176
train
Record a route
[ 30522, 3853, 2501, 22494, 2618, 1006, 2655, 1010, 2655, 5963, 1007, 1063, 13075, 2391, 1035, 4175, 1027, 1014, 1025, 13075, 3444, 1035, 4175, 1027, 1014, 1025, 13075, 3292, 1027, 1014, 1025, 13075, 3025, 1027, 19701, 1025, 1013, 1013, 2707,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nodejs/node-gyp
lib/configure.js
checkPyLauncher
function checkPyLauncher (errorCallback) { this.log.verbose( `- executing "${this.pyLauncher}" to get Python 2 executable path`) this.run(this.pyLauncher, ['-2', ...this.argsExecutable], false, function (err, execPath) { // Possible outcomes: same as checkCommand if (err) { this.addLog( `- "${this.pyLauncher}" is not in PATH or produced an error`) return errorCallback(err) } this.addLog(`- executable path is "${execPath}"`) this.checkExecPath(execPath, errorCallback) }.bind(this)) }
javascript
function checkPyLauncher (errorCallback) { this.log.verbose( `- executing "${this.pyLauncher}" to get Python 2 executable path`) this.run(this.pyLauncher, ['-2', ...this.argsExecutable], false, function (err, execPath) { // Possible outcomes: same as checkCommand if (err) { this.addLog( `- "${this.pyLauncher}" is not in PATH or produced an error`) return errorCallback(err) } this.addLog(`- executable path is "${execPath}"`) this.checkExecPath(execPath, errorCallback) }.bind(this)) }
[ "function", "checkPyLauncher", "(", "errorCallback", ")", "{", "this", ".", "log", ".", "verbose", "(", "`", "${", "this", ".", "pyLauncher", "}", "`", ")", "this", ".", "run", "(", "this", ".", "pyLauncher", ",", "[", "'-2'", ",", "...", "this", "."...
Check if the py launcher can find a valid Python to use. Will exit the Python finder on success. Distributions of Python on Windows by default install with the "py.exe" Python launcher which is more likely to exist than the Python executable being in the $PATH. Because the Python launcher supports all versions of Python, we have to explicitly request a Python 2 version. This is done by supplying "-2" as the first command line argument. Since "py.exe -2" would be an invalid executable for "execFile", we have to use the launcher to figure out where the actual "python.exe" executable is located.
[ "Check", "if", "the", "py", "launcher", "can", "find", "a", "valid", "Python", "to", "use", ".", "Will", "exit", "the", "Python", "finder", "on", "success", ".", "Distributions", "of", "Python", "on", "Windows", "by", "default", "install", "with", "the", ...
721eb691cf15556cc2700eda0558d5bad5f84232
https://github.com/nodejs/node-gyp/blob/721eb691cf15556cc2700eda0558d5bad5f84232/lib/configure.js#L526-L540
train
Check the Python 2 executable path
[ 30522, 3853, 4638, 7685, 17298, 26091, 2099, 1006, 7561, 9289, 20850, 8684, 1007, 1063, 2023, 1012, 8833, 1012, 12034, 9232, 1006, 1036, 1011, 23448, 1000, 1002, 1063, 2023, 1012, 1052, 23943, 4609, 7474, 1065, 1000, 2000, 2131, 18750, 1016...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/gridList/grid-list.js
getTileSpans
function getTileSpans(tileElements) { return [].map.call(tileElements, function(ele) { var ctrl = angular.element(ele).controller('mdGridTile'); return { row: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-rowspan'), 10) || 1, col: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-colspan'), 10) || 1 }; }); }
javascript
function getTileSpans(tileElements) { return [].map.call(tileElements, function(ele) { var ctrl = angular.element(ele).controller('mdGridTile'); return { row: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-rowspan'), 10) || 1, col: parseInt( $mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-colspan'), 10) || 1 }; }); }
[ "function", "getTileSpans", "(", "tileElements", ")", "{", "return", "[", "]", ".", "map", ".", "call", "(", "tileElements", ",", "function", "(", "ele", ")", "{", "var", "ctrl", "=", "angular", ".", "element", "(", "ele", ")", ".", "controller", "(", ...
Gets an array of objects containing the rowspan and colspan for each tile. @returns {Array<{row: number, col: number}>}
[ "Gets", "an", "array", "of", "objects", "containing", "the", "rowspan", "and", "colspan", "for", "each", "tile", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L370-L380
train
Get the tile spans
[ 30522, 3853, 2131, 15286, 13102, 6962, 1006, 14090, 12260, 8163, 1007, 1063, 2709, 1031, 1033, 1012, 4949, 1012, 2655, 1006, 14090, 12260, 8163, 1010, 3853, 1006, 3449, 2063, 1007, 1063, 13075, 14931, 12190, 1027, 16108, 1012, 5783, 1006, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_removeAddon
function addonsManager_removeAddon(aSpec) { var spec = aSpec || { }; spec.button = "remove"; var button = this.getAddonButton(spec); this._controller.click(button); }
javascript
function addonsManager_removeAddon(aSpec) { var spec = aSpec || { }; spec.button = "remove"; var button = this.getAddonButton(spec); this._controller.click(button); }
[ "function", "addonsManager_removeAddon", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "spec", ".", "button", "=", "\"remove\"", ";", "var", "button", "=", "this", ".", "getAddonButton", "(", "spec", ")", ";", "this", ".", "...
Removes the specified add-on @param {object} aSpec Information on which add-on to operate on Elements: addon - Add-on element
[ "Removes", "the", "specified", "add", "-", "on" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L401-L407
train
Remove an add - on
[ 30522, 3853, 5587, 5644, 24805, 4590, 1035, 6366, 4215, 5280, 1006, 2004, 5051, 2278, 1007, 1063, 13075, 28699, 1027, 2004, 5051, 2278, 1064, 1064, 1063, 1065, 1025, 28699, 1012, 6462, 1027, 1000, 6366, 1000, 1025, 13075, 6462, 1027, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
packages/vue-native-scripts/src/scripts/compiler.js
compileVueToRn
function compileVueToRn(resource) { const code = resource.toString(); const cparsed = compiler.parseComponent(code, { pad: 'line' }); // console.log(cparsed); let output = ''; let mappings = ''; // add react-vue import output += `import ${constants.VUE}, { observer as ${ constants.OBSERVER } } from 'vue-native-core'`; output += '\n'; // // add react import // output += `import ${constants.REACT} from 'react'` // output += '\n'; // add react-native import output += `import ${constants.REACT_NATIVE} from 'react-native'`; output += '\n'; // add prop-type import output += `import ${constants.PROP_TYPE} from 'prop-types'`; output += '\n'; // add component builder import output += `import { buildNativeComponent as ${ constants.BUILD_COMPONENT } } from 'vue-native-helper'`; output += '\n'; // parse template const template = cparsed.template; //Consider the start of template for debugging // let templateStartIndex = code.indexOf("<"); let tempStringBeforeStart = code.substring(0, templateStartIndex); let templateLineNumber = tempStringBeforeStart.split(splitRE).length - 1; // Get tags and location of tags from template // let nodes = []; const templateFragments = parse5.parseFragment(cparsed.template.content, { sourceCodeLocationInfo: true }); if (templateFragments.childNodes) { traverse(templateFragments, nodes); } let templateParsed = DEFAULT_OUTPUT.template; if (template) { const templateContent = template.content.replace(/\/\/\n/g, '').trim(); if (templateContent) { templateParsed = parseTemplate(templateContent); } } // add render dep import output += templateParsed.import; output += '\n'; // parse script const script = cparsed.script; let scriptParsed = DEFAULT_OUTPUT.script; if (script) { const scriptContent = script.content.replace(/\/\/\n/g, '').trim(); scriptParsed = parseScript(scriptContent); mappings = generateSourceMap(code); } if (mappings) { // Start of the script content // var beforeLines = output.split(splitRE).length; // Start of the script content of the original code // var scriptLine = code.slice(0, cparsed.script.start).split(splitRE).length + 1; var exportDefaultIndex = code.indexOf('export default'); var tempString = code.substring(0, exportDefaultIndex); var exportDefaultLineNumber = tempString.split('\n').length; } // add vue options output += scriptParsed; output += '\n\n'; var endLines = output.split(splitRE).length - 1; for (; scriptLine < endLines; scriptLine++) { //Skip export default line if (scriptLine !== exportDefaultLineNumber) { mappings.addMapping({ source: mappings._hashedFilename, generated: { line: beforeLines, column: 0 }, original: { line: scriptLine, column: 0 } }); } beforeLines++; } // add render funtion let beautifiedRender = beautify(addvm(templateParsed.render, { indent_size: 2 })); output += beautifiedRender; output += '\n\n'; // Get last line of render code // let renderEndLine = beautifiedRender.split(splitRE).length - 1; // Search Elements and postion based on render function // var reactVueElementRegex = /__react__vue__createElement/; let foundLines = lineNumber(beautifiedRender, reactVueElementRegex); if (mappings) { foundLines.forEach((line, index) => { let renderJsLine = endLines + line.number; if (foundLines[index + 1]) { for (let i = line.number; i < foundLines[index + 1].number; i++) { // Add Mapping if (nodes[index]) { mappings.addMapping({ source: mappings._hashedFilename, generated: { line: renderJsLine++, column: 0 }, original: { line: nodes[index].startTag.startLine + templateLineNumber, column: 0 } }); } } } else if (nodes[index] && nodes[index].startTag) { // Last Line for (let i = line.number; i < renderEndLine; i++) { // Add Mapping mappings.addMapping({ source: mappings._hashedFilename, generated: { line: renderJsLine++, column: 0 }, original: { line: nodes[index].startTag.startLine + templateLineNumber, column: 0 } }); } } }); } // parse css const styles = cparsed.styles; let cssParsed = {}; styles.forEach(function (v) { const cssAst = cssParse(v.content); cssParsed = Object.assign({}, cssParsed, parseCss(cssAst)); }); // add css obj output += `const ${constants.CSS} = ${JSON.stringify(cssParsed)}`; output += '\n\n'; // add builder output += `const ${constants.COMPONENT_BUILDED} = ${ constants.BUILD_COMPONENT }(${constants.TEMPLATE_RENDER}, ${constants.SCRIPT_OPTIONS}, {Component: ${ constants.COMPONENT }, PropTypes: ${constants.PROP_TYPE}, Vue: ${constants.VUE}, ReactNative: ${ constants.REACT_NATIVE }, css: ${constants.CSS}})`; output += '\n\n'; // export default output += `export default ${constants.OBSERVER}(${ constants.COMPONENT_BUILDED })`; // beautiful // output = beautify(output, { indent_size: 2 }); return { output, mappings: mappings ? mappings.toJSON() : null }; // fs.writeFile(name.replace(FILTER, '.js'), output, function(err) { // if (err) { // throw err; // } // }); }
javascript
function compileVueToRn(resource) { const code = resource.toString(); const cparsed = compiler.parseComponent(code, { pad: 'line' }); // console.log(cparsed); let output = ''; let mappings = ''; // add react-vue import output += `import ${constants.VUE}, { observer as ${ constants.OBSERVER } } from 'vue-native-core'`; output += '\n'; // // add react import // output += `import ${constants.REACT} from 'react'` // output += '\n'; // add react-native import output += `import ${constants.REACT_NATIVE} from 'react-native'`; output += '\n'; // add prop-type import output += `import ${constants.PROP_TYPE} from 'prop-types'`; output += '\n'; // add component builder import output += `import { buildNativeComponent as ${ constants.BUILD_COMPONENT } } from 'vue-native-helper'`; output += '\n'; // parse template const template = cparsed.template; //Consider the start of template for debugging // let templateStartIndex = code.indexOf("<"); let tempStringBeforeStart = code.substring(0, templateStartIndex); let templateLineNumber = tempStringBeforeStart.split(splitRE).length - 1; // Get tags and location of tags from template // let nodes = []; const templateFragments = parse5.parseFragment(cparsed.template.content, { sourceCodeLocationInfo: true }); if (templateFragments.childNodes) { traverse(templateFragments, nodes); } let templateParsed = DEFAULT_OUTPUT.template; if (template) { const templateContent = template.content.replace(/\/\/\n/g, '').trim(); if (templateContent) { templateParsed = parseTemplate(templateContent); } } // add render dep import output += templateParsed.import; output += '\n'; // parse script const script = cparsed.script; let scriptParsed = DEFAULT_OUTPUT.script; if (script) { const scriptContent = script.content.replace(/\/\/\n/g, '').trim(); scriptParsed = parseScript(scriptContent); mappings = generateSourceMap(code); } if (mappings) { // Start of the script content // var beforeLines = output.split(splitRE).length; // Start of the script content of the original code // var scriptLine = code.slice(0, cparsed.script.start).split(splitRE).length + 1; var exportDefaultIndex = code.indexOf('export default'); var tempString = code.substring(0, exportDefaultIndex); var exportDefaultLineNumber = tempString.split('\n').length; } // add vue options output += scriptParsed; output += '\n\n'; var endLines = output.split(splitRE).length - 1; for (; scriptLine < endLines; scriptLine++) { //Skip export default line if (scriptLine !== exportDefaultLineNumber) { mappings.addMapping({ source: mappings._hashedFilename, generated: { line: beforeLines, column: 0 }, original: { line: scriptLine, column: 0 } }); } beforeLines++; } // add render funtion let beautifiedRender = beautify(addvm(templateParsed.render, { indent_size: 2 })); output += beautifiedRender; output += '\n\n'; // Get last line of render code // let renderEndLine = beautifiedRender.split(splitRE).length - 1; // Search Elements and postion based on render function // var reactVueElementRegex = /__react__vue__createElement/; let foundLines = lineNumber(beautifiedRender, reactVueElementRegex); if (mappings) { foundLines.forEach((line, index) => { let renderJsLine = endLines + line.number; if (foundLines[index + 1]) { for (let i = line.number; i < foundLines[index + 1].number; i++) { // Add Mapping if (nodes[index]) { mappings.addMapping({ source: mappings._hashedFilename, generated: { line: renderJsLine++, column: 0 }, original: { line: nodes[index].startTag.startLine + templateLineNumber, column: 0 } }); } } } else if (nodes[index] && nodes[index].startTag) { // Last Line for (let i = line.number; i < renderEndLine; i++) { // Add Mapping mappings.addMapping({ source: mappings._hashedFilename, generated: { line: renderJsLine++, column: 0 }, original: { line: nodes[index].startTag.startLine + templateLineNumber, column: 0 } }); } } }); } // parse css const styles = cparsed.styles; let cssParsed = {}; styles.forEach(function (v) { const cssAst = cssParse(v.content); cssParsed = Object.assign({}, cssParsed, parseCss(cssAst)); }); // add css obj output += `const ${constants.CSS} = ${JSON.stringify(cssParsed)}`; output += '\n\n'; // add builder output += `const ${constants.COMPONENT_BUILDED} = ${ constants.BUILD_COMPONENT }(${constants.TEMPLATE_RENDER}, ${constants.SCRIPT_OPTIONS}, {Component: ${ constants.COMPONENT }, PropTypes: ${constants.PROP_TYPE}, Vue: ${constants.VUE}, ReactNative: ${ constants.REACT_NATIVE }, css: ${constants.CSS}})`; output += '\n\n'; // export default output += `export default ${constants.OBSERVER}(${ constants.COMPONENT_BUILDED })`; // beautiful // output = beautify(output, { indent_size: 2 }); return { output, mappings: mappings ? mappings.toJSON() : null }; // fs.writeFile(name.replace(FILTER, '.js'), output, function(err) { // if (err) { // throw err; // } // }); }
[ "function", "compileVueToRn", "(", "resource", ")", "{", "const", "code", "=", "resource", ".", "toString", "(", ")", ";", "const", "cparsed", "=", "compiler", ".", "parseComponent", "(", "code", ",", "{", "pad", ":", "'line'", "}", ")", ";", "// console...
watch('./', { recursive: true, filter: FILTER }, function (evt, name) { if (evt === 'update') { compileVueToRn(name); } else if (evt === 'remove') { remove(name); } });
[ "watch", "(", ".", "/", "{", "recursive", ":", "true", "filter", ":", "FILTER", "}", "function", "(", "evt", "name", ")", "{", "if", "(", "evt", "===", "update", ")", "{", "compileVueToRn", "(", "name", ")", ";", "}", "else", "if", "(", "evt", "=...
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-scripts/src/scripts/compiler.js#L48-L244
train
Compile a vue component to a RN file
[ 30522, 3853, 4012, 22090, 19722, 18903, 6826, 1006, 7692, 1007, 1063, 9530, 3367, 3642, 1027, 7692, 1012, 2000, 3367, 4892, 1006, 1007, 1025, 9530, 3367, 18133, 11650, 2098, 1027, 21624, 1012, 11968, 3366, 9006, 29513, 3372, 1006, 3642, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js
function (oTargetInfo, vData, oSequencePromise, oTargetCreateInfo) { var sName = oTargetInfo.name, oTarget = this.getTarget(sName); if (oTarget !== undefined) { return oTarget._display(vData, oSequencePromise, oTargetCreateInfo); } else { var sErrorMessage = "The target with the name \"" + sName + "\" does not exist!"; Log.error(sErrorMessage, this); return Promise.resolve({ name: sName, error: sErrorMessage }); } }
javascript
function (oTargetInfo, vData, oSequencePromise, oTargetCreateInfo) { var sName = oTargetInfo.name, oTarget = this.getTarget(sName); if (oTarget !== undefined) { return oTarget._display(vData, oSequencePromise, oTargetCreateInfo); } else { var sErrorMessage = "The target with the name \"" + sName + "\" does not exist!"; Log.error(sErrorMessage, this); return Promise.resolve({ name: sName, error: sErrorMessage }); } }
[ "function", "(", "oTargetInfo", ",", "vData", ",", "oSequencePromise", ",", "oTargetCreateInfo", ")", "{", "var", "sName", "=", "oTargetInfo", ".", "name", ",", "oTarget", "=", "this", ".", "getTarget", "(", "sName", ")", ";", "if", "(", "oTarget", "!==", ...
Displays a single target @param {string} sName name of the single target @param {any} vData an object that will be passed to the display event in the data property. @param {Promise} oSequencePromise the promise which for chaining @param {object} [oTargetCreateInfo] the object which contains extra information for the creation of the target @param {function} [oTargetCreateInfo.afterCreate] the function which is called after a target View/Component is instantiated @param {string} [oTargetCreateInfo.prefix] the prefix which will be used by the RouterHashChanger of the target @private
[ "Displays", "a", "single", "target" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js#L86-L100
train
Display the target
[ 30522, 3853, 1006, 27178, 2906, 18150, 2378, 14876, 1010, 1058, 2850, 2696, 1010, 9808, 2063, 4226, 5897, 21572, 28732, 1010, 27178, 2906, 18150, 16748, 3686, 2378, 14876, 1007, 1063, 13075, 1055, 18442, 1027, 27178, 2906, 18150, 2378, 14876,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/webdriver/logging.js
function(logRecord, opt_type) { return new Entry( normalizeLevel(/** @type {!Logger.Level} */(logRecord.getLevel())), '[' + logRecord.getLoggerName() + '] ' + logRecord.getMessage(), logRecord.getMillis(), opt_type); }
javascript
function(logRecord, opt_type) { return new Entry( normalizeLevel(/** @type {!Logger.Level} */(logRecord.getLevel())), '[' + logRecord.getLoggerName() + '] ' + logRecord.getMessage(), logRecord.getMillis(), opt_type); }
[ "function", "(", "logRecord", ",", "opt_type", ")", "{", "return", "new", "Entry", "(", "normalizeLevel", "(", "/** @type {!Logger.Level} */", "(", "logRecord", ".", "getLevel", "(", ")", ")", ")", ",", "'['", "+", "logRecord", ".", "getLoggerName", "(", ")"...
Converts a {@link goog.debug.LogRecord} into a {@link webdriver.logging.Entry}. @param {!LogRecord} logRecord The record to convert. @param {string=} opt_type The log type. @return {!Entry} The converted entry.
[ "Converts", "a", "{" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/webdriver/logging.js#L325-L331
train
Creates an entry from a log record
[ 30522, 3853, 1006, 8833, 2890, 27108, 2094, 1010, 23569, 1035, 2828, 1007, 1063, 2709, 2047, 4443, 1006, 3671, 4697, 20414, 2884, 1006, 1013, 1008, 1008, 1030, 2828, 1063, 999, 8833, 4590, 1012, 2504, 1065, 1008, 1013, 1006, 8833, 2890, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebaseui-web
javascript/widgets/handler/emaillinkconfirmation.js
function() { var email = component.checkAndGetEmail(); if (!email) { component.getEmailElement().focus(); return; } component.dispose(); onContinue(app, container, email, link); }
javascript
function() { var email = component.checkAndGetEmail(); if (!email) { component.getEmailElement().focus(); return; } component.dispose(); onContinue(app, container, email, link); }
[ "function", "(", ")", "{", "var", "email", "=", "component", ".", "checkAndGetEmail", "(", ")", ";", "if", "(", "!", "email", ")", "{", "component", ".", "getEmailElement", "(", ")", ".", "focus", "(", ")", ";", "return", ";", "}", "component", ".", ...
On email enter.
[ "On", "email", "enter", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/emaillinkconfirmation.js#L46-L54
train
This function is called when the user is trying to send an email to the user.
[ 30522, 3853, 1006, 1007, 1063, 13075, 10373, 1027, 6922, 1012, 4638, 5685, 18150, 14545, 4014, 1006, 1007, 1025, 2065, 1006, 999, 10373, 1007, 1063, 6922, 1012, 2131, 14545, 9463, 16930, 4765, 1006, 1007, 1012, 3579, 1006, 1007, 1025, 2709,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects) { var aRequiredContextParameters = []; aContextObjects.forEach(function (oContext) { oContext.parameters.forEach(function (oContextParameter) { var sSelector = oContextParameter.selector; if (aRequiredContextParameters.indexOf(sSelector) === -1) { aRequiredContextParameters.push(sSelector); } }); }); return this._oContext.getValue(aRequiredContextParameters); }
javascript
function (aContextObjects) { var aRequiredContextParameters = []; aContextObjects.forEach(function (oContext) { oContext.parameters.forEach(function (oContextParameter) { var sSelector = oContextParameter.selector; if (aRequiredContextParameters.indexOf(sSelector) === -1) { aRequiredContextParameters.push(sSelector); } }); }); return this._oContext.getValue(aRequiredContextParameters); }
[ "function", "(", "aContextObjects", ")", "{", "var", "aRequiredContextParameters", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "oContext", ".", "parameters", ".", "forEach", "(", "function", "(", "oContext...
Helper to retreive the context parameters from the instanciated context api @param {sap.ui.fl.Context[]} aContextObjects - context objects within the application @returns {Promise} aRuntimeContextParameters - Promise resolving with a map of context keys and their current values
[ "Helper", "to", "retreive", "the", "context", "parameters", "from", "the", "instanciated", "context", "api" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L78-L91
train
Returns the context value of the context object
[ 30522, 3853, 1006, 9353, 28040, 18413, 16429, 20614, 2015, 1007, 1063, 13075, 2024, 15549, 5596, 8663, 18209, 28689, 22828, 2015, 1027, 1031, 1033, 1025, 9353, 28040, 18413, 16429, 20614, 2015, 1012, 18921, 6776, 1006, 3853, 1006, 1051, 8663,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
docs/js/toc.js
maketoc
function maketoc(element, enableSections) { enableSections = (enableSections != null) ? enableSections : true; var tmp = crawlDom(document.body, 2, 4, [], 30, enableSections); if (tmp.childNodes.length > 0) { element.appendChild(tmp); } }
javascript
function maketoc(element, enableSections) { enableSections = (enableSections != null) ? enableSections : true; var tmp = crawlDom(document.body, 2, 4, [], 30, enableSections); if (tmp.childNodes.length > 0) { element.appendChild(tmp); } }
[ "function", "maketoc", "(", "element", ",", "enableSections", ")", "{", "enableSections", "=", "(", "enableSections", "!=", "null", ")", "?", "enableSections", ":", "true", ";", "var", "tmp", "=", "crawlDom", "(", "document", ".", "body", ",", "2", ",", ...
Creates a table of contents inside the given element.
[ "Creates", "a", "table", "of", "contents", "inside", "the", "given", "element", "." ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/docs/js/toc.js#L4-L13
train
Crawls the document and adds it to the DOM
[ 30522, 3853, 2191, 3406, 2278, 1006, 5783, 1010, 12939, 18491, 2015, 1007, 1063, 12939, 18491, 2015, 1027, 1006, 12939, 18491, 2015, 999, 1027, 19701, 1007, 1029, 12939, 18491, 2015, 1024, 2995, 1025, 13075, 1056, 8737, 1027, 13529, 9527, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
function() { // Pass processingMode to Fragments only if (oClass.getMetadata().isA("sap.ui.core.Fragment") && node.getAttribute("type") !== "JS" && oView._sProcessingMode === "sequential") { mSettings.processingMode = "sequential"; } if (oView.fnScopedRunWithOwner) { return oView.fnScopedRunWithOwner(function() { return new oClass(mSettings); }); } else { return new oClass(mSettings); } }
javascript
function() { // Pass processingMode to Fragments only if (oClass.getMetadata().isA("sap.ui.core.Fragment") && node.getAttribute("type") !== "JS" && oView._sProcessingMode === "sequential") { mSettings.processingMode = "sequential"; } if (oView.fnScopedRunWithOwner) { return oView.fnScopedRunWithOwner(function() { return new oClass(mSettings); }); } else { return new oClass(mSettings); } }
[ "function", "(", ")", "{", "// Pass processingMode to Fragments only", "if", "(", "oClass", ".", "getMetadata", "(", ")", ".", "isA", "(", "\"sap.ui.core.Fragment\"", ")", "&&", "node", ".", "getAttribute", "(", "\"type\"", ")", "!==", "\"JS\"", "&&", "oView", ...
call the control constructor with the according owner in scope
[ "call", "the", "control", "constructor", "with", "the", "according", "owner", "in", "scope" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L927-L939
train
Creates a new instance of the class
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 3413, 6364, 5302, 3207, 2000, 10341, 2069, 2065, 1006, 1051, 26266, 1012, 2131, 11368, 8447, 2696, 1006, 1007, 1012, 18061, 1006, 1000, 20066, 1012, 21318, 1012, 4563, 1012, 15778, 1000, 1007, 1004...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/filesystem/FileSystemEntry.js
compareFilesWithIndices
function compareFilesWithIndices(index1, index2) { return entries[index1]._name.toLocaleLowerCase().localeCompare(entries[index2]._name.toLocaleLowerCase()); }
javascript
function compareFilesWithIndices(index1, index2) { return entries[index1]._name.toLocaleLowerCase().localeCompare(entries[index2]._name.toLocaleLowerCase()); }
[ "function", "compareFilesWithIndices", "(", "index1", ",", "index2", ")", "{", "return", "entries", "[", "index1", "]", ".", "_name", ".", "toLocaleLowerCase", "(", ")", ".", "localeCompare", "(", "entries", "[", "index2", "]", ".", "_name", ".", "toLocaleLo...
sort entries if required
[ "sort", "entries", "if", "required" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/FileSystemEntry.js#L510-L512
train
Compare files with indices
[ 30522, 3853, 12826, 8873, 4244, 24415, 22254, 23522, 1006, 5950, 2487, 1010, 5950, 2475, 1007, 1063, 2709, 10445, 1031, 5950, 2487, 1033, 1012, 1035, 2171, 1012, 2000, 4135, 9289, 18349, 13777, 18382, 1006, 1007, 1012, 2334, 8586, 25377, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
statsd/statsd
backends/graphite.js
Stats
function Stats() { var s = this; this.metrics = []; this.add = function(key, value, ts) { s.metrics.push(new Metric(key, value, ts)); }; this.toText = function() { return s.metrics.map(function(m) { return m.toText(); }).join('\n') + '\n'; }; this.toPickle = function() { var body = MARK + LIST + s.metrics.map(function(m) { return m.toPickle(); }).join('') + STOP; // The first four bytes of the graphite pickle format // contain the length of the rest of the payload. // We use Buffer because this is binary data. var buf = new Buffer(4 + body.length); buf.writeUInt32BE(body.length,0); buf.write(body,4); return buf; }; }
javascript
function Stats() { var s = this; this.metrics = []; this.add = function(key, value, ts) { s.metrics.push(new Metric(key, value, ts)); }; this.toText = function() { return s.metrics.map(function(m) { return m.toText(); }).join('\n') + '\n'; }; this.toPickle = function() { var body = MARK + LIST + s.metrics.map(function(m) { return m.toPickle(); }).join('') + STOP; // The first four bytes of the graphite pickle format // contain the length of the rest of the payload. // We use Buffer because this is binary data. var buf = new Buffer(4 + body.length); buf.writeUInt32BE(body.length,0); buf.write(body,4); return buf; }; }
[ "function", "Stats", "(", ")", "{", "var", "s", "=", "this", ";", "this", ".", "metrics", "=", "[", "]", ";", "this", ".", "add", "=", "function", "(", "key", ",", "value", ",", "ts", ")", "{", "s", ".", "metrics", ".", "push", "(", "new", "M...
A collection of measurements for sending to graphite.
[ "A", "collection", "of", "measurements", "for", "sending", "to", "graphite", "." ]
ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9
https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/backends/graphite.js#L124-L148
train
Stats object.
[ 30522, 3853, 26319, 1006, 1007, 1063, 13075, 1055, 1027, 2023, 1025, 2023, 1012, 12046, 2015, 1027, 1031, 1033, 1025, 2023, 1012, 5587, 1027, 3853, 1006, 3145, 1010, 3643, 1010, 24529, 1007, 1063, 1055, 1012, 12046, 2015, 1012, 5245, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-fallthrough.js
hasBlankLinesBetween
function hasBlankLinesBetween(node, token) { return token.loc.start.line > node.loc.end.line + 1; }
javascript
function hasBlankLinesBetween(node, token) { return token.loc.start.line > node.loc.end.line + 1; }
[ "function", "hasBlankLinesBetween", "(", "node", ",", "token", ")", "{", "return", "token", ".", "loc", ".", "start", ".", "line", ">", "node", ".", "loc", ".", "end", ".", "line", "+", "1", ";", "}" ]
Checks whether a node and a token are separated by blank lines @param {ASTNode} node - The node to check @param {Token} token - The token to compare against @returns {boolean} `true` if there are blank lines between node and token
[ "Checks", "whether", "a", "node", "and", "a", "token", "are", "separated", "by", "blank", "lines" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-fallthrough.js#L48-L50
train
Returns true if the given token is a blank line between the node and the token.
[ 30522, 3853, 2038, 28522, 8950, 12735, 20915, 28394, 2078, 1006, 13045, 1010, 19204, 1007, 1063, 2709, 19204, 1012, 8840, 2278, 1012, 2707, 1012, 2240, 1028, 13045, 1012, 8840, 2278, 1012, 2203, 1012, 2240, 1009, 1015, 1025, 1065, 102, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/tabs/js/tabsController.js
updateHeightFromContent
function updateHeightFromContent () { if (!ctrl.dynamicHeight) return $element.css('height', ''); if (!ctrl.tabs.length) return queue.push(updateHeightFromContent); var elements = getElements(); var tabContent = elements.contents[ ctrl.selectedIndex ], contentHeight = tabContent ? tabContent.offsetHeight : 0, tabsHeight = elements.wrapper.offsetHeight, newHeight = contentHeight + tabsHeight, currentHeight = $element.prop('clientHeight'); if (currentHeight === newHeight) return; // Adjusts calculations for when the buttons are bottom-aligned since this relies on absolute // positioning. This should probably be cleaned up if a cleaner solution is possible. if ($element.attr('md-align-tabs') === 'bottom') { currentHeight -= tabsHeight; newHeight -= tabsHeight; // Need to include bottom border in these calculations if ($element.attr('md-border-bottom') !== undefined) { ++currentHeight; } } // Lock during animation so the user can't change tabs locked = true; var fromHeight = { height: currentHeight + 'px' }, toHeight = { height: newHeight + 'px' }; // Set the height to the current, specific pixel height to fix a bug on iOS where the height // first animates to 0, then back to the proper height causing a visual glitch $element.css(fromHeight); // Animate the height from the old to the new $animateCss($element, { from: fromHeight, to: toHeight, easing: 'cubic-bezier(0.35, 0, 0.25, 1)', duration: 0.5 }).start().done(function () { // Then (to fix the same iOS issue as above), disable transitions and remove the specific // pixel height so the height can size with browser width/content changes, etc. $element.css({ transition: 'none', height: '' }); // In the next tick, re-allow transitions (if we do it all at once, $element.css is "smart" // enough to batch it for us instead of doing it immediately, which undoes the original // transition: none) $mdUtil.nextTick(function() { $element.css('transition', ''); }); // And unlock so tab changes can occur locked = false; }); }
javascript
function updateHeightFromContent () { if (!ctrl.dynamicHeight) return $element.css('height', ''); if (!ctrl.tabs.length) return queue.push(updateHeightFromContent); var elements = getElements(); var tabContent = elements.contents[ ctrl.selectedIndex ], contentHeight = tabContent ? tabContent.offsetHeight : 0, tabsHeight = elements.wrapper.offsetHeight, newHeight = contentHeight + tabsHeight, currentHeight = $element.prop('clientHeight'); if (currentHeight === newHeight) return; // Adjusts calculations for when the buttons are bottom-aligned since this relies on absolute // positioning. This should probably be cleaned up if a cleaner solution is possible. if ($element.attr('md-align-tabs') === 'bottom') { currentHeight -= tabsHeight; newHeight -= tabsHeight; // Need to include bottom border in these calculations if ($element.attr('md-border-bottom') !== undefined) { ++currentHeight; } } // Lock during animation so the user can't change tabs locked = true; var fromHeight = { height: currentHeight + 'px' }, toHeight = { height: newHeight + 'px' }; // Set the height to the current, specific pixel height to fix a bug on iOS where the height // first animates to 0, then back to the proper height causing a visual glitch $element.css(fromHeight); // Animate the height from the old to the new $animateCss($element, { from: fromHeight, to: toHeight, easing: 'cubic-bezier(0.35, 0, 0.25, 1)', duration: 0.5 }).start().done(function () { // Then (to fix the same iOS issue as above), disable transitions and remove the specific // pixel height so the height can size with browser width/content changes, etc. $element.css({ transition: 'none', height: '' }); // In the next tick, re-allow transitions (if we do it all at once, $element.css is "smart" // enough to batch it for us instead of doing it immediately, which undoes the original // transition: none) $mdUtil.nextTick(function() { $element.css('transition', ''); }); // And unlock so tab changes can occur locked = false; }); }
[ "function", "updateHeightFromContent", "(", ")", "{", "if", "(", "!", "ctrl", ".", "dynamicHeight", ")", "return", "$element", ".", "css", "(", "'height'", ",", "''", ")", ";", "if", "(", "!", "ctrl", ".", "tabs", ".", "length", ")", "return", "queue",...
Calculates the content height of the current tab. @returns {*}
[ "Calculates", "the", "content", "height", "of", "the", "current", "tab", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L792-L851
train
Updates the height of the tab s content based on the current height of the tabs.
[ 30522, 3853, 10651, 26036, 13900, 19699, 5358, 8663, 6528, 2102, 1006, 1007, 1063, 2065, 1006, 999, 14931, 12190, 1012, 8790, 26036, 13900, 1007, 2709, 1002, 5783, 1012, 20116, 2015, 1006, 1005, 4578, 1005, 1010, 1005, 1005, 1007, 1025, 206...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
zeit/pkg
prelude/bootstrap.js
accessFromSnapshot
function accessFromSnapshot (path_, cb) { var cb2 = cb || rethrow; var path = normalizePath(path_); // console.log("accessFromSnapshot", path); var entity = VIRTUAL_FILESYSTEM[path]; if (!entity) return cb2(error_ENOENT('File or directory', path)); return cb2(null, undefined); }
javascript
function accessFromSnapshot (path_, cb) { var cb2 = cb || rethrow; var path = normalizePath(path_); // console.log("accessFromSnapshot", path); var entity = VIRTUAL_FILESYSTEM[path]; if (!entity) return cb2(error_ENOENT('File or directory', path)); return cb2(null, undefined); }
[ "function", "accessFromSnapshot", "(", "path_", ",", "cb", ")", "{", "var", "cb2", "=", "cb", "||", "rethrow", ";", "var", "path", "=", "normalizePath", "(", "path_", ")", ";", "// console.log(\"accessFromSnapshot\", path);", "var", "entity", "=", "VIRTUAL_FILES...
/////////////////////////////////////////////////////////////// access //////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
[ "///////////////////////////////////////////////////////////////", "access", "////////////////////////////////////////////////////////", "///////////////////////////////////////////////////////////////" ]
3775ab6decc2f8f013142e1282934c12fbd1881e
https://github.com/zeit/pkg/blob/3775ab6decc2f8f013142e1282934c12fbd1881e/prelude/bootstrap.js#L1044-L1051
train
accessFromSnapshot - Get the VIRTUAL_FILESYSTEM entity for a given path
[ 30522, 3853, 3229, 19699, 22225, 2532, 4523, 12326, 1006, 4130, 1035, 1010, 17324, 1007, 1063, 13075, 17324, 2475, 1027, 17324, 1064, 1064, 2128, 2705, 10524, 1025, 13075, 4130, 1027, 3671, 4697, 15069, 1006, 4130, 1035, 1007, 1025, 1013, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/ui5loader.js
requireModule
function requireModule(oRequestingModule, sModuleName, bAsync, bSkipShimDeps) { var bLoggable = log.isLoggable(), oSplitName = urnToBaseIDAndSubType(sModuleName), oShim = mShims[sModuleName], oModule, aExtensions, i, sMsg, bExecutedNow; // only for robustness, should not be possible by design (all callers append '.js') if ( !oSplitName ) { throw new Error("can only require Javascript module, not " + sModuleName); } // Module names should not start with a "/" if (sModuleName[0] == "/") { log.error("Module names that start with a slash should not be used, as they are reserved for future use."); } oModule = Module.get(sModuleName); // when there's a shim with dependencies for the module // resolve them first before requiring the module again with bSkipShimDeps = true if ( oShim && oShim.deps && !bSkipShimDeps ) { if ( bLoggable ) { log.debug("require dependencies of raw module " + sModuleName); } return requireAll(oModule, oShim.deps, function() { return requireModule(oRequestingModule, sModuleName, bAsync, /* bSkipShimDeps = */ true); }, function(oErr) { oModule.fail(oErr); if ( bAsync ) { return; } throw oErr; }, bAsync); } if ( bLoggable ) { log.debug(sLogPrefix + "require '" + sModuleName + "' of type '" + oSplitName.subType + "'"); } // check if module has been loaded already if ( oModule.state !== INITIAL ) { if ( oModule.state === PRELOADED ) { oModule.state = LOADED; oModule.async = bAsync; bExecutedNow = true; measure && measure.start(sModuleName, "Require module " + sModuleName + " (preloaded)", ["require"]); execModule(sModuleName, bAsync); measure && measure.end(sModuleName); } if ( oModule.state === READY ) { if ( bLoggable ) { log.debug(sLogPrefix + "module '" + sModuleName + "' has already been loaded (skipped)."); } // Note: this intentionally does not return oModule.promise() as the export might be temporary in case of cycles // or it might have changed after repeated module execution return bAsync ? Promise.resolve(oModule.value()) : oModule.value(); } else if ( oModule.state === FAILED ) { if ( bAsync ) { return oModule.deferred().promise; } else { throw (bExecutedNow ? oModule.error : makeNestedError("found in negative cache: '" + sModuleName + "' from " + oModule.url, oModule.error)); } } else { // currently loading or executing if ( bAsync ) { // break up cyclic dependencies if ( oRequestingModule && oModule.dependsOn(oRequestingModule) ) { if ( log.isLoggable() ) { log.debug("cycle detected between '" + oRequestingModule.name + "' and '" + sModuleName + "', returning undefined for '" + sModuleName + "'"); } // Note: this must be a separate promise as the fulfillment is not the final one return Promise.resolve(undefined); } return oModule.deferred().promise; } if ( !bAsync && !oModule.async ) { // sync pending, return undefined if ( log.isLoggable() ) { log.debug("cycle detected between '" + (oRequestingModule ? oRequestingModule.name : "unknown") + "' and '" + sModuleName + "', returning undefined for '" + sModuleName + "'"); } return undefined; } // async pending, load sync again log.warning("Sync request triggered for '" + sModuleName + "' while async request was already pending." + " Loading a module twice might cause issues and should be avoided by fully migrating to async APIs."); } } measure && measure.start(sModuleName, "Require module " + sModuleName, ["require"]); // set marker for loading modules (to break cycles) oModule.state = LOADING; oModule.async = bAsync; // if debug is enabled, try to load debug module first aExtensions = bDebugSources ? ["-dbg", ""] : [""]; if ( !bAsync ) { for (i = 0; i < aExtensions.length && oModule.state !== LOADED; i++) { // create module URL for the current extension oModule.url = getResourcePath(oSplitName.baseID, aExtensions[i] + oSplitName.subType); if ( bLoggable ) { log.debug(sLogPrefix + "loading " + (aExtensions[i] ? aExtensions[i] + " version of " : "") + "'" + sModuleName + "' from '" + oModule.url + "'"); } if ( syncCallBehavior ) { sMsg = "[nosync] loading module '" + oModule.url + "'"; if ( syncCallBehavior === 1 ) { log.error(sMsg); } else { throw new Error(sMsg); } } // call notification hook ui5Require.load({ completeLoad:noop, async: false }, oModule.url, oSplitName.baseID); loadSyncXHR(oModule); } if ( oModule.state === LOADING ) { // transition to FAILED oModule.fail( makeNestedError("failed to load '" + sModuleName + "' from " + oModule.url, oModule.error)); } else if ( oModule.state === LOADED ) { // execute module __after__ loading it, this reduces the required stack space! execModule(sModuleName, bAsync); } measure && measure.end(sModuleName); if ( oModule.state !== READY ) { // loading or executing failed for some reason, load again as script for better error reporting // (but without further eventing) if ( fnIgnorePreload ) { loadScript(oModule); } throw oModule.error; } return oModule.value(); } else { oModule.url = getResourcePath(oSplitName.baseID, aExtensions[0] + oSplitName.subType); // in debug mode, fall back to the non-dbg source, otherwise try the same source again (for SSO re-connect) var sAltUrl = bDebugSources ? getResourcePath(oSplitName.baseID, aExtensions[1] + oSplitName.subType) : oModule.url; // call notification hook only once ui5Require.load({ completeLoad:noop, async: true }, sAltUrl, oSplitName.baseID); loadScript(oModule, /* sAlternativeURL= */ sAltUrl); // process dep cache info preloadDependencies(sModuleName); return oModule.deferred().promise; } }
javascript
function requireModule(oRequestingModule, sModuleName, bAsync, bSkipShimDeps) { var bLoggable = log.isLoggable(), oSplitName = urnToBaseIDAndSubType(sModuleName), oShim = mShims[sModuleName], oModule, aExtensions, i, sMsg, bExecutedNow; // only for robustness, should not be possible by design (all callers append '.js') if ( !oSplitName ) { throw new Error("can only require Javascript module, not " + sModuleName); } // Module names should not start with a "/" if (sModuleName[0] == "/") { log.error("Module names that start with a slash should not be used, as they are reserved for future use."); } oModule = Module.get(sModuleName); // when there's a shim with dependencies for the module // resolve them first before requiring the module again with bSkipShimDeps = true if ( oShim && oShim.deps && !bSkipShimDeps ) { if ( bLoggable ) { log.debug("require dependencies of raw module " + sModuleName); } return requireAll(oModule, oShim.deps, function() { return requireModule(oRequestingModule, sModuleName, bAsync, /* bSkipShimDeps = */ true); }, function(oErr) { oModule.fail(oErr); if ( bAsync ) { return; } throw oErr; }, bAsync); } if ( bLoggable ) { log.debug(sLogPrefix + "require '" + sModuleName + "' of type '" + oSplitName.subType + "'"); } // check if module has been loaded already if ( oModule.state !== INITIAL ) { if ( oModule.state === PRELOADED ) { oModule.state = LOADED; oModule.async = bAsync; bExecutedNow = true; measure && measure.start(sModuleName, "Require module " + sModuleName + " (preloaded)", ["require"]); execModule(sModuleName, bAsync); measure && measure.end(sModuleName); } if ( oModule.state === READY ) { if ( bLoggable ) { log.debug(sLogPrefix + "module '" + sModuleName + "' has already been loaded (skipped)."); } // Note: this intentionally does not return oModule.promise() as the export might be temporary in case of cycles // or it might have changed after repeated module execution return bAsync ? Promise.resolve(oModule.value()) : oModule.value(); } else if ( oModule.state === FAILED ) { if ( bAsync ) { return oModule.deferred().promise; } else { throw (bExecutedNow ? oModule.error : makeNestedError("found in negative cache: '" + sModuleName + "' from " + oModule.url, oModule.error)); } } else { // currently loading or executing if ( bAsync ) { // break up cyclic dependencies if ( oRequestingModule && oModule.dependsOn(oRequestingModule) ) { if ( log.isLoggable() ) { log.debug("cycle detected between '" + oRequestingModule.name + "' and '" + sModuleName + "', returning undefined for '" + sModuleName + "'"); } // Note: this must be a separate promise as the fulfillment is not the final one return Promise.resolve(undefined); } return oModule.deferred().promise; } if ( !bAsync && !oModule.async ) { // sync pending, return undefined if ( log.isLoggable() ) { log.debug("cycle detected between '" + (oRequestingModule ? oRequestingModule.name : "unknown") + "' and '" + sModuleName + "', returning undefined for '" + sModuleName + "'"); } return undefined; } // async pending, load sync again log.warning("Sync request triggered for '" + sModuleName + "' while async request was already pending." + " Loading a module twice might cause issues and should be avoided by fully migrating to async APIs."); } } measure && measure.start(sModuleName, "Require module " + sModuleName, ["require"]); // set marker for loading modules (to break cycles) oModule.state = LOADING; oModule.async = bAsync; // if debug is enabled, try to load debug module first aExtensions = bDebugSources ? ["-dbg", ""] : [""]; if ( !bAsync ) { for (i = 0; i < aExtensions.length && oModule.state !== LOADED; i++) { // create module URL for the current extension oModule.url = getResourcePath(oSplitName.baseID, aExtensions[i] + oSplitName.subType); if ( bLoggable ) { log.debug(sLogPrefix + "loading " + (aExtensions[i] ? aExtensions[i] + " version of " : "") + "'" + sModuleName + "' from '" + oModule.url + "'"); } if ( syncCallBehavior ) { sMsg = "[nosync] loading module '" + oModule.url + "'"; if ( syncCallBehavior === 1 ) { log.error(sMsg); } else { throw new Error(sMsg); } } // call notification hook ui5Require.load({ completeLoad:noop, async: false }, oModule.url, oSplitName.baseID); loadSyncXHR(oModule); } if ( oModule.state === LOADING ) { // transition to FAILED oModule.fail( makeNestedError("failed to load '" + sModuleName + "' from " + oModule.url, oModule.error)); } else if ( oModule.state === LOADED ) { // execute module __after__ loading it, this reduces the required stack space! execModule(sModuleName, bAsync); } measure && measure.end(sModuleName); if ( oModule.state !== READY ) { // loading or executing failed for some reason, load again as script for better error reporting // (but without further eventing) if ( fnIgnorePreload ) { loadScript(oModule); } throw oModule.error; } return oModule.value(); } else { oModule.url = getResourcePath(oSplitName.baseID, aExtensions[0] + oSplitName.subType); // in debug mode, fall back to the non-dbg source, otherwise try the same source again (for SSO re-connect) var sAltUrl = bDebugSources ? getResourcePath(oSplitName.baseID, aExtensions[1] + oSplitName.subType) : oModule.url; // call notification hook only once ui5Require.load({ completeLoad:noop, async: true }, sAltUrl, oSplitName.baseID); loadScript(oModule, /* sAlternativeURL= */ sAltUrl); // process dep cache info preloadDependencies(sModuleName); return oModule.deferred().promise; } }
[ "function", "requireModule", "(", "oRequestingModule", ",", "sModuleName", ",", "bAsync", ",", "bSkipShimDeps", ")", "{", "var", "bLoggable", "=", "log", ".", "isLoggable", "(", ")", ",", "oSplitName", "=", "urnToBaseIDAndSubType", "(", "sModuleName", ")", ",", ...
Loads the given module if needed and returns the module export or a promise on it. If loading is still ongoing for the requested module and if there is a cycle detected between the requesting module and the module to be loaded, then <code>undefined</code> (or a promise on <code>undefined</code>) will be returned as intermediate module export to resolve the cycle. @param {Module} oRequestingModule The module in whose context the new module has to be loaded; this is needed to detect cycles @param {string} sModuleName Name of the module to be loaded, in URN form and with '.js' extension @param {boolean} bAsync Whether the operation can be executed asynchronously @param {boolean} bSkipShimDeps Whether shim dependencies should be ignored @returns {any|Promise} Returns the module export in sync mode or a promise on it in async mode @throws {Error} When loading failed in sync mode @private
[ "Loads", "the", "given", "module", "if", "needed", "and", "returns", "the", "module", "export", "or", "a", "promise", "on", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L1278-L1438
train
require module
[ 30522, 3853, 5478, 5302, 8566, 2571, 1006, 10848, 15500, 2075, 5302, 8566, 2571, 1010, 15488, 7716, 9307, 18442, 1010, 19021, 6038, 2278, 1010, 18667, 3211, 4523, 14341, 3207, 4523, 1007, 1063, 13075, 9927, 3654, 3468, 1027, 8833, 1012, 200...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/toolbars.js
locationBar_toggleAutocompletePopup
function locationBar_toggleAutocompletePopup() { var dropdown = this.getElement({type: "historyDropMarker"}); var stateOpen = this.autoCompleteResults.isOpened; this._controller.click(dropdown); this._controller.waitForEval("subject.isOpened == " + stateOpen, TIMEOUT, 100, this.autoCompleteResults); }
javascript
function locationBar_toggleAutocompletePopup() { var dropdown = this.getElement({type: "historyDropMarker"}); var stateOpen = this.autoCompleteResults.isOpened; this._controller.click(dropdown); this._controller.waitForEval("subject.isOpened == " + stateOpen, TIMEOUT, 100, this.autoCompleteResults); }
[ "function", "locationBar_toggleAutocompletePopup", "(", ")", "{", "var", "dropdown", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"historyDropMarker\"", "}", ")", ";", "var", "stateOpen", "=", "this", ".", "autoCompleteResults", ".", "isOpened", ";",...
Toggles between the open and closed state of the auto-complete popup
[ "Toggles", "between", "the", "open", "and", "closed", "state", "of", "the", "auto", "-", "complete", "popup" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L474-L481
train
Toggle autocomplete popup
[ 30522, 3853, 3295, 8237, 1035, 2000, 24679, 4887, 3406, 9006, 10814, 2618, 16340, 6279, 1006, 1007, 1063, 13075, 4530, 7698, 1027, 2023, 1012, 2131, 12260, 3672, 1006, 1063, 2828, 1024, 1000, 2381, 25711, 10665, 2121, 1000, 1065, 1007, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/chips/js/chipsDirective.js
MdChips
function MdChips ($mdTheming, $mdUtil, $compile, $log, $timeout, $$mdSvgRegistry) { // Run our templates through $mdUtil.processTemplate() to allow custom start/end symbols var templates = getTemplates(); return { template: function(element, attrs) { // Clone the element into an attribute. By prepending the attribute // name with '$', AngularJS won't write it into the DOM. The cloned // element propagates to the link function via the attrs argument, // where various contained-elements can be consumed. attrs['$mdUserTemplate'] = element.clone(); return templates.chips; }, require: ['mdChips'], restrict: 'E', controller: 'MdChipsCtrl', controllerAs: '$mdChipsCtrl', bindToController: true, compile: compile, scope: { readonly: '=?readonly', removable: '=?mdRemovable', placeholder: '@?', secondaryPlaceholder: '@?', maxChips: '@?mdMaxChips', transformChip: '&mdTransformChip', onAppend: '&?mdOnAppend', onAdd: '&?mdOnAdd', onRemove: '&?mdOnRemove', addedMessage: '@?mdAddedMessage', removedMessage: '@?mdRemovedMessage', onSelect: '&?mdOnSelect', inputAriaDescribedBy: '@?inputAriaDescribedby', inputAriaLabelledBy: '@?inputAriaLabelledby', inputAriaLabel: '@?', containerHint: '@?', containerEmptyHint: '@?', deleteHint: '@?', deleteButtonLabel: '@?', separatorKeys: '=?mdSeparatorKeys', requireMatch: '=?mdRequireMatch', chipAppendDelayString: '@?mdChipAppendDelay', ngChange: '&?' } }; /** * Builds the final template for `md-chips` and returns the postLink function. * * Building the template involves 3 key components: * static chips * chip template * input control * * If no `ng-model` is provided, only the static chip work needs to be done. * * If no user-passed `md-chip-template` exists, the default template is used. This resulting * template is appended to the chip content element. * * The remove button may be overridden by passing an element with an md-chip-remove attribute. * * If an `input` or `md-autocomplete` element is provided by the caller, it is set aside for * transclusion later. The transclusion happens in `postLink` as the parent scope is required. * If no user input is provided, a default one is appended to the input container node in the * template. * * Static Chips (i.e. `md-chip` elements passed from the caller) are gathered and set aside for * transclusion in the `postLink` function. * * * @param element * @param attr * @returns {Function} */ function compile(element, attr) { // Grab the user template from attr and reset the attribute to null. var userTemplate = attr['$mdUserTemplate']; attr['$mdUserTemplate'] = null; var chipTemplate = getTemplateByQuery('md-chips>md-chip-template'); var chipRemoveSelector = $mdUtil .prefixer() .buildList('md-chip-remove') .map(function(attr) { return 'md-chips>*[' + attr + ']'; }) .join(','); // Set the chip remove, chip contents and chip input templates. The link function will put // them on the scope for transclusion later. var chipRemoveTemplate = getTemplateByQuery(chipRemoveSelector) || templates.remove, chipContentsTemplate = chipTemplate || templates.default, chipInputTemplate = getTemplateByQuery('md-chips>md-autocomplete') || getTemplateByQuery('md-chips>input') || templates.input, staticChips = userTemplate.find('md-chip'); // Warn of malformed template. See #2545 if (userTemplate[0].querySelector('md-chip-template>*[md-chip-remove]')) { $log.warn('invalid placement of md-chip-remove within md-chip-template.'); } function getTemplateByQuery (query) { if (!attr.ngModel) return; var element = userTemplate[0].querySelector(query); return element && element.outerHTML; } /** * Configures controller and transcludes. */ return function postLink(scope, element, attrs, controllers) { $mdUtil.initOptionalProperties(scope, attr); $mdTheming(element); var mdChipsCtrl = controllers[0]; if (chipTemplate) { // Chip editing functionality assumes we are using the default chip template. mdChipsCtrl.enableChipEdit = false; } mdChipsCtrl.chipContentsTemplate = chipContentsTemplate; mdChipsCtrl.chipRemoveTemplate = chipRemoveTemplate; mdChipsCtrl.chipInputTemplate = chipInputTemplate; mdChipsCtrl.mdCloseIcon = $$mdSvgRegistry.mdClose; element .attr({ tabindex: -1 }) .on('focus', function () { mdChipsCtrl.onFocus(); }) .on('click', function () { if (!mdChipsCtrl.readonly && mdChipsCtrl.selectedChip === -1) { mdChipsCtrl.onFocus(); } }); if (attr.ngModel) { mdChipsCtrl.configureNgModel(element.controller('ngModel')); // If an `md-transform-chip` attribute was set, tell the controller to use the expression // before appending chips. if (attrs.mdTransformChip) mdChipsCtrl.useTransformChipExpression(); // If an `md-on-append` attribute was set, tell the controller to use the expression // when appending chips. // // TODO: Remove this now that 1.0 is long since released // DEPRECATED: Will remove in official 1.0 release if (attrs.mdOnAppend) mdChipsCtrl.useOnAppendExpression(); // If an `md-on-add` attribute was set, tell the controller to use the expression // when adding chips. if (attrs.mdOnAdd) mdChipsCtrl.useOnAddExpression(); // If an `md-on-remove` attribute was set, tell the controller to use the expression // when removing chips. if (attrs.mdOnRemove) mdChipsCtrl.useOnRemoveExpression(); // If an `md-on-select` attribute was set, tell the controller to use the expression // when selecting chips. if (attrs.mdOnSelect) mdChipsCtrl.useOnSelectExpression(); // The md-autocomplete and input elements won't be compiled until after this directive // is complete (due to their nested nature). Wait a tick before looking for them to // configure the controller. if (chipInputTemplate !== templates.input) { // The autocomplete will not appear until the readonly attribute is not true (i.e. // false or undefined), so we have to watch the readonly and then on the next tick // after the chip transclusion has run, we can configure the autocomplete and user // input. scope.$watch('$mdChipsCtrl.readonly', function(readonly) { if (!readonly) { $mdUtil.nextTick(function(){ if (chipInputTemplate.indexOf('<md-autocomplete') === 0) { var autocompleteEl = element.find('md-autocomplete'); mdChipsCtrl.configureAutocomplete(autocompleteEl.controller('mdAutocomplete')); } mdChipsCtrl.configureUserInput(element.find('input')); }); } }); } // At the next tick, if we find an input, make sure it has the md-input class $mdUtil.nextTick(function() { var input = element.find('input'); if (input) { mdChipsCtrl.configureInput(input); input.toggleClass('md-input', true); } }); } // Compile with the parent's scope and prepend any static chips to the wrapper. if (staticChips.length > 0) { var compiledStaticChips = $compile(staticChips.clone())(scope.$parent); $timeout(function() { element.find('md-chips-wrap').prepend(compiledStaticChips); }); } }; } function getTemplates() { return { chips: $mdUtil.processTemplate(MD_CHIPS_TEMPLATE), input: $mdUtil.processTemplate(CHIP_INPUT_TEMPLATE), default: $mdUtil.processTemplate(CHIP_DEFAULT_TEMPLATE), remove: $mdUtil.processTemplate(CHIP_REMOVE_TEMPLATE) }; } }
javascript
function MdChips ($mdTheming, $mdUtil, $compile, $log, $timeout, $$mdSvgRegistry) { // Run our templates through $mdUtil.processTemplate() to allow custom start/end symbols var templates = getTemplates(); return { template: function(element, attrs) { // Clone the element into an attribute. By prepending the attribute // name with '$', AngularJS won't write it into the DOM. The cloned // element propagates to the link function via the attrs argument, // where various contained-elements can be consumed. attrs['$mdUserTemplate'] = element.clone(); return templates.chips; }, require: ['mdChips'], restrict: 'E', controller: 'MdChipsCtrl', controllerAs: '$mdChipsCtrl', bindToController: true, compile: compile, scope: { readonly: '=?readonly', removable: '=?mdRemovable', placeholder: '@?', secondaryPlaceholder: '@?', maxChips: '@?mdMaxChips', transformChip: '&mdTransformChip', onAppend: '&?mdOnAppend', onAdd: '&?mdOnAdd', onRemove: '&?mdOnRemove', addedMessage: '@?mdAddedMessage', removedMessage: '@?mdRemovedMessage', onSelect: '&?mdOnSelect', inputAriaDescribedBy: '@?inputAriaDescribedby', inputAriaLabelledBy: '@?inputAriaLabelledby', inputAriaLabel: '@?', containerHint: '@?', containerEmptyHint: '@?', deleteHint: '@?', deleteButtonLabel: '@?', separatorKeys: '=?mdSeparatorKeys', requireMatch: '=?mdRequireMatch', chipAppendDelayString: '@?mdChipAppendDelay', ngChange: '&?' } }; /** * Builds the final template for `md-chips` and returns the postLink function. * * Building the template involves 3 key components: * static chips * chip template * input control * * If no `ng-model` is provided, only the static chip work needs to be done. * * If no user-passed `md-chip-template` exists, the default template is used. This resulting * template is appended to the chip content element. * * The remove button may be overridden by passing an element with an md-chip-remove attribute. * * If an `input` or `md-autocomplete` element is provided by the caller, it is set aside for * transclusion later. The transclusion happens in `postLink` as the parent scope is required. * If no user input is provided, a default one is appended to the input container node in the * template. * * Static Chips (i.e. `md-chip` elements passed from the caller) are gathered and set aside for * transclusion in the `postLink` function. * * * @param element * @param attr * @returns {Function} */ function compile(element, attr) { // Grab the user template from attr and reset the attribute to null. var userTemplate = attr['$mdUserTemplate']; attr['$mdUserTemplate'] = null; var chipTemplate = getTemplateByQuery('md-chips>md-chip-template'); var chipRemoveSelector = $mdUtil .prefixer() .buildList('md-chip-remove') .map(function(attr) { return 'md-chips>*[' + attr + ']'; }) .join(','); // Set the chip remove, chip contents and chip input templates. The link function will put // them on the scope for transclusion later. var chipRemoveTemplate = getTemplateByQuery(chipRemoveSelector) || templates.remove, chipContentsTemplate = chipTemplate || templates.default, chipInputTemplate = getTemplateByQuery('md-chips>md-autocomplete') || getTemplateByQuery('md-chips>input') || templates.input, staticChips = userTemplate.find('md-chip'); // Warn of malformed template. See #2545 if (userTemplate[0].querySelector('md-chip-template>*[md-chip-remove]')) { $log.warn('invalid placement of md-chip-remove within md-chip-template.'); } function getTemplateByQuery (query) { if (!attr.ngModel) return; var element = userTemplate[0].querySelector(query); return element && element.outerHTML; } /** * Configures controller and transcludes. */ return function postLink(scope, element, attrs, controllers) { $mdUtil.initOptionalProperties(scope, attr); $mdTheming(element); var mdChipsCtrl = controllers[0]; if (chipTemplate) { // Chip editing functionality assumes we are using the default chip template. mdChipsCtrl.enableChipEdit = false; } mdChipsCtrl.chipContentsTemplate = chipContentsTemplate; mdChipsCtrl.chipRemoveTemplate = chipRemoveTemplate; mdChipsCtrl.chipInputTemplate = chipInputTemplate; mdChipsCtrl.mdCloseIcon = $$mdSvgRegistry.mdClose; element .attr({ tabindex: -1 }) .on('focus', function () { mdChipsCtrl.onFocus(); }) .on('click', function () { if (!mdChipsCtrl.readonly && mdChipsCtrl.selectedChip === -1) { mdChipsCtrl.onFocus(); } }); if (attr.ngModel) { mdChipsCtrl.configureNgModel(element.controller('ngModel')); // If an `md-transform-chip` attribute was set, tell the controller to use the expression // before appending chips. if (attrs.mdTransformChip) mdChipsCtrl.useTransformChipExpression(); // If an `md-on-append` attribute was set, tell the controller to use the expression // when appending chips. // // TODO: Remove this now that 1.0 is long since released // DEPRECATED: Will remove in official 1.0 release if (attrs.mdOnAppend) mdChipsCtrl.useOnAppendExpression(); // If an `md-on-add` attribute was set, tell the controller to use the expression // when adding chips. if (attrs.mdOnAdd) mdChipsCtrl.useOnAddExpression(); // If an `md-on-remove` attribute was set, tell the controller to use the expression // when removing chips. if (attrs.mdOnRemove) mdChipsCtrl.useOnRemoveExpression(); // If an `md-on-select` attribute was set, tell the controller to use the expression // when selecting chips. if (attrs.mdOnSelect) mdChipsCtrl.useOnSelectExpression(); // The md-autocomplete and input elements won't be compiled until after this directive // is complete (due to their nested nature). Wait a tick before looking for them to // configure the controller. if (chipInputTemplate !== templates.input) { // The autocomplete will not appear until the readonly attribute is not true (i.e. // false or undefined), so we have to watch the readonly and then on the next tick // after the chip transclusion has run, we can configure the autocomplete and user // input. scope.$watch('$mdChipsCtrl.readonly', function(readonly) { if (!readonly) { $mdUtil.nextTick(function(){ if (chipInputTemplate.indexOf('<md-autocomplete') === 0) { var autocompleteEl = element.find('md-autocomplete'); mdChipsCtrl.configureAutocomplete(autocompleteEl.controller('mdAutocomplete')); } mdChipsCtrl.configureUserInput(element.find('input')); }); } }); } // At the next tick, if we find an input, make sure it has the md-input class $mdUtil.nextTick(function() { var input = element.find('input'); if (input) { mdChipsCtrl.configureInput(input); input.toggleClass('md-input', true); } }); } // Compile with the parent's scope and prepend any static chips to the wrapper. if (staticChips.length > 0) { var compiledStaticChips = $compile(staticChips.clone())(scope.$parent); $timeout(function() { element.find('md-chips-wrap').prepend(compiledStaticChips); }); } }; } function getTemplates() { return { chips: $mdUtil.processTemplate(MD_CHIPS_TEMPLATE), input: $mdUtil.processTemplate(CHIP_INPUT_TEMPLATE), default: $mdUtil.processTemplate(CHIP_DEFAULT_TEMPLATE), remove: $mdUtil.processTemplate(CHIP_REMOVE_TEMPLATE) }; } }
[ "function", "MdChips", "(", "$mdTheming", ",", "$mdUtil", ",", "$compile", ",", "$log", ",", "$timeout", ",", "$$mdSvgRegistry", ")", "{", "// Run our templates through $mdUtil.processTemplate() to allow custom start/end symbols", "var", "templates", "=", "getTemplates", "(...
MDChips Directive Definition
[ "MDChips", "Directive", "Definition" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/chips/js/chipsDirective.js#L275-L489
train
The md - chips directive is a template that can be used to generate the chips.
[ 30522, 3853, 9108, 5428, 4523, 1006, 1002, 9108, 10760, 6562, 1010, 1002, 9108, 21823, 2140, 1010, 1002, 4012, 22090, 1010, 1002, 8833, 1010, 1002, 2051, 5833, 1010, 1002, 1002, 9108, 2015, 2615, 17603, 24063, 2854, 1007, 1063, 1013, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-useless-escape.js
check
function check(node) { const isTemplateElement = node.type === "TemplateElement"; if ( isTemplateElement && node.parent && node.parent.parent && node.parent.parent.type === "TaggedTemplateExpression" && node.parent === node.parent.parent.quasi ) { // Don't report tagged template literals, because the backslash character is accessible to the tag function. return; } if (typeof node.value === "string" || isTemplateElement) { /* * JSXAttribute doesn't have any escape sequence: https://facebook.github.io/jsx/. * In addition, backticks are not supported by JSX yet: https://github.com/facebook/jsx/issues/25. */ if (node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment") { return; } const value = isTemplateElement ? node.value.raw : node.raw.slice(1, -1); const pattern = /\\[^\d]/gu; let match; while ((match = pattern.exec(value))) { validateString(node, match); } } else if (node.regex) { parseRegExp(node.regex.pattern) /* * The '-' character is a special case, because it's only valid to escape it if it's in a character * class, and is not at either edge of the character class. To account for this, don't consider '-' * characters to be valid in general, and filter out '-' characters that appear in the middle of a * character class. */ .filter(charInfo => !(charInfo.text === "-" && charInfo.inCharClass && !charInfo.startsCharClass && !charInfo.endsCharClass)) /* * The '^' character is also a special case; it must always be escaped outside of character classes, but * it only needs to be escaped in character classes if it's at the beginning of the character class. To * account for this, consider it to be a valid escape character outside of character classes, and filter * out '^' characters that appear at the start of a character class. */ .filter(charInfo => !(charInfo.text === "^" && charInfo.startsCharClass)) // Filter out characters that aren't escaped. .filter(charInfo => charInfo.escaped) // Filter out characters that are valid to escape, based on their position in the regular expression. .filter(charInfo => !(charInfo.inCharClass ? REGEX_GENERAL_ESCAPES : REGEX_NON_CHARCLASS_ESCAPES).has(charInfo.text)) // Report all the remaining characters. .forEach(charInfo => report(node, charInfo.index, charInfo.text)); } }
javascript
function check(node) { const isTemplateElement = node.type === "TemplateElement"; if ( isTemplateElement && node.parent && node.parent.parent && node.parent.parent.type === "TaggedTemplateExpression" && node.parent === node.parent.parent.quasi ) { // Don't report tagged template literals, because the backslash character is accessible to the tag function. return; } if (typeof node.value === "string" || isTemplateElement) { /* * JSXAttribute doesn't have any escape sequence: https://facebook.github.io/jsx/. * In addition, backticks are not supported by JSX yet: https://github.com/facebook/jsx/issues/25. */ if (node.parent.type === "JSXAttribute" || node.parent.type === "JSXElement" || node.parent.type === "JSXFragment") { return; } const value = isTemplateElement ? node.value.raw : node.raw.slice(1, -1); const pattern = /\\[^\d]/gu; let match; while ((match = pattern.exec(value))) { validateString(node, match); } } else if (node.regex) { parseRegExp(node.regex.pattern) /* * The '-' character is a special case, because it's only valid to escape it if it's in a character * class, and is not at either edge of the character class. To account for this, don't consider '-' * characters to be valid in general, and filter out '-' characters that appear in the middle of a * character class. */ .filter(charInfo => !(charInfo.text === "-" && charInfo.inCharClass && !charInfo.startsCharClass && !charInfo.endsCharClass)) /* * The '^' character is also a special case; it must always be escaped outside of character classes, but * it only needs to be escaped in character classes if it's at the beginning of the character class. To * account for this, consider it to be a valid escape character outside of character classes, and filter * out '^' characters that appear at the start of a character class. */ .filter(charInfo => !(charInfo.text === "^" && charInfo.startsCharClass)) // Filter out characters that aren't escaped. .filter(charInfo => charInfo.escaped) // Filter out characters that are valid to escape, based on their position in the regular expression. .filter(charInfo => !(charInfo.inCharClass ? REGEX_GENERAL_ESCAPES : REGEX_NON_CHARCLASS_ESCAPES).has(charInfo.text)) // Report all the remaining characters. .forEach(charInfo => report(node, charInfo.index, charInfo.text)); } }
[ "function", "check", "(", "node", ")", "{", "const", "isTemplateElement", "=", "node", ".", "type", "===", "\"TemplateElement\"", ";", "if", "(", "isTemplateElement", "&&", "node", ".", "parent", "&&", "node", ".", "parent", ".", "parent", "&&", "node", "....
Checks if a node has an escape. @param {ASTNode} node - node to check. @returns {void}
[ "Checks", "if", "a", "node", "has", "an", "escape", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-escape.js#L158-L219
train
Check if node is valid
[ 30522, 3853, 4638, 1006, 13045, 1007, 1063, 9530, 3367, 21541, 6633, 15725, 12260, 3672, 1027, 13045, 1012, 2828, 1027, 1027, 1027, 1000, 23561, 12260, 3672, 1000, 1025, 2065, 1006, 21541, 6633, 15725, 12260, 3672, 1004, 1004, 13045, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mui-org/material-ui
docs/src/modules/components/AppDrawer.js
renderNavItems
function renderNavItems({ pages, ...params }) { return ( <List> {pages.reduce( // eslint-disable-next-line no-use-before-define (items, page) => reduceChildRoutes({ items, page, ...params }), [], )} </List> ); }
javascript
function renderNavItems({ pages, ...params }) { return ( <List> {pages.reduce( // eslint-disable-next-line no-use-before-define (items, page) => reduceChildRoutes({ items, page, ...params }), [], )} </List> ); }
[ "function", "renderNavItems", "(", "{", "pages", ",", "...", "params", "}", ")", "{", "return", "(", "<", "List", ">", "\n ", "{", "pages", ".", "reduce", "(", "// eslint-disable-next-line no-use-before-define", "(", "items", ",", "page", ")", "=>", "re...
eslint-disable-next-line react/prop-types
[ "eslint", "-", "disable", "-", "next", "-", "line", "react", "/", "prop", "-", "types" ]
1555e52367835946382fbf2a8f681de71318915d
https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/modules/components/AppDrawer.js#L47-L57
train
Render nav items
[ 30522, 3853, 17552, 2532, 25217, 5244, 1006, 1063, 5530, 1010, 1012, 1012, 1012, 11498, 5244, 1065, 1007, 1063, 2709, 1006, 1026, 2862, 1028, 1063, 5530, 1012, 5547, 1006, 1013, 1013, 9686, 4115, 2102, 1011, 4487, 19150, 1011, 2279, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Microsoft/vscode
build/lib/bundle.js
visit
function visit(rootNodes, graph) { const result = {}; const queue = rootNodes; rootNodes.forEach((node) => { result[node] = true; }); while (queue.length > 0) { const el = queue.shift(); const myEdges = graph[el] || []; myEdges.forEach((toNode) => { if (!result[toNode]) { result[toNode] = true; queue.push(toNode); } }); } return result; }
javascript
function visit(rootNodes, graph) { const result = {}; const queue = rootNodes; rootNodes.forEach((node) => { result[node] = true; }); while (queue.length > 0) { const el = queue.shift(); const myEdges = graph[el] || []; myEdges.forEach((toNode) => { if (!result[toNode]) { result[toNode] = true; queue.push(toNode); } }); } return result; }
[ "function", "visit", "(", "rootNodes", ",", "graph", ")", "{", "const", "result", "=", "{", "}", ";", "const", "queue", "=", "rootNodes", ";", "rootNodes", ".", "forEach", "(", "(", "node", ")", "=>", "{", "result", "[", "node", "]", "=", "true", "...
Return a set of reachable nodes in `graph` starting from `rootNodes`
[ "Return", "a", "set", "of", "reachable", "nodes", "in", "graph", "starting", "from", "rootNodes" ]
693a13cd32c5be798051edc0cb43e1e39fc456d9
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L404-L421
train
Visit a set of nodes
[ 30522, 3853, 3942, 1006, 7117, 3630, 6155, 1010, 10629, 1007, 1063, 9530, 3367, 2765, 1027, 1063, 1065, 1025, 9530, 3367, 24240, 1027, 7117, 3630, 6155, 1025, 7117, 3630, 6155, 1012, 18921, 6776, 1006, 1006, 13045, 1007, 1027, 1028, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/taskCounter.js
taskCounterExtension
function taskCounterExtension(editor) { editor.getTaskCount = () => { let found, count; if (editor.isViewer()) { count = editor.preview.$el.find('.task-list-item').length; } else if (editor.isMarkdownMode()) { found = editor.mdEditor.getValue().match(FIND_TASK_RX); count = found ? found.length : 0; } else { count = editor.wwEditor.get$Body().find('.task-list-item').length; } return count; }; editor.getCheckedTaskCount = () => { let found, count; if (editor.isViewer()) { count = editor.preview.$el.find('.task-list-item.checked').length; } else if (editor.isMarkdownMode()) { found = editor.mdEditor.getValue().match(FIND_CHECKED_TASK_RX); count = found ? found.length : 0; } else { count = editor.wwEditor.get$Body().find('.task-list-item.checked').length; } return count; }; }
javascript
function taskCounterExtension(editor) { editor.getTaskCount = () => { let found, count; if (editor.isViewer()) { count = editor.preview.$el.find('.task-list-item').length; } else if (editor.isMarkdownMode()) { found = editor.mdEditor.getValue().match(FIND_TASK_RX); count = found ? found.length : 0; } else { count = editor.wwEditor.get$Body().find('.task-list-item').length; } return count; }; editor.getCheckedTaskCount = () => { let found, count; if (editor.isViewer()) { count = editor.preview.$el.find('.task-list-item.checked').length; } else if (editor.isMarkdownMode()) { found = editor.mdEditor.getValue().match(FIND_CHECKED_TASK_RX); count = found ? found.length : 0; } else { count = editor.wwEditor.get$Body().find('.task-list-item.checked').length; } return count; }; }
[ "function", "taskCounterExtension", "(", "editor", ")", "{", "editor", ".", "getTaskCount", "=", "(", ")", "=>", "{", "let", "found", ",", "count", ";", "if", "(", "editor", ".", "isViewer", "(", ")", ")", "{", "count", "=", "editor", ".", "preview", ...
task counter extension @param {Editor} editor - editor instance @ignore
[ "task", "counter", "extension" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/taskCounter.js#L15-L45
train
taskCounterExtension - Extension for task counter
[ 30522, 3853, 4708, 3597, 16671, 7869, 18413, 6132, 3258, 1006, 3559, 1007, 1063, 3559, 1012, 2131, 10230, 2243, 3597, 16671, 1027, 1006, 1007, 1027, 1028, 1063, 2292, 2179, 1010, 4175, 1025, 2065, 1006, 3559, 1012, 2003, 8584, 2121, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/EditorManager.js
closeInlineWidget
function closeInlineWidget(hostEditor, inlineWidget) { // If widget has focus, return it to the hostEditor & move the cursor to where the inline used to be if (inlineWidget.hasFocus()) { // Place cursor back on the line just above the inline (the line from which it was opened) // If cursor's already on that line, leave it be to preserve column position var widgetLine = hostEditor._codeMirror.getLineNumber(inlineWidget.info.line); var cursorLine = hostEditor.getCursorPos().line; if (cursorLine !== widgetLine) { hostEditor.setCursorPos({ line: widgetLine, pos: 0 }); } hostEditor.focus(); } return hostEditor.removeInlineWidget(inlineWidget); }
javascript
function closeInlineWidget(hostEditor, inlineWidget) { // If widget has focus, return it to the hostEditor & move the cursor to where the inline used to be if (inlineWidget.hasFocus()) { // Place cursor back on the line just above the inline (the line from which it was opened) // If cursor's already on that line, leave it be to preserve column position var widgetLine = hostEditor._codeMirror.getLineNumber(inlineWidget.info.line); var cursorLine = hostEditor.getCursorPos().line; if (cursorLine !== widgetLine) { hostEditor.setCursorPos({ line: widgetLine, pos: 0 }); } hostEditor.focus(); } return hostEditor.removeInlineWidget(inlineWidget); }
[ "function", "closeInlineWidget", "(", "hostEditor", ",", "inlineWidget", ")", "{", "// If widget has focus, return it to the hostEditor & move the cursor to where the inline used to be", "if", "(", "inlineWidget", ".", "hasFocus", "(", ")", ")", "{", "// Place cursor back on the ...
Removes the given widget UI from the given hostEditor (agnostic of what the widget's content is). The widget's onClosed() callback will be run as a result. @param {!Editor} hostEditor The editor containing the widget. @param {!InlineWidget} inlineWidget The inline widget to close. @return {$.Promise} A promise that's resolved when the widget is fully closed.
[ "Removes", "the", "given", "widget", "UI", "from", "the", "given", "hostEditor", "(", "agnostic", "of", "what", "the", "widget", "s", "content", "is", ")", ".", "The", "widget", "s", "onClosed", "()", "callback", "will", "be", "run", "as", "a", "result",...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorManager.js#L364-L379
train
Close inline widget
[ 30522, 3853, 2485, 2378, 4179, 9148, 24291, 1006, 4354, 15660, 1010, 23881, 9148, 24291, 1007, 1063, 1013, 1013, 2065, 15536, 24291, 2038, 3579, 1010, 2709, 2009, 2000, 1996, 4354, 15660, 1004, 2693, 1996, 12731, 25301, 2099, 2000, 2073, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebaseui-web
javascript/widgets/handler/phonesigninstart.js
function(phoneAuthResult) { // Display the dialog that the code was sent. var container = component.getContainer(); component.showProgressDialog( firebaseui.auth.ui.element.progressDialog.State.DONE, firebaseui.auth.soy2.strings.dialogCodeSent().toString()); // Keep the dialog long enough to be seen before redirecting to code // entry page. var codeVerificationTimer = setTimeout(function() { component.dismissDialog(); // Handle sign in with phone number code verification. component.dispose(); firebaseui.auth.widget.handler.handle( firebaseui.auth.widget.HandlerName.PHONE_SIGN_IN_FINISH, app, container, phoneNumberValue, firebaseui.auth.widget.handler.RESEND_DELAY_SECONDS, phoneAuthResult); }, firebaseui.auth.widget.handler.SENDING_SUCCESS_DIALOG_DELAY); // On reset, clear timeout. app.registerPending(function() { // Dismiss dialog if still visible. if (component) { component.dismissDialog(); } clearTimeout(codeVerificationTimer); }); }
javascript
function(phoneAuthResult) { // Display the dialog that the code was sent. var container = component.getContainer(); component.showProgressDialog( firebaseui.auth.ui.element.progressDialog.State.DONE, firebaseui.auth.soy2.strings.dialogCodeSent().toString()); // Keep the dialog long enough to be seen before redirecting to code // entry page. var codeVerificationTimer = setTimeout(function() { component.dismissDialog(); // Handle sign in with phone number code verification. component.dispose(); firebaseui.auth.widget.handler.handle( firebaseui.auth.widget.HandlerName.PHONE_SIGN_IN_FINISH, app, container, phoneNumberValue, firebaseui.auth.widget.handler.RESEND_DELAY_SECONDS, phoneAuthResult); }, firebaseui.auth.widget.handler.SENDING_SUCCESS_DIALOG_DELAY); // On reset, clear timeout. app.registerPending(function() { // Dismiss dialog if still visible. if (component) { component.dismissDialog(); } clearTimeout(codeVerificationTimer); }); }
[ "function", "(", "phoneAuthResult", ")", "{", "// Display the dialog that the code was sent.", "var", "container", "=", "component", ".", "getContainer", "(", ")", ";", "component", ".", "showProgressDialog", "(", "firebaseui", ".", "auth", ".", "ui", ".", "element"...
On success a phone Auth result is returned.
[ "On", "success", "a", "phone", "Auth", "result", "is", "returned", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/phonesigninstart.js#L269-L297
train
Called when the phone number is successfully signed in.
[ 30522, 3853, 1006, 3042, 4887, 2705, 6072, 11314, 1007, 1063, 1013, 1013, 4653, 1996, 13764, 8649, 2008, 1996, 3642, 2001, 2741, 1012, 13075, 11661, 1027, 6922, 1012, 2131, 8663, 18249, 2121, 1006, 1007, 1025, 6922, 1012, 2265, 21572, 17603...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/project/FileTreeViewModel.js
_createIntermediateDirectories
function _createIntermediateDirectories(treeData, path) { var objectPath = [], result = { objectPath: objectPath, treeData: treeData }, treePointer = treeData; if (path === "") { return result; } var parts = path.split("/"), part = parts.shift(), node; while (part) { if (treePointer === null) { return null; } node = treePointer.get(part); objectPath.push(part); // This directory is missing, so create it. if (node === undefined) { treeData = treeData.updateIn(objectPath, _createNotFullyLoadedDirectory); node = treeData.getIn(objectPath); } part = parts.shift(); if (part) { treePointer = node.get("children"); if (treePointer) { objectPath.push("children"); } else { // The directory is there, but the directory hasn't been loaded. // Update the directory to be a `notFullyLoaded` directory. treeData = treeData.updateIn(objectPath, _createNotFullyLoadedDirectory); objectPath.push("children"); treePointer = treeData.getIn(objectPath); } } } result.treeData = treeData; return result; }
javascript
function _createIntermediateDirectories(treeData, path) { var objectPath = [], result = { objectPath: objectPath, treeData: treeData }, treePointer = treeData; if (path === "") { return result; } var parts = path.split("/"), part = parts.shift(), node; while (part) { if (treePointer === null) { return null; } node = treePointer.get(part); objectPath.push(part); // This directory is missing, so create it. if (node === undefined) { treeData = treeData.updateIn(objectPath, _createNotFullyLoadedDirectory); node = treeData.getIn(objectPath); } part = parts.shift(); if (part) { treePointer = node.get("children"); if (treePointer) { objectPath.push("children"); } else { // The directory is there, but the directory hasn't been loaded. // Update the directory to be a `notFullyLoaded` directory. treeData = treeData.updateIn(objectPath, _createNotFullyLoadedDirectory); objectPath.push("children"); treePointer = treeData.getIn(objectPath); } } } result.treeData = treeData; return result; }
[ "function", "_createIntermediateDirectories", "(", "treeData", ",", "path", ")", "{", "var", "objectPath", "=", "[", "]", ",", "result", "=", "{", "objectPath", ":", "objectPath", ",", "treeData", ":", "treeData", "}", ",", "treePointer", "=", "treeData", ";...
@private Creates the directories necessary to display the given path, even if those directories do not yet exist in the tree and have not been loaded. @param {Immutable.Map} treeData @param {string} path Path to the final directory to be added in the tree @return {{treeData: Immutable.Map, objectPath: Array.<string>}} updated treeData and object path to the created object
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeViewModel.js#L725-L773
train
Create intermediate directories
[ 30522, 3853, 1035, 3443, 18447, 2121, 16969, 3064, 7442, 16761, 3111, 1006, 3392, 2850, 2696, 1010, 4130, 1007, 1063, 13075, 4874, 15069, 1027, 1031, 1033, 1010, 2765, 1027, 1063, 4874, 15069, 1024, 4874, 15069, 1010, 3392, 2850, 2696, 1024...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/demo/weinre-demo.js
onLoad
function onLoad() { if (!buttonStartStuff) buttonStartStuff = document.getElementById("button-start-stuff") if (!buttonClearOutput) buttonClearOutput = document.getElementById("button-clear-output") if (!outputElement) outputElement = document.getElementById("output") buttonStartStuff.addEventListener("click", function() { lastClickTime = new Date().toString() if (db) db.transaction(addClick) openTheOtherDatabase() if (!started) { buttonStartStuff.value = "stop stuff" startStuff() } else { buttonStartStuff.value = "start stuff" stopStuff() } started = !started }) buttonClearOutput.addEventListener("click", function() { outputElement.innerHTML = "" }) openTheDatabase() }
javascript
function onLoad() { if (!buttonStartStuff) buttonStartStuff = document.getElementById("button-start-stuff") if (!buttonClearOutput) buttonClearOutput = document.getElementById("button-clear-output") if (!outputElement) outputElement = document.getElementById("output") buttonStartStuff.addEventListener("click", function() { lastClickTime = new Date().toString() if (db) db.transaction(addClick) openTheOtherDatabase() if (!started) { buttonStartStuff.value = "stop stuff" startStuff() } else { buttonStartStuff.value = "start stuff" stopStuff() } started = !started }) buttonClearOutput.addEventListener("click", function() { outputElement.innerHTML = "" }) openTheDatabase() }
[ "function", "onLoad", "(", ")", "{", "if", "(", "!", "buttonStartStuff", ")", "buttonStartStuff", "=", "document", ".", "getElementById", "(", "\"button-start-stuff\"", ")", "if", "(", "!", "buttonClearOutput", ")", "buttonClearOutput", "=", "document", ".", "ge...
------------------------------------------------------------------------------
[ "------------------------------------------------------------------------------" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/demo/weinre-demo.js#L38-L65
train
onLoad - Loads the database
[ 30522, 3853, 2006, 11066, 1006, 1007, 1063, 2065, 1006, 999, 11287, 7559, 3215, 8525, 4246, 1007, 11287, 7559, 3215, 8525, 4246, 1027, 6254, 1012, 2131, 12260, 3672, 3762, 3593, 1006, 1000, 6462, 1011, 2707, 1011, 4933, 1000, 1007, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/DragAndDrop.js
isValidDrop
function isValidDrop(items) { var i, len = items.length; for (i = 0; i < len; i++) { if (items[i].kind === "file") { var entry = items[i].webkitGetAsEntry(); if (entry.isFile) { // If any files are being dropped, this is a valid drop return true; } else if (len === 1) { // If exactly one folder is being dropped, this is a valid drop return true; } } } // No valid entries found return false; }
javascript
function isValidDrop(items) { var i, len = items.length; for (i = 0; i < len; i++) { if (items[i].kind === "file") { var entry = items[i].webkitGetAsEntry(); if (entry.isFile) { // If any files are being dropped, this is a valid drop return true; } else if (len === 1) { // If exactly one folder is being dropped, this is a valid drop return true; } } } // No valid entries found return false; }
[ "function", "isValidDrop", "(", "items", ")", "{", "var", "i", ",", "len", "=", "items", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "items", "[", "i", "]", ".", "kind", "===", "...
Returns true if the drag and drop items contains valid drop objects. @param {Array.<DataTransferItem>} items Array of items being dragged @return {boolean} True if one or more items can be dropped.
[ "Returns", "true", "if", "the", "drag", "and", "drop", "items", "contains", "valid", "drop", "objects", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/DragAndDrop.js#L44-L63
train
Check if the drop item is valid
[ 30522, 3853, 2003, 10175, 3593, 25711, 1006, 5167, 1007, 1063, 13075, 1045, 1010, 18798, 1027, 5167, 1012, 3091, 1025, 2005, 1006, 1045, 1027, 1014, 1025, 1045, 1026, 18798, 1025, 1045, 1009, 1009, 1007, 1063, 2065, 1006, 5167, 1031, 1045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
goldfire/howler.js
dist/howler.js
function(audio) { var self = this || Howler; // Don't add audio to the pool if we don't know if it has been unlocked. if (audio._unlocked) { self._html5AudioPool.push(audio); } return self; }
javascript
function(audio) { var self = this || Howler; // Don't add audio to the pool if we don't know if it has been unlocked. if (audio._unlocked) { self._html5AudioPool.push(audio); } return self; }
[ "function", "(", "audio", ")", "{", "var", "self", "=", "this", "||", "Howler", ";", "// Don't add audio to the pool if we don't know if it has been unlocked.", "if", "(", "audio", ".", "_unlocked", ")", "{", "self", ".", "_html5AudioPool", ".", "push", "(", "audi...
Return an activated HTML5 Audio object to the pool. @return {Howler}
[ "Return", "an", "activated", "HTML5", "Audio", "object", "to", "the", "pool", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L423-L432
train
Add an audio to the pool
[ 30522, 3853, 1006, 5746, 1007, 1063, 13075, 2969, 1027, 2023, 1064, 1064, 22912, 2121, 1025, 1013, 1013, 2123, 1005, 1056, 5587, 5746, 2000, 1996, 4770, 2065, 2057, 2123, 1005, 1056, 2113, 2065, 2009, 2038, 2042, 14058, 1012, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jiahaog/nativefier
src/helpers/iconShellHelpers.js
iconShellHelper
function iconShellHelper(shellScriptPath, icoSrc, dest) { return new Promise((resolve, reject) => { if (isWindows()) { reject(new Error('OSX or Linux is required')); return; } shell.exec( `"${shellScriptPath}" "${icoSrc}" "${dest}"`, { silent: true }, (exitCode, stdOut, stdError) => { if (exitCode) { // eslint-disable-next-line prefer-promise-reject-errors reject({ stdOut, stdError, }); return; } resolve(dest); }, ); }); }
javascript
function iconShellHelper(shellScriptPath, icoSrc, dest) { return new Promise((resolve, reject) => { if (isWindows()) { reject(new Error('OSX or Linux is required')); return; } shell.exec( `"${shellScriptPath}" "${icoSrc}" "${dest}"`, { silent: true }, (exitCode, stdOut, stdError) => { if (exitCode) { // eslint-disable-next-line prefer-promise-reject-errors reject({ stdOut, stdError, }); return; } resolve(dest); }, ); }); }
[ "function", "iconShellHelper", "(", "shellScriptPath", ",", "icoSrc", ",", "dest", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "if", "(", "isWindows", "(", ")", ")", "{", "reject", "(", "new", "Error", "(",...
Executes a shell script with the form "./pathToScript param1 param2" @param {string} shellScriptPath @param {string} icoSrc input .ico @param {string} dest has to be a .ico path
[ "Executes", "a", "shell", "script", "with", "the", "form", ".", "/", "pathToScript", "param1", "param2" ]
b959956a38ce51a9dd95d42308f0a6c66489b624
https://github.com/jiahaog/nativefier/blob/b959956a38ce51a9dd95d42308f0a6c66489b624/src/helpers/iconShellHelpers.js#L23-L47
train
Helper function for iconShell
[ 30522, 3853, 18407, 18223, 16001, 4842, 1006, 10986, 23235, 15069, 1010, 24582, 2891, 11890, 1010, 4078, 2102, 1007, 1063, 2709, 2047, 4872, 1006, 1006, 10663, 1010, 15454, 1007, 1027, 1028, 1063, 2065, 1006, 2003, 11101, 15568, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (sValue) { return DateFormat.getDateInstance({ pattern : "yyyy-MM-dd", strictParsing : true, UTC : true }).parse(sValue); }
javascript
function (sValue) { return DateFormat.getDateInstance({ pattern : "yyyy-MM-dd", strictParsing : true, UTC : true }).parse(sValue); }
[ "function", "(", "sValue", ")", "{", "return", "DateFormat", ".", "getDateInstance", "(", "{", "pattern", ":", "\"yyyy-MM-dd\"", ",", "strictParsing", ":", "true", ",", "UTC", ":", "true", "}", ")", ".", "parse", "(", "sValue", ")", ";", "}" ]
Parses an Edm.Date value and returns the corresponding JavaScript Date value. @param {string} sValue the Edm.Date value to parse @returns {Date} the JavaScript Date value or <code>null</code> in case the input could not be parsed
[ "Parses", "an", "Edm", ".", "Date", "value", "and", "returns", "the", "corresponding", "JavaScript", "Date", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L647-L653
train
Parses the given value into a date object.
[ 30522, 3853, 1006, 17917, 2389, 5657, 1007, 1063, 2709, 3058, 14192, 4017, 1012, 2131, 13701, 7076, 26897, 1006, 1063, 5418, 1024, 1000, 1061, 2100, 2100, 2100, 1011, 3461, 1011, 20315, 1000, 1010, 9384, 19362, 7741, 1024, 2995, 1010, 11396...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/EditorCommandHandlers.js
openLine
function openLine(editor, direction) { editor = editor || EditorManager.getFocusedEditor(); if (!editor) { return; } var selections = editor.getSelections(), isInlineWidget = !!EditorManager.getFocusedInlineWidget(), lastLine = editor.getLastVisibleLine(), doc = editor.document, edits = [], newSelections, line; // First, insert all the newlines (skipping multiple selections on the same line), // then indent them all. (We can't easily do them all at once, because doMultipleEdits() // won't do the indentation for us, but we want its help tracking any selection changes // as the result of the edits.) // Note that we don't just use `editor.getLineSelections()` here because we don't actually want // to coalesce adjacent selections - we just want to ignore dupes. doc.batchOperation(function () { _.each(selections, function (sel, index) { if (index === 0 || (direction === DIRECTION_UP && sel.start.line > selections[index - 1].start.line) || (direction === DIRECTION_DOWN && sel.end.line > selections[index - 1].end.line)) { // Insert the new line switch (direction) { case DIRECTION_UP: line = sel.start.line; break; case DIRECTION_DOWN: line = sel.end.line; if (!(CodeMirror.cmpPos(sel.start, sel.end) !== 0 && sel.end.ch === 0)) { // If not linewise selection line++; } break; } var insertPos; if (line > lastLine && isInlineWidget) { insertPos = {line: line - 1, ch: doc.getLine(line - 1).length}; } else { insertPos = {line: line, ch: 0}; } // We want the selection after this edit to be right before the \n we just inserted. edits.push({edit: {text: "\n", start: insertPos}, selection: {start: insertPos, end: insertPos, primary: sel.primary}}); } else { // We just want to discard this selection, since we've already operated on the // same line and it would just collapse to the same location. But if this was // primary, make sure the last selection we did operate on ends up as primary. if (sel.primary) { edits[edits.length - 1].selections[0].primary = true; } } }); newSelections = doc.doMultipleEdits(edits, "+input"); // Now indent each added line (which doesn't mess up any line numbers, and // we're going to set the character offset to the last position on each line anyway). _.each(newSelections, function (sel) { // This is a bit of a hack. The document is the one that batches operations, but we want // to use CodeMirror's "smart indent" operation. So we need to use the document's own backing editor's // CodeMirror to do the indentation. A better way to fix this would be to expose this // operation on Document, but I'm not sure we want to sign up for that as a public API. doc._masterEditor._codeMirror.indentLine(sel.start.line, "smart", true); sel.start.ch = null; // last character on line sel.end = sel.start; }); }); editor.setSelections(newSelections); }
javascript
function openLine(editor, direction) { editor = editor || EditorManager.getFocusedEditor(); if (!editor) { return; } var selections = editor.getSelections(), isInlineWidget = !!EditorManager.getFocusedInlineWidget(), lastLine = editor.getLastVisibleLine(), doc = editor.document, edits = [], newSelections, line; // First, insert all the newlines (skipping multiple selections on the same line), // then indent them all. (We can't easily do them all at once, because doMultipleEdits() // won't do the indentation for us, but we want its help tracking any selection changes // as the result of the edits.) // Note that we don't just use `editor.getLineSelections()` here because we don't actually want // to coalesce adjacent selections - we just want to ignore dupes. doc.batchOperation(function () { _.each(selections, function (sel, index) { if (index === 0 || (direction === DIRECTION_UP && sel.start.line > selections[index - 1].start.line) || (direction === DIRECTION_DOWN && sel.end.line > selections[index - 1].end.line)) { // Insert the new line switch (direction) { case DIRECTION_UP: line = sel.start.line; break; case DIRECTION_DOWN: line = sel.end.line; if (!(CodeMirror.cmpPos(sel.start, sel.end) !== 0 && sel.end.ch === 0)) { // If not linewise selection line++; } break; } var insertPos; if (line > lastLine && isInlineWidget) { insertPos = {line: line - 1, ch: doc.getLine(line - 1).length}; } else { insertPos = {line: line, ch: 0}; } // We want the selection after this edit to be right before the \n we just inserted. edits.push({edit: {text: "\n", start: insertPos}, selection: {start: insertPos, end: insertPos, primary: sel.primary}}); } else { // We just want to discard this selection, since we've already operated on the // same line and it would just collapse to the same location. But if this was // primary, make sure the last selection we did operate on ends up as primary. if (sel.primary) { edits[edits.length - 1].selections[0].primary = true; } } }); newSelections = doc.doMultipleEdits(edits, "+input"); // Now indent each added line (which doesn't mess up any line numbers, and // we're going to set the character offset to the last position on each line anyway). _.each(newSelections, function (sel) { // This is a bit of a hack. The document is the one that batches operations, but we want // to use CodeMirror's "smart indent" operation. So we need to use the document's own backing editor's // CodeMirror to do the indentation. A better way to fix this would be to expose this // operation on Document, but I'm not sure we want to sign up for that as a public API. doc._masterEditor._codeMirror.indentLine(sel.start.line, "smart", true); sel.start.ch = null; // last character on line sel.end = sel.start; }); }); editor.setSelections(newSelections); }
[ "function", "openLine", "(", "editor", ",", "direction", ")", "{", "editor", "=", "editor", "||", "EditorManager", ".", "getFocusedEditor", "(", ")", ";", "if", "(", "!", "editor", ")", "{", "return", ";", "}", "var", "selections", "=", "editor", ".", ...
Inserts a new and smart indented line above/below the selected text, or current line if no selection. The cursor is moved in the new line. @param {Editor} editor - target editor @param {Number} direction - direction where to place the new line (-1,+1) => (Up,Down)
[ "Inserts", "a", "new", "and", "smart", "indented", "line", "above", "/", "below", "the", "selected", "text", "or", "current", "line", "if", "no", "selection", ".", "The", "cursor", "is", "moved", "in", "the", "new", "line", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorCommandHandlers.js#L950-L1023
train
Open a line in the editor
[ 30522, 3853, 2330, 4179, 1006, 3559, 1010, 3257, 1007, 1063, 3559, 1027, 3559, 1064, 1064, 3559, 24805, 4590, 1012, 2131, 14876, 7874, 19082, 15660, 1006, 1007, 1025, 2065, 1006, 999, 3559, 1007, 1063, 2709, 1025, 1065, 13075, 16310, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/preferences/PreferencesBase.js
function () { var result = new $.Deferred(); this.storage.load() .then(function (data) { var oldKeys = this.getKeys(); this.data = data; result.resolve(); this.trigger(PREFERENCE_CHANGE, { ids: _.union(this.getKeys(), oldKeys) }); }.bind(this)) .fail(function (error) { result.reject(error); }); return result.promise(); }
javascript
function () { var result = new $.Deferred(); this.storage.load() .then(function (data) { var oldKeys = this.getKeys(); this.data = data; result.resolve(); this.trigger(PREFERENCE_CHANGE, { ids: _.union(this.getKeys(), oldKeys) }); }.bind(this)) .fail(function (error) { result.reject(error); }); return result.promise(); }
[ "function", "(", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "this", ".", "storage", ".", "load", "(", ")", ".", "then", "(", "function", "(", "data", ")", "{", "var", "oldKeys", "=", "this", ".", "getKeys", "(", ...
Loads the prefs for this `Scope` from the `Storage`. @return {Promise} Promise that is resolved once loading is complete
[ "Loads", "the", "prefs", "for", "this", "Scope", "from", "the", "Storage", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L316-L331
train
Load the cache
[ 30522, 3853, 1006, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 2023, 1012, 5527, 1012, 7170, 1006, 1007, 1012, 2059, 1006, 3853, 1006, 2951, 1007, 1063, 13075, 2214, 14839, 2015, 1027, 2023, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/require-atomic-updates.js
reportAssignment
function reportAssignment(assignmentExpression) { context.report({ node: assignmentExpression, messageId: "nonAtomicUpdate", data: { value: sourceCode.getText(assignmentExpression.left) } }); }
javascript
function reportAssignment(assignmentExpression) { context.report({ node: assignmentExpression, messageId: "nonAtomicUpdate", data: { value: sourceCode.getText(assignmentExpression.left) } }); }
[ "function", "reportAssignment", "(", "assignmentExpression", ")", "{", "context", ".", "report", "(", "{", "node", ":", "assignmentExpression", ",", "messageId", ":", "\"nonAtomicUpdate\"", ",", "data", ":", "{", "value", ":", "sourceCode", ".", "getText", "(", ...
Reports an AssignmentExpression node that has a non-atomic update @param {ASTNode} assignmentExpression The assignment that is potentially unsafe @returns {void}
[ "Reports", "an", "AssignmentExpression", "node", "that", "has", "a", "non", "-", "atomic", "update" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/require-atomic-updates.js#L116-L124
train
Reports an assignment expression.
[ 30522, 3853, 3189, 12054, 24838, 1006, 8775, 10288, 20110, 3258, 1007, 1063, 6123, 1012, 3189, 1006, 1063, 13045, 1024, 8775, 10288, 20110, 3258, 1010, 4471, 3593, 1024, 1000, 2512, 10610, 7712, 6279, 13701, 1000, 1010, 2951, 1024, 1063, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/interimElement/interimElement.js
waitForInterim
function waitForInterim(callbackFn) { return function() { var fnArguments = arguments; if (!showingInterims.length) { // When there are still interim's opening, then wait for the first interim element to // finish its open animation. if (showPromises.length) { return showPromises[0].finally(function () { return callbackFn.apply(service, fnArguments); }); } return $q.when("No interim elements currently showing up."); } return callbackFn.apply(service, fnArguments); }; }
javascript
function waitForInterim(callbackFn) { return function() { var fnArguments = arguments; if (!showingInterims.length) { // When there are still interim's opening, then wait for the first interim element to // finish its open animation. if (showPromises.length) { return showPromises[0].finally(function () { return callbackFn.apply(service, fnArguments); }); } return $q.when("No interim elements currently showing up."); } return callbackFn.apply(service, fnArguments); }; }
[ "function", "waitForInterim", "(", "callbackFn", ")", "{", "return", "function", "(", ")", "{", "var", "fnArguments", "=", "arguments", ";", "if", "(", "!", "showingInterims", ".", "length", ")", "{", "// When there are still interim's opening, then wait for the first...
Creates a function to wait for at least one interim element to be available. @param callbackFn Function to be used as callback @returns {Function}
[ "Creates", "a", "function", "to", "wait", "for", "at", "least", "one", "interim", "element", "to", "be", "available", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L425-L443
train
Wait until all interims are open
[ 30522, 3853, 3524, 29278, 18447, 11124, 2213, 1006, 2655, 5963, 2546, 2078, 1007, 1063, 2709, 3853, 1006, 1007, 1063, 13075, 1042, 11802, 22850, 11187, 1027, 9918, 1025, 2065, 1006, 999, 4760, 18447, 11124, 5244, 1012, 3091, 1007, 1063, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
sass/node-sass
lib/index.js
tryCallback
function tryCallback(callback, args) { try { return callback.apply(this, args); } catch (e) { if (typeof e === 'string') { return new binding.types.Error(e); } else if (e instanceof Error) { return new binding.types.Error(e.message); } else { return new binding.types.Error('An unexpected error occurred'); } } }
javascript
function tryCallback(callback, args) { try { return callback.apply(this, args); } catch (e) { if (typeof e === 'string') { return new binding.types.Error(e); } else if (e instanceof Error) { return new binding.types.Error(e.message); } else { return new binding.types.Error('An unexpected error occurred'); } } }
[ "function", "tryCallback", "(", "callback", ",", "args", ")", "{", "try", "{", "return", "callback", ".", "apply", "(", "this", ",", "args", ")", ";", "}", "catch", "(", "e", ")", "{", "if", "(", "typeof", "e", "===", "'string'", ")", "{", "return"...
Executes a callback and transforms any exception raised into a sass error @param {Function} callback @param {Array} arguments @api private
[ "Executes", "a", "callback", "and", "transforms", "any", "exception", "raised", "into", "a", "sass", "error" ]
0c1a49eefa37544d16041c5fe5b2e3d9168004b7
https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/index.js#L226-L238
train
Try a callback
[ 30522, 3853, 3046, 9289, 20850, 8684, 1006, 2655, 5963, 1010, 12098, 5620, 1007, 1063, 3046, 1063, 2709, 2655, 5963, 1012, 6611, 1006, 2023, 1010, 12098, 5620, 1007, 1025, 1065, 4608, 1006, 1041, 1007, 1063, 2065, 1006, 2828, 11253, 1041, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/systems/tracked-controls-webvr.js
function () { var controllers = this.controllers; var gamepad; var gamepads; var i; var prevCount; gamepads = navigator.getGamepads && navigator.getGamepads(); if (!gamepads) { return; } prevCount = controllers.length; controllers.length = 0; for (i = 0; i < gamepads.length; ++i) { gamepad = gamepads[i]; if (gamepad && gamepad.pose) { controllers.push(gamepad); } } if (controllers.length !== prevCount) { this.el.emit('controllersupdated', undefined, false); } }
javascript
function () { var controllers = this.controllers; var gamepad; var gamepads; var i; var prevCount; gamepads = navigator.getGamepads && navigator.getGamepads(); if (!gamepads) { return; } prevCount = controllers.length; controllers.length = 0; for (i = 0; i < gamepads.length; ++i) { gamepad = gamepads[i]; if (gamepad && gamepad.pose) { controllers.push(gamepad); } } if (controllers.length !== prevCount) { this.el.emit('controllersupdated', undefined, false); } }
[ "function", "(", ")", "{", "var", "controllers", "=", "this", ".", "controllers", ";", "var", "gamepad", ";", "var", "gamepads", ";", "var", "i", ";", "var", "prevCount", ";", "gamepads", "=", "navigator", ".", "getGamepads", "&&", "navigator", ".", "get...
Update controller list.
[ "Update", "controller", "list", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/systems/tracked-controls-webvr.js#L39-L61
train
Updates the controllers array
[ 30522, 3853, 1006, 1007, 1063, 30524, 25465, 21723, 1025, 2208, 15455, 2015, 1027, 20532, 1012, 2131, 16650, 15455, 2015, 1004, 1004, 20532, 1012, 2131, 16650, 15455, 2015, 1006, 1007, 1025, 2065, 1006, 999, 2208, 15455, 2015, 1007, 1063, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/aws-containers/aws-client.js
loadAWS
function loadAWS(generator) { return new Promise((resolve, reject) => { try { AWS = require('aws-sdk'); // eslint-disable-line ProgressBar = require('progress'); // eslint-disable-line ora = require('ora'); // eslint-disable-line } catch (e) { generator.log('Installing AWS dependencies'); let installCommand = 'yarn add aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0'; if (generator.config.get('clientPackageManager') === 'npm') { installCommand = 'npm install aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0--save'; } shelljs.exec(installCommand, { silent: false }, code => { if (code !== 0) { generator.error('Something went wrong while installing the dependencies\n'); reject(); } AWS = require('aws-sdk'); // eslint-disable-line ProgressBar = require('progress'); // eslint-disable-line ora = require('ora'); // eslint-disable-line }); } resolve(); }); }
javascript
function loadAWS(generator) { return new Promise((resolve, reject) => { try { AWS = require('aws-sdk'); // eslint-disable-line ProgressBar = require('progress'); // eslint-disable-line ora = require('ora'); // eslint-disable-line } catch (e) { generator.log('Installing AWS dependencies'); let installCommand = 'yarn add aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0'; if (generator.config.get('clientPackageManager') === 'npm') { installCommand = 'npm install aws-sdk@2.167.0 progress@2.0.0 ora@1.3.0--save'; } shelljs.exec(installCommand, { silent: false }, code => { if (code !== 0) { generator.error('Something went wrong while installing the dependencies\n'); reject(); } AWS = require('aws-sdk'); // eslint-disable-line ProgressBar = require('progress'); // eslint-disable-line ora = require('ora'); // eslint-disable-line }); } resolve(); }); }
[ "function", "loadAWS", "(", "generator", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "AWS", "=", "require", "(", "'aws-sdk'", ")", ";", "// eslint-disable-line", "ProgressBar", "=", "require", "(", ...
Will load the aws-sdk npm dependency if it's not already loaded. @param generator the yeoman generator it'll be loaded in. @returns {Promise} The promise will succeed if the aws-sdk has been loaded and fails if it couldn't be installed.
[ "Will", "load", "the", "aws", "-", "sdk", "npm", "dependency", "if", "it", "s", "not", "already", "loaded", "." ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/aws-client.js#L73-L97
train
Load the AWS SDK
[ 30522, 3853, 7170, 10376, 2015, 1006, 13103, 1007, 1063, 2709, 2047, 4872, 1006, 1006, 10663, 1010, 15454, 1007, 1027, 1028, 1063, 3046, 1063, 22091, 2015, 1027, 5478, 1006, 1005, 22091, 2015, 1011, 17371, 2243, 1005, 1007, 1025, 1013, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js
function(oRoadMap, oStep){ var oParent = oStep.getParent(); if (oParent === oRoadMap) { return oParent.indexOfStep(oStep) + 1; } var iIdx = oParent.indexOfSubStep(oStep); if (iIdx < 26) { return String.fromCharCode(97 + iIdx); } // Single character //Double characters Substeps name are formed of 2 letters (e.g. "aa"). -> so overall 702 substeps possible var firstCharIdx = Math.floor(iIdx / 26) - 1; var secondCharIdx = iIdx % 26; return String.fromCharCode(97 + firstCharIdx, 97 + secondCharIdx); }
javascript
function(oRoadMap, oStep){ var oParent = oStep.getParent(); if (oParent === oRoadMap) { return oParent.indexOfStep(oStep) + 1; } var iIdx = oParent.indexOfSubStep(oStep); if (iIdx < 26) { return String.fromCharCode(97 + iIdx); } // Single character //Double characters Substeps name are formed of 2 letters (e.g. "aa"). -> so overall 702 substeps possible var firstCharIdx = Math.floor(iIdx / 26) - 1; var secondCharIdx = iIdx % 26; return String.fromCharCode(97 + firstCharIdx, 97 + secondCharIdx); }
[ "function", "(", "oRoadMap", ",", "oStep", ")", "{", "var", "oParent", "=", "oStep", ".", "getParent", "(", ")", ";", "if", "(", "oParent", "===", "oRoadMap", ")", "{", "return", "oParent", ".", "indexOfStep", "(", "oStep", ")", "+", "1", ";", "}", ...
Returns the name of the step according to its index in the aggregation (like "1", "a", "aa")
[ "Returns", "the", "name", "of", "the", "step", "according", "to", "its", "index", "in", "the", "aggregation", "(", "like", "1", "a", "aa", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L759-L775
train
Returns the name of the given step
[ 30522, 3853, 1006, 20298, 4215, 2863, 2361, 1010, 9808, 2618, 2361, 1007, 1063, 13075, 6728, 12069, 3372, 1027, 9808, 2618, 2361, 1012, 2131, 19362, 4765, 1006, 1007, 1025, 2065, 1006, 6728, 12069, 3372, 1027, 1027, 1027, 20298, 4215, 2863,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/interfaces/interfaces.js
showInterfaceJava
function showInterfaceJava(intf, html) { html.push("<div class='show-Java'><h3>Java</h3><pre>") intf.methods.forEach(function(method){ showInterfaceJavaMethod(intf, method, html) }) html.push("</pre></div>") }
javascript
function showInterfaceJava(intf, html) { html.push("<div class='show-Java'><h3>Java</h3><pre>") intf.methods.forEach(function(method){ showInterfaceJavaMethod(intf, method, html) }) html.push("</pre></div>") }
[ "function", "showInterfaceJava", "(", "intf", ",", "html", ")", "{", "html", ".", "push", "(", "\"<div class='show-Java'><h3>Java</h3><pre>\"", ")", "intf", ".", "methods", ".", "forEach", "(", "function", "(", "method", ")", "{", "showInterfaceJavaMethod", "(", ...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L344-L352
train
show interface java
[ 30522, 3853, 2265, 18447, 2121, 12172, 3900, 3567, 1006, 20014, 2546, 1010, 16129, 1007, 1063, 16129, 1012, 5245, 1006, 1000, 1026, 4487, 2615, 2465, 1027, 1005, 2265, 1011, 9262, 1005, 1028, 1026, 1044, 2509, 1028, 9262, 1026, 1013, 1044, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wix/Detox
generation/core/generator.js
createClass
function createClass(json) { return t.classDeclaration( t.identifier(json.name), null, t.classBody( json.methods .filter(filterMethodsWithUnsupportedParams) .filter(filterMethodsWithBlacklistedName) .reduce(handleOverloadedMethods, []) .map(createMethod.bind(null, json)) ), [] ); }
javascript
function createClass(json) { return t.classDeclaration( t.identifier(json.name), null, t.classBody( json.methods .filter(filterMethodsWithUnsupportedParams) .filter(filterMethodsWithBlacklistedName) .reduce(handleOverloadedMethods, []) .map(createMethod.bind(null, json)) ), [] ); }
[ "function", "createClass", "(", "json", ")", "{", "return", "t", ".", "classDeclaration", "(", "t", ".", "identifier", "(", "json", ".", "name", ")", ",", "null", ",", "t", ".", "classBody", "(", "json", ".", "methods", ".", "filter", "(", "filterMetho...
the input provided by objective-c-parser looks like this: { "name": "BasicName", "methods": [ { "args": [], "comment": "This is the comment of basic method one", "name": "basicMethodOne", "returnType": "NSInteger" }, { "args": [ { "type": "NSInteger", "name": "argOne" }, { "type": "NSString", "name": "argTwo" } ], "comment": "This is the comment of basic method two.\nIt has multiple lines", "name": "basicMethodTwoWithArgOneAndArgTwo", "returnType": "NSString" } ] }
[ "the", "input", "provided", "by", "objective", "-", "c", "-", "parser", "looks", "like", "this", ":", "{", "name", ":", "BasicName", "methods", ":", "[", "{", "args", ":", "[]", "comment", ":", "This", "is", "the", "comment", "of", "basic", "method", ...
0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9
https://github.com/wix/Detox/blob/0ed5e8c7ba279a3a409130b4d4bad3f9a9c2f1f9/generation/core/generator.js#L49-L62
train
Creates a class declaration
[ 30522, 3853, 3443, 26266, 1006, 1046, 3385, 1007, 1063, 2709, 1056, 1012, 2465, 3207, 20464, 25879, 3258, 1006, 1056, 1012, 8909, 4765, 18095, 1006, 1046, 3385, 1012, 2171, 1007, 1010, 19701, 1010, 1056, 1012, 2465, 23684, 1006, 1046, 3385,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/filesystem/impls/appshell/AppshellFileSystem.js
_mapError
function _mapError(err) { if (!err) { return null; } switch (err) { case appshell.fs.ERR_INVALID_PARAMS: return FileSystemError.INVALID_PARAMS; case appshell.fs.ERR_NOT_FOUND: return FileSystemError.NOT_FOUND; case appshell.fs.ERR_CANT_READ: return FileSystemError.NOT_READABLE; case appshell.fs.ERR_CANT_WRITE: return FileSystemError.NOT_WRITABLE; case appshell.fs.ERR_UNSUPPORTED_ENCODING: return FileSystemError.UNSUPPORTED_ENCODING; case appshell.fs.ERR_OUT_OF_SPACE: return FileSystemError.OUT_OF_SPACE; case appshell.fs.ERR_FILE_EXISTS: return FileSystemError.ALREADY_EXISTS; case appshell.fs.ERR_ENCODE_FILE_FAILED: return FileSystemError.ENCODE_FILE_FAILED; case appshell.fs.ERR_DECODE_FILE_FAILED: return FileSystemError.DECODE_FILE_FAILED; case appshell.fs.ERR_UNSUPPORTED_UTF16_ENCODING: return FileSystemError.UNSUPPORTED_UTF16_ENCODING; } return FileSystemError.UNKNOWN; }
javascript
function _mapError(err) { if (!err) { return null; } switch (err) { case appshell.fs.ERR_INVALID_PARAMS: return FileSystemError.INVALID_PARAMS; case appshell.fs.ERR_NOT_FOUND: return FileSystemError.NOT_FOUND; case appshell.fs.ERR_CANT_READ: return FileSystemError.NOT_READABLE; case appshell.fs.ERR_CANT_WRITE: return FileSystemError.NOT_WRITABLE; case appshell.fs.ERR_UNSUPPORTED_ENCODING: return FileSystemError.UNSUPPORTED_ENCODING; case appshell.fs.ERR_OUT_OF_SPACE: return FileSystemError.OUT_OF_SPACE; case appshell.fs.ERR_FILE_EXISTS: return FileSystemError.ALREADY_EXISTS; case appshell.fs.ERR_ENCODE_FILE_FAILED: return FileSystemError.ENCODE_FILE_FAILED; case appshell.fs.ERR_DECODE_FILE_FAILED: return FileSystemError.DECODE_FILE_FAILED; case appshell.fs.ERR_UNSUPPORTED_UTF16_ENCODING: return FileSystemError.UNSUPPORTED_UTF16_ENCODING; } return FileSystemError.UNKNOWN; }
[ "function", "_mapError", "(", "err", ")", "{", "if", "(", "!", "err", ")", "{", "return", "null", ";", "}", "switch", "(", "err", ")", "{", "case", "appshell", ".", "fs", ".", "ERR_INVALID_PARAMS", ":", "return", "FileSystemError", ".", "INVALID_PARAMS",...
Convert appshell error codes to FileSystemError values. @param {?number} err An appshell error code @return {?string} A FileSystemError string, or null if there was no error code. @private
[ "Convert", "appshell", "error", "codes", "to", "FileSystemError", "values", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/impls/appshell/AppshellFileSystem.js#L143-L171
train
map error to FileSystemError
[ 30522, 3853, 1035, 4949, 2121, 29165, 1006, 9413, 2099, 1007, 1063, 2065, 1006, 999, 9413, 2099, 1007, 1063, 2709, 19701, 1025, 1065, 6942, 1006, 9413, 2099, 1007, 1063, 2553, 18726, 18223, 1012, 1042, 2015, 1012, 9413, 2099, 1035, 19528, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/chart/bar/PictorialBarView.js
prepareSymbolSize
function prepareSymbolSize( data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength, pxSign, symbolPatternSize, opt, output ) { var valueDim = opt.valueDim; var categoryDim = opt.categoryDim; var categorySize = Math.abs(layout[categoryDim.wh]); var symbolSize = data.getItemVisual(dataIndex, 'symbolSize'); if (zrUtil.isArray(symbolSize)) { symbolSize = symbolSize.slice(); } else { if (symbolSize == null) { symbolSize = '100%'; } symbolSize = [symbolSize, symbolSize]; } // Note: percentage symbolSize (like '100%') do not consider lineWidth, because it is // to complicated to calculate real percent value if considering scaled lineWidth. // So the actual size will bigger than layout size if lineWidth is bigger than zero, // which can be tolerated in pictorial chart. symbolSize[categoryDim.index] = parsePercent( symbolSize[categoryDim.index], categorySize ); symbolSize[valueDim.index] = parsePercent( symbolSize[valueDim.index], symbolRepeat ? categorySize : Math.abs(boundingLength) ); output.symbolSize = symbolSize; // If x or y is less than zero, show reversed shape. var symbolScale = output.symbolScale = [ symbolSize[0] / symbolPatternSize, symbolSize[1] / symbolPatternSize ]; // Follow convention, 'right' and 'top' is the normal scale. symbolScale[valueDim.index] *= (opt.isHorizontal ? -1 : 1) * pxSign; }
javascript
function prepareSymbolSize( data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength, pxSign, symbolPatternSize, opt, output ) { var valueDim = opt.valueDim; var categoryDim = opt.categoryDim; var categorySize = Math.abs(layout[categoryDim.wh]); var symbolSize = data.getItemVisual(dataIndex, 'symbolSize'); if (zrUtil.isArray(symbolSize)) { symbolSize = symbolSize.slice(); } else { if (symbolSize == null) { symbolSize = '100%'; } symbolSize = [symbolSize, symbolSize]; } // Note: percentage symbolSize (like '100%') do not consider lineWidth, because it is // to complicated to calculate real percent value if considering scaled lineWidth. // So the actual size will bigger than layout size if lineWidth is bigger than zero, // which can be tolerated in pictorial chart. symbolSize[categoryDim.index] = parsePercent( symbolSize[categoryDim.index], categorySize ); symbolSize[valueDim.index] = parsePercent( symbolSize[valueDim.index], symbolRepeat ? categorySize : Math.abs(boundingLength) ); output.symbolSize = symbolSize; // If x or y is less than zero, show reversed shape. var symbolScale = output.symbolScale = [ symbolSize[0] / symbolPatternSize, symbolSize[1] / symbolPatternSize ]; // Follow convention, 'right' and 'top' is the normal scale. symbolScale[valueDim.index] *= (opt.isHorizontal ? -1 : 1) * pxSign; }
[ "function", "prepareSymbolSize", "(", "data", ",", "dataIndex", ",", "layout", ",", "symbolRepeat", ",", "symbolClip", ",", "boundingLength", ",", "pxSign", ",", "symbolPatternSize", ",", "opt", ",", "output", ")", "{", "var", "valueDim", "=", "opt", ".", "v...
Support ['100%', '100%']
[ "Support", "[", "100%", "100%", "]" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/bar/PictorialBarView.js#L238-L280
train
Prepare the symbol size for the categorizing chart.
[ 30522, 3853, 20776, 24335, 14956, 5332, 4371, 1006, 2951, 1010, 2951, 22254, 10288, 1010, 9621, 1010, 6454, 2890, 5051, 4017, 1010, 6454, 20464, 11514, 1010, 5391, 2075, 7770, 13512, 2232, 1010, 1052, 2595, 5332, 16206, 1010, 6454, 4502, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/EditorStatusBar.js
_updateEncodingInfo
function _updateEncodingInfo(editor) { var doc = editor.document; // Show the current encoding as button title if (!doc.file._encoding) { doc.file._encoding = "UTF-8"; } encodingSelect.$button.text(doc.file._encoding); }
javascript
function _updateEncodingInfo(editor) { var doc = editor.document; // Show the current encoding as button title if (!doc.file._encoding) { doc.file._encoding = "UTF-8"; } encodingSelect.$button.text(doc.file._encoding); }
[ "function", "_updateEncodingInfo", "(", "editor", ")", "{", "var", "doc", "=", "editor", ".", "document", ";", "// Show the current encoding as button title", "if", "(", "!", "doc", ".", "file", ".", "_encoding", ")", "{", "doc", ".", "file", ".", "_encoding",...
Update encoding @param {Editor} editor Current editor
[ "Update", "encoding" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorStatusBar.js#L100-L108
train
Update the encoding button
[ 30522, 3853, 1035, 10651, 2368, 3597, 4667, 2378, 14876, 1006, 3559, 1007, 1063, 13075, 9986, 1027, 3559, 1012, 6254, 1025, 1013, 1013, 2265, 1996, 2783, 17181, 2004, 6462, 2516, 2065, 1006, 999, 9986, 1012, 5371, 1012, 1035, 17181, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
src/core/util/options.js
mergeHook
function mergeHook ( parentVal: ?Array<Function>, childVal: ?Function | ?Array<Function> ): ?Array<Function> { return childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal }
javascript
function mergeHook ( parentVal: ?Array<Function>, childVal: ?Function | ?Array<Function> ): ?Array<Function> { return childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal }
[ "function", "mergeHook", "(", "parentVal", ":", "?", "Array", "<", "Function", ">", ",", "childVal", ":", "?", "Function", "|", "?", "Array", "<", "Function", ">", ")", ":", "?", "Array", "<", "Function", ">", "{", "return", "childVal", "?", "parentVal...
Hooks and props are merged as arrays.
[ "Hooks", "and", "props", "are", "merged", "as", "arrays", "." ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/core/util/options.js#L120-L131
train
Merge a hook with a child hook
[ 30522, 3853, 13590, 6806, 6559, 1006, 6687, 10175, 1024, 1029, 9140, 1026, 3853, 1028, 1010, 2775, 10175, 1024, 1029, 3853, 1064, 1029, 9140, 1026, 3853, 1028, 1007, 1024, 1029, 9140, 1026, 3853, 1028, 1063, 2709, 2775, 10175, 1029, 6687, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/code-path-analysis/code-path-state.js
getContinueContext
function getContinueContext(state, label) { if (!label) { return state.loopContext; } let context = state.loopContext; while (context) { if (context.label === label) { return context; } context = context.upper; } /* istanbul ignore next: foolproof (syntax error) */ return null; }
javascript
function getContinueContext(state, label) { if (!label) { return state.loopContext; } let context = state.loopContext; while (context) { if (context.label === label) { return context; } context = context.upper; } /* istanbul ignore next: foolproof (syntax error) */ return null; }
[ "function", "getContinueContext", "(", "state", ",", "label", ")", "{", "if", "(", "!", "label", ")", "{", "return", "state", ".", "loopContext", ";", "}", "let", "context", "=", "state", ".", "loopContext", ";", "while", "(", "context", ")", "{", "if"...
Gets a loop-context for a `continue` statement. @param {CodePathState} state - A state to get. @param {string} label - The label of a `continue` statement. @returns {LoopContext} A loop-context for a `continue` statement.
[ "Gets", "a", "loop", "-", "context", "for", "a", "continue", "statement", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/code-path-analysis/code-path-state.js#L50-L66
train
Returns the context for a continue statement
[ 30522, 3853, 2131, 8663, 7629, 5657, 8663, 18209, 1006, 2110, 1010, 3830, 1007, 1063, 2065, 1006, 999, 3830, 1007, 1063, 2709, 2110, 1012, 7077, 8663, 18209, 1025, 1065, 2292, 6123, 1027, 2110, 1012, 7077, 8663, 18209, 1025, 2096, 1006, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js
downloadReportZip
function downloadReportZip(oData) { this.getReportHtml(oData).done(function (html) { var report = '<!DOCTYPE HTML><html><head><title>Report</title></head><body><div id="sap-report-content">' + html + '</div></body></html>'; var issues = { 'issues': oData.issues }; var appInfos = { 'appInfos': oData.application }; var technicalInfo = { 'technicalInfo': oData.technical }; var archiver = new Archiver(); archiver.add('technicalInfo.json', technicalInfo, 'json'); archiver.add('issues.json', issues, 'json'); archiver.add('appInfos.json', appInfos, 'json'); archiver.add('report.html', report); archiver.add('abap.json', oData.abap, 'json'); archiver.download("SupportAssistantReport"); archiver.clear(); }); }
javascript
function downloadReportZip(oData) { this.getReportHtml(oData).done(function (html) { var report = '<!DOCTYPE HTML><html><head><title>Report</title></head><body><div id="sap-report-content">' + html + '</div></body></html>'; var issues = { 'issues': oData.issues }; var appInfos = { 'appInfos': oData.application }; var technicalInfo = { 'technicalInfo': oData.technical }; var archiver = new Archiver(); archiver.add('technicalInfo.json', technicalInfo, 'json'); archiver.add('issues.json', issues, 'json'); archiver.add('appInfos.json', appInfos, 'json'); archiver.add('report.html', report); archiver.add('abap.json', oData.abap, 'json'); archiver.download("SupportAssistantReport"); archiver.clear(); }); }
[ "function", "downloadReportZip", "(", "oData", ")", "{", "this", ".", "getReportHtml", "(", "oData", ")", ".", "done", "(", "function", "(", "html", ")", "{", "var", "report", "=", "'<!DOCTYPE HTML><html><head><title>Report</title></head><body><div id=\"sap-report-conte...
Creates a zip file containing the report.html, appInfo.json, technicalInfo.json, issues.json. @param {Object} oData - the data required to create a report
[ "Creates", "a", "zip", "file", "containing", "the", "report", ".", "html", "appInfo", ".", "json", "technicalInfo", ".", "json", "issues", ".", "json", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js#L400-L415
train
Download the report zip
[ 30522, 3853, 8816, 2890, 6442, 5831, 2361, 1006, 1051, 2850, 2696, 1007, 1063, 2023, 1012, 2131, 2890, 6442, 11039, 19968, 1006, 1051, 2850, 2696, 1007, 1012, 2589, 1006, 3853, 1006, 16129, 1007, 1063, 13075, 3189, 1027, 1005, 1026, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/js/mui.locker.js
function(diffX, diffY) { var self = this; var Re = []; for (var row = 0; row < 3; row++) { for (var col = 0; col < 3; col++) { var Point = { X: (self.OffsetX + col * diffX + (col * 2 + 1) * self.R), Y: (self.OffsetY + row * diffY + (row * 2 + 1) * self.R) }; Re.push(Point); } } return Re; }
javascript
function(diffX, diffY) { var self = this; var Re = []; for (var row = 0; row < 3; row++) { for (var col = 0; col < 3; col++) { var Point = { X: (self.OffsetX + col * diffX + (col * 2 + 1) * self.R), Y: (self.OffsetY + row * diffY + (row * 2 + 1) * self.R) }; Re.push(Point); } } return Re; }
[ "function", "(", "diffX", ",", "diffY", ")", "{", "var", "self", "=", "this", ";", "var", "Re", "=", "[", "]", ";", "for", "(", "var", "row", "=", "0", ";", "row", "<", "3", ";", "row", "++", ")", "{", "for", "(", "var", "col", "=", "0", ...
计算
[ "计算" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/js/mui.locker.js#L107-L120
train
Returns a list of points that are within the specified rectangle
[ 30522, 3853, 1006, 4487, 4246, 2595, 1010, 4487, 16329, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 13075, 2128, 1027, 1031, 1033, 1025, 2005, 1006, 13075, 5216, 1027, 1014, 1025, 5216, 1026, 1017, 1025, 5216, 1009, 1009, 1007, 1063, 2005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
js/mui.jsonp.js
function(url) { var element = doc.createElement('script'); element.src = url; element.async = true; element.defer = true; container.appendChild(element); return element; }
javascript
function(url) { var element = doc.createElement('script'); element.src = url; element.async = true; element.defer = true; container.appendChild(element); return element; }
[ "function", "(", "url", ")", "{", "var", "element", "=", "doc", ".", "createElement", "(", "'script'", ")", ";", "element", ".", "src", "=", "url", ";", "element", ".", "async", "=", "true", ";", "element", ".", "defer", "=", "true", ";", "container"...
导入 script 元素
[ "导入", "script", "元素" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/js/mui.jsonp.js#L20-L27
train
Creates a script element
[ 30522, 3853, 1006, 24471, 2140, 1007, 1063, 13075, 5783, 1027, 9986, 1012, 3443, 12260, 3672, 1006, 1005, 5896, 1005, 1007, 1025, 5783, 1012, 5034, 2278, 1027, 24471, 2140, 1025, 5783, 1012, 2004, 6038, 2278, 1027, 2995, 1025, 5783, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ccxt/ccxt
examples/js/load-all-tickers-at-once.js
async function (exchange, symbol) { try { await exchange.loadMarkets () if (symbol in exchange.markets) { let ticker = await exchange.fetchTicker (symbol) log (exchange.id.green, symbol.green, 'ticker', ticker['datetime'], 'high: ' + human_value (ticker['high']), 'low: ' + human_value (ticker['low']), 'bid: ' + human_value (ticker['bid']), 'ask: ' + human_value (ticker['ask']), 'volume: ' + human_value (ticker['quoteVolume'])) } else { // do nothing or throw an error log.bright.yellow (exchange.id + ' does not have ' + symbol) } } catch (e) { if (e instanceof ccxt.DDoSProtection) { log.bright.yellow (exchange.id, '[DDoS Protection]') } else if (e instanceof ccxt.RequestTimeout) { log.bright.yellow (exchange.id, '[Request Timeout]') } else if (e instanceof ccxt.AuthenticationError) { log.bright.yellow (exchange.id, '[Authentication Error]') } else if (e instanceof ccxt.ExchangeNotAvailable) { log.bright.yellow (exchange.id, '[Exchange Not Available]') } else if (e instanceof ccxt.ExchangeError) { log.bright.yellow (exchange.id, '[Exchange Error]') } else if (e instanceof ccxt.NetworkError) { log.bright.yellow (exchange.id, '[Network Error]') } else { throw e } } }
javascript
async function (exchange, symbol) { try { await exchange.loadMarkets () if (symbol in exchange.markets) { let ticker = await exchange.fetchTicker (symbol) log (exchange.id.green, symbol.green, 'ticker', ticker['datetime'], 'high: ' + human_value (ticker['high']), 'low: ' + human_value (ticker['low']), 'bid: ' + human_value (ticker['bid']), 'ask: ' + human_value (ticker['ask']), 'volume: ' + human_value (ticker['quoteVolume'])) } else { // do nothing or throw an error log.bright.yellow (exchange.id + ' does not have ' + symbol) } } catch (e) { if (e instanceof ccxt.DDoSProtection) { log.bright.yellow (exchange.id, '[DDoS Protection]') } else if (e instanceof ccxt.RequestTimeout) { log.bright.yellow (exchange.id, '[Request Timeout]') } else if (e instanceof ccxt.AuthenticationError) { log.bright.yellow (exchange.id, '[Authentication Error]') } else if (e instanceof ccxt.ExchangeNotAvailable) { log.bright.yellow (exchange.id, '[Exchange Not Available]') } else if (e instanceof ccxt.ExchangeError) { log.bright.yellow (exchange.id, '[Exchange Error]') } else if (e instanceof ccxt.NetworkError) { log.bright.yellow (exchange.id, '[Network Error]') } else { throw e } } }
[ "async", "function", "(", "exchange", ",", "symbol", ")", "{", "try", "{", "await", "exchange", ".", "loadMarkets", "(", ")", "if", "(", "symbol", "in", "exchange", ".", "markets", ")", "{", "let", "ticker", "=", "await", "exchange", ".", "fetchTicker", ...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
8168069b9180a465532905e225586215e115a565
https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/examples/js/load-all-tickers-at-once.js#L22-L63
train
get the term
[ 30522, 2004, 6038, 2278, 3853, 1006, 3863, 1010, 6454, 1007, 1063, 3046, 1063, 26751, 3863, 1012, 7170, 20285, 2015, 1006, 1007, 2065, 1006, 6454, 1999, 3863, 1012, 6089, 1007, 1063, 2292, 16356, 2121, 1027, 26751, 3863, 1012, 18584, 26348,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
emberjs/ember.js
packages/@ember/object/lib/computed/reduce_computed_macros.js
propertySort
function propertySort(itemsKey, sortPropertiesKey) { let activeObserversMap = new WeakMap(); let sortPropertyDidChangeMap = new WeakMap(); if (EMBER_METAL_TRACKED_PROPERTIES) { let cp = computed(`${itemsKey}.[]`, `${sortPropertiesKey}.[]`, function(key) { let sortProperties = get(this, sortPropertiesKey); assert( `The sort definition for '${key}' on ${this} must be a function or an array of strings`, isArray(sortProperties) && sortProperties.every(s => typeof s === 'string') ); let itemsKeyIsAtThis = itemsKey === '@this'; let normalizedSortProperties = normalizeSortProperties(sortProperties); let items = itemsKeyIsAtThis ? this : get(this, itemsKey); if (!isArray(items)) { return emberA(); } if (normalizedSortProperties.length === 0) { return emberA(items.slice()); } else { return sortByNormalizedSortProperties(items, normalizedSortProperties); } }).readOnly(); descriptorForDecorator(cp).auto(); return cp; } else { return computed(`${sortPropertiesKey}.[]`, function(key) { let sortProperties = get(this, sortPropertiesKey); assert( `The sort definition for '${key}' on ${this} must be a function or an array of strings`, isArray(sortProperties) && sortProperties.every(s => typeof s === 'string') ); // Add/remove property observers as required. let activeObservers = activeObserversMap.get(this); if (!sortPropertyDidChangeMap.has(this)) { sortPropertyDidChangeMap.set(this, function() { notifyPropertyChange(this, key); }); } let sortPropertyDidChange = sortPropertyDidChangeMap.get(this); if (activeObservers !== undefined) { activeObservers.forEach(path => removeObserver(this, path, sortPropertyDidChange)); } let itemsKeyIsAtThis = itemsKey === '@this'; let normalizedSortProperties = normalizeSortProperties(sortProperties); if (normalizedSortProperties.length === 0) { let path = itemsKeyIsAtThis ? `[]` : `${itemsKey}.[]`; addObserver(this, path, sortPropertyDidChange); activeObservers = [path]; } else { activeObservers = normalizedSortProperties.map(([prop]) => { let path = itemsKeyIsAtThis ? `@each.${prop}` : `${itemsKey}.@each.${prop}`; addObserver(this, path, sortPropertyDidChange); return path; }); } activeObserversMap.set(this, activeObservers); let items = itemsKeyIsAtThis ? this : get(this, itemsKey); if (!isArray(items)) { return emberA(); } if (normalizedSortProperties.length === 0) { return emberA(items.slice()); } else { return sortByNormalizedSortProperties(items, normalizedSortProperties); } }).readOnly(); } }
javascript
function propertySort(itemsKey, sortPropertiesKey) { let activeObserversMap = new WeakMap(); let sortPropertyDidChangeMap = new WeakMap(); if (EMBER_METAL_TRACKED_PROPERTIES) { let cp = computed(`${itemsKey}.[]`, `${sortPropertiesKey}.[]`, function(key) { let sortProperties = get(this, sortPropertiesKey); assert( `The sort definition for '${key}' on ${this} must be a function or an array of strings`, isArray(sortProperties) && sortProperties.every(s => typeof s === 'string') ); let itemsKeyIsAtThis = itemsKey === '@this'; let normalizedSortProperties = normalizeSortProperties(sortProperties); let items = itemsKeyIsAtThis ? this : get(this, itemsKey); if (!isArray(items)) { return emberA(); } if (normalizedSortProperties.length === 0) { return emberA(items.slice()); } else { return sortByNormalizedSortProperties(items, normalizedSortProperties); } }).readOnly(); descriptorForDecorator(cp).auto(); return cp; } else { return computed(`${sortPropertiesKey}.[]`, function(key) { let sortProperties = get(this, sortPropertiesKey); assert( `The sort definition for '${key}' on ${this} must be a function or an array of strings`, isArray(sortProperties) && sortProperties.every(s => typeof s === 'string') ); // Add/remove property observers as required. let activeObservers = activeObserversMap.get(this); if (!sortPropertyDidChangeMap.has(this)) { sortPropertyDidChangeMap.set(this, function() { notifyPropertyChange(this, key); }); } let sortPropertyDidChange = sortPropertyDidChangeMap.get(this); if (activeObservers !== undefined) { activeObservers.forEach(path => removeObserver(this, path, sortPropertyDidChange)); } let itemsKeyIsAtThis = itemsKey === '@this'; let normalizedSortProperties = normalizeSortProperties(sortProperties); if (normalizedSortProperties.length === 0) { let path = itemsKeyIsAtThis ? `[]` : `${itemsKey}.[]`; addObserver(this, path, sortPropertyDidChange); activeObservers = [path]; } else { activeObservers = normalizedSortProperties.map(([prop]) => { let path = itemsKeyIsAtThis ? `@each.${prop}` : `${itemsKey}.@each.${prop}`; addObserver(this, path, sortPropertyDidChange); return path; }); } activeObserversMap.set(this, activeObservers); let items = itemsKeyIsAtThis ? this : get(this, itemsKey); if (!isArray(items)) { return emberA(); } if (normalizedSortProperties.length === 0) { return emberA(items.slice()); } else { return sortByNormalizedSortProperties(items, normalizedSortProperties); } }).readOnly(); } }
[ "function", "propertySort", "(", "itemsKey", ",", "sortPropertiesKey", ")", "{", "let", "activeObserversMap", "=", "new", "WeakMap", "(", ")", ";", "let", "sortPropertyDidChangeMap", "=", "new", "WeakMap", "(", ")", ";", "if", "(", "EMBER_METAL_TRACKED_PROPERTIES"...
This one needs to dynamically set up and tear down observers on the itemsKey depending on the sortProperties
[ "This", "one", "needs", "to", "dynamically", "set", "up", "and", "tear", "down", "observers", "on", "the", "itemsKey", "depending", "on", "the", "sortProperties" ]
7ef1d08b7fe44000cf97b3c43566d20337b0683d
https://github.com/emberjs/ember.js/blob/7ef1d08b7fe44000cf97b3c43566d20337b0683d/packages/@ember/object/lib/computed/reduce_computed_macros.js#L1487-L1570
train
Returns a computed property which sorts the items in the given array of items by the given property name.
[ 30522, 3853, 3200, 21748, 2102, 1006, 5167, 14839, 1010, 4066, 21572, 4842, 7368, 14839, 1007, 1063, 2292, 3161, 16429, 8043, 14028, 2863, 2361, 1027, 2047, 5410, 2863, 2361, 1006, 1007, 1025, 2292, 4066, 21572, 4842, 3723, 4305, 16409, 180...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js
ODataParentBinding
function ODataParentBinding() { // initialize members introduced by ODataBinding asODataBinding.call(this); // the aggregated query options this.mAggregatedQueryOptions = {}; // whether the aggregated query options are processed the first time this.bAggregatedQueryOptionsInitial = true; // auto-$expand/$select: promises to wait until child bindings have provided // their path and query options this.aChildCanUseCachePromises = []; // counts the sent but not yet completed PATCHes this.iPatchCounter = 0; // whether all sent PATCHes have been successfully processed this.bPatchSuccess = true; this.oReadGroupLock = undefined; // see #createReadGroupLock this.oResumePromise = undefined; // see #getResumePromise }
javascript
function ODataParentBinding() { // initialize members introduced by ODataBinding asODataBinding.call(this); // the aggregated query options this.mAggregatedQueryOptions = {}; // whether the aggregated query options are processed the first time this.bAggregatedQueryOptionsInitial = true; // auto-$expand/$select: promises to wait until child bindings have provided // their path and query options this.aChildCanUseCachePromises = []; // counts the sent but not yet completed PATCHes this.iPatchCounter = 0; // whether all sent PATCHes have been successfully processed this.bPatchSuccess = true; this.oReadGroupLock = undefined; // see #createReadGroupLock this.oResumePromise = undefined; // see #getResumePromise }
[ "function", "ODataParentBinding", "(", ")", "{", "// initialize members introduced by ODataBinding", "asODataBinding", ".", "call", "(", "this", ")", ";", "// the aggregated query options", "this", ".", "mAggregatedQueryOptions", "=", "{", "}", ";", "// whether the aggregat...
A mixin for all OData V4 bindings with dependent bindings. @alias sap.ui.model.odata.v4.ODataParentBinding @extends sap.ui.model.odata.v4.ODataBinding @mixin
[ "A", "mixin", "for", "all", "OData", "V4", "bindings", "with", "dependent", "bindings", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js#L24-L41
train
The ODataParentBinding class
[ 30522, 3853, 1051, 2850, 2696, 19362, 4765, 8428, 4667, 1006, 1007, 1063, 1013, 1013, 3988, 4697, 2372, 3107, 2011, 1051, 2850, 2696, 8428, 4667, 2004, 13390, 2696, 8428, 4667, 1012, 2655, 1006, 2023, 1007, 1025, 1013, 1013, 1996, 9572, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/EditorOptionHandlers.js
_updateCheckedState
function _updateCheckedState(name) { var mapping = _optionMapping[name]; if (!mapping) { return; } CommandManager.get(mapping).setChecked(PreferencesManager.get(name)); }
javascript
function _updateCheckedState(name) { var mapping = _optionMapping[name]; if (!mapping) { return; } CommandManager.get(mapping).setChecked(PreferencesManager.get(name)); }
[ "function", "_updateCheckedState", "(", "name", ")", "{", "var", "mapping", "=", "_optionMapping", "[", "name", "]", ";", "if", "(", "!", "mapping", ")", "{", "return", ";", "}", "CommandManager", ".", "get", "(", "mapping", ")", ".", "setChecked", "(", ...
@private Updates the command checked status based on the preference name given. @param {string} name Name of preference that has changed
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorOptionHandlers.js#L64-L70
train
Updates the state of a command
[ 30522, 3853, 1035, 10651, 5403, 18141, 9153, 2618, 1006, 2171, 1007, 1063, 13075, 12375, 1027, 1035, 5724, 2863, 14853, 1031, 2171, 1033, 1025, 2065, 1006, 999, 12375, 1007, 1063, 2709, 1025, 1065, 3094, 24805, 4590, 1012, 2131, 1006, 12375...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netlify/netlify-cms
packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js
transform
function transform(node) { /** * Combine adjacent text and inline nodes before processing so they can * share marks. */ const combinedChildren = node.nodes && combineTextAndInline(node.nodes); /** * Call `transform` recursively on child nodes, and flatten the resulting * array. */ const children = !isEmpty(combinedChildren) && flatMap(combinedChildren, transform); /** * Run individual nodes through conversion factories. */ return ['text'].includes(node.object) ? convertTextNode(node) : convertNode(node, children); }
javascript
function transform(node) { /** * Combine adjacent text and inline nodes before processing so they can * share marks. */ const combinedChildren = node.nodes && combineTextAndInline(node.nodes); /** * Call `transform` recursively on child nodes, and flatten the resulting * array. */ const children = !isEmpty(combinedChildren) && flatMap(combinedChildren, transform); /** * Run individual nodes through conversion factories. */ return ['text'].includes(node.object) ? convertTextNode(node) : convertNode(node, children); }
[ "function", "transform", "(", "node", ")", "{", "/**\n * Combine adjacent text and inline nodes before processing so they can\n * share marks.\n */", "const", "combinedChildren", "=", "node", ".", "nodes", "&&", "combineTextAndInline", "(", "node", ".", "nodes", ")", ";...
The transform function mimics the approach of a Remark plugin for conformity with the other serialization functions. This function converts Slate nodes to MDAST nodes, and recursively calls itself to process child nodes to arbitrary depth.
[ "The", "transform", "function", "mimics", "the", "approach", "of", "a", "Remark", "plugin", "for", "conformity", "with", "the", "other", "serialization", "functions", ".", "This", "function", "converts", "Slate", "nodes", "to", "MDAST", "nodes", "and", "recursiv...
2488556590cbfdcefa626f2f2de01e7a160cf6ee
https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-widget-markdown/src/serializers/slateRemark.js#L57-L74
train
Transform a node recursively.
[ 30522, 3853, 10938, 1006, 13045, 1007, 1063, 1013, 1008, 1008, 1008, 11506, 5516, 3793, 1998, 23881, 14164, 2077, 6364, 2061, 2027, 2064, 1008, 3745, 6017, 1012, 1008, 1013, 9530, 3367, 4117, 19339, 7389, 1027, 13045, 1012, 14164, 1004, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/preferences/PreferencesBase.js
function (data, oldContext, newContext) { var newGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, newContext[this.key])), oldGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, oldContext[this.key])); if (newGlob === oldGlob) { return; } if (newGlob === undefined) { return _.keys(data[oldGlob]); } if (oldGlob === undefined) { return _.keys(data[newGlob]); } return _.union(_.keys(data[oldGlob]), _.keys(data[newGlob])); }
javascript
function (data, oldContext, newContext) { var newGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, newContext[this.key])), oldGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, oldContext[this.key])); if (newGlob === oldGlob) { return; } if (newGlob === undefined) { return _.keys(data[oldGlob]); } if (oldGlob === undefined) { return _.keys(data[newGlob]); } return _.union(_.keys(data[oldGlob]), _.keys(data[newGlob])); }
[ "function", "(", "data", ",", "oldContext", ",", "newContext", ")", "{", "var", "newGlob", "=", "_findMatchingGlob", "(", "data", ",", "FileUtils", ".", "getRelativeFilename", "(", "this", ".", "prefFilePath", ",", "newContext", "[", "this", ".", "key", "]",...
Determines if there are preference IDs that could change as a result of a change in the context. This implementation considers only the path portion of the context and looks up matching globes if any. @param {Object} data Data in the Scope @param {{path: string}} oldContext Old context @param {{path: string}} newContext New context @return {Array.<string>} list of preference IDs that could have changed
[ "Determines", "if", "there", "are", "preference", "IDs", "that", "could", "change", "as", "a", "result", "of", "a", "change", "in", "the", "context", ".", "This", "implementation", "considers", "only", "the", "path", "portion", "of", "the", "context", "and",...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1001-L1018
train
returns the keys of the new and old globs
[ 30522, 3853, 1006, 2951, 1010, 2214, 8663, 18209, 1010, 2047, 8663, 18209, 1007, 1063, 13075, 2047, 23296, 16429, 1027, 1035, 2424, 18900, 8450, 23296, 16429, 1006, 2951, 1010, 5371, 21823, 4877, 1012, 2131, 16570, 8082, 8873, 20844, 4168, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
packages/weex-vue-framework/factory.js
flushSchedulerQueue
function flushSchedulerQueue () { flushing = true; var watcher, id, vm; // Sort queue before flush. // This ensures that: // 1. Components are updated from parent to child. (because parent is always // created before the child) // 2. A component's user watchers are run before its render watcher (because // user watchers are created before the render watcher) // 3. If a component is destroyed during a parent component's watcher run, // its watchers can be skipped. queue.sort(function (a, b) { return a.id - b.id; }); // do not cache length because more watchers might be pushed // as we run existing watchers for (index = 0; index < queue.length; index++) { watcher = queue[index]; id = watcher.id; has[id] = null; watcher.run(); // in dev build, check and stop circular updates. if (process.env.NODE_ENV !== 'production' && has[id] != null) { circular[id] = (circular[id] || 0) + 1; if (circular[id] > config._maxUpdateCount) { warn( 'You may have an infinite update loop ' + ( watcher.user ? ("in watcher with expression \"" + (watcher.expression) + "\"") : "in a component render function." ), watcher.vm ); break } } } // call updated hooks index = queue.length; while (index--) { watcher = queue[index]; vm = watcher.vm; if (vm._watcher === watcher && vm._isMounted) { callHook(vm, 'updated'); } } // devtool hook /* istanbul ignore if */ if (devtools && config.devtools) { devtools.emit('flush'); } resetSchedulerState(); }
javascript
function flushSchedulerQueue () { flushing = true; var watcher, id, vm; // Sort queue before flush. // This ensures that: // 1. Components are updated from parent to child. (because parent is always // created before the child) // 2. A component's user watchers are run before its render watcher (because // user watchers are created before the render watcher) // 3. If a component is destroyed during a parent component's watcher run, // its watchers can be skipped. queue.sort(function (a, b) { return a.id - b.id; }); // do not cache length because more watchers might be pushed // as we run existing watchers for (index = 0; index < queue.length; index++) { watcher = queue[index]; id = watcher.id; has[id] = null; watcher.run(); // in dev build, check and stop circular updates. if (process.env.NODE_ENV !== 'production' && has[id] != null) { circular[id] = (circular[id] || 0) + 1; if (circular[id] > config._maxUpdateCount) { warn( 'You may have an infinite update loop ' + ( watcher.user ? ("in watcher with expression \"" + (watcher.expression) + "\"") : "in a component render function." ), watcher.vm ); break } } } // call updated hooks index = queue.length; while (index--) { watcher = queue[index]; vm = watcher.vm; if (vm._watcher === watcher && vm._isMounted) { callHook(vm, 'updated'); } } // devtool hook /* istanbul ignore if */ if (devtools && config.devtools) { devtools.emit('flush'); } resetSchedulerState(); }
[ "function", "flushSchedulerQueue", "(", ")", "{", "flushing", "=", "true", ";", "var", "watcher", ",", "id", ",", "vm", ";", "// Sort queue before flush.", "// This ensures that:", "// 1. Components are updated from parent to child. (because parent is always", "// created be...
Flush both queues and run the watchers.
[ "Flush", "both", "queues", "and", "run", "the", "watchers", "." ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/factory.js#L2286-L2341
train
flush scheduler queue
[ 30522, 3853, 13862, 22842, 8566, 3917, 4226, 5657, 1006, 1007, 1063, 23519, 1027, 2995, 1025, 13075, 3422, 2121, 1010, 8909, 1010, 1058, 2213, 1025, 1013, 1013, 4066, 24240, 2077, 13862, 1012, 1013, 1013, 2023, 21312, 2008, 1024, 1013, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/preferences/PreferencesBase.js
function (newData) { var result = new $.Deferred(); var path = this.path; var prefFile = FileSystem.getFileForPath(path); if (path) { try { var text = JSON.stringify(newData, null, 4); // maintain the original line endings text = FileUtils.translateLineEndings(text, this._lineEndings); prefFile.write(text, {}, function (err) { if (err) { result.reject("Unable to save prefs at " + path + " " + err); } else { result.resolve(); } }); } catch (e) { result.reject("Unable to convert prefs to JSON" + e.toString()); } } else { result.resolve(); } return result.promise(); }
javascript
function (newData) { var result = new $.Deferred(); var path = this.path; var prefFile = FileSystem.getFileForPath(path); if (path) { try { var text = JSON.stringify(newData, null, 4); // maintain the original line endings text = FileUtils.translateLineEndings(text, this._lineEndings); prefFile.write(text, {}, function (err) { if (err) { result.reject("Unable to save prefs at " + path + " " + err); } else { result.resolve(); } }); } catch (e) { result.reject("Unable to convert prefs to JSON" + e.toString()); } } else { result.resolve(); } return result.promise(); }
[ "function", "(", "newData", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "var", "path", "=", "this", ".", "path", ";", "var", "prefFile", "=", "FileSystem", ".", "getFileForPath", "(", "path", ")", ";", "if", "(", "pa...
Saves the new data to disk. @param {Object} newData data to save @return {Promise} Promise resolved (with no arguments) once the data has been saved
[ "Saves", "the", "new", "data", "to", "disk", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L237-L262
train
Save the new data to the file system
[ 30522, 3853, 1006, 2047, 2850, 2696, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 13075, 4130, 30524, 3385, 1012, 5164, 8757, 1006, 2047, 2850, 2696, 1010, 19701, 1010, 1018, 1007, 1025, 1013, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
didi/cube-ui
example/modules/image.js
orientationHelper
function orientationHelper(canvas, ctx, orientation) { const w = canvas.width, h = canvas.height; if(orientation > 4){ canvas.width = h; canvas.height = w; } switch (orientation) { case 2: ctx.translate(w, 0); ctx.scale(-1, 1); break; case 3: ctx.translate(w, h); ctx.rotate(Math.PI); break; case 4: ctx.translate(0, h); ctx.scale(1, -1); break; case 5: ctx.rotate(0.5 * Math.PI); ctx.scale(1, -1); break; case 6: ctx.rotate(0.5 * Math.PI); ctx.translate(0, -h); break; case 7: ctx.rotate(0.5 * Math.PI); ctx.translate(w, -h); ctx.scale(-1, 1); break; case 8: ctx.rotate(-0.5 * Math.PI); ctx.translate(-w, 0); break; } }
javascript
function orientationHelper(canvas, ctx, orientation) { const w = canvas.width, h = canvas.height; if(orientation > 4){ canvas.width = h; canvas.height = w; } switch (orientation) { case 2: ctx.translate(w, 0); ctx.scale(-1, 1); break; case 3: ctx.translate(w, h); ctx.rotate(Math.PI); break; case 4: ctx.translate(0, h); ctx.scale(1, -1); break; case 5: ctx.rotate(0.5 * Math.PI); ctx.scale(1, -1); break; case 6: ctx.rotate(0.5 * Math.PI); ctx.translate(0, -h); break; case 7: ctx.rotate(0.5 * Math.PI); ctx.translate(w, -h); ctx.scale(-1, 1); break; case 8: ctx.rotate(-0.5 * Math.PI); ctx.translate(-w, 0); break; } }
[ "function", "orientationHelper", "(", "canvas", ",", "ctx", ",", "orientation", ")", "{", "const", "w", "=", "canvas", ".", "width", ",", "h", "=", "canvas", ".", "height", ";", "if", "(", "orientation", ">", "4", ")", "{", "canvas", ".", "width", "=...
修正拍照时图片的方向 ref to http://stackoverflow.com/questions/19463126/how-to-draw-photo-with-correct-orientation-in-canvas-after-capture-photo-by-usin
[ "修正拍照时图片的方向", "ref", "to", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "19463126", "/", "how", "-", "to", "-", "draw", "-", "photo", "-", "with", "-", "correct", "-", "orientation", "-", "in", "-", "canvas", "-", "after", "...
29096d1fe600c699237db8039255f74126730157
https://github.com/didi/cube-ui/blob/29096d1fe600c699237db8039255f74126730157/example/modules/image.js#L105-L142
train
Helper function for orientation
[ 30522, 3853, 10296, 16001, 4842, 1006, 10683, 1010, 14931, 2595, 1010, 10296, 1007, 1063, 9530, 3367, 1059, 1027, 10683, 1012, 9381, 1010, 1044, 1027, 10683, 1012, 4578, 1025, 2065, 1006, 10296, 1028, 1018, 1007, 1063, 10683, 1012, 9381, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
src/ol/render/canvas/ExecutorGroup.js
fillCircleArrayRowToMiddle
function fillCircleArrayRowToMiddle(array, x, y) { let i; const radius = Math.floor(array.length / 2); if (x >= radius) { for (i = radius; i < x; i++) { array[i][y] = true; } } else if (x < radius) { for (i = x + 1; i < radius; i++) { array[i][y] = true; } } }
javascript
function fillCircleArrayRowToMiddle(array, x, y) { let i; const radius = Math.floor(array.length / 2); if (x >= radius) { for (i = radius; i < x; i++) { array[i][y] = true; } } else if (x < radius) { for (i = x + 1; i < radius; i++) { array[i][y] = true; } } }
[ "function", "fillCircleArrayRowToMiddle", "(", "array", ",", "x", ",", "y", ")", "{", "let", "i", ";", "const", "radius", "=", "Math", ".", "floor", "(", "array", ".", "length", "/", "2", ")", ";", "if", "(", "x", ">=", "radius", ")", "{", "for", ...
This method fills a row in the array from the given coordinate to the middle with `true`. @param {Array<Array<(boolean|undefined)>>} array The array that will be altered. @param {number} x X coordinate. @param {number} y Y coordinate.
[ "This", "method", "fills", "a", "row", "in", "the", "array", "from", "the", "given", "coordinate", "to", "the", "middle", "with", "true", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/render/canvas/ExecutorGroup.js#L361-L373
train
Fill the array row to the middle of the circle
[ 30522, 3853, 6039, 6895, 21769, 2906, 9447, 10524, 20389, 3593, 10362, 1006, 9140, 1010, 1060, 1010, 1061, 1007, 1063, 2292, 1045, 1025, 9530, 3367, 12177, 1027, 8785, 1012, 2723, 1006, 9140, 1012, 3091, 1013, 1016, 1007, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-compiler/language/javascript/RelayFlowBabelFactories.js
readOnlyArrayOfType
function readOnlyArrayOfType(thing: BabelAST) { return t.genericTypeAnnotation( t.identifier('$ReadOnlyArray'), t.typeParameterInstantiation([thing]), ); }
javascript
function readOnlyArrayOfType(thing: BabelAST) { return t.genericTypeAnnotation( t.identifier('$ReadOnlyArray'), t.typeParameterInstantiation([thing]), ); }
[ "function", "readOnlyArrayOfType", "(", "thing", ":", "BabelAST", ")", "{", "return", "t", ".", "genericTypeAnnotation", "(", "t", ".", "identifier", "(", "'$ReadOnlyArray'", ")", ",", "t", ".", "typeParameterInstantiation", "(", "[", "thing", "]", ")", ",", ...
$ReadOnlyArray<TYPE>
[ "$ReadOnlyArray<TYPE", ">" ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/language/javascript/RelayFlowBabelFactories.js#L84-L89
train
Returns a type annotation for a given type
[ 30522, 3853, 3191, 2239, 2135, 2906, 9447, 15794, 18863, 1006, 2518, 1024, 11561, 8523, 2102, 1007, 1063, 2709, 1056, 1012, 12391, 13874, 11639, 17287, 3508, 1006, 1056, 1012, 8909, 4765, 18095, 1006, 1005, 1002, 3191, 2239, 2135, 30524, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js
function (oEvent) { var sValue = oEvent.getParameter("value"), oControl = oEvent.getSource(); this._storage.put(this._LOCAL_STORAGE_KEYS.CUSTOM_URL, sValue); try { this._validateValue(oControl.getValue()); this._resetValueState(oControl); } catch (oException) { this._showError(oControl, oException.message); } }
javascript
function (oEvent) { var sValue = oEvent.getParameter("value"), oControl = oEvent.getSource(); this._storage.put(this._LOCAL_STORAGE_KEYS.CUSTOM_URL, sValue); try { this._validateValue(oControl.getValue()); this._resetValueState(oControl); } catch (oException) { this._showError(oControl, oException.message); } }
[ "function", "(", "oEvent", ")", "{", "var", "sValue", "=", "oEvent", ".", "getParameter", "(", "\"value\"", ")", ",", "oControl", "=", "oEvent", ".", "getSource", "(", ")", ";", "this", ".", "_storage", ".", "put", "(", "this", ".", "_LOCAL_STORAGE_KEYS"...
Handler for liveChange event fired by custom bootstrap URL. @param oEvent
[ "Handler", "for", "liveChange", "event", "fired", "by", "custom", "bootstrap", "URL", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L369-L379
train
Updates the custom url in the local storage
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 17917, 2389, 5657, 1027, 1051, 18697, 3372, 1012, 2131, 28689, 22828, 1006, 1000, 3643, 1000, 1007, 1010, 1051, 8663, 13181, 2140, 1027, 1051, 18697, 3372, 1012, 4152, 8162, 3401, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
getModulePath
function getModulePath(sModuleName, sSuffix){ return sap.ui.require.toUrl(sModuleName.replace(/\./g, "/") + sSuffix); }
javascript
function getModulePath(sModuleName, sSuffix){ return sap.ui.require.toUrl(sModuleName.replace(/\./g, "/") + sSuffix); }
[ "function", "getModulePath", "(", "sModuleName", ",", "sSuffix", ")", "{", "return", "sap", ".", "ui", ".", "require", ".", "toUrl", "(", "sModuleName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", "+", "sSuffix", ")", ";", "}" ]
Retrieves the module path. @param {string} sModuleName module name. @param {string} sSuffix is used untouched (dots are not replaced with slashes). @returns {string} module path.
[ "Retrieves", "the", "module", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1870-L1872
train
Returns the absolute path of the module with the given name.
[ 30522, 3853, 2131, 5302, 8566, 2571, 15069, 1006, 15488, 7716, 9307, 18442, 1010, 7020, 16093, 8873, 2595, 1007, 1063, 2709, 20066, 1012, 21318, 1012, 5478, 1012, 2778, 2140, 1006, 15488, 7716, 9307, 18442, 1012, 5672, 1006, 1013, 1032, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jantimon/html-webpack-plugin
lib/compiler.js
compileTemplate
function compileTemplate (templatePath, outputFilename, mainCompilation) { const childCompiler = getChildCompiler(mainCompilation.compiler); return childCompiler.compileTemplates(mainCompilation).then((compiledTemplates) => { if (!compiledTemplates[templatePath]) console.log(Object.keys(compiledTemplates), templatePath); const compiledTemplate = compiledTemplates[templatePath]; // Replace [hash] placeholders in filename const outputName = mainCompilation.mainTemplate.hooks.assetPath.call(outputFilename, { hash: compiledTemplate.hash, chunk: compiledTemplate.entry }); return { // Hash of the template entry point hash: compiledTemplate.hash, // Output name outputName: outputName, // Compiled code content: compiledTemplate.content }; }); }
javascript
function compileTemplate (templatePath, outputFilename, mainCompilation) { const childCompiler = getChildCompiler(mainCompilation.compiler); return childCompiler.compileTemplates(mainCompilation).then((compiledTemplates) => { if (!compiledTemplates[templatePath]) console.log(Object.keys(compiledTemplates), templatePath); const compiledTemplate = compiledTemplates[templatePath]; // Replace [hash] placeholders in filename const outputName = mainCompilation.mainTemplate.hooks.assetPath.call(outputFilename, { hash: compiledTemplate.hash, chunk: compiledTemplate.entry }); return { // Hash of the template entry point hash: compiledTemplate.hash, // Output name outputName: outputName, // Compiled code content: compiledTemplate.content }; }); }
[ "function", "compileTemplate", "(", "templatePath", ",", "outputFilename", ",", "mainCompilation", ")", "{", "const", "childCompiler", "=", "getChildCompiler", "(", "mainCompilation", ".", "compiler", ")", ";", "return", "childCompiler", ".", "compileTemplates", "(", ...
Starts the compilation for all templates. This has to be called once all templates where added. If this function is called multiple times it will use a cache inside the childCompiler @param {string} templatePath @param {string} outputFilename @param {WebpackCompilation} mainCompilation
[ "Starts", "the", "compilation", "for", "all", "templates", ".", "This", "has", "to", "be", "called", "once", "all", "templates", "where", "added", "." ]
38db64ae8805de37d038e0ee0f6dfa2a26e2163a
https://github.com/jantimon/html-webpack-plugin/blob/38db64ae8805de37d038e0ee0f6dfa2a26e2163a/lib/compiler.js#L258-L277
train
Compile a template
[ 30522, 3853, 4012, 22090, 18532, 15725, 1006, 23561, 15069, 1010, 6434, 8873, 20844, 4168, 1010, 2364, 9006, 8197, 13490, 1007, 1063, 9530, 3367, 2775, 9006, 22090, 2099, 1027, 2131, 19339, 9006, 22090, 2099, 1006, 2364, 9006, 8197, 13490, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
necolas/react-native-web
packages/website/storybook/3-demos/Game2048/GameBoard.js
function(matrix) { const rows = matrix.length; const columns = matrix[0].length; const res = []; for (let row = 0; row < rows; ++row) { res.push([]); for (let column = 0; column < columns; ++column) { res[row][column] = matrix[column][columns - row - 1]; } } return res; }
javascript
function(matrix) { const rows = matrix.length; const columns = matrix[0].length; const res = []; for (let row = 0; row < rows; ++row) { res.push([]); for (let column = 0; column < columns; ++column) { res[row][column] = matrix[column][columns - row - 1]; } } return res; }
[ "function", "(", "matrix", ")", "{", "const", "rows", "=", "matrix", ".", "length", ";", "const", "columns", "=", "matrix", "[", "0", "]", ".", "length", ";", "const", "res", "=", "[", "]", ";", "for", "(", "let", "row", "=", "0", ";", "row", "...
NB: Taken straight from: https://github.com/IvanVergiliev/2048-react/blob/master/src/board.js with no modification except to format it for CommonJS and fix lint/flow errors
[ "NB", ":", "Taken", "straight", "from", ":", "https", ":", "//", "github", ".", "com", "/", "IvanVergiliev", "/", "2048", "-", "react", "/", "blob", "/", "master", "/", "src", "/", "board", ".", "js", "with", "no", "modification", "except", "to", "fo...
801937748b2f3c96284bee1881164ac0c62a9c6d
https://github.com/necolas/react-native-web/blob/801937748b2f3c96284bee1881164ac0c62a9c6d/packages/website/storybook/3-demos/Game2048/GameBoard.js#L21-L32
train
Compute the coefficients of a matrix
[ 30522, 3853, 1006, 8185, 1007, 1063, 9530, 3367, 10281, 1027, 8185, 1012, 3091, 1025, 9530, 3367, 7753, 1027, 8185, 1031, 1014, 1033, 1012, 3091, 1025, 9530, 3367, 24501, 1027, 1031, 1033, 1025, 2005, 1006, 2292, 5216, 1027, 1014, 1025, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/Agents/DOMHelpers.js
extractPayload
function extractPayload(content) { var payload = {}; if (content[0] !== "<") { // text payload.nodeType = 3; payload.nodeValue = content; } else if (content.substr(0, 4) === "<!--") { // comment payload.nodeType = 8; payload.nodeValue = content.substr(4, content.length - 7); } else if (content[1] === "!") { // doctype payload.nodeType = 10; } else { // regular element payload.nodeType = 1; payload.nodeName = /^<([^>\s]+)/.exec(content)[1].toUpperCase(); payload.attributes = _extractAttributes(content); // closing node (/ at the beginning) if (payload.nodeName[0] === "/") { payload.nodeName = payload.nodeName.substr(1); payload.closing = true; } // closed node (/ at the end) if (content[content.length - 2] === "/") { payload.closed = true; } // Special handling for script/style tag since we've already collected // everything up to the end tag. if (payload.nodeName === "SCRIPT" || payload.nodeName === "STYLE") { payload.closed = true; } } return payload; }
javascript
function extractPayload(content) { var payload = {}; if (content[0] !== "<") { // text payload.nodeType = 3; payload.nodeValue = content; } else if (content.substr(0, 4) === "<!--") { // comment payload.nodeType = 8; payload.nodeValue = content.substr(4, content.length - 7); } else if (content[1] === "!") { // doctype payload.nodeType = 10; } else { // regular element payload.nodeType = 1; payload.nodeName = /^<([^>\s]+)/.exec(content)[1].toUpperCase(); payload.attributes = _extractAttributes(content); // closing node (/ at the beginning) if (payload.nodeName[0] === "/") { payload.nodeName = payload.nodeName.substr(1); payload.closing = true; } // closed node (/ at the end) if (content[content.length - 2] === "/") { payload.closed = true; } // Special handling for script/style tag since we've already collected // everything up to the end tag. if (payload.nodeName === "SCRIPT" || payload.nodeName === "STYLE") { payload.closed = true; } } return payload; }
[ "function", "extractPayload", "(", "content", ")", "{", "var", "payload", "=", "{", "}", ";", "if", "(", "content", "[", "0", "]", "!==", "\"<\"", ")", "{", "// text", "payload", ".", "nodeType", "=", "3", ";", "payload", ".", "nodeValue", "=", "cont...
Extract the node payload @param {string} source content
[ "Extract", "the", "node", "payload" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMHelpers.js#L183-L221
train
Extract payload from content
[ 30522, 3853, 14817, 4502, 30524, 1027, 1000, 1026, 1000, 1007, 1063, 1013, 1013, 3793, 18093, 1012, 13045, 13874, 1027, 1017, 1025, 18093, 1012, 13045, 10175, 5657, 1027, 4180, 1025, 1065, 2842, 2065, 1006, 4180, 1012, 4942, 3367, 2099, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/output/modifiers/svgToImg.js
renderDOM
function renderDOM($, dom, options) { if (!dom && $._root && $._root.children) { dom = $._root.children; } options = options|| dom.options || $._options; return domSerializer(dom, options); }
javascript
function renderDOM($, dom, options) { if (!dom && $._root && $._root.children) { dom = $._root.children; } options = options|| dom.options || $._options; return domSerializer(dom, options); }
[ "function", "renderDOM", "(", "$", ",", "dom", ",", "options", ")", "{", "if", "(", "!", "dom", "&&", "$", ".", "_root", "&&", "$", ".", "_root", ".", "children", ")", "{", "dom", "=", "$", ".", "_root", ".", "children", ";", "}", "options", "=...
Render a cheerio DOM as html @param {HTMLDom} $ @param {HTMLElement} dom @param {Object} @return {String}
[ "Render", "a", "cheerio", "DOM", "as", "html" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/modifiers/svgToImg.js#L17-L23
train
Render a DOM
[ 30522, 3853, 17552, 9527, 1006, 1002, 1010, 14383, 1010, 7047, 1007, 1063, 2065, 1006, 999, 14383, 1004, 1004, 1002, 1012, 1035, 7117, 1004, 1004, 1002, 1012, 1035, 7117, 1012, 2336, 1007, 1063, 14383, 1027, 1002, 1012, 1035, 7117, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vue-cli
packages/@vue/cli-service/lib/commands/serve.js
checkInContainer
function checkInContainer () { const fs = require('fs') if (fs.existsSync(`/proc/1/cgroup`)) { const content = fs.readFileSync(`/proc/1/cgroup`, 'utf-8') return /:\/(lxc|docker|kubepods)\//.test(content) } }
javascript
function checkInContainer () { const fs = require('fs') if (fs.existsSync(`/proc/1/cgroup`)) { const content = fs.readFileSync(`/proc/1/cgroup`, 'utf-8') return /:\/(lxc|docker|kubepods)\//.test(content) } }
[ "function", "checkInContainer", "(", ")", "{", "const", "fs", "=", "require", "(", "'fs'", ")", "if", "(", "fs", ".", "existsSync", "(", "`", "`", ")", ")", "{", "const", "content", "=", "fs", ".", "readFileSync", "(", "`", "`", ",", "'utf-8'", ")"...
https://stackoverflow.com/a/20012536
[ "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "20012536" ]
206803cbefefdfbc7d8ed12440b0b751688b77b2
https://github.com/vuejs/vue-cli/blob/206803cbefefdfbc7d8ed12440b0b751688b77b2/packages/@vue/cli-service/lib/commands/serve.js#L299-L305
train
Check if the container is in the container group
[ 30522, 3853, 4638, 2378, 8663, 18249, 2121, 1006, 1007, 1063, 9530, 3367, 1042, 2015, 1027, 5478, 1006, 1005, 1042, 2015, 1005, 1007, 2065, 1006, 1042, 2015, 1012, 6526, 6508, 12273, 1006, 1036, 1013, 4013, 2278, 1013, 1015, 1013, 1039, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/document/Document.js
Document
function Document(file, initialTimestamp, rawText) { this.file = file; this.editable = !file.readOnly; this._updateLanguage(); this.refreshText(rawText, initialTimestamp, true); // List of full editors which are initialized as master editors for this doc. this._associatedFullEditors = []; }
javascript
function Document(file, initialTimestamp, rawText) { this.file = file; this.editable = !file.readOnly; this._updateLanguage(); this.refreshText(rawText, initialTimestamp, true); // List of full editors which are initialized as master editors for this doc. this._associatedFullEditors = []; }
[ "function", "Document", "(", "file", ",", "initialTimestamp", ",", "rawText", ")", "{", "this", ".", "file", "=", "file", ";", "this", ".", "editable", "=", "!", "file", ".", "readOnly", ";", "this", ".", "_updateLanguage", "(", ")", ";", "this", ".", ...
Model for the contents of a single file and its current modification state. See DocumentManager documentation for important usage notes. Document dispatches these events: __change__ -- When the text of the editor changes (including due to undo/redo). Passes ({Document}, {ChangeList}), where ChangeList is an array of change record objects. Each change record looks like: { from: start of change, expressed as {line: <line number>, ch: <character offset>}, to: end of change, expressed as {line: <line number>, ch: <chracter offset>}, text: array of lines of text to replace existing text } The line and ch offsets are both 0-based. The ch offset in "from" is inclusive, but the ch offset in "to" is exclusive. For example, an insertion of new content (without replacing existing content) is expressed by a range where from and to are the same. If "from" and "to" are undefined, then this is a replacement of the entire text content. IMPORTANT: If you listen for the "change" event, you MUST also addRef() the document (and releaseRef() it whenever you stop listening). You should also listen to the "deleted" event. __deleted__ -- When the file for this document has been deleted. All views onto the document should be closed. The document will no longer be editable or dispatch "change" events. __languageChanged__ -- When the value of getLanguage() has changed. 2nd argument is the old value, 3rd argument is the new value. @constructor @param {!File} file Need not lie within the project. @param {!Date} initialTimestamp File's timestamp when we read it off disk. @param {!string} rawText Text content of the file.
[ "Model", "for", "the", "contents", "of", "a", "single", "file", "and", "its", "current", "modification", "state", ".", "See", "DocumentManager", "documentation", "for", "important", "usage", "notes", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/Document.js#L74-L81
train
A document is a document that contains a single language and a single language.
[ 30522, 3853, 6254, 1006, 5371, 1010, 3988, 7292, 9153, 8737, 1010, 6315, 18209, 1007, 1063, 2023, 1012, 5371, 1027, 5371, 1025, 2023, 1012, 10086, 3085, 1027, 999, 5371, 1012, 3191, 2239, 2135, 1025, 2023, 1012, 1035, 10651, 25023, 6692, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/RoadMap.js
function(oEvent, oThis, sDir){ if (oEvent) { oEvent.stopPropagation(); oEvent.preventDefault(); } if (!oThis.sCurrentFocusedStepRefId) { return; } var sFoo = sDir + "All"; var bIsJumpToDelimiter = false; if (sDir == "first") { sFoo = "prevAll"; bIsJumpToDelimiter = true; } else if (sDir == "last") { sFoo = "nextAll"; bIsJumpToDelimiter = true; } var jCurrentFocusStep = jQuery(document.getElementById(oThis.sCurrentFocusedStepRefId)); var jFollowingSteps = jCurrentFocusStep[sFoo](":visible"); var sFollowingFocusStepId = jQuery(jFollowingSteps.get(bIsJumpToDelimiter ? jFollowingSteps.length - 1 : 0)).attr("id"); if (sFollowingFocusStepId) { if (!RoadMapRenderer.isVisibleRef(oThis, sFollowingFocusStepId)) { scrollToNextStep(oThis, sDir); } document.getElementById(sFollowingFocusStepId + "-box").focus(); } }
javascript
function(oEvent, oThis, sDir){ if (oEvent) { oEvent.stopPropagation(); oEvent.preventDefault(); } if (!oThis.sCurrentFocusedStepRefId) { return; } var sFoo = sDir + "All"; var bIsJumpToDelimiter = false; if (sDir == "first") { sFoo = "prevAll"; bIsJumpToDelimiter = true; } else if (sDir == "last") { sFoo = "nextAll"; bIsJumpToDelimiter = true; } var jCurrentFocusStep = jQuery(document.getElementById(oThis.sCurrentFocusedStepRefId)); var jFollowingSteps = jCurrentFocusStep[sFoo](":visible"); var sFollowingFocusStepId = jQuery(jFollowingSteps.get(bIsJumpToDelimiter ? jFollowingSteps.length - 1 : 0)).attr("id"); if (sFollowingFocusStepId) { if (!RoadMapRenderer.isVisibleRef(oThis, sFollowingFocusStepId)) { scrollToNextStep(oThis, sDir); } document.getElementById(sFollowingFocusStepId + "-box").focus(); } }
[ "function", "(", "oEvent", ",", "oThis", ",", "sDir", ")", "{", "if", "(", "oEvent", ")", "{", "oEvent", ".", "stopPropagation", "(", ")", ";", "oEvent", ".", "preventDefault", "(", ")", ";", "}", "if", "(", "!", "oThis", ".", "sCurrentFocusedStepRefId...
Helper function to focus the following step of the current focused step in the given direction. Allowed directions are: next, prev, first, last. If this step is not visible an automatic scrolling is done.
[ "Helper", "function", "to", "focus", "the", "following", "step", "of", "the", "current", "focused", "step", "in", "the", "given", "direction", ".", "Allowed", "directions", "are", ":", "next", "prev", "first", "last", ".", "If", "this", "step", "is", "not"...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMap.js#L484-L513
train
Scrolls to the next or previous step of the delimiter
[ 30522, 3853, 1006, 1051, 18697, 3372, 1010, 27178, 24158, 1010, 17371, 4313, 1007, 1063, 2065, 1006, 1051, 18697, 3372, 1007, 1063, 1051, 18697, 30524, 29264, 14876, 7874, 2098, 13473, 28139, 8873, 2094, 1007, 1063, 2709, 1025, 1065, 13075, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
sass/node-sass
lib/extensions.js
getBinaryCachePath
function getBinaryCachePath() { var i, cachePath, cachePathCandidates = getCachePathCandidates(); for (i = 0; i < cachePathCandidates.length; i++) { cachePath = path.join(cachePathCandidates[i], pkg.name, pkg.version); try { mkdir.sync(cachePath); return cachePath; } catch (e) { // Directory is not writable, try another } } return ''; }
javascript
function getBinaryCachePath() { var i, cachePath, cachePathCandidates = getCachePathCandidates(); for (i = 0; i < cachePathCandidates.length; i++) { cachePath = path.join(cachePathCandidates[i], pkg.name, pkg.version); try { mkdir.sync(cachePath); return cachePath; } catch (e) { // Directory is not writable, try another } } return ''; }
[ "function", "getBinaryCachePath", "(", ")", "{", "var", "i", ",", "cachePath", ",", "cachePathCandidates", "=", "getCachePathCandidates", "(", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "cachePathCandidates", ".", "length", ";", "i", "++", ")", ...
The most suitable location for caching the binding on disk. Given the candidates directories provided by `getCachePathCandidates()` this returns the first writable directory. By treating the candidate directories as a prioritised list this method is deterministic, assuming no change to the local environment. @return {String} directory to cache binding @api public
[ "The", "most", "suitable", "location", "for", "caching", "the", "binding", "on", "disk", "." ]
0c1a49eefa37544d16041c5fe5b2e3d9168004b7
https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/extensions.js#L346-L363
train
Get the binary cache path
[ 30522, 3853, 2131, 21114, 2854, 3540, 5403, 15069, 1006, 1007, 1063, 13075, 1045, 1010, 17053, 15069, 1010, 17053, 15069, 9336, 4305, 27122, 1027, 2131, 3540, 5403, 15069, 9336, 4305, 27122, 1006, 1007, 1025, 2005, 1006, 1045, 1027, 1014, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/core/a-register-element.js
wrapAEntityMethods
function wrapAEntityMethods (obj) { var newObj = {}; var ANodeMethods = [ 'attachedCallback', 'attributeChangedCallback', 'createdCallback', 'detachedCallback' ]; var AEntityMethods = [ 'attachedCallback', 'attributeChangedCallback', 'createdCallback', 'detachedCallback' ]; wrapMethods(newObj, ANodeMethods, obj, ANode.prototype); wrapMethods(newObj, AEntityMethods, obj, AEntity.prototype); // Copies the remaining properties into the new object. copyProperties(obj, newObj); return newObj; }
javascript
function wrapAEntityMethods (obj) { var newObj = {}; var ANodeMethods = [ 'attachedCallback', 'attributeChangedCallback', 'createdCallback', 'detachedCallback' ]; var AEntityMethods = [ 'attachedCallback', 'attributeChangedCallback', 'createdCallback', 'detachedCallback' ]; wrapMethods(newObj, ANodeMethods, obj, ANode.prototype); wrapMethods(newObj, AEntityMethods, obj, AEntity.prototype); // Copies the remaining properties into the new object. copyProperties(obj, newObj); return newObj; }
[ "function", "wrapAEntityMethods", "(", "obj", ")", "{", "var", "newObj", "=", "{", "}", ";", "var", "ANodeMethods", "=", "[", "'attachedCallback'", ",", "'attributeChangedCallback'", ",", "'createdCallback'", ",", "'detachedCallback'", "]", ";", "var", "AEntityMet...
This wraps some of the obj methods to call those on `AEntity` base prototype. @param {object} obj - The objects that contains the methods that will be wrapped. @return {object} - An object with the same properties as the input parameter but with some of methods wrapped.
[ "This", "wraps", "some", "of", "the", "obj", "methods", "to", "call", "those", "on", "AEntity", "base", "prototype", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/a-register-element.js#L99-L119
train
ANode and AEntity methods are wrapped in a new object.
[ 30522, 3853, 10236, 6679, 16778, 3723, 11368, 6806, 5104, 1006, 27885, 3501, 1007, 1063, 13075, 2047, 16429, 3501, 1027, 1063, 1065, 1025, 13075, 2019, 10244, 11368, 6806, 5104, 1027, 1031, 1005, 4987, 9289, 20850, 8684, 1005, 1010, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
populateActionCodes
function populateActionCodes() { var emailForSignIn = null; var signInTime = 0; if ('localStorage' in window && window['localStorage'] !== null) { try { // Try to parse as JSON first using new storage format. var emailForSignInData = JSON.parse(window.localStorage.getItem('emailForSignIn')); emailForSignIn = emailForSignInData['email'] || null; signInTime = emailForSignInData['timestamp'] || 0; } catch (e) { // JSON parsing failed. This means the email is stored in the old string // format. emailForSignIn = window.localStorage.getItem('emailForSignIn'); } if (emailForSignIn) { // Clear old codes. Old format codes should be cleared immediately. if (new Date().getTime() - signInTime >= 1 * 24 * 3600 * 1000) { // Remove email from storage. window.localStorage.removeItem('emailForSignIn'); } } } var actionCode = getParameterByName('oobCode'); if (actionCode != null) { var mode = getParameterByName('mode'); if (mode == 'verifyEmail') { $('#email-verification-code').val(actionCode); } else if (mode == 'resetPassword') { $('#password-reset-code').val(actionCode); } else if (mode == 'signIn') { if (emailForSignIn) { $('#sign-in-with-email-link-email').val(emailForSignIn); $('#sign-in-with-email-link-link').val(window.location.href); onSignInWithEmailLink(); // Remove email from storage as the code is only usable once. window.localStorage.removeItem('emailForSignIn'); } } else { $('#email-verification-code').val(actionCode); $('#password-reset-code').val(actionCode); } } }
javascript
function populateActionCodes() { var emailForSignIn = null; var signInTime = 0; if ('localStorage' in window && window['localStorage'] !== null) { try { // Try to parse as JSON first using new storage format. var emailForSignInData = JSON.parse(window.localStorage.getItem('emailForSignIn')); emailForSignIn = emailForSignInData['email'] || null; signInTime = emailForSignInData['timestamp'] || 0; } catch (e) { // JSON parsing failed. This means the email is stored in the old string // format. emailForSignIn = window.localStorage.getItem('emailForSignIn'); } if (emailForSignIn) { // Clear old codes. Old format codes should be cleared immediately. if (new Date().getTime() - signInTime >= 1 * 24 * 3600 * 1000) { // Remove email from storage. window.localStorage.removeItem('emailForSignIn'); } } } var actionCode = getParameterByName('oobCode'); if (actionCode != null) { var mode = getParameterByName('mode'); if (mode == 'verifyEmail') { $('#email-verification-code').val(actionCode); } else if (mode == 'resetPassword') { $('#password-reset-code').val(actionCode); } else if (mode == 'signIn') { if (emailForSignIn) { $('#sign-in-with-email-link-email').val(emailForSignIn); $('#sign-in-with-email-link-link').val(window.location.href); onSignInWithEmailLink(); // Remove email from storage as the code is only usable once. window.localStorage.removeItem('emailForSignIn'); } } else { $('#email-verification-code').val(actionCode); $('#password-reset-code').val(actionCode); } } }
[ "function", "populateActionCodes", "(", ")", "{", "var", "emailForSignIn", "=", "null", ";", "var", "signInTime", "=", "0", ";", "if", "(", "'localStorage'", "in", "window", "&&", "window", "[", "'localStorage'", "]", "!==", "null", ")", "{", "try", "{", ...
Detects if an action code is passed in the URL, and populates accordingly the input field for the confirm email verification process.
[ "Detects", "if", "an", "action", "code", "is", "passed", "in", "the", "URL", "and", "populates", "accordingly", "the", "input", "field", "for", "the", "confirm", "email", "verification", "process", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L1128-L1171
train
Populate the action codes
[ 30522, 3853, 3769, 9869, 18908, 3258, 23237, 1006, 1007, 1063, 13075, 10373, 29278, 5332, 29076, 2078, 1027, 19701, 1025, 13075, 3696, 18447, 14428, 1027, 1014, 1025, 2065, 1006, 1005, 10575, 4263, 4270, 1005, 1999, 3332, 1004, 1004, 3332, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
fex-team/webuploader
dist/webuploader.withoutimage.js
function( file ) { if ( !(file instanceof WUFile) ) { if ( !(file instanceof File) ) { if ( !this._ruid ) { throw new Error('Can\'t add external files.'); } file = new File( this._ruid, file ); } file = new WUFile( file ); } return file; }
javascript
function( file ) { if ( !(file instanceof WUFile) ) { if ( !(file instanceof File) ) { if ( !this._ruid ) { throw new Error('Can\'t add external files.'); } file = new File( this._ruid, file ); } file = new WUFile( file ); } return file; }
[ "function", "(", "file", ")", "{", "if", "(", "!", "(", "file", "instanceof", "WUFile", ")", ")", "{", "if", "(", "!", "(", "file", "instanceof", "File", ")", ")", "{", "if", "(", "!", "this", ".", "_ruid", ")", "{", "throw", "new", "Error", "(...
为了支持外部直接添加一个原生File对象。
[ "为了支持外部直接添加一个原生File对象。" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2452-L2466
train
Add external files to the file system.
[ 30522, 3853, 1006, 5371, 1007, 1063, 2065, 1006, 999, 1006, 5371, 6013, 11253, 8814, 8873, 2571, 1007, 1007, 1063, 2065, 1006, 999, 1006, 5371, 6013, 11253, 5371, 1007, 1007, 1063, 2065, 1006, 999, 2023, 1012, 1035, 21766, 3593, 1007, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/plugins/Performance.js
_initSlider
function _initSlider() { _sliderVars.nodes.slider = _sliderVars.nodes.slider || document.querySelector('#slider'); _sliderVars.nodes.handle = _sliderVars.nodes.handle || document.querySelector('#slideHandle'); _sliderVars.nodes.leftResizeHandle = _sliderVars.nodes.leftResizeHandle || document.querySelector('#leftHandle'); _sliderVars.nodes.rightResizeHandle = _sliderVars.nodes.rightResizeHandle || document.querySelector('#rightHandle'); _sliderVars.nodes.handle.style.left = 0; _sliderVars.nodes.handle.style.width = '100%'; //set the slider width _calculateSliderSize(); _sliderVars.nodes.slider.addEventListener('mousedown', _onMouseDown); }
javascript
function _initSlider() { _sliderVars.nodes.slider = _sliderVars.nodes.slider || document.querySelector('#slider'); _sliderVars.nodes.handle = _sliderVars.nodes.handle || document.querySelector('#slideHandle'); _sliderVars.nodes.leftResizeHandle = _sliderVars.nodes.leftResizeHandle || document.querySelector('#leftHandle'); _sliderVars.nodes.rightResizeHandle = _sliderVars.nodes.rightResizeHandle || document.querySelector('#rightHandle'); _sliderVars.nodes.handle.style.left = 0; _sliderVars.nodes.handle.style.width = '100%'; //set the slider width _calculateSliderSize(); _sliderVars.nodes.slider.addEventListener('mousedown', _onMouseDown); }
[ "function", "_initSlider", "(", ")", "{", "_sliderVars", ".", "nodes", ".", "slider", "=", "_sliderVars", ".", "nodes", ".", "slider", "||", "document", ".", "querySelector", "(", "'#slider'", ")", ";", "_sliderVars", ".", "nodes", ".", "handle", "=", "_sl...
/* ============================================================================================================= Slider =============================================================================================================
[ "/", "*", "=============================================================================================================", "Slider", "=============================================================================================================" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/plugins/Performance.js#L867-L880
train
Initializes the slider
[ 30522, 3853, 1035, 1999, 12762, 24198, 2099, 1006, 1007, 1063, 1035, 7358, 19146, 2869, 1012, 14164, 1012, 7358, 2099, 1027, 1035, 7358, 19146, 2869, 1012, 14164, 1012, 7358, 2099, 1064, 1064, 6254, 1012, 23032, 11246, 22471, 2953, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
juliangarnier/anime
lib/anime.js
createAnimation
function createAnimation(animatable, prop) { var animType = getAnimationType(animatable.target, prop.name); if (animType) { var tweens = normalizeTweens(prop, animatable); var lastTween = tweens[tweens.length - 1]; return { type: animType, property: prop.name, animatable: animatable, tweens: tweens, duration: lastTween.end, delay: tweens[0].delay, endDelay: lastTween.endDelay } } }
javascript
function createAnimation(animatable, prop) { var animType = getAnimationType(animatable.target, prop.name); if (animType) { var tweens = normalizeTweens(prop, animatable); var lastTween = tweens[tweens.length - 1]; return { type: animType, property: prop.name, animatable: animatable, tweens: tweens, duration: lastTween.end, delay: tweens[0].delay, endDelay: lastTween.endDelay } } }
[ "function", "createAnimation", "(", "animatable", ",", "prop", ")", "{", "var", "animType", "=", "getAnimationType", "(", "animatable", ".", "target", ",", "prop", ".", "name", ")", ";", "if", "(", "animType", ")", "{", "var", "tweens", "=", "normalizeTwee...
Animations
[ "Animations" ]
875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a
https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/lib/anime.js#L815-L830
train
Create an animation object
[ 30522, 3853, 3443, 7088, 28649, 1006, 2019, 9581, 10880, 1010, 17678, 30524, 13075, 1056, 28394, 3619, 1027, 3671, 4697, 2102, 28394, 3619, 1006, 17678, 1010, 2019, 9581, 10880, 1007, 1025, 13075, 2197, 2102, 28394, 2078, 1027, 1056, 28394, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/max-len.js
isTrailingComment
function isTrailingComment(line, lineNumber, comment) { return comment && (comment.loc.start.line === lineNumber && lineNumber <= comment.loc.end.line) && (comment.loc.end.line > lineNumber || comment.loc.end.column === line.length); }
javascript
function isTrailingComment(line, lineNumber, comment) { return comment && (comment.loc.start.line === lineNumber && lineNumber <= comment.loc.end.line) && (comment.loc.end.line > lineNumber || comment.loc.end.column === line.length); }
[ "function", "isTrailingComment", "(", "line", ",", "lineNumber", ",", "comment", ")", "{", "return", "comment", "&&", "(", "comment", ".", "loc", ".", "start", ".", "line", "===", "lineNumber", "&&", "lineNumber", "<=", "comment", ".", "loc", ".", "end", ...
-------------------------------------------------------------------------- Helpers -------------------------------------------------------------------------- Tells if a given comment is trailing: it starts on the current line and extends to or past the end of the current line. @param {string} line The source line we want to check for a trailing comment on @param {number} lineNumber The one-indexed line number for line @param {ASTNode} comment The comment to inspect @returns {boolean} If the comment is trailing on the given line
[ "--------------------------------------------------------------------------", "Helpers", "--------------------------------------------------------------------------", "Tells", "if", "a", "given", "comment", "is", "trailing", ":", "it", "starts", "on", "the", "current", "line", "and...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-len.js#L163-L167
train
Check if comment is a trailing comment
[ 30522, 3853, 21541, 15118, 2075, 9006, 3672, 1006, 2240, 1010, 17517, 29440, 1010, 7615, 1007, 1063, 2709, 7615, 1004, 1004, 1006, 30524, 1012, 2203, 1012, 2240, 1028, 17517, 29440, 1064, 1064, 7615, 1012, 8840, 2278, 1012, 2203, 1012, 5930...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function () { var oViewport = {}; oViewport.width = window.innerWidth; oViewport.height = window.innerHeight; oViewport.top = parseInt(jQuery(".type_standalone").css("height")) || 0; oViewport.bottom = oViewport.top + oViewport.height; return oViewport; }
javascript
function () { var oViewport = {}; oViewport.width = window.innerWidth; oViewport.height = window.innerHeight; oViewport.top = parseInt(jQuery(".type_standalone").css("height")) || 0; oViewport.bottom = oViewport.top + oViewport.height; return oViewport; }
[ "function", "(", ")", "{", "var", "oViewport", "=", "{", "}", ";", "oViewport", ".", "width", "=", "window", ".", "innerWidth", ";", "oViewport", ".", "height", "=", "window", ".", "innerHeight", ";", "oViewport", ".", "top", "=", "parseInt", "(", "jQu...
Gets the dimensions of the viewport @return {object} the dimensions of the viewport
[ "Gets", "the", "dimensions", "of", "the", "viewport" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L530-L538
train
Returns the viewport of the type standalone element
[ 30522, 3853, 1006, 1007, 1063, 13075, 1051, 8584, 6442, 1027, 1063, 1065, 1025, 1051, 8584, 6442, 1012, 9381, 1027, 3332, 1012, 5110, 9148, 11927, 2232, 1025, 1051, 8584, 6442, 1012, 4578, 1027, 3332, 1012, 5110, 26036, 13900, 1025, 1051, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js
function(sId) { var sNamespace = this.getMetadata().getNamespace(); sId = sNamespace + "." + sId; return this.base ? this.base.byId(sId) : undefined; }
javascript
function(sId) { var sNamespace = this.getMetadata().getNamespace(); sId = sNamespace + "." + sId; return this.base ? this.base.byId(sId) : undefined; }
[ "function", "(", "sId", ")", "{", "var", "sNamespace", "=", "this", ".", "getMetadata", "(", ")", ".", "getNamespace", "(", ")", ";", "sId", "=", "sNamespace", "+", "\".\"", "+", "sId", ";", "return", "this", ".", "base", "?", "this", ".", "base", ...
Returns an Element of the connected view with the given local ID. Views automatically prepend their own ID as a prefix to created Elements to make the IDs unique even in the case of multiple view instances. For Controller extension the namespace of the control id gets also prefixed with the namespace of the extension. This method helps to find an element by its local ID only. If no view is connected or if the view doesn't contain an element with the given local ID, undefined is returned. @param {string} sId View-local ID @return {sap.ui.core.Element} Element by its (view local) ID @public
[ "Returns", "an", "Element", "of", "the", "connected", "view", "with", "the", "given", "local", "ID", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js#L52-L56
train
Returns the object with the given ID
[ 30522, 3853, 1006, 15765, 1007, 1063, 13075, 1055, 18442, 23058, 1027, 2023, 1012, 2131, 11368, 8447, 2696, 1006, 1007, 1012, 2131, 18442, 23058, 1006, 1007, 1025, 15765, 1027, 1055, 18442, 23058, 1009, 1000, 1012, 1000, 1009, 15765, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/angular
aio/tools/examples/run-example-e2e.js
loadExampleConfig
function loadExampleConfig(exampleFolder) { // Default config. let config = {build: 'build', run: 'serve:e2e'}; try { const exampleConfig = fs.readJsonSync(`${exampleFolder}/${EXAMPLE_CONFIG_FILENAME}`); Object.assign(config, exampleConfig); } catch (e) { } return config; }
javascript
function loadExampleConfig(exampleFolder) { // Default config. let config = {build: 'build', run: 'serve:e2e'}; try { const exampleConfig = fs.readJsonSync(`${exampleFolder}/${EXAMPLE_CONFIG_FILENAME}`); Object.assign(config, exampleConfig); } catch (e) { } return config; }
[ "function", "loadExampleConfig", "(", "exampleFolder", ")", "{", "// Default config.", "let", "config", "=", "{", "build", ":", "'build'", ",", "run", ":", "'serve:e2e'", "}", ";", "try", "{", "const", "exampleConfig", "=", "fs", ".", "readJsonSync", "(", "`...
Load configuration for an example. Used for SystemJS
[ "Load", "configuration", "for", "an", "example", ".", "Used", "for", "SystemJS" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/examples/run-example-e2e.js#L373-L384
train
Load the example config from the example folder
[ 30522, 3853, 7170, 10288, 16613, 2571, 8663, 8873, 2290, 1006, 2742, 10371, 2121, 1007, 1063, 1013, 1013, 12398, 9530, 8873, 2290, 1012, 2292, 9530, 8873, 2290, 1027, 1063, 3857, 1024, 1005, 3857, 1005, 1010, 2448, 1024, 1005, 3710, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/docker-prompts.js
askForDockerPushCommand
function askForDockerPushCommand() { if (this.regenerate) return; const done = this.async(); const prompts = [ { type: 'input', name: 'dockerPushCommand', message: 'What command should we use for push Docker image to repository?', default: this.dockerPushCommand ? this.dockerPushCommand : 'docker push' } ]; this.prompt(prompts).then(props => { this.dockerPushCommand = props.dockerPushCommand; done(); }); }
javascript
function askForDockerPushCommand() { if (this.regenerate) return; const done = this.async(); const prompts = [ { type: 'input', name: 'dockerPushCommand', message: 'What command should we use for push Docker image to repository?', default: this.dockerPushCommand ? this.dockerPushCommand : 'docker push' } ]; this.prompt(prompts).then(props => { this.dockerPushCommand = props.dockerPushCommand; done(); }); }
[ "function", "askForDockerPushCommand", "(", ")", "{", "if", "(", "this", ".", "regenerate", ")", "return", ";", "const", "done", "=", "this", ".", "async", "(", ")", ";", "const", "prompts", "=", "[", "{", "type", ":", "'input'", ",", "name", ":", "'...
Ask For Docker Push Command
[ "Ask", "For", "Docker", "Push", "Command" ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/docker-prompts.js#L424-L442
train
Ask For Docker Push Command
[ 30522, 3853, 3198, 3877, 7432, 2121, 12207, 16257, 5358, 2386, 2094, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 19723, 24454, 3686, 1007, 2709, 1025, 9530, 3367, 2589, 1027, 2023, 1012, 2004, 6038, 2278, 1006, 1007, 1025, 9530, 3367, 25732, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
calcStepsToRealHistory
function calcStepsToRealHistory(sCurrentHash, bForward){ var iIndex = jQuery.inArray(sCurrentHash, hashHistory), i; if (iIndex !== -1) { if (bForward) { for (i = iIndex ; i < hashHistory.length ; i++) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } } else { for (i = iIndex ; i >= 0 ; i--) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } return -1 * (iIndex + 1); } } }
javascript
function calcStepsToRealHistory(sCurrentHash, bForward){ var iIndex = jQuery.inArray(sCurrentHash, hashHistory), i; if (iIndex !== -1) { if (bForward) { for (i = iIndex ; i < hashHistory.length ; i++) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } } else { for (i = iIndex ; i >= 0 ; i--) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } return -1 * (iIndex + 1); } } }
[ "function", "calcStepsToRealHistory", "(", "sCurrentHash", ",", "bForward", ")", "{", "var", "iIndex", "=", "jQuery", ".", "inArray", "(", "sCurrentHash", ",", "hashHistory", ")", ",", "i", ";", "if", "(", "iIndex", "!==", "-", "1", ")", "{", "if", "(", ...
This function calculates the steps forward or backward that need to skip the virtual history states. @private
[ "This", "function", "calculates", "the", "steps", "forward", "or", "backward", "that", "need", "to", "skip", "the", "virtual", "history", "states", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L549-L569
train
Calculate the number of steps to real history
[ 30522, 3853, 10250, 6169, 2618, 4523, 19277, 2389, 24158, 7062, 1006, 8040, 29264, 14949, 2232, 1010, 28939, 2953, 7652, 1007, 1063, 13075, 2462, 13629, 2595, 1027, 1046, 4226, 2854, 1012, 27118, 11335, 2100, 1006, 8040, 29264, 14949, 2232, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/core/services/interimElement/interimElement.js
linkElement
function linkElement(compileData, options){ angular.extend(compileData.locals, options); var element = compileData.link(options.scope); // Search for parent at insertion time, if not specified options.element = element; options.parent = findParent(element, options); if (options.themable) $mdTheming(element); return element; }
javascript
function linkElement(compileData, options){ angular.extend(compileData.locals, options); var element = compileData.link(options.scope); // Search for parent at insertion time, if not specified options.element = element; options.parent = findParent(element, options); if (options.themable) $mdTheming(element); return element; }
[ "function", "linkElement", "(", "compileData", ",", "options", ")", "{", "angular", ".", "extend", "(", "compileData", ".", "locals", ",", "options", ")", ";", "var", "element", "=", "compileData", ".", "link", "(", "options", ".", "scope", ")", ";", "//...
Link an element with compiled configuration
[ "Link", "an", "element", "with", "compiled", "configuration" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L622-L633
train
Link the element to the parent element
[ 30522, 3853, 4957, 12260, 3672, 1006, 9227, 6790, 1010, 7047, 1007, 1063, 16108, 1012, 7949, 1006, 9227, 6790, 1012, 10575, 1010, 7047, 1007, 1025, 13075, 5783, 1027, 9227, 6790, 1012, 4957, 1006, 7047, 1012, 9531, 1007, 1025, 1013, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/api/v0.1/tags.js
doQuery
function doQuery(options) { return models.Tag.findPage(options) .then(({data, meta}) => { return { tags: data.map(model => urlsForTag(model.id, model.toJSON(options), options)), meta: meta }; }); }
javascript
function doQuery(options) { return models.Tag.findPage(options) .then(({data, meta}) => { return { tags: data.map(model => urlsForTag(model.id, model.toJSON(options), options)), meta: meta }; }); }
[ "function", "doQuery", "(", "options", ")", "{", "return", "models", ".", "Tag", ".", "findPage", "(", "options", ")", ".", "then", "(", "(", "{", "data", ",", "meta", "}", ")", "=>", "{", "return", "{", "tags", ":", "data", ".", "map", "(", "mod...
### Model Query Make the call to the Model layer @param {Object} options @returns {Object} options
[ "###", "Model", "Query", "Make", "the", "call", "to", "the", "Model", "layer" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/tags.js#L36-L44
train
Query the database for tags
[ 30522, 3853, 2079, 4226, 2854, 1006, 7047, 1007, 1063, 2709, 4275, 1012, 6415, 1012, 2424, 13704, 1006, 7047, 1007, 1012, 2059, 1006, 1006, 1063, 2951, 1010, 18804, 1065, 1007, 1027, 1028, 1063, 2709, 1063, 22073, 1024, 2951, 1012, 4949, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
juliangarnier/anime
documentation/assets/js/website.js
scrollToElement
function scrollToElement(el, offset) { var off = offset || 0; var rect = el.getBoundingClientRect(); var top = rect.top + off; var animation = anime({ targets: [document.body, document.documentElement], scrollTop: '+='+top, easing: 'easeInOutSine', duration: 1500 }); // onScroll(animation.pause); }
javascript
function scrollToElement(el, offset) { var off = offset || 0; var rect = el.getBoundingClientRect(); var top = rect.top + off; var animation = anime({ targets: [document.body, document.documentElement], scrollTop: '+='+top, easing: 'easeInOutSine', duration: 1500 }); // onScroll(animation.pause); }
[ "function", "scrollToElement", "(", "el", ",", "offset", ")", "{", "var", "off", "=", "offset", "||", "0", ";", "var", "rect", "=", "el", ".", "getBoundingClientRect", "(", ")", ";", "var", "top", "=", "rect", ".", "top", "+", "off", ";", "var", "a...
Scroll to element
[ "Scroll", "to", "element" ]
875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a
https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/documentation/assets/js/website.js#L91-L102
train
Scrolls to an element
[ 30522, 3853, 17186, 3406, 12260, 3672, 1006, 3449, 1010, 16396, 1007, 1063, 13075, 2125, 1027, 16396, 1064, 1064, 1014, 1025, 13075, 28667, 2102, 1027, 3449, 1012, 2131, 15494, 2075, 20464, 11638, 2890, 6593, 1006, 1007, 1025, 13075, 2327, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
layoutPositions
function layoutPositions(layout, options, fn) { var nodes = this.nodes(); var cy = this.cy(); var layoutEles = options.eles; // nodes & edges var getMemoizeKey = function getMemoizeKey(node) { return node.id(); }; var fnMem = memoize(fn, getMemoizeKey); // memoized version of position function layout.emit({ type: 'layoutstart', layout: layout }); layout.animations = []; var calculateSpacing = function calculateSpacing(spacing, nodesBb, pos) { var center = { x: nodesBb.x1 + nodesBb.w / 2, y: nodesBb.y1 + nodesBb.h / 2 }; var spacingVector = { // scale from center of bounding box (not necessarily 0,0) x: (pos.x - center.x) * spacing, y: (pos.y - center.y) * spacing }; return { x: center.x + spacingVector.x, y: center.y + spacingVector.y }; }; var useSpacingFactor = options.spacingFactor && options.spacingFactor !== 1; var spacingBb = function spacingBb() { if (!useSpacingFactor) { return null; } var bb = makeBoundingBox(); for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; var pos = fnMem(node, i); expandBoundingBoxByPoint(bb, pos.x, pos.y); } return bb; }; var bb = spacingBb(); var getFinalPos = memoize(function (node, i) { var newPos = fnMem(node, i); if (useSpacingFactor) { var spacing = Math.abs(options.spacingFactor); newPos = calculateSpacing(spacing, bb, newPos); } if (options.transform != null) { newPos = options.transform(node, newPos); } return newPos; }, getMemoizeKey); if (options.animate) { for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; var newPos = getFinalPos(node, i); var animateNode = options.animateFilter == null || options.animateFilter(node, i); if (animateNode) { var ani = node.animation({ position: newPos, duration: options.animationDuration, easing: options.animationEasing }); layout.animations.push(ani); } else { node.position(newPos); } } if (options.fit) { var fitAni = cy.animation({ fit: { boundingBox: layoutEles.boundingBoxAt(getFinalPos), padding: options.padding }, duration: options.animationDuration, easing: options.animationEasing }); layout.animations.push(fitAni); } else if (options.zoom !== undefined && options.pan !== undefined) { var zoomPanAni = cy.animation({ zoom: options.zoom, pan: options.pan, duration: options.animationDuration, easing: options.animationEasing }); layout.animations.push(zoomPanAni); } layout.animations.forEach(function (ani) { return ani.play(); }); layout.one('layoutready', options.ready); layout.emit({ type: 'layoutready', layout: layout }); Promise$1.all(layout.animations.map(function (ani) { return ani.promise(); })).then(function () { layout.one('layoutstop', options.stop); layout.emit({ type: 'layoutstop', layout: layout }); }); } else { nodes.positions(getFinalPos); if (options.fit) { cy.fit(options.eles, options.padding); } if (options.zoom != null) { cy.zoom(options.zoom); } if (options.pan) { cy.pan(options.pan); } layout.one('layoutready', options.ready); layout.emit({ type: 'layoutready', layout: layout }); layout.one('layoutstop', options.stop); layout.emit({ type: 'layoutstop', layout: layout }); } return this; // chaining }
javascript
function layoutPositions(layout, options, fn) { var nodes = this.nodes(); var cy = this.cy(); var layoutEles = options.eles; // nodes & edges var getMemoizeKey = function getMemoizeKey(node) { return node.id(); }; var fnMem = memoize(fn, getMemoizeKey); // memoized version of position function layout.emit({ type: 'layoutstart', layout: layout }); layout.animations = []; var calculateSpacing = function calculateSpacing(spacing, nodesBb, pos) { var center = { x: nodesBb.x1 + nodesBb.w / 2, y: nodesBb.y1 + nodesBb.h / 2 }; var spacingVector = { // scale from center of bounding box (not necessarily 0,0) x: (pos.x - center.x) * spacing, y: (pos.y - center.y) * spacing }; return { x: center.x + spacingVector.x, y: center.y + spacingVector.y }; }; var useSpacingFactor = options.spacingFactor && options.spacingFactor !== 1; var spacingBb = function spacingBb() { if (!useSpacingFactor) { return null; } var bb = makeBoundingBox(); for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; var pos = fnMem(node, i); expandBoundingBoxByPoint(bb, pos.x, pos.y); } return bb; }; var bb = spacingBb(); var getFinalPos = memoize(function (node, i) { var newPos = fnMem(node, i); if (useSpacingFactor) { var spacing = Math.abs(options.spacingFactor); newPos = calculateSpacing(spacing, bb, newPos); } if (options.transform != null) { newPos = options.transform(node, newPos); } return newPos; }, getMemoizeKey); if (options.animate) { for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; var newPos = getFinalPos(node, i); var animateNode = options.animateFilter == null || options.animateFilter(node, i); if (animateNode) { var ani = node.animation({ position: newPos, duration: options.animationDuration, easing: options.animationEasing }); layout.animations.push(ani); } else { node.position(newPos); } } if (options.fit) { var fitAni = cy.animation({ fit: { boundingBox: layoutEles.boundingBoxAt(getFinalPos), padding: options.padding }, duration: options.animationDuration, easing: options.animationEasing }); layout.animations.push(fitAni); } else if (options.zoom !== undefined && options.pan !== undefined) { var zoomPanAni = cy.animation({ zoom: options.zoom, pan: options.pan, duration: options.animationDuration, easing: options.animationEasing }); layout.animations.push(zoomPanAni); } layout.animations.forEach(function (ani) { return ani.play(); }); layout.one('layoutready', options.ready); layout.emit({ type: 'layoutready', layout: layout }); Promise$1.all(layout.animations.map(function (ani) { return ani.promise(); })).then(function () { layout.one('layoutstop', options.stop); layout.emit({ type: 'layoutstop', layout: layout }); }); } else { nodes.positions(getFinalPos); if (options.fit) { cy.fit(options.eles, options.padding); } if (options.zoom != null) { cy.zoom(options.zoom); } if (options.pan) { cy.pan(options.pan); } layout.one('layoutready', options.ready); layout.emit({ type: 'layoutready', layout: layout }); layout.one('layoutstop', options.stop); layout.emit({ type: 'layoutstop', layout: layout }); } return this; // chaining }
[ "function", "layoutPositions", "(", "layout", ",", "options", ",", "fn", ")", "{", "var", "nodes", "=", "this", ".", "nodes", "(", ")", ";", "var", "cy", "=", "this", ".", "cy", "(", ")", ";", "var", "layoutEles", "=", "options", ".", "eles", ";", ...
using standard layout options, apply position function (w/ or w/o animation)
[ "using", "standard", "layout", "options", "apply", "position", "function", "(", "w", "/", "or", "w", "/", "o", "animation", ")" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L10638-L10788
train
Layouts the nodes and edges of the graph
[ 30522, 3853, 9621, 26994, 2015, 1006, 9621, 1010, 7047, 1010, 1042, 2078, 1007, 1063, 13075, 14164, 1027, 2023, 1012, 14164, 1006, 1007, 1025, 13075, 22330, 1027, 2023, 1012, 22330, 1006, 1007, 1025, 13075, 9621, 26741, 1027, 7047, 1012, 34...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/less.js
function () { var str, j = i, e; if (input.charAt(j) === '~') { j++; e = true; } // Escaped strings if (input.charAt(j) !== '`') { return; } if (env.javascriptEnabled !== undefined && !env.javascriptEnabled) { error("You are using JavaScript, which has been disabled."); } if (e) { $char('~'); } str = $re(/^`([^`]*)`/); if (str) { return new(tree.JavaScript)(str[1], i, e); } }
javascript
function () { var str, j = i, e; if (input.charAt(j) === '~') { j++; e = true; } // Escaped strings if (input.charAt(j) !== '`') { return; } if (env.javascriptEnabled !== undefined && !env.javascriptEnabled) { error("You are using JavaScript, which has been disabled."); } if (e) { $char('~'); } str = $re(/^`([^`]*)`/); if (str) { return new(tree.JavaScript)(str[1], i, e); } }
[ "function", "(", ")", "{", "var", "str", ",", "j", "=", "i", ",", "e", ";", "if", "(", "input", ".", "charAt", "(", "j", ")", "===", "'~'", ")", "{", "j", "++", ";", "e", "=", "true", ";", "}", "// Escaped strings", "if", "(", "input", ".", ...
JavaScript code to be evaluated `window.location.href`
[ "JavaScript", "code", "to", "be", "evaluated", "window", ".", "location", ".", "href" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L1028-L1043
train
Parse JavaScript string
[ 30522, 3853, 1006, 1007, 1063, 13075, 2358, 2099, 1010, 1046, 1027, 1045, 1010, 1041, 1025, 2065, 1006, 7953, 1012, 25869, 4017, 1006, 1046, 1007, 1027, 1027, 1027, 1005, 1066, 1005, 1007, 1063, 1046, 1009, 1009, 1025, 1041, 1027, 2995, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/IconPool.js
loadFont
function loadFont(oFontMetadata) { for (var sKey in oFontMetadata) { oFontMetadata[sKey] = parseInt(oFontMetadata[sKey], 16); } mRegistry[collectionName] = oFontMetadata; IconPool.insertFontFaceStyle(oConfig.fontFamily, oConfig.fontURI, collectionName); mFontRegistry[collectionName].metadataLoaded = true; }
javascript
function loadFont(oFontMetadata) { for (var sKey in oFontMetadata) { oFontMetadata[sKey] = parseInt(oFontMetadata[sKey], 16); } mRegistry[collectionName] = oFontMetadata; IconPool.insertFontFaceStyle(oConfig.fontFamily, oConfig.fontURI, collectionName); mFontRegistry[collectionName].metadataLoaded = true; }
[ "function", "loadFont", "(", "oFontMetadata", ")", "{", "for", "(", "var", "sKey", "in", "oFontMetadata", ")", "{", "oFontMetadata", "[", "sKey", "]", "=", "parseInt", "(", "oFontMetadata", "[", "sKey", "]", ",", "16", ")", ";", "}", "mRegistry", "[", ...
add icons to registry and insert the font style
[ "add", "icons", "to", "registry", "and", "insert", "the", "font", "style" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/IconPool.js#L1227-L1234
train
Loads the font metadata into the registry
[ 30522, 3853, 7170, 14876, 3372, 1006, 1997, 12162, 11368, 8447, 2696, 1007, 1063, 2005, 1006, 13075, 15315, 3240, 1999, 1997, 12162, 11368, 8447, 2696, 1007, 1063, 1997, 12162, 11368, 8447, 2696, 1031, 15315, 3240, 1033, 1027, 11968, 20240, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/command/KeyBindingManager.js
_isReservedShortcuts
function _isReservedShortcuts(normalizedKey) { if (!normalizedKey) { return false; } if (_reservedShortcuts.indexOf(normalizedKey) > -1 || _reservedShortcuts.indexOf(normalizedKey.replace("Cmd", "Ctrl")) > -1) { return true; } if (brackets.platform === "mac" && _macReservedShortcuts.indexOf(normalizedKey) > -1) { return true; } return false; }
javascript
function _isReservedShortcuts(normalizedKey) { if (!normalizedKey) { return false; } if (_reservedShortcuts.indexOf(normalizedKey) > -1 || _reservedShortcuts.indexOf(normalizedKey.replace("Cmd", "Ctrl")) > -1) { return true; } if (brackets.platform === "mac" && _macReservedShortcuts.indexOf(normalizedKey) > -1) { return true; } return false; }
[ "function", "_isReservedShortcuts", "(", "normalizedKey", ")", "{", "if", "(", "!", "normalizedKey", ")", "{", "return", "false", ";", "}", "if", "(", "_reservedShortcuts", ".", "indexOf", "(", "normalizedKey", ")", ">", "-", "1", "||", "_reservedShortcuts", ...
@private Checks whether the given key combination is a shortcut of a special command or a Mac system command that the user can't reassign to another command. @param {!string} normalizedKey A key combination string used for a keyboard shortcut @return {boolean} true if normalizedKey is a restricted shortcut, false otherwise.
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L1059-L1074
train
Check if the key is reserved
[ 30522, 3853, 1035, 2003, 6072, 25944, 22231, 5339, 12690, 2015, 1006, 3671, 3550, 14839, 1007, 1063, 2065, 1006, 999, 3671, 3550, 14839, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 1035, 9235, 22231, 5339, 12690, 2015, 1012, 5950, 11253...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(node, value) { if (mxUtils.isVml(node)) { if (value >= 100) { node.style.filter = ''; } else { // TODO: Why is the division by 5 needed in VML? node.style.filter = 'alpha(opacity=' + (value/5) + ')'; } } else if (mxClient.IS_IE && (typeof(document.documentMode) === 'undefined' || document.documentMode < 9)) { if (value >= 100) { node.style.filter = ''; } else { node.style.filter = 'alpha(opacity=' + value + ')'; } } else { node.style.opacity = (value / 100); } }
javascript
function(node, value) { if (mxUtils.isVml(node)) { if (value >= 100) { node.style.filter = ''; } else { // TODO: Why is the division by 5 needed in VML? node.style.filter = 'alpha(opacity=' + (value/5) + ')'; } } else if (mxClient.IS_IE && (typeof(document.documentMode) === 'undefined' || document.documentMode < 9)) { if (value >= 100) { node.style.filter = ''; } else { node.style.filter = 'alpha(opacity=' + value + ')'; } } else { node.style.opacity = (value / 100); } }
[ "function", "(", "node", ",", "value", ")", "{", "if", "(", "mxUtils", ".", "isVml", "(", "node", ")", ")", "{", "if", "(", "value", ">=", "100", ")", "{", "node", ".", "style", ".", "filter", "=", "''", ";", "}", "else", "{", "// TODO: Why is th...
Function: setOpacity Sets the opacity of the specified DOM node to the given value in %. Parameters: node - DOM node to set the opacity for. value - Opacity in %. Possible values are between 0 and 100.
[ "Function", ":", "setOpacity" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L5203-L5232
train
Sets the opacity of a node
[ 30522, 3853, 1006, 13045, 1010, 3643, 1007, 1063, 2065, 1006, 25630, 21823, 4877, 1012, 2003, 2615, 19968, 1006, 13045, 1007, 1007, 1063, 2065, 1006, 3643, 1028, 1027, 2531, 1007, 1063, 13045, 1012, 2806, 1012, 11307, 1027, 1005, 1005, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/error.js
throwDecodedError
function throwDecodedError(data) { if (isErrorResponse(data)) { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; let err = new ctor(data.message); // TODO(jleyba): remove whichever case is excluded from the final W3C spec. if (typeof data.stacktrace === 'string') { err.remoteStacktrace = data.stacktrace; } else if (typeof data.stackTrace === 'string') { err.remoteStacktrace = data.stackTrace; } throw err; } throw new WebDriverError('Unknown error: ' + JSON.stringify(data)); }
javascript
function throwDecodedError(data) { if (isErrorResponse(data)) { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; let err = new ctor(data.message); // TODO(jleyba): remove whichever case is excluded from the final W3C spec. if (typeof data.stacktrace === 'string') { err.remoteStacktrace = data.stacktrace; } else if (typeof data.stackTrace === 'string') { err.remoteStacktrace = data.stackTrace; } throw err; } throw new WebDriverError('Unknown error: ' + JSON.stringify(data)); }
[ "function", "throwDecodedError", "(", "data", ")", "{", "if", "(", "isErrorResponse", "(", "data", ")", ")", "{", "let", "ctor", "=", "ERROR_CODE_TO_TYPE", ".", "get", "(", "data", ".", "error", ")", "||", "WebDriverError", ";", "let", "err", "=", "new",...
Throws an error coded from the W3C protocol. A generic error will be thrown if the provided `data` is not a valid encoded error. @param {{error: string, message: string}} data The error data to decode. @throws {WebDriverError} the decoded error. @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol
[ "Throws", "an", "error", "coded", "from", "the", "W3C", "protocol", ".", "A", "generic", "error", "will", "be", "thrown", "if", "the", "provided", "data", "is", "not", "a", "valid", "encoded", "error", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/error.js#L547-L560
train
Throw an error from the server
[ 30522, 3853, 5466, 3207, 16044, 4063, 29165, 1006, 2951, 1007, 1063, 2065, 1006, 2003, 2121, 29165, 6072, 26029, 3366, 1006, 2951, 1007, 1007, 1063, 2292, 14931, 2953, 1027, 7561, 1035, 3642, 1035, 2000, 1035, 2828, 1012, 2131, 1006, 2951, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/downloads.js
downloadManager_open
function downloadManager_open(controller, shortcut) { if (shortcut) { if (mozmill.isLinux) { var cmdKey = utils.getEntity(this.getDtds(), "downloadsUnix.commandkey"); controller.keypress(null, cmdKey, {ctrlKey: true, shiftKey: true}); } else { var cmdKey = utils.getEntity(this.getDtds(), "downloads.commandkey"); controller.keypress(null, cmdKey, {accelKey: true}); } } else { controller.click(new elementslib.Elem(controller.menus["tools-menu"].menu_openDownloads)); } controller.sleep(500); this.waitForOpened(controller); }
javascript
function downloadManager_open(controller, shortcut) { if (shortcut) { if (mozmill.isLinux) { var cmdKey = utils.getEntity(this.getDtds(), "downloadsUnix.commandkey"); controller.keypress(null, cmdKey, {ctrlKey: true, shiftKey: true}); } else { var cmdKey = utils.getEntity(this.getDtds(), "downloads.commandkey"); controller.keypress(null, cmdKey, {accelKey: true}); } } else { controller.click(new elementslib.Elem(controller.menus["tools-menu"].menu_openDownloads)); } controller.sleep(500); this.waitForOpened(controller); }
[ "function", "downloadManager_open", "(", "controller", ",", "shortcut", ")", "{", "if", "(", "shortcut", ")", "{", "if", "(", "mozmill", ".", "isLinux", ")", "{", "var", "cmdKey", "=", "utils", ".", "getEntity", "(", "this", ".", "getDtds", "(", ")", "...
Open the Download Manager @param {MozMillController} controller MozMillController of the window to operate on @param {boolean} shortcut If true the keyboard shortcut is used
[ "Open", "the", "Download", "Manager" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/downloads.js#L302-L317
train
Open the download manager
[ 30522, 3853, 8816, 24805, 4590, 1035, 2330, 1006, 11486, 1010, 2460, 12690, 1007, 1063, 2065, 1006, 2460, 12690, 1007, 1063, 2065, 1006, 9587, 2480, 19912, 1012, 2003, 4115, 5602, 1007, 1063, 13075, 4642, 2094, 14839, 1027, 21183, 12146, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
write_BrtColInfo
function write_BrtColInfo(C, col, o) { if(o == null) o = new_buf(18); var p = col_obj_w(C, col); o.write_shift(-4, C); o.write_shift(-4, C); o.write_shift(4, (p.width || 10) * 256); o.write_shift(4, 0/*ixfe*/); // style var flags = 0; if(col.hidden) flags |= 0x01; if(typeof p.width == 'number') flags |= 0x02; o.write_shift(1, flags); // bit flag o.write_shift(1, 0); // bit flag return o; }
javascript
function write_BrtColInfo(C, col, o) { if(o == null) o = new_buf(18); var p = col_obj_w(C, col); o.write_shift(-4, C); o.write_shift(-4, C); o.write_shift(4, (p.width || 10) * 256); o.write_shift(4, 0/*ixfe*/); // style var flags = 0; if(col.hidden) flags |= 0x01; if(typeof p.width == 'number') flags |= 0x02; o.write_shift(1, flags); // bit flag o.write_shift(1, 0); // bit flag return o; }
[ "function", "write_BrtColInfo", "(", "C", ",", "col", ",", "o", ")", "{", "if", "(", "o", "==", "null", ")", "o", "=", "new_buf", "(", "18", ")", ";", "var", "p", "=", "col_obj_w", "(", "C", ",", "col", ")", ";", "o", ".", "write_shift", "(", ...
/* [MS-XLSB] 2.4.323 BrtColInfo /* TODO: once XLS ColInfo is set, combine the functions
[ "/", "*", "[", "MS", "-", "XLSB", "]", "2", ".", "4", ".", "323", "BrtColInfo", "/", "*", "TODO", ":", "once", "XLS", "ColInfo", "is", "set", "combine", "the", "functions" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L13690-L13703
train
Writes the BrtColInfo object.
[ 30522, 3853, 4339, 1035, 7987, 13535, 18861, 14876, 1006, 1039, 1010, 8902, 1010, 1051, 1007, 1063, 2065, 1006, 1051, 1027, 1027, 19701, 1007, 1051, 1027, 2047, 1035, 20934, 2546, 1006, 2324, 1007, 1025, 13075, 1052, 1027, 8902, 1035, 27885...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/lib/common/i18n.js
init
function init() { // This function is called during Ghost's initialization. // Reading translation file for messages from core .js files and keeping its content in memory // The English file is always loaded, until back-end translations are enabled in future versions. // Before that, see previous tasks on issue #6526 (error codes or identifiers, error message // translation at the point of display...) coreStrings = fs.readFileSync(path.join(__dirname, '..', '..', 'translations', 'en.json')); // if translation file is not valid, you will see an error try { coreStrings = JSON.parse(coreStrings); } catch (err) { coreStrings = undefined; throw err; } _private.initializeIntl(); }
javascript
function init() { // This function is called during Ghost's initialization. // Reading translation file for messages from core .js files and keeping its content in memory // The English file is always loaded, until back-end translations are enabled in future versions. // Before that, see previous tasks on issue #6526 (error codes or identifiers, error message // translation at the point of display...) coreStrings = fs.readFileSync(path.join(__dirname, '..', '..', 'translations', 'en.json')); // if translation file is not valid, you will see an error try { coreStrings = JSON.parse(coreStrings); } catch (err) { coreStrings = undefined; throw err; } _private.initializeIntl(); }
[ "function", "init", "(", ")", "{", "// This function is called during Ghost's initialization.", "// Reading translation file for messages from core .js files and keeping its content in memory", "// The English file is always loaded, until back-end translations are enabled in future versions.", "// B...
Setup i18n support: - Load proper language file into memory
[ "Setup", "i18n", "support", ":", "-", "Load", "proper", "language", "file", "into", "memory" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/lib/common/i18n.js#L175-L192
train
Initializes the language file.
[ 30522, 3853, 1999, 4183, 1006, 1007, 1063, 1013, 1013, 2023, 3853, 2003, 2170, 2076, 5745, 1005, 1055, 3988, 3989, 1012, 1013, 1013, 3752, 5449, 5371, 2005, 7696, 2013, 4563, 1012, 1046, 2015, 6764, 1998, 4363, 2049, 4180, 1999, 3638, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...