query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Parses the given text and invokes the visitor functions for each object, array and literal reached. | function visit(text, visitor, options) {
if (options === void 0) { options = ParseOptions.DEFAULT; }
var _scanner = Object(_scanner__WEBPACK_IMPORTED_MODULE_0__["createScanner"])(text, false);
function toNoArgVisit(visitFunction) {
return visitFunction ? function () { return visitFunction(_scanner.g... | [
"function visit(text, visitor, options = ParseOptions.DEFAULT) {\n const _scanner = (0,_scanner__WEBPACK_IMPORTED_MODULE_0__.createScanner)(text, false);\n // Important: Only pass copies of this to visitor functions to prevent accidental modification, and\n // to not affect visitor functions which stored a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a log driver configuration that sends log information to fluentd Logs. | static fluentd(props) {
return new fluentd_log_driver_1.FluentdLogDriver(props);
} | [
"createLogDriver(enableLoggingProp, logDriverProp) {\n const enableLogging = enableLoggingProp !== undefined ? enableLoggingProp : true;\n const logDriver = logDriverProp !== undefined\n ? logDriverProp : enableLogging\n ? this.createAWSLogDriver(this.node.id) : undefined;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads a single item from the database by name and pass it to the callback function WARNING: if multiple items are found with the same name, only the first will be selected | findByName(name, cb) {
this.db.view('item', 'by_name', {key: name}, (err, itemByName) => {
if (err) {
console.error(err)
return cb(err, null)
}
if (itemByName.rows.length > 0) {
return this.foundItem(itemByName, name, cb)
} else {
return cb(null, null) // No item found
}
})
} | [
"async selectItemByName(name) {\n await this.listing.selectItemByName(name);\n }",
"function getItemInfoByName(itemName, callback) {\n const query = {\n text: 'SELECT * FROM items WHERE name = $1',\n values: [itemName],\n };\n client.query(query, (err, res) => {\n if (err) {\n return ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if products array has object with value containing "|" | function findObjectWithVariations(array){
var index = -1;
array.forEach((element, i) => {
_.values(element).forEach(value => {
if (!value){
// console.log(element);
}
if (value.includes('|')){
index = i;
return false;
... | [
"getCategoryProduct(skinType, categoryProducts, category, regimenProducts) {\n Object.keys(categoryProducts).some((productId, index) => {\n let containsAllTypes = false;\n let product = categoryProducts[productId];\n // console.log(product);\n let productSkinTypes ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function to handle VueFuse search results param descriptions: object: string that describes what type of object the matchingText corresponds to (ie 'card') matchingText: string that matched VueFuse's search currentTasklist: name of current taskList being filtered (getResults() is called on each taskList) returns... | getCardFromMatchingText(matchingText, object, currentTasklist) {
// if object is a card
if (object === "card") {
// return card with matchingText as it's name
return this.allData.data.currentProject.taskLists.find(taskList => taskList.name === currentTasklist).ca... | [
"handleSearchResults(results, displayText) {\n this.selectedDisplayName = displayText;\n if (results.some(group => group.matches) || results.length != this.lists.length) {\n this.currentList = \"text-filter\";\n let listsShown = [];\n let cardsShown... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tries to resolve a soundcloud track url url: string Soundcloud track url props: object properties to pass to the Item constructor returns Item | scTrack(url, props) {
return scRequest(`/resolve?url=${url}`)
.then(raw => {
if (raw.kind === 'track' && raw.streamable) {
return Item.fromApi(ITEM_TYPE.SOUNDCLOUD, merge(raw, props));
}
throw 'Soundcloud url is not streamable or isnt a track';
});
} | [
"function resolve(trackUrl) {\n var deferred = Q.defer();\n\n unirest.get('https://api.soundcloud.com/resolve.json')\n .query({\n client_id: config.soundcloud.clientId,\n url: trackUrl\n })\n .end(function (response) {\n if (response.error) return deferred.reject(response.error);\n if (response.bod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a closure for each separate chain spawned from this jsloader instance, to keep state cleanly separated between chains | function create_chain() {
var chainedAPI,
chain_opts = merge_objs(global_defaults, {}),
chain = [],
exec_cursor = 0,
scripts_currently_loading = false,
group
;
// called when a script has finished pre... | [
"function create_chain() {\n\t\t\tvar chainedAPI,\n\t\t\t\tchain_opts = merge_objs(global_defaults,{}),\n\t\t\t\tchain = [],\n\t\t\t\texec_cursor = 0,\n\t\t\t\tscripts_currently_loading = false,\n\t\t\t\tgroup\n\t\t\t;\n\t\t\t\n\t\t\t// called when a script has finished preloading\n\t\t\tfunction chain_script_ready... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate plate boundary layer | function create_PlateBoundary_Layer(b_data){
console.log(b_data)
var myStyle = {
"color": "#ff7800",
"weight": 3,
"opacity": 0.7
};
var boundaryLayer = L.geoJson(b_data.features, {
style: myStyle
})
return boundaryLayer;
} | [
"function createBoundary () {\n let tmp = Math.random()\n tmp = Math.abs(tmp * new Date().getTime())\n return boundaryBorder + tmp + boundaryBorder\n}",
"createSurface() {\n let controlPoints = [];\n for (var i = 0, k = 0; i < this.nPointsU; i++) {\n let uPoint = [];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is used to determine if a clicked character needs to be placed in the selected fighter section or the defender section | function characterClicked(characterElement, characterObject) {
// Check if the global var used to hold the selected figther is undefined.
// This is how it will be determined if the user has not selected a fighter.
if(typeof _selectedFighterObj === 'undefined') {
$('#selected-character').empty();
/* Remove oran... | [
"function selectFighters() {\n $('.character-figure').on('click', function() {\n if (!$(this).hasClass('enemy-figure') && !$(this).hasClass('player-figure')) {\n selectPlayer(this);\n moveEnemies(this);\n $('#enemies').removeClass('hidden').addClass('show');\n } els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check se nella stringa ci sono caratteri che non sono validi Caratteri validi: az, AZ, 09, _, | function check_string(input) {
var re = new RegExp('[^a-zA-Z0-9-_]+');
if (input.match(re)) { return false; }
else { return true; }
} | [
"function verifyString(str) {\n if (/^[a-zA-Z0-9- ]*$/.test(str) == false) {\n throw 'Contains invalid characters';\n }\n}",
"static checkInvalidUsernameChars(username) {\n if (!username || username.length === 0) {\n return false;\n }\n let c = username.charAt(0);\n if (c >= '0' && c <= ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determine the accounts receivable nominal code rule = if bill to is distributor the A/R Account is 1161.002 otherwise it's 1161.001 [TODO] remove hardcoded account values 1161.002 & 1161.001 1.0.2 | function determineAccountReceivable(billToChannelDesc)
{
var accountReceivable = '';
var arInternalID = '';
try
{
billToChannelDesc = billToChannelDesc.toUpperCase();
if(billToChannelDesc.indexOf('DISTRIBUTOR') != -1)
{
if(regionDesc=='AU') {
accountReceivabl... | [
"function calcNeto( ) {\r\n\t\t\treturn $scope.pes_br-$scope.pes_ta;\r\n//\t\t\treturn toString(accounting.unformat($scope.pes_br)-accounting.unformat($scope.pes_ta)); /*\r\n\t\t}",
"getActiveNominatorBond(){\n var bondTally=0;\n\n this._active_nominators.forEach(nominator=>{\n bondTally+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get topic by status | getTopicByStatus(callback, errorCallback) {
CommonUtil.requestAxios(
baseServerAxios().get(UrlConstant.api.topic.GET_TOPIC_BY_STATUS),
callback,
errorCallback
);
} | [
"getByTopicId (topicId) {\n let self = this\n return self.axios.get(`${self.baseUrl}/topic/${topicId}/currents`)\n }",
"function getTopic() {\n return (state.vis.topicIdx === -1 ? null : data.topics[state.vis.topicIdx]);\n}",
"async getTopicById(id){\n\t\tlet sql = `SELECT * FROM topics WHERE id=` + Str... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
JS for calling Mega Menu | function callMegaMenu() {
"use strict";
var e, menucolumn = 4;
if ((jQuery(window).width() >= 768) && (jQuery(window).width() < 980)) {
menucolumn = 2;
}
if (jQuery(window).width() >= 768) {
e = "hover";
jQuery(".mega-menu .mega").dcMegaMenu({
rowItems: menucolumn... | [
"function uberMenu_openMega( id ){\n\tjQuery( '.ubermenu' ).ubermenu( 'openSubmenu' , jQuery( id ) );\n}",
"function megamenu(){\n\tapp.getView().render('components/header/megamenu');\n}",
"function DWMenu() {}",
"function menuOptions() {}",
"function mobileMenu() {\r\n var outputElem = $('#mobile_me... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an export object ("module") `e`, promote its keys to the global context. If an optional list of keys is given (in wsv or Array form), promote just those keys. | function globalize (e, just) {
// determine the global context
var _global
if (typeof window !== 'undefined') {
_global = window
} else {
_global = (typeof global === 'undefined')
? GLOBAL
: global
}
// parse wsv just array, if needed
if (just && (typeof just === '... | [
"function extendModule(keys, obj) {\n angular.forEach(keys, function(k) {\n if (obj[k])\n $module[k] = obj[k];\n if ($module.options.extendRemove)\n delete obj[k];\n });\n }",
"function mapExportedGlobals(names) {\n names.forEach(name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Your subclass must override this method to define how a CompileResult translates into adding assets to the bundle. This method is given an InputFile (the data type passed to processFilesForTarget as part of the Plugin.registerCompiler API) and a CompileResult (either returned directly from compileOneFile or read from t... | addCompileResult(inputFile, compileResult) {
if (!compileResult.data) {
return;
}
inputFile.addJavaScript({
path: compileResult.path,
sourcePath: inputFile.getPathInPackage(),
data: compileResult.data,
sourceMap: compileResult.sourceMap,
bare: inputFile.getFileOptions().bare
});
} | [
"function addFileToWebpackOutput(compilation, filename, fileContent) {\n\tcompilation.assets[filename] = {\n\t\tsource: () => {\n\t\t\treturn fileContent;\n\t\t},\n\t\tsize: () => {\n\t\t\treturn Buffer.byteLength(fileContent, 'utf8');\n\t\t},\n\t};\n}",
"function addFileToWebpackOutput(compilation, filename, fil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method 2 Using a Set checkDuplicate2(); | function checkDuplicate2() {
let arr = ["abc","xy","bb", "abc"];
let result = false;
// create a Set with array elements
const s = new Set(arr);
// compare the size of array and Set
if(arr.length !== s.size){
result = true;
}
if(result) {
conso... | [
"function checkDuplicates2(args) {\n return new Set(args).size !== args.length\n}",
"function areThereDuplicates2() {\n // Creates set of objects from arguments passed in and compares the number of elements in the object aka. size to the arguments length\n return new Set(arguments).size !== arguments.length;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Problem 3: Historical life expectancy / This must return the object/map with centuries as keys and average age for the century as the value | function averageAgeByCentury() {
//assign each person to a century
var avgAgeExpectancy = {};
var century;
ancestry.forEach(function(person) {
century = Math.ceil(person.died / 100).toString();
if(!avgAgeExpectancy.hasOwnProperty(century)) { avgAgeExpectancy[century] = []; }
avgAgeExp... | [
"function averageAgeByCentury() {\n\t// Your code here\n \tvar map = {};\n \tancestry.forEach(\n \t\tfunction(person)\n \t\t{\n \t\t\tvar centuries = Math.ceil(person.died / 100);\n \t\t\tif (!map[centuries])\n \t\t\t{\n \t\t\t\tmap[centuries] = [];\n \t\t\t\tmap[centuries].push(person.died - person.born);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
passes the track from the this.props object to the addTrack() method in the App.js through props of TrackList.js and SearchResults.js; | addTrack() {
this.props.onAdd(this.props.track);
} | [
"addTrack() {\n\t\tthis.props.onAdd(this.props.track);\n\t}",
"addTrack(track) {\n\t\tlet tracks = this.state.playlistTracks;\n\t\ttracks.push(track);\n\n\t\tthis.setState({playlistTracks: tracks});\n\t}",
"addTrack(track) {\n let artist = track['artist']['#text'];\n let song = track['name'];\n let t =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function takes a piece of JavaScript (`input`), and instruments it. The instrumentation: inserts calls to `enterScript()` and `exitScript()` in inline JavaScripts, and inserts calls to `enterScript()` and `exitScript()` in external JavaScript files (i.e., .js files). It additionally instruments (selected) property... | function instrumentJavaScript(input, options) {
// Instrument the property assignments in `input`
var instrumented = instrumentSelectedPropertyRW(input, {
allowReturnOutsideFunction: options.allowReturnOutsideFunction
});
if (options.isExternal || !options.allowReturnOutsideFunction) {
... | [
"function instrumentString(code, options) {\n if (!options) {\n options = {};\n }\n var outputFileName = getInstOutputFile(options.outputFile);\n var instCodeOptions = {\n code: code,\n origCodeFileName: options.inputFileName,\n instCodeFileName: outputFileName,\n inli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts years to milliseconds | function yearsToMS(years){
return years * 365.25 * 24 * 60 * 60 * 1000;
} | [
"function yearsToMS(years){\n\treturn years * 365.25 * 24 * 60 * 60 * 1000;\n}",
"function getYearsFromMilli(time){\n time=Math.floor(time/1000);\n return Math.floor(time/31536000);\n}",
"timeInYears(months){\r\n months*=Month\r\n return months/Yr\r\n }",
"static transformMilisecondsToYea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from functions/java/JavaInvoke.java =================================================================== Needed early: Builtin Needed late: JsObject Symbol Pair | function JavaInvoke() {
} | [
"\"syscall/js.valueInvoke\"(sp) {\n sp >>>= 0;\n try {\n const v = go.loadValue(sp + 8);\n const args = go.loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, undefined, args);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a scale (array of ints) and the name of a mode (either "Major" or "Minor") and builds and html table for the chord progression based on that scale. | function makeTable(scale,mode) {
var pattern = (mode=="Major" ? ["","m","m","","","m","dim"] : ["m","dim","","m","m","",""]);
var majnum = '<td>I</td><td>ii</td><td>iii</td><td>IV</td><td>V</td><td>vi</td><td>vii</td>';
var minnum = '<td>i</td><td>ii</td><td>III</td><td>iv</td><td>v</td><td>VI</td><td>VII</td>';
... | [
"function genScaleTable(p_modeIndex) {\n var v_scaleTable = document.querySelector('table'); // the table used to display the data\n var v_init; // indicates the start of the table row to use\n var v_row_ctr;\n var v_col_ctr;\n var v_rowtype; // The types of rows are: 0-5, 1-6, 2-7, 3-8, 4-9... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a position along a cubic Bezier curve | function bezier(u, p0, p1, p2, p3) {
return Math.pow(u, 3) * (p3 + 3 * (p1 - p2) - p0)
+ 3 * Math.pow(u, 2) * (p0 - 2 * p1 + p2)
+ 3 * u * (p1 - p0) + p0;
} | [
"function _cubicBezierCurve(t,p0,p1,p2,p3){return(1-t)*(1-t)*(1-t)*p0+3*(1-t)*(1-t)*t*p1+3*(1-t)*t*t*p2+t*t*t*p3;}",
"function pointOnCubicBezier(x0, y0, x1, y1, x2, y2, x3, y3, t) {\n var t2 = 1 - t;\n return {\n x: t2 * t2 * t2 * x0 + 3 * t2 * t2 * t * x1 + 3 * t2 * t * t * x2 + t * t * t * x3,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funcion para el formato de valores | function formatoValor(objetoTexto) {
debugger;
if (objetoTexto.val() != '' && objetoTexto.val().substring(objetoTexto.val().length - 1, objetoTexto.val().length) != ',') {
var NuevoValor = objetoTexto.val();
NuevoValor = formatoBase(NuevoValor);
if (NuevoValor.includes(".")) {
... | [
"_formatField() {\n const value = this._loadValue();\n\n if (_.isFunction(this.formatValue)) {\n this.formatValue(value);\n } else {\n this.$el.text(value);\n }\n }",
"function format_it ()\n\t\t\t{\n\t\t\t\tvar str = obj.val();\n\t\t\t\tvar price = numbers_for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assertion test that code never reaches this task | neverReach (res, cb) {
assert.ok(true, 'Should never reach here')
} | [
"async preTest() { throw new Error('abstract method not implemented'); }",
"function _NoAssertCommand() {\n}",
"failing() {}",
"function WebUIAssertionsTestAsyncFail() {}",
"function testParserInsertedDidNotRun(description) {\n test(() => assert_false(window.ran),\n \"Script shouldn't run with \" + d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sun rise/set obs is the observer twilight is one of the following for actual rise and set 0.833 for civil rise and set 6.0 for nautical rise and set 12.0 for astronomical rise and set 18.0 | function sunrise(obs,twilight) {
// obs is a reference variable make a copy
var obscopy=new Object();
for (var i in obs) obscopy[i] = obs[i];
var riseset=new Array("","");
obscopy.hours=12;
obscopy.minutes=0;
obscopy.seconds=0;
lst=local_sidereal(obscopy);
earth_xyz=helios(planets[2],obscopy);
sun_x... | [
"function GMSTRiseSet(coor, lon, lat, h) {\n var h = (h == null) ? 0. : h; // set default value\n var riseset = new Object();\n// var tagbogen = Math.acos(-Math.tan(lat)*Math.tan(coor.dec)); // simple formula if twilight is not required\n var tagbogen = Math.acos((Math.sin(h) - Math.sin(lat) * Math.sin(co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a new render context which is used to render a set of values | createContext() {
const context = new RenderContext({
renderers: this.renderers,
theme: this.theme,
});
return context;
} | [
"function RenderContext() {\n /**\n * @type Array.<(string|number)>\n * @private\n */\n this._html = [];\n /**\n * @type number\n */\n this.length = 0;\n }",
"function render(template, context) {\n var container = document.createElement('di... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback for write errors | onWriteError(err, fileId, file) {
console.error(`ufs: cannot write file "${ fileId }" (${ err.message })`);
} | [
"function writeFailure() {\n}",
"onWriteError(err, fileId, file) {\n\t\tconsole.error(`ufs: cannot write file \"${ fileId }\" (${ err.message })`, err);\n\t}",
"onWriteError(err, fileId, file) {\n console.error(`ufs: cannot write file \"${ fileId }\" (${ err.message })`);\n }",
"function fileErr(err... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Comppute the neighborMasksByHop and neighborMasks (all hops combined) | function computeNeighborMasks(numNodes, edgeDict, hops) {
const masks = [],
masksByHop = [];
let last;
for (let i = 0; i < numNodes; i++) {
masks.push(bs(0));
// include self
masks[i].set(i, 1);
}
// first hop
for (let sid = 0; sid < edgeDict.length; sid++) {
... | [
"function calculateAdjacencyInfo(map, x, y){\n let number = 0;\n let Sides = [{x:0,y:-1}, {x:-1,y:0}, {x:1,y:0}, {x:0,y:1}];\n let SidesID = [0x10, 0x20, 0x40, 0x80];\n \n let CornerMask = [0x30, 0x50, 0xA0, 0xC0];\n let Corners = [{x:-1,y:-1}, {x:1,y:-1}, {x:-1,y:1}, {x:1,y:1}];\n let CornersI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loadCookies IN: nothing OUT: nothing Set viewport and selected color from previous sessions cookies | function loadCookies()
{
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++)
{
var c = cookies[i];
while (c.charAt(0) == ' ')
c = c.substring(1);
var val = parseInt(c.substring(5, c.length));
if (val == NaN)
val = 0;
... | [
"function updateCookies()\n{\n document.cookie = \"offX=\" + xOffset;\n document.cookie = \"offY=\" + yOffset;\n document.cookie = \"zoom=\" + zoomValue;\n document.cookie = \"selX=\" + inputX;\n document.cookie = \"selY=\" + inputY;\n var col = document.querySelector('input[name=\"color\"]:checke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To randomize cows in the same X variable, but only when the beam ray is not activated | function drawCow (){
if(!IsBeamAiming){
cowX = cowWidth + Math.floor(Math.random()*canvas.width-cowWidth);
}
else{
cowX == canvas.height - 60
}
} | [
"randomXcoordinate() {\n let minLanes = 1, maxLanes = 5, firstLane = 15;\n let lane = Math.floor(Math.random() * maxLanes) + minLanes;\n if (lane === minLanes) {\n this.x = firstLane;\n }\n else {\n lane--;\n let newLane = firstLane + (lane * this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates through the array of Materials, if duplicated items, combine and sum the quantity | reduce(input) {
const map = input.reduce((res, { Ingredient, Quantity, ...rest }) => {
if (res[Ingredient]) {
res[Ingredient].Quantity += Quantity
} else {
res[Ingredient] = { Ingredient, Quantity, ...rest }
}
return res
}, {})
const res = Object.values(map)
... | [
"aggregate() {\n let uniqueItems = new Map();\n\n for (let i = 0; i < this.items.length; i++) {\n\n // If item exists already, add quantity\n if (uniqueItems.has(this.items[i].name)) {\n let item = uniqueItems.get(this.items[i].name)\n item.quantity ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List most recent projects | getMostRecent(req, res) {
// SQL for most recent projects.
// TODO - factor out KpiProjects, we're not using it now.
/*
let sql = "select id, title, description, startAt, ProjectUpdated, " +
" greatest(ProjectUpdated, COALESCE(TUdate, '2000-01-01'), " +
" COALESCE(TCdate, '2000-01-01'),... | [
"async function recentlyUpdated () {\n // Get all global, active projects\n const projects = await Project\n .find({ privacyLevel: 'global', status: 'active' })\n .select('_id');\n\n // pair project _ids with latest note update date\n const withDates = await lastUpdated(projects.map(project => project._id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
valid address is a valid ecdsa public key in the 04 + Xcoordinate + Ycoordinate format | static isValidAddress(address) {
if (address.length !== 130) {
console.log('invalid public key length');
return false;
}
else if (address.match('^[a-fA-F0-9]+$') === null) {
console.log('public key must contain only hex characters');
return false;... | [
"function isValidPublicAddress(value) {\n\tif (typeof value === 'string') {\n\t\treturn /^[0-9a-f]{40}$/.test(value);\n\t}\n\n\treturn false;\n}",
"function validateAddr(address) {\n if (address.charAt(0) !== \"H\") {\n return 1\n }\n const check = address.slice(-4)\n address = address.slice(1,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changing a node's metadata Node metadata can be set or changed by calling this method. | setNodeMetadata(id, metadata) {
let node = this.getNode(id);
if (!node) { return; }
this.checkTransactionStart();
let before = clone(node.metadata);
if (!node.metadata) { node.metadata = {}; }
for (let item in metadata) {
let val = metadata[item];
if (val != null) {
node.m... | [
"function nymag_setMetadata( metadata ) {\n trk_setMetadata(metadata);\n}",
"set metadata(value) {\n this._metadata = value;\n }",
"setEdgeMetadata(node, port, node2, port2, metadata) {\n let edge = this.getEdge(node, port, node2, port2);\n if (!edge) { return; }\n\n this.checkTransactionS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows a load mask while the connected store is loading | onStoreLoadStart() {
if (this.loadMask) {
this.maskBody(this.loadMask);
}
} | [
"function displayLoadMask() {\n\tif (mapIsLoading) { // check if layer is still loading\n\t\tloadMask = new Ext.LoadMask(Ext.getCmp('MapPanel').body, {msg:mapLoadingString[lang]});\n\t\tloadMask.show();\n\t}\n}",
"function showKittoLoadMask(amount)\r\n{\r\n if (amount == 0)\r\n window.kittoLoadMaskShowCount =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to get the next email reminder time. Adds +2 hours to the current date. | function getNextReminderTime(){
var today = new Date();
//Adding 19 hours to PST will give Australia/ Sydney timezone
today.setHours(today.getHours() + 19);
var currentHours = today.getHours();
nlapiLogExecution('DEBUG', 'currentHours + 2', currentHours + 2);
if(currentHours + 2 > 16 ){
... | [
"function nextDate() {\n const next = 1000 * 60 * 60 * 72\n return Date.now() + next\n}",
"function getNextResetDate() {\n var newTime = new Date();\n newTime.setHours(resetHour, 0, 0);\n if (newTime.getTime() < Date.now()) {\n newTime.setDate(newTime.getDate() + 1);\n }\n return newTi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send feedback back to Echonest indicating that user likes a song. | function likeSong(){
var favorite_song_request = "http://developer.echonest.com/api/v4/playlist/dynamic/feedback?api_key=7VI2RLSXC4GBPF6S7&format=json&session_id=" + session_id + "&favorite_song=last";
$.getJSON(favorite_song_request + "&_=" + Math.floor(Math.random()*1000000), function(data) {
if (data.response.st... | [
"sendFeedback (like) {\n 'use strict';\n\n // Set the song as rated \"like\" and start animating\n this.currentSong.rated = like;\n this.currentSong.animating = true;\n\n // add song as favorite\n if (like) {\n User.addSong(this.currentSong);\n }\n\n // Call next song\n this.nextSong... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pointv2 solves the problem that occurs with pointv1 by wrapping the methods in another closure. | function pointv2(x, y) {
return function (msg) {
if (msg == 'get-x')
return x;
if (msg == 'get-y')
return y;
if (msg == 'set-x')
return function (val) {
x = val;
return x;
};
if (msg == 'set-y')
return function (val) {
y = val;
return y;
... | [
"function pointv1(x, y) {\n return {\n getX: function () {\n return x;\n },\n \n setX: function (val) {\n x = val;\n },\n \n getY: function () {\n return y;\n },\n \n setY: function (val) {\n y = val;\n }\n };\n}",
"function reflect2(point, p1, p2){\n let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
insert new poll into db | function insertPoll(name, options, author) {
return new Promise((resolve, reject) => {
getConnection((err, db, collection) => {
if(err) return reject(err);
collection.insert({
name,
options,
//votes: [],
totalVotes: 0,
... | [
"insertDemoData() {\n db.run(`INSERT INTO poll(name) VALUES('Demo poll')`, function (err) {\n if(err) { console.log(err.message) }\n else {\n db.run(`INSERT INTO poll_vote(poll_id, value, name) VALUES(1, 1, 'Hanna'), (1, 2, 'Joakim'), (1, 5, 'Mark'), (1, 13, 'Max')`, fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compile a math expression assignment like: v = i j, v = (i + 1) j | compileMathExpressionAssignment(opts) {
let mathExpressionNode = new MathExpression({
varExpression: this._varExpression,
compiler: this._compiler,
program: this._program,
scope: this._scope
}).compile(opts.srcExpression, this._compiler.getPass());
let value = mathExpressionNode.getValue() || mathExp... | [
"compileSpecialMath(o) {\n var left, right;\n [left, right] = this.variable.cacheReference(o);\n return new Assign(left, new Op(this.context.slice(0, -1), right, this.value)).compileToFragments(o);\n }",
"function i(t,e,n){t[e]=n,t.expression.mathWithTransform[e]=n}",
"function makeInl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
task 11 unable to do it..just can't comprehand the logic behind task 12 is on another file in the directory | function Task12()
{
jsConsole.writeLine("task 12 is on another file in the directory");
} | [
"taskActivator() {\n var Bot = exports.Bot;\n if (!botManager.isDoingDisassembly) {\n if (new Date().getDay() === 2 && new Date().getHours() === 19 && new Date().getMinutes() === 0) {\n require('./../tasks/CheckMarketplaceTask.js').check(Bot);\n }\n for ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort planets using user preferred order | function sortPlanets(planets){
var sorted = {};
foreach(planets, function(p){
sorted[parseInt(100000 * p.g + 100 * p.s + 1 * p.p)] = p;
});
return sorted;
} | [
"function sortedPlanets(Planets) {\n\treturn Planets.sort();\n}",
"function sortedPlanets(){\n var alpha = Planets.sort();\n console.log(alpha);\n}",
"function sortedPlanets() {\n\tPlanets.sort();\n\tdocument.write(Planets);\n}",
"function sortByPoints(){\n self.sortBy = sortBy.teamPoints;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle bookmark deletion event bnId = id of BookmarkNode subtree to remove. | function bkmkRemoved (bnId) {
//console.log("Remove event on: "+bnId);
if (!isDisplayComplete) // If we get an event while not yet ready, ignore
return;
// Retrieve removed subtree
let BN = curBNList[bnId];
if (backgroundPage == undefined) { // Redo deletion in our own copy of curBNList
// Remove item and i... | [
"function removeBookmark(selectedId){\n bookmarks.forEach(function (bookmark, index) {\n if (bookmark.id === selectedId){\n api.deleteBookmark(bookmark, function() {\n bookmarks.splice(index, 1);\n bookmarkList.render();\n });\n }\n });\n \n }",
"function deleteBo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns two items: flat array of all the plus operation subexpressions true when the result of the plus operation is a string | function flattenPlusExpression(node) {
if (isPlusExpression(node)) {
const [left, leftIsString] = flattenPlusExpression(node.left);
const [right, rightIsString] = flattenPlusExpression(node.right);
if (leftIsString || rightIsString) {
return [_.flatten([left, right]), true];
}
else {
... | [
"function flattenPlusExpression(node) {\n if (isPlusExpression(node)) {\n const left = flattenPlusExpression(node.left);\n const right = flattenPlusExpression(node.right);\n\n if (left.isString || right.isString) {\n return {\n operands: flatten([left.operands, right.operands]),\n comme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to filter cruise results by user selected values | function filter() {
//getting values selected by user from dropdown menus
var vessel = $('#vessel').val();
var dbo = $('#dbo').val();
var chief_sci = $('#chief_sci').val();
var cruise_id = $('#cruise_id').val();
var year = $('#year').val();
//copying original data array w/ all cruises
va... | [
"function filter_list() { \n region_filter=[\"in\", \"Region\"]\n if ($(region_select).val()){\n for (var i = 0; i < $(region_select).val().length;i++){\n region_filter.push( $(region_select).val()[i])\n }\n }\n version_filter =[\"in\", \"HWISE_Version\"]\n if ($(Version_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set up the given function to run when the player of the given uuid has lost the game. | addPlayerLoseHandler(uuid, func) {
this.players[uuid].lose = func;
} | [
"async onPlayerDeath(player, killer, reason) {}",
"function onPlayerDeath(data){\n\t//find the player by id in the players array\n\tvar deadPlayer = playerById(data.id);\n\t//Player not found\n\tif(!deadPlayer){\n\t\tconsole.log(\"A player was claimed dead, but wasn't found\");\n\t\treturn;\n\t};\n\t//set the pla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets an implementation for the given declaration that lives within a declaration file | function getImplementationForDeclarationWithinDeclarationFile(options) {
var _a;
const { node, typescript } = options;
const name = getDeclarationName(options);
if (name == null) {
throw new UnexpectedNodeError({ node, typescript });
}
// First see if it lives within the lexical environm... | [
"getDtsDeclaration(declaration) {\n if (this.dts === null) {\n return null;\n }\n if (!isNamedDeclaration(declaration)) {\n throw new Error(`Cannot get the dts file for a declaration that has no name: ${declaration.getText()} in ${declaration.getSourceFile().fileName}`);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the content title based on attributes of the main widget. | _updateContentTitle() {
if (this._changeGuard || !this.content) {
return;
}
this._changeGuard = true;
const content = this.content;
content.title.label = this.title.label;
content.title.mnemonic = this.title.mnemonic;
content.title.icon = this.title.ic... | [
"_updateContentTitle() {\n if (this._changeGuard) {\n return;\n }\n this._changeGuard = true;\n const content = this.content;\n content.title.label = this.title.label;\n content.title.mnemonic = this.title.mnemonic;\n content.title.iconClass = this.title.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return a promise for finding messagethreads by the given user id. if the messagethreads were found, then the promise will resolve with the existing messagethreads. if the messagethreads were not found, then the promise will resolve with an error. | function findMessagethreadsByUserId(userId) {
var url = "/api/petshelter/user/" + userId + "/messagethread";
return $http.get(url);
} | [
"async getThreadById(id) {\n try {\n const getThreadQuery = new PQ(`SELECT * FROM threads WHERE id = $1`, [id]);\n return await this._dbContext.db.oneOrNone(getThreadQuery);\n } catch (error) {\n console.log('ERROR: ', error.message || error);\n }\n }",
"st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setStartPosition set Random Spawn Point | setRandomSpawnPoint() {
// leer
} | [
"nextSpawnPos() {\n let angle = Math.random() * Math.PI * 2;\n let dist = Math.random() * (this.maxSpawnRadius - this.minSpawnRadius) + this.minSpawnRadius;\n\n let x = Math.cos(angle) * this.minSpawnRadius;\n let y = Math.cos(angle) * this.minSpawnRadius;\n }",
"function randomStar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GroceryItems CRUD functions Load all grocery items from local storage. | function loadGroceryItems()
{
var items = localStorage.getObject("shoppinglist");
if( items != null ) {
//check if items is an array
if(_.isArray(items)) {
groceryItems = items;
} else {
// This will happen on first run
//alert("Kauppalistan lataus ei onnistunut");
}
}
} | [
"function storeGroceryItems()\r\n{\r\n\tlocalStorage.setObject(\"shoppinglist\", groceryItems);\r\n}",
"function loadItems(){\n let items=getLocalStorage()\n items.forEach(function(item){\n setUpItems(item.id, item.value)\n })\n}",
"function GroceryItemStore () {\n 'use strict';\n\n var li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combines an arbitrary set of paths ensuring and normalizes the slashes | function combine() {
var paths = [];
for (var _i = 0; _i < arguments.length; _i++) {
paths[_i] = arguments[_i];
}
return paths
.filter(function (path) { return !stringIsNullOrEmpty(path); })
.map(function (path) { return path.replace(/^[\\|\/]/, "").replace(/[\\|\/]$/, "")... | [
"function combinePaths() {\r\n var paths = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n paths[_i] = arguments[_i];\r\n }\r\n return paths\r\n .filter(function (path) { return !stringIsNullOrEmpty(path); })\r\n .map(function (path) { return path.replace(/^[\\\\|\\/]/, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: choose by manhatten distance, not breadth search distance returns the furthest possible tile index from the general, with maximum distance to edge tiles are arrays of Objects with index and generalDistance properties | static chooseDiscoverTile(gameState, gameMap, tiles) {
let generalCoords = gameMap.getCoordinatesFromTileIndex(gameState.ownGeneral);
let optimalTile = {"index": -1, "edgeWeight": -1};
let maxGeneralDistance = tiles[tiles.length -1].generalDistance;
//first elements are the closest to the general
... | [
"function calculateTileDistances() {\r\n var job, i, count, deltaX, deltaY, distanceOffset;\r\n\r\n job = this;\r\n\r\n distanceOffset = -window.hg.Grid.config.tileShortLengthWithGap;\r\n\r\n for (i = 0, count = job.grid.allNonContentTiles.length; i < count; i += 1) {\r\n deltaX = job.grid.allNonCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Input wrapper if wrapperClassName set | renderWrapper(children) {
return this.props.wrapperClassName ? (
<div
className={this.props.wrapperClassName}
key="wrapper">
{children}
</div>
) : children;
} | [
"function InputWrapper() {\n}",
"function setupWrapper() {\n _dom.wrapper = _dom.mainInput.parentNode;\n addClass(_dom.wrapper, \"wrap\");\n if (!_features.hasInlineBlock) {\n addClass(_dom.wrapper, \"wrap-no-ib\");\n }\n if (css(_dom.wrapper, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a staking pool | getStakingPool(poolId) {
const self = this;
assert_1.assert.isString('poolId', poolId);
const functionSignature = 'getStakingPool(bytes32)';
return {
callAsync(callData = {}, defaultBlock) {
return __awaiter(this, void 0, void 0, function* () {
... | [
"function createCardPool() {\r\n\t// Get the set or block to generate a pool from\r\n\tvar cardPool = readCardPools();\r\n\t// Single set\r\n\tif (!Array.isArray(cardPool)) {\r\n\t\t// Add the prerelease promo card (randomly selected rare or mythic)\r\n\t\tvar promoPool = cardPool.mythicPool.concat(cardPool.rarePoo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete blog from Firestore | function deleteBlog(id){
var docId;
datebase.collection("blog").get().then((query) => {
var j = 0;
query.forEach((item) => {
if (j == id) {
docId = item.id;
}
j++;
});
datebase.collection("blog").doc(docId).delete().then(()=>{
... | [
"function deleteBlog(req, res) {\n Blog.deleteOne({_id : req.params.id}).then(() => {\n res.redirect(\"/\");\n }).catch(err => {\n res.status(400).send(\"Unable to delete data\");\n });\n}",
"deleteRefFromFirestore() {\n const { image } = this.props.route.params;\n firebase.firestore()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Serverless::Function.TableStreamSAMPT` resource | function cfnFunctionTableStreamSAMPTPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnFunction_TableStreamSAMPTPropertyValidator(properties).assertSuccess();
return {
StreamName: cdk.stringToCloudFormation(properties.streamName),
Ta... | [
"function cfnFunctionStreamSAMPTPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnFunction_StreamSAMPTPropertyValidator(properties).assertSuccess();\n return {\n StreamName: cdk.stringToCloudFormation(properties.streamName),\n };\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function called hasNoDuplicates which accepts an array and returns true if there are no duplicate values (more than one element in the array that has the same value as another). If there are any duplicates, the function should return false. | function hasNoDuplicates(arr) {
return arr.every(function(val, idx) {
while (idx < arr.length - 1) {
return arr[0] !== arr[idx + 1];
}
});
} | [
"function hasNoDuplicates(array) {\n return array.every(function(value) {\n return array.indexOf(value) === array.lastIndexOf(value);\n })\n}",
"function hasDuplicates(array) {\n return (new Set(array)).size !== array.length;\n}",
"function hasDuplicates(array) {\n return [...new Set(array)].length !... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display links of equivalent MusicBrainz entities // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Insert MusicBrainz links in a section of the page | function insertMBLinks(current_page_key) {
function searchAndDisplayMbLinkInSection($tr, discogs_type, mb_type, nosearch) {
if (!mb_type) mb_type = defaultMBtype(discogs_type);
$tr.find('a[mlink^="' + discogs_type + '/"]').each(function() {
var $link = $(this);
if ($link.att... | [
"function HateoasLinks() {}",
"function makeLinks(site, node) {\r\n\tvar container = $(\"<span class='torrentLinkSpan'></span>\");\r\n\tvar artistName = getText(site.artistPath ? $(site.artistPath, node) : $(node));\r\n\tvar albumName = site.albumPath ? getText($(site.albumPath, node)) : \"\";\r\n\tif(albumName &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns subGrid for the column | get subGrid() {
return this.grid ? this.grid.getSubGridFromColumn(this) : undefined;
} | [
"initSubGrid() {\n let tempsub = []\n for (let i = 1; i <= 9; i++) {\n this.subgrids.push(tempsub)\n }\n for (let i = 0; i < 9; i++) {\n for (let j = 0; j < 9; j++) {\n this.subgrids[(i % 3) * 3 + j % 3].push(this.rows[i][j])\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to remove an edge from src index to tgt index | function removeEdgeOnto(src,tgt){
i = indexOfLinkOnto(src,tgt);
if(i==-1) return;
link_dataOnto.splice(i,1);
refreshGraphOnto(node_dataOnto,link_dataOnto);
} | [
"removeEdge(fromVertex, toVertex) {\r\n let index = fromVertex.edges.findIndex(v => v === toVertex);\r\n if (index >= 0) {\r\n fromVertex.edges.splice(index, 1);\r\n if (fromVertex.numberOfEdges === 0) {\r\n this.removeVertex(fromVertex.value);\r\n }\r\n }\r\n index = toVertex.edge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
asyncParsingDone() is called when async.queue() has totally finished: > Either with an error (first parameter is the error) > Or just finished So here, we set up the _parsingInfo and run the caller's callback, after setting the misc. "done" flags to true. | function asyncParsingDone(inObj, inParsingConfig, inMainCallback, inCallBackParameters) {
if(typeof inObj !== "boolean") {
inMainCallback(inObj, inCallBackParameters);
} else {
_parsingInfo.fullSizeInBytes = inCallBackParameters.fullSizeInBytes;
_parsingInfo.countDirectories = inCallBackParameters.co... | [
"doneParsing() {\n for (var handler in this.parsers) {\n this.parsers[handler].postParse();\n }\n }",
"function processQueue() {\n if (queue.length === 0) {\n busy = false;\n return;\n }\n\n busy = true;\n var entry = queue.shift(); // get first element off queue\n try {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is run many times a second checking if a ghost has caught pacman | function pacCaught(ghost) {
console.log('is it catching?')
if(gridSquare[pacIndex] === gridSquare[ghost.ghostIndex]) {
gridSquare[pacIndex].classList.remove('pacmanRight')
gridSquare[pacIndex].classList.remove('pacmanLeft')
gridSquare[pacIndex].classList.remove('pacmanUp')
gridSquare[pac... | [
"function pacKill(ghost){\n console.log('can pac kill')\n for( let i=0; i<16; i++) {\n clearInterval(caughtIdOne)\n clearInterval(caughtIdTwo)\n clearInterval(caughtIdThree)\n clearInterval(caughtIdFour)\n }\n // so pacMan can kill ghost\n if(gridSquare[pacIndex] === gridSquare[gh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set active class on sort nodes for styling | function setActiveSortClass(fieldName, reverse) {
const activeSortLink = document.querySelector(
`.headCell__link[data-fieldName=${fieldName}]`
);
const oldSortLink = document.querySelector(".headCell__link.active");
const direction = reverse ? "asc" : "desc";
// Remove previous active classes
if (oldS... | [
"function selectionSetSorted(){\n setClass(nodes[selectionSmallest], 2, \"Default\");\n setClass(nodes[selectionCurrent], 2, \"Sorted\"); //sets the current node to \"sorted\" color\n addStep(\"Current Node \" + (selectionCurrent + 1) + \" is now sorted.\");\n sortedSwitchStep++;\n}",
"function setAc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the Firebase root, wait forever | async function _getFBRootRefUnlimited() {
if (_fbRootRef) {
return _fbRootRef;
}
if (_isAuthInProgress) {
return _waitForFBRoot(Date.now(), Number.MAX_SAFE_INTEGER);
}
return _go();
} | [
"function root() {\n return database.ref(UserInfo.getCurrentUser().uid);\n }",
"firebaseGet(ref, callback){\n \n }",
"get rootRef() {\n return this._db.ref();\n }",
"static get(uid) {\n // return new Promise((resolve, reject) => {\n // database.ref('/'+nodeName+'/' + uid).once('value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the motd banner to a switch without committing it to the startup configuration | async addBanner() {
let bannerText = "/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n\n\nThis system is for the use of authorized users only.\n\n\n\n\n\nI... | [
"function setBanner() {\n if (grunt.config.get('app_plugins_mode_release')) {\n var moduleName = grunt.config.get('app_plugins_work_script_name') + '.js';\n var version = grunt.config.get('app_plugins_work_version');\n var src = path.join(\n grunt.config.get('a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns youtube playlistID from a youtube playlist link | function getYouTubePlaylistID(link) {
var id;
var indexEndOfID = link.indexOf("&", link.search("list=") + 5);
if (indexEndOfID != -1) {
id = link.slice(((link.search("list=")) + 5), indexEndOfID);
} else {
id = link.slice((link.search("list=")) + 5);
}
//console.log(id);
retu... | [
"function getPlaylistID() {\n if (url.indexOf(\"?playlist_id=\") !== -1) {\n currentPlaylist = url.split(\"=\")[1];\n }\n }",
"function getPlaylistID() {\n const url = window.location.search;\n if (url.indexOf(\"?playlist_id=\") !== -1) {\n let currentPlaylist = url.split(\"=\")[1];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funzione che gestisce il click sul pulsante About: fa comparire la sezione 3 con le informazioni riguardanti il progetto e i responsabili, se riclicco torno alle 3 cartoline di partenza | function About() {
if (ClickAbout) {
section_3.style.display="inline-block";
section_2.style.display="none";
linkAbout.setAttribute("href", "#section_3");
buttonAbout.setAttribute("value", "Corrispondenze");
ClickAbout=false;
} else {
linkAbout.setAt... | [
"function setupAboutClick () {\n // position the figcaption out of view\n var aboutItems = $('.article-icon a');\n\n for (i=0; i<aboutItems.length; i++) {\n $(aboutItems[i]).click(function (item) {\n var chosen = $(item.currentTarget).find('img');\n var altText = $(chosen).attr('alt');\n\n $('#... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Links Project to the specified Device Group and displays current Project info. Parameters: options : Options impt options of the corresponding command Returns: Promise that resolves when the Project linked successfully or rejects with an error | _link(options) {
return this._initDeviceGroup(options).
then(() => this._linkToDeviceGroup()).
then(() => this._processSourceFiles(options)).
then(() => {
this._projectConfig.endpoint = this._helper.authConfig.endpoint;
if(options && options.ac... | [
"link(options) {\n this._checkExistingProject(options, this._link.bind(this)).\n then(() => this._info()).\n then(info => {\n UserInteractor.printInfo(UserInteractor.MESSAGES.PROJECT_LINKED);\n UserInteractor.printResultWithStatus(info);\n }).\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update text on the page to reflect some variable options | function UpdatePageText()
{
// If the toggle is false, set to inches
var labelUnits = (_buttonState) ? _millimetersAbbrev : _inches;
var tipUnits = (_buttonState) ? _millimeters : _inches;
// Clear out previous calculated value
jQuery('.calculated-value').html("- -");
// Update input/output unit labels
jQue... | [
"function updateBotText(textOptions) {\n\t\n\tvar ranUpdateText = textOptions[ranNumGen(textOptions.length)];\n\t\n\tbotText.innerHTML = ranUpdateText;\n\t\n}",
"function updateTextUI() {\n select('#result').html(currentText);\n}",
"function changeTextInDescripTextArea() {\n $(\".info-text-content p\").html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET / Return all students | list(req, res) {
studentDAO.getStudents(db)
.then(students => {
res.status(200).json(students)
})
.catch(err => {
console.error(err)
res.sendStatus(404)
})
} | [
"function getStudents() {\n return Students.findAll();\n }",
"function getall(req, res) {\n Student.find()\n \n .exec(function(err, user) {\n if (user) {\n res.json({ status: true, students: user });\n } else {\n res.json({ status: false, error: \"Students not found\" });\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a text box that will contain the script information for a description with the start and end time of the description (replaced above function) | function updateDescriptionText(recordStart, recordFinished,timeStart, timeFinished, id, desc_text){
var newItem = document.createElement("LI");
var text = document.createElement("textarea");
var deleteButton = document.createElement("button");
newItem.id ... | [
"function assignmentDescPopup()\n\t{\n\t\tvar stageSize = fw.stageSize();\n\n\t\tvar wid = fw.createWidget('textBox', {\n\t\t\txStart: stageSize[0]/2,\n\t\t\tyStart: stageSize[1]/2,\n\t\t\twStart: 1,\n\t\t\thStart: 1,\n\n\t\t\ttext: that.desc,\n\t\t\ttitle: 'Description',\n\t\t\tdepth: fw.ZENITH\n\t\t}, {\n\t\t\twi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
zoto_modal_set_main_image Allows the user to set the main photo of a set The images that can be selected are drawn from the main_images of the user's albums. If more than one album has the same main image the duplicate should be discarded. (jacks with the pagination though :/) | function zoto_modal_set_main_image(options) {
this.options = options ||{};
this.options.in_wizard = this.options.in_wizard || false;
this.options.wizard_options = this.options.wizard_options || {};
this.$uber(options);
this.__init = false;
this.str_header = _("select the set's main image");
this.str_save = _("... | [
"function zoto_modal_album_main_image(options) {\n\tthis.options = options ||{};\n\tthis.$uber(options);\n\t\n\tthis.__init = false;\n\t\n\tthis.str_header = _(\"select the album's main image\");\n\tthis.str_save = _(\"set selected image as the album's main image\");\n\tthis.str_search = _('search');\n\tthis.str_ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Column_BIGINT extends Column_INT ============================================================================= | function Column_BIGINT() {} | [
"function Column_INT() {}",
"function Column_INTEGER() {}",
"function Column_SMALLINT() {}",
"function Column_MEDIUMINT() {}",
"function castAsBigInt(x) {\n return squill.functionCall(\"CAST\", [[x, \"AS BIGINT\"]]);\n }",
"function bigint() {\n return utils_1.createSymmetricS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filters by brew status | statusFilter(recipe) {
if (this.state.brewStatus === "Finished") {
return new Date(recipe.endTime) < new Date();
} else if (this.state.brewStatus === "Brewing") {
return new Date(recipe.endTime) > new Date();
}
} | [
"filterByStatus(status) {\n this.sendAction('filterByStatus', status);\n }",
"filterByStatus(status) {\n this.stats = status;\n if (status === null) this.list = ls.getList() || []\n else this.list = ls.getList().filter(v => v.open == status)\n }",
"function DetectBrewDevice()\n {\n if (u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
' Name : callAddCardOrSubmitCard ' Return type : None ' Input Parameter(s) : None ' Purpose : This method is to chek either CM_ADD_PAYMENT_CARD or BP_SUBMIT_PAYMENT_GROUP API will be called. ' History Header : Version Date Developer Name ' Added By : 1.0 15th May, 2013 Karuna Mishra ' | function callAddCardOrSubmitCard(serviceFlag) {
var visibleJsonType = '';
for(var arrayIndex in cardOptionJsonTypes) {
var cardOptionJsonType = getVisibleJsonType(cardOptionJsonTypes[arrayIndex]);
if ($("#panel" + cardOptionJsonType).is(":visible")) {
visibleJsonType = cardOptionJsonType;
break;
}
}
if ... | [
"function getAddCardSec(fundingSourceTypes_JsonType, manageCardsCallForCheckOut, fundingSourceTypes_TenderType) {\n\tvar addCardBtnSection = '';\n\tvar typeOfCard = fundingSourceTypes_TenderType === tenderTypeConstant.DEBIT ? \n\t\t\t\t\t manageCard_typeConstants.DEBIT : manageCard_typeConstants.CREDIT;\n\tif (!cm_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loads accounts from json file | function loadAccountsJson() {
var accountsJson = [];
$.ajax({
type: 'GET',
url: 'accounts.json',
dataType: 'json',
success: function (data) { accountsJson = data; },
async: false
});
return accountsJson.accounts;
} | [
"function loadAccounts() {\n let accountsfile = FileUtils.getFile(\"ProfD\", [\"data\", \"accounts.txt\"]);\n if (accountsfile.exists()) {\n accounts = readFromFile(accountsfile);\n }\n dump(\"accounts:\" + accounts + \"\\n\");\n}",
"loadAccounts() {\n let accounts = store.getData( this._accountsKey );\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
accepted_route_count computed: true, optional: false, required: false | get acceptedRouteCount() {
return this.getNumberAttribute('accepted_route_count');
} | [
"getTrafficRouteTotalCount ({ commit }) {\n const getItems = async () => {\n const entities = await api.getAllTrafficRoutes()\n const count = entities.items.length\n\n commit('SET_TOTAL_TRAFFIC_ROUTE_COUNT', count)\n }\n\n getItems()\n }",
"function score({rout... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns true if the row needs a counterattack because it might win soon | function rowToCounter(row) {
// player uses "1"
var oneCount = 0;
// checking that row is NOT full yet
if (row.indexOf(null) == -1) {
return false;
}
for (var i = 0; i < row.length; i++) {
if (row[i] == 1) {
oneCount++;
}
}
if (oneCount >= 2) {
return true... | [
"function canAttack() {\n return timeSinceLastAttack >= constants.ATTACK_DELAY;\n }",
"checkChow(tile) {\n return Evaluator.getDiscardedChow(this, tile).length > 0;\n }",
"function isAttacked(toRow, toCol, atkColor)\n{\n\treturn getAttackers(toRow, toCol, atkColor).length > 0;\n}",
"function row... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UI FUNCTIONS Fill the assignments SELECT widget with data | function assignmentsRender() {
var asgnSelect = document.getElementById('assignment_select');
for(i = asgnSelect.options.length - 1 ; i >= 0 ; i--) {
asgnSelect.remove(i);
}
var shown=0;
for (var i=0; i<assignments.length; i++) {
var option = document.createElement("option");
option.value = assignments[i].... | [
"function selectAssignments_onclick() {\n var assignments = getCheckedBoxes_('assignments');\n showLoading();\n google.script.run\n .withSuccessHandler(updateDisplay)\n .displayMasteryData(assignments);\n}",
"function fillInAssignmentEdit(assignment) {\n $(\"#edit-assignment-id\").val(DROPDOWN_ASS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses plugin names and presets from the specified options. | function processOptions(options) {
// Parse preset names
const presets = (options.presets || []).map(presetName => {
if (typeof presetName === 'string') {
var preset = availablePresets[presetName];
if (!preset) {
throw new Error(`Invalid preset specified in Babel options: "${presetName}"`);
... | [
"function processOptions(options) {\n\t\t // Parse preset names\n\t\t var presets = (options.presets || []).map(function (presetName) {\n\t\t var preset = loadBuiltin(availablePresets, presetName);\n\t\n\t\t if (preset) {\n\t\t // workaround for babel issue\n\t\t // at some point, babel copies the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UPDATED/EDITED MFL LIVESCORING FUNCTIONS REWRITE OF MFL'S update_game_status TO GET NFL ICONS TO APPEAR | function update_game_status (team) {
var opp = ls_nfl_games[team].opp;
var game_status = '<a target="new" href="pro_matchup?L=' + league_id + '&W=' + liveScoringWeek + '&MATCHUP=';
var poss_class = "";
var custom_game_status_class = ""; //NEW ADDITION HERE AND ALL OCCURRENCES BELOW
var custom_is_half = fa... | [
"function updateStatus () {\n var status = ''\n\n var moveColor = 'White'\n if (game.turn() === 'b') {\n moveColor = 'Black'\n }\n\n // checkmate?\n if (game.in_checkmate()) {\n status = 'Game over, ' + moveColor + ' is in checkmate.'\n }\n\n // draw?\n else if (game.in_draw()) {\n status = 'Game ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Noise movement for target after win. | function targetNoise(){
var targetWin={
x: windowWidth*noise(tx),
y: windowHeight*noise(ty),
};
image(targetImage,targetWin.x,targetWin.y);
noFill();
stroke(random(255));
strokeWeight(10);
ellipse(targetWin.x,targetWin.y,targetImage.width,targetImage.height);
tx+=0.02;
ty+=0.01;
} | [
"move() {\n\t\t// Get the next Perlin noise value\n\t\tthis.xOff = this.xOff + this.xInc;\n\t\t// Scale it to the width of the canvas\n\t\tthis.x = noise(this.xOff) * width;\n\n\t\t// Do the same for the y coordinate\n\t\tthis.yOff = this.yOff + this.yInc;\n\t\tthis.y = noise(this.yOff) * height; // Scale to height... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true iff the i'th bit of x is set to 1. | function getBit(x, i) {
return (x >>> i & 1) != 0;
} | [
"function getBit(x, i) {\n return ((x >>> i) & 1) != 0;\n }",
"function IsBit1(num , indexBit) {\n num = num >> indexBit ;\n return (num & 1) ;\n }",
"function bit(value) {\n\t return value === 0 || value === 1;\n\t }",
"function isSet(bitMap, i) {\n return !bitMap.get(i);\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selects the entire table if the context is within table. | selectTable() {
if (!this.owner.enableSelection) {
return;
}
this.selectTableInternal();
} | [
"function selectData() {\n\tquery('SELECT * FROM ' + tableId);\n }",
"selectAll(table){\n const queryString = \"SELECT * FROM ??\";\n return this.connection.query(queryString, [table])\n }",
"function select_all(table, options, callback) {\n if (!callback && typeof(options) == \"function\") {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Signature Base String URI | function signatureBaseStringURI (uri) {
var url = URL.parse(uri, true)
, protocol = url.protocol
, hostname = url.hostname
, pathname = url.pathname
, port = ''
, result = ''
;
if (url.port) {
if ((protocol === 'http:' && url.port !== '80')
|| (protocol === 'https:' && ... | [
"function signatureBaseStringURI (uri) {\n const url = new URL(uri)\n const protocol = url.protocol\n const hostname = url.hostname\n let pathname = url.pathname\n let port = ''\n let result = ''\n\n if (url.port) {\n if ((protocol === 'http:' && url.port !== '80') ||\n (protocol === 'https:' && url.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of the CustodianServiceClientContext class. | function CustodianServiceClientContext(credentials, options) {
var _this = this;
if (credentials == undefined) {
throw new Error("'credentials' cannot be null.");
}
if (!options) {
options = {};
}
if (!options.userAgent) {
var ... | [
"function CustodianServiceClient(credentials, options) {\r\n return _super.call(this, credentials, options) || this;\r\n }",
"constructor() { \n \n NetCordaCoreContextInvocationContext.initialize(this);\n }",
"function initializeContext() {\n GSC.Logging.checkWithLogger(logger, conte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Date$prototype$equals :: Date ~> Date > Boolean | function Date$prototype$equals(other) {
return equals(this.valueOf(), other.valueOf());
} | [
"function Date$prototype$equals(other) {\n return equals (this.valueOf (), other.valueOf ());\n }",
"function isSameDate(date1, date2) {\n return eq(date1, date2, 'day')\n}",
"function formalDatesEqual(date1, date2){\n if(date1 === date2){\n \n }\n}",
"function dates_equal(d1, d2) {\r\n if (!d1 || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles DNI input required | toggle() {
if (1 === parseInt($(this.countryInputSelectedSelector).attr('need_dni'), 10)) {
$(this.commentLabel).fadeOut();
this.$countryDniInput.prop('required', true);
} else {
this.$countryDniInput.prop('required', false);
$(this.commentLabel).fadeIn();
}
} | [
"function toggleRequired() {\n if (textInput.hasAttribute('required') !== true) {\n textInput.removeAttribute('disabled');\n textInput.setAttribute('required','required');\n locationIsValid = false;\n activateSearchButton();\n }\n \n else {\n textInput.removeAttribute(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If this supports a simple extension, then determine its type (and other necessary data). It is a simple type if one of the following is true: a) it is an entry or abstract that maps to a FHIR resource/datatype (return 'Reference' and idValue) b) it is an element that maps to one of the FHIR datatypes in value[x] (retur... | getSimpleTypeAndValue(valueXTypes, def, defAsValue) {
if (defAsValue == null) {
defAsValue = new mdls.IdentifiableValue(def.identifier).withMinMax(1,1);
}
let type, value;
const map = this._specs.maps.findByTargetAndIdentifier(this._target, def.identifier);
if (map != null) {
if (def.isE... | [
"getValueDescription(value) {\n if (!['object', 'boolean', 'number', 'string'].includes(typeof value)) {\n throw new TypeError(`Unsupported type of value: ${typeof value}`)\n }\n\n if (isObject(value)) {\n if (value instanceof Date) {\n // Date object, represented as milliseconds since epo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get tan of value in deg | function tanDeg(deg) {
return Math.tan(deg * PIx2 / 360.0);
} | [
"function tan(value) {\n return round(Math.tan(RADIANS * value), 10);\n }",
"function tan(value) {\r\n return round(Math.tan(RADIANS * value), 10);\r\n}",
"function tan(value) {\n return round(Math.tan(RADIANS * value), 10);\n}",
"function tanDegree() {\n currentInput = Math.round(Math.tan((M... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the object contains an array where the selector string could take multiple possible routes, returns all those output possibilities. Otherwise, returns just the singular matching object | function selectProp(obj, path) {
var pathArr = path.split('.');
var arr = [];
var res = pathArr.reduce(function (prev, curr, i) {
if (prev instanceof Array) {
for (var _i = 0, prev_1 = prev; _i < prev_1.length; _i++) {
var val = prev_1[_i];
// let my res b... | [
"static choice(r, ...rs) {\n if (Array.isArray(r))\n return r.reduce((x, y) => x.concat(y), Router.empty());\n return [r].concat(rs).reduce((x, y) => x.concat(y), Router.empty());\n }",
"function select_item(object, key_array) {\n\n if (key_array.length === 0) {\n\n return object\n\n } el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to get current conditions for a specific AccuWeather location. Using the accuWeatherLocationKey from the searchAccuWeatherLocations() function as well as the accuWeatherApiKey, we can get the current conditions. That information will be returned and put into the Big Panda alert. | async function getCurrentConditions(req, res, next, accuWeatherLocationKey) {
// Use request to call the AccuWeather GET Current Conditions API
let getResponse = await requestLib.get({
"headers": {
"content-type": "application/json",
"Authorization": req.access_token
},
"url": `https://dataservice.accuwea... | [
"getCurrentConditions() {\n const apiModel = new WeatherAPIDao(this.city);\n const result = apiModel.getCurrentConditions();\n return result;\n }",
"function getConditions(focus) {\n return new Promise((resolve,reject) => {\n request\n .get(focus.__bx_creds.weatherinsights.url + \"/api/weather/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the markdown contents of a slide section element. Normalizes leading tabs/whitespace. | function getMarkdownFromSlide( section ) {
var template = section.querySelector( 'script' );
// strip leading whitespace so it isn't evaluated as code
var text = ( template || section ).textContent;
var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
leadingTabs = text.ma... | [
"getSectionContent($section) {\n let sectionContentParts = [this.getSpacingBeforeSection($section)];\n let $verses = $section.children('.verse');\n $verses.each((v, verse) => {\n let $verse = this.$(verse);\n if (this.isVerseWithinRange($verse)) {\n sectionContentParts.push(...$verse.find(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array with votes for each candidate | function simpleCount(candidates, votes, index) {
var i = index || 0;
var a = new Array(candidates.length);
a.setAll(0);
var j = 0, n = votes.length;
for (j; j < n; j++) {
a[candidates.indexOf(votes[j].vote[i])]++;
}
return a;
} | [
"function getVotes() {\n return votes;\n}",
"function getVotesForCandidate(candidate) {\n return new Promise((resolve, reject) => {\n vote.getVotesforCandidate(candidate, (err, result) => {\n if(err) reject(err);\n resolve(Number('' + result));\n });\n });\n}",
"sortCandid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a tiny image loader | function imgLoader(el){
if($(el).hasClass(classes[2])){doUpd(); return;}
var img=new Image();
function createDelegate(contextObject,delegateMethod){
return function(){return delegateMethod.apply(contextObject,arguments);}
}
function imgOnLoad(){
this.onload=null;
$(el)... | [
"function ImageLevelLoader() {}",
"function imgLoader(el){\r\n if($(el).hasClass(classes[2])){doUpd(); return;}\r\n var img=new Image();\r\n function createDelegate(contextObject,delegateMethod){\r\n return function(){return delegateM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
node2.boundingBox.edge2 <= node1.boundingBox.edge2 so we create a new parent node for node2 based on node1.boundingBox We calculate the precision of the new bigger node based on a distance, if provided | normalizeOneNodeOnly(node1, node2, distance=null, minEdge=0.25)
{
var bBox = new Utils.BoundingBox (Utils.Vector.sum(node1.boundingBox.center, {x:0, y:0, z:0}), node1.boundingBox.edge);
var wrapperNode2 = new Octree.Node(null, bBox, Octree.WHITE, node2.level-1, []);
if (distance) {
var precision = this.find... | [
"function nodeCompare(n1, n2) {\n return n1.distance < n2.distance ? -1 : n1.distance > n2.distance ? 1 : 0;\n}",
"function nearestNode(index,startNode,endNode){\n\n minDistance = 999;\n node1 = -1;\n node2 = -1\n node1Position = -1;\n node2Position = -1;\n\tnode1length = 999;\n\tnode2length = 999;\n\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fill: 'red', a Konva.Canvas renderer is passed into the sceneFunc function | sceneFunc (context, shape) {
if(self.attr.typeid==0){
context.fillStyle=self.attr.data.sc;
}else if(self.attr.typeid==1){
var gradientBar = context.createLinearGradient(
25*self.attr.data.sw,
25*self.attr.data.sh,
25*self.attr.data.ew,
... | [
"function RenderScene (context, canvas, scene)\n{\t\n\tvar sceneitems = scene.items;\n\tfor (var i = 0; i < sceneitems.length; i++)\n\t{\n\t\tDrawItem(context, canvas, sceneitems[i]);\n\t}\n}",
"function renderScene()\n\t{\n\t\tctx.save();\n\t\tctx.translate(cw / 2, ch / 2);\n\t\tctx.scale(scale, scale);\n\t\tctx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrive url of articles by ID volume. | async function getArticlesByIdVolume(id) {
try {
// const { id } = req.body
const articles = await Volume.findOne({ _id: id }, { list_articles: 1 })
.populate({ path: 'list_articles', model: 'Article' }).exec()
// return res.send(articles)
return articles
} catch (error) {
return Error(err... | [
"function get_article_url(id) {\n \n array_id = get_xml_storage(id);\n \n for (var j = 0; j < array_id.length; j++) {\n if (array_id[j][0] == 'location') {\n return array_id[j][1];\n }\n }\n \n return null;\n}",
"function getVolume(volumeId) {\n let queryStr = `${BASE_URL}/${volumeId}?`;\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |