query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
if user manages to get to this page without submitting geo info, it asks for it again | function setInitialMap() {
if (window.location.href.includes('search') && localStorage.currLat == undefined && localStorage.state == undefined) {
showModal();
console.log('all conditions met')
} else if (localStorage.currLat !== undefined) { //else if geo data from button exists,... | [
"function ask(){\n navigator.geolocation.getCurrentPosition(function(){\n sessionStorage.setItem(\"geo_access\", \"granted\");\n }, function(err){\n if(err.code == 1){ // PERMISSION_DENIED\n sessionStorage.setItem(\"geo_access\", \"denied\");\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recursive function to generate screens of widgets and subwidgets | function renderWidgets(hierarchy, level)
{
var newLevel = level;
for(var i = 0; i < hierarchy.length; i++) {
if(hierarchy[i].coord !== null){
newLevel = (level !== null) ? level + '.' + (i+1) : i+1;
if(hierarchy[i].coord === undefined) continue;
page.clipRect = ge... | [
"eachWidget(fn, deep = true) {\n const me = this,\n widgets = me.items ? me.items.slice() : [];\n\n if (me.tools) {\n widgets.unshift(...Object.values(me.tools));\n }\n if (me.tbar) {\n widgets.unshift(me.tbar);\n }\n if (me.bbar) {\n widgets.push(me.bbar);\n }\n\n for (l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makes sur that the map is refreshed and positioned correctly | function refreshMapPosition() {
//alert("on Map");
roeMapTNit.resize();
roeMapTNit.reposition();
} | [
"function refreshMapPosition() {\n //alert(\"on Map\");\n roeMapCarbon.resize();\n roeMapCarbon.reposition();\n }",
"function updateMap() {\n //Anything else should be handled by pre and postdraw functions\n ms.draw();\n }",
"function onRefr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This will update the information we have about the attendee and make the icon appear and disappear as needed | function updateAttendeeInfo(tabId){
chrome.tabs.sendMessage(tabId, {action: "Get Attendee Data"}, function(attendee) {
console.log("The attendee data returned was:"+attendee);
attendeeInfo = attendee;
if (!attendee) {
console.log('This page does not have the required attende... | [
"updateAttendees(item) {\n let attendees = item.getAttendees();\n if (attendees && attendees.length) {\n this.querySelector(\".item-attendees\").removeAttribute(\"hidden\");\n\n let { attendeesInRow, maxLabelWidth } = setupAttendees(\n attendees,\n this.querySelector(\".ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to check if offset was inputed | function checkOffset(offset){
if(offset && offset >= 0){
return offset;
}
else{
return 0;
}
} | [
"hasOffset (offset) {\n let min = this.offset\n let max = min + this.length\n return offset >= min && offset <= max\n }",
"function isStepOffset(value) {\n return value.hasOwnProperty('stepOffset');\n }",
"contains(offset) {\n return (offset >= this.start) && (offset < this.end || this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HELPER FUNCTIONS Get index of currently selected assignment | function assignmentsGetCurrentIdx() {
var asgnSelect = document.getElementById('assignment_select');
if (asgnSelect.selectedIndex == -1) return -1;
var currentId = asgnSelect.options[asgnSelect.selectedIndex].value;
for (var i=0; i<assignments.length; i++)
if (assignments[i].id == currentId)
return i;
return ... | [
"function assignmentsGetIdxForId(id) {\n\tfor (var i=0; i<assignments.length; i++)\n\t\tif (assignments[i].id == id)\n\t\t\treturn i;\n\treturn -1;\n}",
"get selectedIndex() {\n let item = this.itemData.filter((i) => i.id === this.selection);\n return item && item[0] ? item[0].index : 0;\n }",
"get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return true iff all samples are blank at index i | function testEmptyCol(samples, i) {
var line;
for (var j=0; j<samples.length; j++) {
line = samples[j];
if (testContentChar(line, i)) return false;
}
return true;
} | [
"_isEmpty(index) {\n\t\tif (index < this.elements.length &&\n\t\t\tthis.elements[index] === undefined) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"function checkEmpty(board, i){\n\tfor(let idx = 0; idx < board.board[i].length; idx++){\n\t\tif(!board.board[i][idx].isEmpty()){\n\t\t\treturn false;\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to call blockchain and remove all the selected documents | removeAllSelectedDocuments(event) {
event.preventDefault();
const _selectedIds = Array.from(this.state.selectedDocIds);
if (_selectedIds.length > 0) {
const { contractInst, account } = this.props;
//blockcahin method to remove selected documents
contractInst.m... | [
"function deleteAllBooks() {\n // on ouvre la base, et on d�clare les listeners\n var request = indexedDB.open(\"booksLibrary2\", 1);\n request.onerror = errorOpen;\n request.onupgradeneeded = createDatabase;\n\n request.onsuccess = function(event) {\n var db = event.target.result;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get list of races based on particular year | function getRaceListByYear (callack,championData){
const url = baseUrl + championData.season+ '/results/1.json'
const raceList= fetch(`${url}`).then(response => {
return response.json()
}).then(data => {
let raceData = [];
if (data &&
data.MRData
&& data.MRDa... | [
"function getAllRacesForYear(season) {\n var url = API_BASE_URL+\"/\"+season+\"/results/1.json\";\n return $http.get(url);\n }",
"function getRacesBySeason(seasonYear) {\n\n var _seasonYear = parseInt(seasonYear);\n\n if (angular.isNumber(_seasonYear)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new ReorderingGraphPatternIterator | function ReorderingGraphPatternIterator(parent, pattern, options) {
// Empty patterns have no effect
if (!pattern || !pattern.length)
return new TransformIterator(parent, options);
// A one-element pattern can be solved by a triple pattern iterator
if (pattern.length === 1)
return new TriplePatternItera... | [
"function OptimizedGraphPatternIterator(parent, pattern, options) {\n // Empty patterns have no effect\n if (!pattern || !pattern.length)\n return new TransformIterator(parent, options);\n // A one-element pattern can be solved by a triple pattern iterator\n if (pattern.length === 1){\n return new TripleP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
style last played track | function styleLastPlayedTrack() {
let elem1 = localStorage.getItem('last_played_sound');
if (elem1 != null) {
$("div").find("[data-content='" + elem1 + "']").addClass("last-played");
}
} | [
"prevTrack () {\n this.trackIndex = (this.trackIndex > 0) ? (this.trackIndex - 1) : 0\n this.play()\n }",
"function prevTrack() {\n if(track_index > 0) track_index -= 1;\n else track_index = track_list.length - 1;\n\n // Load and play the new track\n loadTrack(track_index);\n playTrack... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns whether user exists | function checkIfUserExists (callback) {
connection.query(`SELECT * FROM user WHERE userid=${connection.escape(id)}`, (err, res)=>{
if (err) {message.channel.send(embeds.errorOccured(message, err));}
callback(res[0] !== undefined);
});
} | [
"userExists() {\n if (fs.existsSync(usersPath + this.username)) {\n return true;\n }\n return false;\n }",
"function userExists(user){\n\n}",
"doesUserExist(uname){\n\t\treturn db.one(`SELECT * FROM user_id WHERE uname=$1`, uname);\n\t}",
"async isUserExists(ctx, next) {\n const total = awai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check, format and return CPF or error | function CPF(CPF) {
const result = formatCPF(CPF);
if (result === '') {
errors.invalidCPF(CPF);
}
return result;
} | [
"function valida_cpf(cpf){\n erro = new String; \n if (cpf.value.length === 11){ \n cpf.value = cpf.value.replace('.', ''); \n cpf.value = cpf.value.replace('.', ''); \n cpf.value = cpf.value.replace('-', ''); \n var nonNumbers = /\\D/; \n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get time seconds diff between server and local | function getServerLocalDiffTime(){
var startRequest = new Date().getTime();
var config = getHdcontrolObject();
var endRequest = new Date().getTime();
var requestTime = parseInt((endRequest -startRequest)/1000);
var diffTime = parseInt(parseInt(buyingTime/1000) - config.stime - requestTime);
... | [
"getServerTime(){\r\n let serverTimeNow = Date.now() + this.timeSyncAvrageOffset + this.timeSyncInitialOffset;\r\n return Math.round(serverTimeNow);\r\n }",
"static elapsedTime() {\n let exp;\n if ((exp = Experiments.findOne()) == null) {\n return;\n }\n if (exp.startTi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function : requireLogin (called in all api's for authentication) authentication can be: based on cookie saved, cookieName is defined in init.js) | function requireLogin (req, res, next) {
// check for cookie in browser
if(req.cookies[init.cookieName] != null && req.cookies[init.cookieName] != 'undefined' && req.cookies[init.cookieName]!=""){
var session_id= req.cookies[init.cookieName];
authenticatedUser(session_id, function(userDetails) {
if(userD... | [
"function checkLogin() {\r\n if (getCookie(\"GioeleSession\").exist) {\r\n autoLogin();\r\n } else {\r\n\r\n }\r\n}",
"function autoLoginAfterRefresh() {\n\t\tif(g_UserName) {\n\t\t\tconst username = localStorage.getItem(g_UserName +'.username'); // get it from cookie\n\t\t\tconst password = localStorage.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generateUsername Function Function that creates and returns a username that isn't currently in use | function generateUsername() {
var uName = 'Player ' + Math.floor((Math.random() * 100) + 1),
validUsername;
do {
validUsername = true;
for(var x = 0; x < players.length; x++) {
if(players[x].username === uName) {
validUsername = false;
u... | [
"function genUserName() {\n return (\"User-\" + new Date().getTime()).trim();\n}",
"function generateNewUsername() {\n let text = \"\";\n let alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\n \n for(let i = 0; i < 10; i++) \n text += alphabet.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Goal is assumed to be valid and is added as is Side Effects: sets goal id | async function addGoal(goal){
const collection = db.collection('goals');
goal._id = await getNextGoalId();
await collection.insertOne(goal)
return goal;
} | [
"addGoal() {\n\t\tlet goal = {\n\t\t\tUserID: this.props.currUser.id,\n\t\t\tCreator: this.props.currUser.id,\n\t\t\tTitle: this.state.goalName,\n\t\t\tCategory: \"Education\",\n\t\t\tServiceProviders: this.state.selectedProviders,\n\t\t\tactive: false\n\t\t}\n\t\tif (this.props.isServiceProvider) {\n\t\t\tgoal.act... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addItems function adds categories to items array | addItems(categories) {
this.items.push({
[categories]: 1
})
//return this.items
} | [
"function addItemToCategory (item, category, type) {\n\tlet container = document.createElement(\"div\");\n\tcontainer.classList.add(\"phrase-container-\"+type);\n\tcontainer.classList.add(\"phrase-container\");\n\t// TODO eventually give each data and HTML item a numerical, generated ID \n\t// so we don't need to w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Refacter `doLinesIntersect` when stroke point handling is converted from objects to arrays | doLinesIntersect (a, b) {
for (let i = 1; i < a.length; i++) {
for (let j = 1; j < b.length; j++) {
if (b[j]) {
if (this.doLineSegmentsIntersect(
a[i - 1].x, a[i - 1].y, a[i].x, a[i].y,
b[j - 1].x, b[j - 1].y, b[j].x, b[j].y
)) return true
}
}
... | [
"getLineIntersection(line) {\n if (!(((this.x1 - this.x2) * (line.y1 - line.y2)) - ((this.y1 - this.y2) * (line.x1 - line.x2)))) return;\n\n let x = (((((this.x1 * this.y2) - (this.y1 * this.x2)) * (line.x1 - line.x2)) - ((this.x1 - this.x2) * ((line.x1 * line.y2) - (line.y1 * line.x2)))) /\n (((this.x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
accepts map of filename to array of lines, writes lines to file, writes to src/generated | function writeFiles(files) {
const streams = map(files, (contents, filename) =>
text.fileStream(filename, [text.COPYRIGHT_HEADER, ...contents, ""].join("\n")));
const outputDir = path.join(blueprint.findProject("core").cwd, "src", "generated");
return mergeStream(...streams).pipe(gul... | [
"function writeSourcemap(file, sourcemap) {\n var path = createPath(file, true);\n\n mkdirSync(dirname(path), { recursive: true })\n\n fs.writeFile(path, JSON.stringify(sourcemap), function(err){\n if (err) throw err;\n // don't output log message if --print is present\n if (!print) console.log(' \\033... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take in two genomes assume the first parent to be fit TODO: maybe check here which parent is more fit | mating (parent1, parent2) {
// Create a child genome
let child = new Genome();
parent1.neurons.forEach(neuron => {
child.pushNeuron(neuron.neuron);
});
parent1.synapses.forEach(synapse => {
if (parent2.synapses.id == synapse.id) {
child.pushSynapse(util.randBool() ? synapse.syn... | [
"function crossover(p1, p2) {\n let parent1 = p1.clone();//just incase\n let parent2 = p2.clone();\n\n //iterate over every gene, if there is a matching gene between genome 1 and 2, then we chose one at random\n //if that gene is disjoint (in one but not the other) we select it from the more fit parent\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
One of our `file`s has updated its contents. Have all of our files `resetCompiled()` so they'll compile again. | updatedContentsFor(file) {
this.activeImports.forEach((item) => item.resetCompiled())
} | [
"onCompile (files) {\n this.compiled = false;\n }",
"function recompileUponModification(fileName, extension) {\n utils.watchFileForModification(fileName, 1000, function() {\n q.ncall(fs.readFile, fs, fileName, 'utf8')\n .done(function(contents) {\n // this may be a static file that doesn't hav... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the alarms pref pane. Sets up dialog controls to match the values set in prefs. | init() {
// Enable/disable the alarm sound URL box and buttons
this.alarmsPlaySoundPrefChanged();
// Set the correct singular/plural for the time units
updateMenuLabelsPlural("eventdefalarmlen", "eventdefalarmunit");
updateMenuLabelsPlural("tododefalarmlen", "tododefalarmunit");
updateUnitLabel... | [
"function showAlarmSettings()\n{\n\texitFullScreen();\n\tif( timeformat == \"12Hr\")\n\t\tdocument.getElementById('alarm_am_pm').style.display = \"block\";\n\telse\n\t\tdocument.getElementById('alarm_am_pm').style.display = \"none\";\n\n\tdocument.getElementById('alarm_settings').style.display = \"block\";\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the backprop of a max pool. | function maxPoolBackprop(dy, input, output, filterSize, strides, dilations, pad, dimRoundingMode) {
var $dy = tensor_util_env_1.convertToTensor(dy, 'dy', 'maxPoolBackprop');
var $input = tensor_util_env_1.convertToTensor(input, 'input', 'maxPoolBackprop');
var $output = tensor_util_env_1.convertToTensor(out... | [
"function maxPoolBackprop(dy, input, output, filterSize, strides, dilations, pad, dimRoundingMode) {\n var $dy = tensor_util_env_1.convertToTensor(dy, 'dy', 'maxPoolBackprop');\n var $input = tensor_util_env_1.convertToTensor(input, 'input', 'maxPoolBackprop');\n var $output = tensor_util_env_1.convertToTe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieves the statistics from a custom time period | function getCustom() {
var customFrom = $('#custom-from').val()
var customTo = $('#custom-to').val()
// makes an AJAX call with the custom data period
$.get('/' + username + '/statistics/' + custom + '/custom/' + customFrom + '/' + customTo)
.done((data) => {
switch (custom) {
case 'profits':
... | [
"async fetchStatistics(element, type) {\n let url = this.getURL(element);\n let time = this.getTime(type);\n let start_time = new Date(time[0]).toISOString();\n let end_time = new Date(time[1]).toISOString();\n\n let data = null;\n data = await this.getStatisticData(url, start_time, end_time, type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if two lines mad up of points p1>p2 and p3>p4 intersect eachother | function lines_intersect_2d(p1, p2, p3, p4) {
// first, sanity check that we aren't looking at actual connected points
if (p1 == p3 || p1 == p4 || p2 == p3 || p2 == p4) {
return false;
}
var x=((p1.x*p2.y-p1.y*p2.x)*(p3.x-p4.x)-(p1.x-p2.x)*(p3.x*p4.y-p3.y*p4.x))/((p1.x-p2.x)*(p3.y-p4.y)-(p1.y-p2.y)*(p3.x-p4.x));
... | [
"function lineIntersection( x1,y1,x2,y2, x3,y3,x4,y4 ) {\n var x = ((x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n var y = ((x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n if (isNaN(x)||isNaN(y)) {\n return false;\n } else {\n if (x1>=x2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: trim(strInput) Purpose: Parameter: String strInput Return: String First time : 20010829 Author : ChenHongRi | function trim(strInput)
{
var iLoop = 0;
var iLoop2 = -1;
var strChr;
if((strInput == null)||(strInput == "<NULL>")) return "";
if(strInput)
{
for(iLoop=0;iLoop<strInput.length-1;iLoop++)
{
strChr=strInput.charAt(iLoop);
if(strChr!=' ')
break;
}
for(iLoop2=strInput.length-1;iLoop... | [
"function trim(string) {\n\n}",
"function s4sagar_TrimString(string)\n{\n // If the incoming string is invalid, or nothing was passed in, return empty\n if (!string)\n return \"\";\n\n string = string.replace(/^\\s+/, ''); // Remove leading whitespace\n string = string.replace(/\\s+$/, ''); // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check item in cart | function checkItemInCart() {
let itemCount = c.cart.item_count;
const items = c.cart.items;
if (itemCount > 0) {
items.forEach((item) => {
if (item.handle === c.product.handle) {
itemCount -= 1;
// eslint-disable-next-line
if (item.properties._giveaway) {
c.inCart = true;
}
}... | [
"function isInCart(item_id) {\n //check to see if there are any items in the cart\n if (cartItems.length > 0) {\n //if there are -> loop through each item in the cart\n for ( let i = 0; i < cartItems.length; i++ ) {\n //if item id matches a cart item id\n if (item_id === cartItems[i].i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In the Unity editor on Linux. | set LinuxEditor(value) {} | [
"get LinuxEditor() {}",
"function linuxAvail(){\n alert(\"This game is supported on Linux!\")\n}",
"function testChromeCompositionEventsLinux() {\n runChromeCompositionEvents('LINUX');\n}",
"get OSXEditor() {}",
"function run() {\r\n fetch(`./run?code=${btoa(editor.getValue())}`).then(result => resul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the animation transition view state for the arrow's position and opacity. If the `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that no animation appears. | _setAnimationTransitionState(viewState) {
this._viewState = viewState;
// If the animation for arrow position state (opacity/translation) should be disabled,
// remove the fromState so that it jumps right to the toState.
if (this._disableViewStateAnimation) {
this._viewState ... | [
"_setAnimationTransitionState(viewState) {\n this._viewState = viewState || {};\n // If the animation for arrow position state (opacity/translation) should be disabled,\n // remove the fromState so that it jumps right to the toState.\n if (this._disableViewStateAnimation) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to set domain for x and y axes | function setDomain() {
//Set x domain
if(typeOfClass > 2)
x.domain(spring18Histogram.map(e => e.key));
else
x.domain(fall17Histogram.map(e => e.key));
//Set y domain
switch(typeOfClass) {
case 1:
y.domain([
0,
d3.max([
d3.max(fall17Histogram.map(e => e.frequency)),
d3.max(s... | [
"function setDomains(canvas){\n domainAxisY = [0, 0, canvas.width/10, canvas.height /10 *9]\n domainAxisX = [canvas.width/10, canvas.height /10 *9, canvas.width, canvas.height]\n domainGraph = [canvas.width/10, 0, canvas.width, canvas.height/10 *9]\n}",
"function setDomains() {\n x0.domain(currentData.map(get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combine number types. Note that never have to create a new type here, we are guaranteed to be able to reuse one of the input types as supertype. | function combineNumbers(types) {
var typeNames = ['int', 'long', 'float', 'double'];
var superIndex = -1;
var superType = null;
var i, l, type, index;
for (i = 0, l = types.length; i < l; i++) {
type = types[i];
index = typeNames.indexOf(type.typeName);
if (index > superIndex) {
superIndex =... | [
"function combine(\n//number1: Combinable, !!Type alias\nnumber1, number2, \n//resultConversion: Conversion, !!Type alias\nresultConversion) {\n var result;\n if (typeof number1 === 'number' && typeof number2 === 'number' || resultConversion === 'as-number') {\n result = +number1 + +number2;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether the command for apply specific text style mark is enabled. | function isTextStyleMarkCommandEnabled(state, markName) {
const {
selection,
schema,
tr
} = state;
const markType = schema.marks[markName];
if (!markType) {
return false;
}
const mathNodeType = schema.nodes[_NodeNames.MATH];
if (mathNodeType && VALID_MATH_MARK_NAMES.has(markName) && (0,... | [
"function supportMark(channel, mark) {\n return mark in getSupportedMark(channel);\n }",
"function supportMark(channel, mark) {\n return mark in getSupportedMark(channel);\n}",
"isEditingText() {\n\t\tif (this.svgCanvasTextArea.isEditingText()) {\n\t\t\treturn true;\n\t\t}\n\t\tlet state = false;\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add close question to the test | addCloseQuestion(state, action) {
action.payload.preventDefault();
state.questionItem = state.test.questions.length
state.test.questions.push({
// questionIndex: state.test.questions[state.test.questions.length - 1].questionIndex + 1, //יחזיר ערך נכון אם מתבצע לפני הדחיפה
... | [
"function addFakeQuestion() {\n Question.create({\n description: \"Interpreting a graph\",\n knowledge: \"know how to label graphs correctly\",\n test_num: \"Test 1\",\n calc: true,\n image_link: \"http://www.catster.com/wp-content/uploads/2017/08/A-fluffy-cat-looking-funny-sur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Requests for an authentication token from the Docker registry for accessing the given image. | requestToken(image) {
return this.performHttpsGet({
hostname: "auth.docker.io",
port: 443,
path: "/token?service=registry.docker.io&scope=repository:" + image + ":pull",
headers: {
Accept: "application/json"
}
}).catch((... | [
"listTags(authToken, image) {\r\n return this.performHttpsGet({\r\n hostname: \"registry-1.docker.io\",\r\n port: 443,\r\n path: \"/v2/\" + image + \"/tags/list\",\r\n headers: {\r\n Accept: \"application/json\",\r\n Authorization: \"B... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3) Create a list for DOM aside | createAside(i){
var list = "<aside id=\"aside-scroll\"><ul id=\"ul-scroll\">";
for ( var a = 0 ; a < i ; a++ ) {
list += "<li class=\"asidelist\">" + this.anchors[a] + "</li>";
}
list += "</ul></aside>";
this.$body.append(list);
} | [
"function createAsideList() {\n\t\n\tconst ul = document.createElement('ul');\n\tul.setAttribute('class', 'catlist');\n\n\tfor (let i = 0; i < cats.length; i++) {\n\n\t\tlet cat = cats[i];\n\n\t\tconst li = document.createElement('li');\n\t\tli.setAttribute('class', 'catlistitem');\n\n\t\tconst img = document.creat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
originalFileNames.values[$index]=noteFile.name; abbrevIfTextOverflow('file_text'+ $index, $index); | function abbrevIfTextOverflow(id, index){
// need to replace this with text width funct
// if ( $('#'+id)[0].scrollWidth > $('#'+id).innerWidth()) {
// var file_text_elem = document.getElementById(id);
// text=file_text_elem.value;
// abbrevText(file_text_elem, text);
// // originalFile... | [
"prepFiles() {\n for (let i = 0; i < this.text.length; i++) {\n let condition = true;\n while (condition) {\n if (this.text[i].search(/\\.|\\?|\\!|\\'|\\\"|\\,|\\`/) != -1)\n this.text[i] = this.text[i].replace(/\\.|\\?|\\!|\\'|\\\"|\\,|\\`/, '');\n else condition = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a snapshot of the data | createSnapshot(){
let fs = require('fs');
let fname = `data/snap${Date.now()}.bck`;
let ws = fs.createWriteStream(fname);
let base64Buffer = new Buffer.from(this.s.read());
ws.write(base64Buffer.toString('base64'));
} | [
"takeSnapshot() {\n this.snapshot_ = this.toJSON();\n }",
"function takeSnapshot() {\n snapshot = context.getImageData(0, 0, canvas.width, canvas.height);\n}",
"createSnapshot(){\r\n let fs = require('fs');\r\n let fname = `data/snap${Date.now()}.bck`;\r\n let ws = fs.createWriteStream(fname);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new station. | static async addStation (station) {
// Retrieve instance of Mongo
const db = await Mongo.instance().getDb();
// Insert position of the station.
const countStations = await db.collection(Station.COLLECTION).countDocuments();
if (countStations === 0) {
station.position = Number(1);
}
s... | [
"function makeStation(lat, lng, name, stopID)\n{\n return {lat: lat, lng: lng, name: name, stopID: stopID};\n}",
"insertStation(body){\n return new Promise(function (resolve, reject) {\n models.Station.findOrCreate({\n where: {name: body.name},\n defaults: {name:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns valid if phrase has no strange characters TODO: add validation for nonlatin based languages | function validate(phrase)
{
var re = new RegExp("^[a-z ,'’-]{6,}$"); // only lowercase, space, comma, etc, 6+ characters
if (!re.test(phrase) || phrase.indexOf('undefined') !== -1)
{
console.log("INVALD " + phrase);
return false;
}
else
{
console.log("VALID " + phrase);
}
return true;
} | [
"function isSimplePhrase(input) {\n return /^[\\w !#$%&'*+-\\/=?^_`{|}~]+$/.test(input);\n}",
"function isValidReasonPhrase (statusText) {\n for (let i = 0; i < statusText.length; ++i) {\n const c = statusText.charCodeAt(i)\n if (\n !(\n (\n c === 0x09 || // HTAB\n (c >= 0x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates progress percentage based on completed subtasks from state | updateProgress() {
var completed = 0;
var total = this.state.subtasks.length;
for (let i = 0; i < total; i++) {
if (this.state.subtasks[i].completed) completed++;
}
var totalProgress =
total === 0 ? 0 : Math.round((completed * 100) / total);
this.s... | [
"function UpdateProgressBar() {\n // total items to be used to calculate percentage below\n const totalItems = reducerTodos.length + reducercompletedTodos.length;\n\n const pausedItemsArr = reducerTodos.filter(\n (todo) => todo.status === 'paused'\n );\n\n const pausedI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Request to update class | function updateClass(name, description, startTime, endTime, price) {
$.ajax({
url: `/api/classes/${classId}`,
method: "PUT",
data: {
name: name,
description: description,
startTime: startTime,
endTime: endTime,
price: price
},
success: classUpdat... | [
"function classUpdate(updatedClass) {\r\n var url = getBaseURL() + \"Classes/Update\";\r\n return $http({\r\n method: \"POST\",\r\n url: url,\r\n data: updatedClass\r\n });\r\n }",
"function update (req, res, next) {\n\tvar wiziq... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
default config for an outdent button | get outdentButton() {
return {
command: "outdent",
icon: "editor:format-indent-decrease",
label: "Decrease Indent",
shortcutKeys: "ctrl+[",
type: "rich-text-editor-button",
};
} | [
"get outdentButton() {\n return {\n ...super.outdentButton,\n label: this.t.outdentButton,\n };\n }",
"get indentButton() {\n return {\n ...super.indentButton,\n label: this.t.indentButton,\n };\n }",
"@api\n get config() {\n return this._config || { buttons: [] };\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the book should be thrown out if it has been checked out over 100 times. | destroy(checkedOutOverTimes){
let messageForThrow = "The book should be thrown out if it has been checked out over 100 times";
this.numberOfTimesCheckedOut += checkedOutOverTimes;
if(this.numberOfTimesCheckedOut > 100){
this.numberOfTimesCheckedOut = "yes "+messageForThrow;
}else{
this.nu... | [
"function getBooksBorrowedCount(books) {\n let checkedOut = 0;\n books.forEach((book) => {\n if (book.borrows[0].returned === false) {\n checkedOut++;\n }\n });\n return checkedOut;\n}",
"async checkBooksAlive() {\n let now = moment();\n for (let asset of this.assets) {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds and formats the word to be displayed. The word will contain the right amount of spaces appended at the front of the word, and the word will have the focus letter in red. | function buildWord(word){
var focusElements = determineFocusLetter(word.length);
var formattedWord = focusElements[1];
for(var i = 0; i < word.length; i++){
if(i == focusElements[0]){
formattedWord += '<span class="focus">' + word.charAt(focusElements[0]) + "</span>";
} else {
formattedWord +=... | [
"function renderNewWord() {\n\n // random word generator\n var random = Math.floor(Math.random() * wordLength.length);\n\n // get a random word and clear the string display\n let word = wordLength[random];\n wordDisplayString.innerHTML = \"\";\n\n // for each character in t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upon Bookmark creation menu event, open Window to let the user enter values in fields BTN is of type BookmarkTreeNode (promise from browser.bookmarks.create()) | function createBookmark (BTN) {
// Truncate title to just before "?" if it has one
let title = BTN.title;
let paramPos = title.indexOf("?");
if (paramPos != -1) {
title = title.slice(0, paramPos);
}
let path = BN_path(BTN.parentId);
openPropPopup("new", BTN.id, path, BTN.type, title, BTN.url, BTN.dateAdd... | [
"showBookmarkPropertiesForSelection() {\n let node = this._view.selectedNode;\n if (!node)\n return;\n\n PlacesUIUtils.showBookmarkDialog({ action: \"edit\",\n node,\n hiddenRows: [ \"folderPicker\" ]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create an Envelope from an event. | function createEventEnvelope(
event,
dsn,
metadata,
tunnel,
) {
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
const eventType = event.type || 'event';
enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunn... | [
"function createEventEnvelope(\n event,\n dsn,\n metadata,\n tunnel,\n) {\n const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);\n const eventType = event.type || 'event';\n\n enhanceEventWithSdkInfo(event, metadata && metadata.sdk);\n\n const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function currentLine(queue): 1. Determine whether the queue is empty. If it is, return a message. 2. If there is somebody in the queue, take them off the front of the queue 3. Put their name into a message saying who is being served. | function nowServing(queue) {
if (queue.length === 0) {
return "There is nobody waiting to be served!";
} // the queue is not empty so remove the first person from the queue and serve them
const firstPerson = queue.shift(); // shift() mutates the original array
return `Currently serving ${firstPerson}.`; // ... | [
"function currentLine(queue) {\n if (queue.length === 0) {\n return \"The line is currently empty.\";\n } // otherwise return the queue as a string inside a phrase ('else' not required as return escapes the method)\n let queueStatus = queue.map(function personInQueueCallback(person, position) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`onDetected` is called for each module that is cyclical | onDetected({ module: webpackModuleRecord, paths, compilation }) {
// `paths` will be an Array of the relative module paths that make up the cycle
// `module` will be the module record generated by webpack that caused the cycle
compilation.errors.push(new Error... | [
"onDetected({ module: webpackModuleRecord, paths, compilation }) {\n // `paths` will be an Array of the relative module paths that make up the cycle\n // `module` will be the module record generated by webpack that caused the cycle\n compilation.errors.push(new Error(\"C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete tag by Id : | function deleteTag (id) {
fetch(`http://localhost:3001/api/tags/delete/${id}`, {
method : 'DELETE'
}).then(res => {
renderTags()
toast.error("Tag Est Bien Supprimer !!!", {
position: "bottom-right"
})
})
} | [
"deleteKey(tagId){\n this.tagList.delete(Number(tagId));\n }",
"function deleteTagRecord(id) {\n\t\ttagTable.get(id).deleteRecord();\n\t}",
"function deleteTag(tagId) {\n DB.transaction(deleteTagCompletely, deleteError);\n\n function deleteTagCompletely(tx) {\n tx.executeSql(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates particles using points and sprites. currently set to look like snow but might change parameter later. | function initParticles(){
particleGeometry = new THREE.Geometry();
for ( var i = 0; i < 1000; i ++ ) {
points2 = new THREE.Vector3();
points2.x = Math.random() * 200 - 100;
points2.y = Math.abs(Math.random() * 200 - 100);
points2.z = Math.random() * 200 - 100;
particleGeometry.ve... | [
"function createParticles(x,y,z,size1,size2,amount){\n var particleGeometry = new THREE.Geometry();\n var points2;\n for ( var i = 0; i < amount; i ++ ) {\n points2 = new THREE.Vector3();\n points2.x = Math.random() * size1.x - size2.x;\n points2.y = Math.abs(Math.random() * size... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes the sender session on the connection. Should only be called from _createLinkIfNotOpen | async _init(options) {
try {
if (!this.isOpen() || !this._sender) {
// Wait for the connectionContext to be ready to open the link.
await this._context.readyToOpenLink();
await this._negotiateClaim({
setTokenRenewal: false,
... | [
"_initialize () {\n this.socket.on('data', data => this._sessionProtocol.chuck(data))\n this.socket.once('close', () => this.disconnect())\n }",
"async _init(abortSignal) {\n try {\n const options = this._createMessageSessionOptions();\n await this.initLink(options, abortSignal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
need to add class '.prependicon' to a link that appends icon first | function appendSubMenuIcon() {
var directive = {
restrict: 'A',
link: link
};
return directive;
function link(scope, el) {
var $el = $(el[0]);
$el.find('.prepend-icon').prepend('<i class="material-icons">keyboard_arrow_right</i>');
... | [
"function addIcons(){\r\n $(\".101\").prepend('<div class=\"icon\"><i class=\"fa fa-male\" aria-hidden=\"true\"></i><i class=\"fa fa-female\" aria-hidden=\"true\"></i></div>');\r\n $(\".102\").prepend('<div class=\"icon\"><i class=\"fa fa-paw\" aria-hidden=\"true\"></i></div>');\r\n $(\".103\").prepend('<div cla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
look for either .subplot (currently just ternary) or xaxis and yaxis attributes | function getSubplot(trace) {
return trace.subplot || (trace.xaxis + trace.yaxis);
} | [
"function getSubplot(trace) {\n\t return trace.subplot || (trace.xaxis + trace.yaxis) || trace.geo;\n\t}",
"function updateSubplots(viewBox) {\n var fullLayout = gd._fullLayout;\n var plotinfos = fullLayout._plots;\n var subplots = fullLayout._subplots.cartesian;\n var i, sp, xa, ya;\n if (hasSp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers the archives/ route with a given Express app. | function registerRouteArchives(app) {
if (config_1.Config.ARENA_MODE) {
return;
}
const lobby = lobby_1.Lobby.getInstance();
app.get("/archives/:gameName?/:pageStart?/:pageCount?", async (req, res) => {
const params = req.params;
const gameName = String(params.gameName || "all");... | [
"function installApplication(app, db) {\n app.use('/', base.createRouter())\n app.use('/items', items.createRouter(db))\n}",
"__addRoutes() {\n this.app.use(this.caching(process.env.CACHE_TIMEOUT), this.session, this.router.router);\n }",
"function attachStaticRoutes(app) {\n\n // Serve anything in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the cookiename begins with a casesensitive match for the string "__Secure", abort these steps and ignore the cookie entirely unless the cookie's secureonlyflag is true. | function isSecurePrefixConditionMet(cookie) {
return !cookie.key.startsWith("__Secure-") || cookie.secure;
} | [
"function isSecurePrefixConditionMet(cookie) {\n return !cookie.key.startsWith(\"__Secure-\") || cookie.secure;\n }",
"function isSecurePrefixConditionMet(cookie) {\n validators.validate(validators.isObject(cookie), cookie);\n return !cookie.key.startsWith(\"__Secure-\") || cookie.secure;\n}",
"async func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makeLake() Purpose: returns an Object3D containing a rippled lake enclosed by a rectangle of widthheight, with the coordinates bounded between two sine curves the rectangle lies in the xzplane, with lake oscillations in the ydirection origin: upper left corner of the rectangle that encloses the lake (widthheight) Param... | function makeLake (width, height, yCurvature, image, xRipples, zRipples) {
var frame = new THREE.Object3D();
//define the function that creates the vectors on the lake surface
radialWave = function (u, v) {
//x and z both lie within a width*height rectangle
var x = u*width;
var z = v*height;
//adju... | [
"function makeTent (height, radius, latheCut, image) {\n\tvar frame = new THREE.Object3D();\n\n\t//add the lathe tent - a cone with a triangle cut out of the front\n\tvar lathePoints = [new THREE.Vector3(radius, 0, 0), new THREE.Vector3(0, 0, height)];\n\tvar latheStart = 0.5*Math.PI + (2*Math.PI - 0.5*latheCut);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor del objeto Coords | function Coords(latitude, longitude) {
//Controlamos que el objeto se instancia mediante constructor
if (!(this instanceof Coords)) throw new InvalidAccessConstructorException();
//Propiedades privadas
var _latitude = latitude;
var _longitude = longitude;
//Propiedades públicas de acceso
Object.definePr... | [
"function Coords(x, y){\n this.x = x\n this.y = y\n}",
"function Coords(x, y) {\n this.x = x;\n this.y = y;\n}",
"function Coords(x, y) {\n this.x = x;\n this.y = y;\n }",
"function Coord (x, y) {\n this.x = x;\n this.y = y;\n}",
"function Coordinates(x, y)\n{\n this.x = x;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get amount of sub events that have start_time defined | getExistingSubCount(values) {
let count = 0
for (const event in values.sub_events) {
if (values.sub_events[event].start_time) {
count += 1
}
}
return count;
} | [
"subEventsContainTime(sub_events) {\n let found = false;\n if (Object.keys(sub_events).length > 0) {\n for(const key in sub_events) {\n if (sub_events[key].hasOwnProperty('start_time') && sub_events[key].start_time !== undefined) {\n found = true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets if the provided structure is a JsxAttributeStructure. | static isJsxAttribute(structure) {
return structure.kind === StructureKind_1.StructureKind.JsxAttribute;
} | [
"static isJsxSpreadAttribute(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.JsxSpreadAttribute;\r\n }",
"static isJsxAttributed(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.JsxSelfClosingElement;\r\n }",
"static isNamed(structure) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for mark note as done or remove note. | function doneremove(e) {
const item = e.target;
if (item.classList[0] === "remove") {
const note = item.parentElement.parentElement;
remove(note);
note.remove();
// reload for update the notes session
window.location.reload(1);
}
if (item.classList[0] === "done") {
const note... | [
"function removeNote(){}",
"function noteFinished() {\n\t\t\t\t\t\tlet txt;\n\t\t\t\t\t\tlet r = confirm(\"Are you sure the task is finished?\");\n\t\t\t\t\t\tif (r == true) {\n\t\t\t\t\t\t\ttxt = \"You closed the note\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttxt = \"You pressed Cancel\";\n\t\t\t\t\t\t}\n\t\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor for instances of BasicObject | function BasicObject(){} | [
"function BasicObject_alloc(){}",
"function Object(){}",
"constructor() {\n\t\tsuper({\n\t\t\tobjectMode: true\n\t\t});\n\t}",
"function _ctor() {\n\t}",
"function objectConstructor(label, value){\n\tvar o = new Object();\n\to.label = label;\n\to.value = value;\n\treturn o;\n}",
"function Object() {}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a promise that resolves to the content of the tor hostname file. | async function readHostnameFile () {
return new Promise((resolve, reject) => {
try {
fs.readFile(`${__dirname}/../../keys/ccoinjoin/hostname`, function (err, data) {
if (err) {
return reject(new Error(`Error trying to read hostname file.`))
}
return resolve(data)
})
... | [
"async function getHostname () {\n try {\n wlogger.silly('Entering tor.js/getHostname()')\n return await readHostnameFile()\n } catch (err) {\n // wlogger.error(`Error in getHostname(): ${util.inspect(err)}`)\n console.log(`Could not open tor hostname file.`)\n\n // Try to set the hostname permissi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve CAM user object by email. callback signature: (err, ) | function lookupCamUser(email, callback) {
const camUrl = process.env.CAM_USER_SEARCH_URL.replace('${userEmail}', email);
csvUtils.parseUrl(camUrl, (err, camUser) => {
if (err) return callback(err);
return callback(null, camUser);
});
} | [
"getUserByEmail(email, cb) {\n\t\tvar query = {\n\t\t\temail: email\n\t\t}\n\t\tthis.getUserDetails(query, cb)\n\t}",
"getUserByEmail(email) {\n\t\treturn instance.get('/api/user/' + email)\n\t}",
"getUserByEmail(email) {\n console.assert(email);\n return this.queryItems(this._context, {}, {\n type: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or Sets the cell spacing for selected table. | get cellSpacing() {
return this.cellSpacingIn;
} | [
"set cellSpacing(value) {\n if (value === this.cellSpacingIn) {\n return;\n }\n this.cellSpacingIn = value;\n this.notifyPropertyChanged('cellSpacing');\n }",
"get lineSpacing() {}",
"set lineSpacing(value) {}",
"get characterSpacing() {}",
"get lineSpacing(){ retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loads the history view | function loadHistoryView() {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if((xhr.readyState == 4) && (xhr.status == 200)) {
$('#view').html(xhr.responseText);
loadHistoryList();
refreshCount();
}
}
xhr.open("GET", 'history.view', true);
xhr.s... | [
"reload(){_backbone.history.loadUrl(_backbone.history.fragment)}",
"function loadHistory() {\r\n // Calling the API route from service and receiving data\r\n chatService.history(conId).then(function(data) {\r\n // Assign data to scope\r\n scope.m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if you are at then bottom of the page. | function checkIfBottomPage() {
return window.innerHeight + window.pageYOffset >= document.body.offsetHeight
? true
: false;
} | [
"function checkBottom() {\n const winScroll = document.documentElement.scrollTop;\n const totalScroll =\n document.documentElement.scrollHeight -\n document.documentElement.clientHeight;\n if (winScroll > totalScroll - 100) {\n return true;\n } else return false;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the plotter for a given Series, using the most specific plotter provided (i.e. if no plotter is provided on the series, use the plotter on the group, or the chart.) | function plotterForSeries(series, group, defaultPlotter) {
var plotter = defaultPlotter;
if (series.plot) {
plotter = series.plot.plotter;
} else if (group.plot) {
plotter = group.plot.plotter;
}
return plotter;
} | [
"function plotter() {\n return namedSeries.plot && namedSeries.plot.plotter || chart().plotter();\n }",
"function getoSeries(series) {\n switch (series) {\n case 1:\n var selectedSeries = aSeries[0];\n break;\n case 2:\n var selectedSeries = aSeries[1];\n break;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns a random xpixel coordinate somehwere on the board | function randX(board) {
return randInt(0, board.num_cols * CELL_SIZE)
} | [
"function randomXPosition() {\n return Math.floor(Math.random() * (9 - 0 + 1));\n}",
"function randomXOrigin() {\n return game.floor(game.random(10, game.width - 9));\n }",
"function getRandomXCoordinate() {\n return Math.floor(Math.random() * (GAMEPLAY_BOX_DIV_WIDTH - CIRCLE_DIAMETER + 1));\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create `Tree` object from `json` string. | static fromJson(js) {
function recursive(jsnode, name, parent) {
let node = new NodeTree_1.default(name, parent);
if (jsnode !== null) {
for (let key in jsnode) {
node.childs.push(recursive(jsnode[key], key, node));
}
}
... | [
"function parseJSON(string) {\n var manyTrees;\n\n manyTrees = JSON.parse(string);\n\n // give a name for each tree\n for (var name in manyTrees) {\n manyTrees[name].name = name;\n }\n\n return manyTrees;\n}",
"function jsonToTreemodel(n) {\n // First we add the children and id propert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called when the script determins that one of the TextFrames in the page contains overset text. If so, it is nessarry to temporarily increase the size of the relevent text box in order to access the 'pointSize' attribute of the paragraph text Accepts: i: Integer, index position of the page in the docume... | function reshapeAndResize(i) {
try {
// iterate through the text frames in the page
for (var s = 0; s < textFrameCount; s++) {
var page = pages.item(i + 1)
// isolate the value of the current page bounds
var origionalBounds = pages.item(i + 1).textFrames[s].geome... | [
"function setTextFrameContentInGroup(frame_nb, group, content, text_configurations){\n // Get considered text frame.\n var text_frame = group.textFrames[frame_nb];\n // Shrink size if overset. There are three possible sizes : 12 pts, 10 pts and 8 pts.\n var font_size = [12, 10, 8];\n for (var counter = 0; coun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Agregar al localstorage los precios | function agregarLocalStoragePrecios(prc){
let precios;
precios = obtenerPreciosDelLocalStorage()
precios.push(prc)
localStorage.setItem('Precios',JSON.stringify(precios))
} | [
"function agregarLocal(curso){\n //se obtiene la infomque hay en el local\n let local = infoLocalStorage()\n //se agrega el nuevo curso a los existentes\n local.push(curso)\n //se agrega al local\n localStorage.setItem('curso',JSON.stringify(local))\n}",
"function setLocal() {\n localStorage.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates through a provided externalsList (penExternals) Should be called ONLY on page load or page update (via put) to do an initial populate | function sortLocalExternalsAndPopulate(externalsList) {
cssExternalListGroup.empty();
jsExternalListGroup.empty();
// Generate under the correct display group (CSS or JS)
// display this out based off of CSS or JS: O(n)
for (var i = 0; i < externalsList.length; ++i) {
switch (externalsLis... | [
"function updateExternalsDictionaryFromList(listGroup, name) {\n\n inputRows = listGroup.children(); // Get the list of rows for the list group\n let errState = false;\n let errDict = [];\n\n // For each row, find the relevant entry in the dictionary and update the value (O(n))\n for (v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The `upsert()` method adds or updates an element with a specified key and a value with the results of calling a provided function on element that is currently assigned to the specified key in the calling object. If the specified key does not exist in the calling object, the provided function with be called with `undefi... | upsert(setKey, callback) {
const value = this.get(setKey);
this.set(setKey, callback(value));
return this;
} | [
"function composable(callback: (err?: Error) => void) {\n bucket.upsert('key', {value: 1}, callback);\n}",
"upsert(entity, data, extIdField) {\n check(data, Match.Where(x => check(x, Object) && !!x[extIdField]))\n return this._invokeSobjectMethod('upsert', true, ...arguments)\n }",
"function upsert(db... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reduce the number of effective zones for this Intersection by one. If the number of effective zones is now zero, set the Intersection to disabled. This is exclusively used in testing the behavior of a project and its functions with randomly generated values. | decrementEffectiveZones() {
this._effective_zones--;
if(this._effective_zones == 0)
this.setEnabled(false);
} | [
"updateAllZones() {\r\n\t\tfor (var config = 0; config < NUM_INTERSECTION_CONFIGS; config++) {\r\n\t\t\tif (PROJECT.getIntersectionByIndex(config).isEnabled) \r\n\t\t\t\tPROJECT.getIntersectionByIndex(config).updateZonePCEs();\r\n\t\t}\r\n\t}",
"function prestigeChanging2(){\n //find out the equipment index o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The ProcessMemoryDump represents a memory dump of a single process. | function ProcessMemoryDump(globalMemoryDump, process, start) {
tr.model.ContainerMemoryDump.call(this, start);
this.process = process;
this.globalMemoryDump = globalMemoryDump;
// Process memory totals (optional object) with the following fields (also
// optional):
// - residentBytes: Total r... | [
"function ProcessMemoryDump(globalMemoryDump, process, start) {\n tr.model.ContainerMemoryDump.call(this, start);\n this.process = process;\n this.globalMemoryDump = globalMemoryDump;\n\n // Process memory totals (optional object) with the following fields (also\n // optional):\n // - residentBy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called from outside. Cancels a polyelement | cancel() {
// stop drawing and remove the element
this.stop();
this.el.remove();
this.el.fire('drawcancel');
} | [
"function cancel(){focusedControl.fire('cancel');}",
"function cancel() {\n\t\t\tfocusedControl.fire('cancel');\n\t\t}",
"function cancelEditPO() {\n clearEditPOForm();\n}",
"function cancel() {\n focusedControl.fire('cancel');\n }",
"function cancelOption(){\n document.getElementById(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
agar team 1 and team2 array mei nhi hai toh daaldo | function putTeamInTeamsArrayIfMissing(teams, match) {
let t1idx = -1;
for (let i = 0; i < teams.length; i++) {
if (teams[i].name == match.t1) {
t1idx = i;
break;
}
}
if (t1idx == -1) {
teams.push({
name: match.t1,
matches: []
... | [
"function separateTeams() {\n allPlayers.forEach(function(player) {\n if (player.team === team1name) {\n team1 = team1.concat(player);\n }\n else {\n team2 = team2.concat(player);\n }\n });\n}",
"function createTeam(arr1,arr2){\n cleanBoard();\n for (i=0; i <= arr1.length-1; i++) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Borrar productos del LocalStorage delete articles from LocalStorage | function borrarProductoLocalStorage(producto) {
let productosLS = obtenerProductoLocalStorage();
// verifica si el articulo a borrar está en el LocalStorage.
// verify if the article to delete is in LocalStorage.
productosLS.forEach(function(productoLS, index) {
if (productoLS.id == producto ) {... | [
"eliminarProductoLocalStorage(productoID){\n let productosLS;\n //Obtenemos el arreglo de productos\n productosLS = this.obtenerProductosLocalStorage();\n //Comparar el id del producto borrado con LS\n productosLS.forEach(function(productoLS, index){\n if(productoLS.id ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================== Catalog ================== Returns an array containing a specified number of randomized products. Each product will have an id, price, and type attribute. | function createRandomCatalog(num){
var catalog = [];
for (var i = 0; i < num; i++){
var obj = createRandomProduct();
catalog.push({id:i,price:obj.price,type:obj.type});
}
return catalog;
} | [
"function createRandomCatalog(num) {\n var catalog = [];\n for (var i = 0; i < num; i++) {\n var obj = createRandomProduct();\n catalog.push({\n id: i,\n price: obj.price,\n type: obj.type\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
===================== Single cell actions ===================== fill the cell in x,y (where 1,1 is top left and 9,9 is down right) with digit | fill_cell(x,y,digit) {
if (!(check_digit(x,this.max) && check_digit(y,this.max)))
return;
this.cells[x-1][y-1].fill(digit)
this.updateCell(x,y);
} | [
"function setCell(y, x, n) {\n if (n==0) Tref[y][x].innerHTML = \"\";\n else Tref[y][x].innerHTML = n.toString();\n}",
"function fillCell(x, y) {\n var canvas = document.getElementById('canvas');\n if (canvas.getContext) {\n var context = canvas.getContext('2d');\n if (gameBoard[x][y] ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Paints the comments window. Quickpaint will only repaint the header as the date is a label field and cannot be changed by itself. The form elements will be changed by their object values and do not have to be repainted. | function WriteComments()
{
if (!Comments || !Comments.commentsWindow || !Comments.commentsWindow.document || !Comments.commentsWindow.document.body
|| !Comments.commentsWindow.document.getElementById("paneBody1"))
{
setTimeout('WriteComments()',5);
return;
}
date_fld_name = "2";
var html = '<div style="pa... | [
"function WriteComments()\n{\n\tvar toolTip;\n\tvar html = '';\n\tdate_fld_name = \"2\";\n\tif (styler && (styler.showLDS || styler.showInfor || styler.showInfor3) && typeof(window[\"DialogObject\"]) == \"function\")\n\t{\t\t\n\t\tmessageDialog = new window.DialogObject(\"/lawson/webappjs/\", null, styler, true);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.RuleGroupReferenceStatement` resource | function cfnWebACLRuleGroupReferenceStatementPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnWebACL_RuleGroupReferenceStatementPropertyValidator(properties).assertSuccess();
return {
Arn: cdk.stringToCloudFormation(properties.arn),
... | [
"function CfnWebACL_RuleGroupReferenceStatementPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the 1st village newdid from dorf3.php, this is called only once when a login is detected. | function getSingleVillageNum() {
//flag ( "getSingleVillageNum():: Started!" );
if ( window.location.href.indexOf("dorf3.php") != -1 ) {
var theString = document.body.innerHTML.match(/newdid=\d{1,}/);
var villageNum = theString.toString().match(/\d{1,}/);
GM_setValue(myacc() + '_singleTownNEWDID', villageNum.to... | [
"function getIdVillageV2(){\r\n\t\t//get the villageID using XPFirst (works for one village - after reading the singleTown name/coordinates/newdid from the profile of the player - and for more villages - directly from the existing village list on the right side -\r\n\t\tvar a = find('//a[@class=\"active_vl\"]/../..... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts any current typed free text to a gene array entry | function syncGeneArrayToInputText() {
const inputTextValues = inputText.trim().split(/[\s,]+/)
if (!inputTextValues.length || !inputTextValues[0].length) {
return geneArray
}
const newGeneArray = geneArray.concat(getOptionsFromGenes(inputTextValues))
setInputText(' ')
setGeneArray(newGeneA... | [
"function syncGeneArrayToInputText() {\n const inputTextTrimmed = inputText.trim().replace(/,/g, '')\n if (!inputTextTrimmed) {\n return geneArray\n }\n const newGeneArray = [...geneArray, { label: inputTextTrimmed, value: inputTextTrimmed }]\n\n setInputText(' ')\n setGeneArray(newGeneArray)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mark transplanted views as needing to be refreshed at their insertion points. | function markTransplantedViewsForRefresh(lView) {
for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
if (!lContainer[HAS_TRANSPLANTED_VIEWS]) continue;
var movedViews = lContainer[MOVED_VIEWS];
ngDevMode && assertDefi... | [
"function markTransplantedViewsForRefresh(lView) {\n for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {\n if (!lContainer[HAS_TRANSPLANTED_VIEWS]) continue;\n var movedViews = lContainer[MOVED_VIEWS];\n ngDevMode && assertDef... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To request for PlayersLink Serially | function getPlayerSerially(allLinks,n){
// Base-case
if(n== allLinks.length){
return;
}else{
request(allLinks[n],cb);
function cb(err, response,html){ // callback to the above request
if(err){
console.log("Error: "+err);
}else{
extractPlayerOfMatch(html);
getPlay... | [
"getPlaylists() {\n this.makeGETRequest('getplaylists','playlistsloaded','playlists')\n }",
"setPlayersFromURL_() {\n console.log(\"***\", this.props.match.params);\n const { firstPlayer, secondPlayer } = this.props.match.params;\n this.props.game.playersManager_.addPlayer(firstPlayer);\n th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup watcher for `preload/` On file changes: reload the web page | function createPreloadWatcher(viteServer) {
const watcher = build({
mode,
configFile: "src/preload/vite.config.js",
build: {
/**
* Set to {} to enable rollup watcher
* @see https://vitejs.dev/config/build-options.html#build-watch
*/
watch: {},
},
plugins: [
{
name: "web-reload-on-pre... | [
"startFileWatcher() {\n const baseDir = process.cwd();\n\n this._reloadWatchers = [];\n\n const watchPaths = this._app.packageJson.getDevRoutesWatch();\n for (let i = watchPaths.length - 1; i >= 0; i--) {\n const path = Path.join(baseDir, watchPaths[i]);\n\n console... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normalizes the userprovided filter criteria. The normalized form is a `Filters` object whose `include` and `exclude` properties are both `FilterFunction` arrays. | function normalize(criteria, opts) {
let filters = {
include: [],
exclude: [],
};
let options = normalizeOptions(opts);
// Convert each criterion to a FilterFunction
let tuples = normalizeCriteria(criteria, options);
// Populate the `include` and `exclude` arrays
for (let [fi... | [
"function Canonical () {\n /**\n * Entry point of the normalizer: takes a filter in, and reduces it\n * into a simplified version\n *\n * Result format:\n * [\n * [{condition: {...}, not: <boolean>}, {condition: {...}, not: <boolean>}, ...],\n * [{condition: {...}, not: <boolean>}, {condition:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the vendor settings for prefixing and vendor specific operations. | function setVendorSettings(vendorSettings) {
_vendorSettings = vendorSettings;
} | [
"function setVendorSettings(vendorSettings) {\n _vendorSettings = vendorSettings;\n}",
"function setVendorFieldsInit()\n{\n\tvar recType = nlapiGetRecordType();\t\n\tvar nlobjContext = nlapiGetContext();\t\n\tvar enableExpenseVBIntegration = nlobjContext.getSetting('SCRIPT', 'custscript_oa_expense_vb_int');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MUST be called after `prepareSource` called Here we need to make auto series, especially for auto legend. But we do not modify series.name in option to avoid side effects. | function autoSeriesName(seriesModel) {
// User specified name has higher priority, otherwise it may cause
// series can not be queried unexpectedly.
var name = seriesModel.name;
if (!modelUtil.isNameSpecified(seriesModel)) {
seriesModel.name = getSeriesAutoName(seriesModel) || name;
}
} | [
"function autoSeriesName(seriesModel){\n// User specified name has higher priority, otherwise it may cause\n// series can not be queried unexpectedly.\nvar name=seriesModel.name;\nif(!isNameSpecified(seriesModel)){\nseriesModel.name=getSeriesAutoName(seriesModel)||name;\n}\n}",
"function autoSeriesName(seriesMode... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function filters tasks by categories and styles selected categories | function filterTasksBy(category) {
currentCategory = category;
// only fetches tasks if user's location has been retrieved
if (userNeighborhoodIsKnown()) {
fetchTasks(currentCategory, "clear")
.then(response => {
taskGroup = response;
displayTasks... | [
"function filterTasks() {\n tasks.forEach(function (task, idx) {\n var $el = $(CONTAINER_ID).children().eq(idx);\n if (isFiltered(task))\n $el.addClass('hide');\n else\n $el.removeClass('hide');\n });\n}",
"function filterTasks(e) {\n let filterTasks = [];\n let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes all keys from an existing object | function cleanObject(obj) {
Object.keys(obj).forEach(function (key) {
delete obj[key];
});
} | [
"removeKeys(obj, keys) {\n keys.map((key) => {\n delete obj[key];\n return null;\n });\n return obj;\n }",
"removeKeys(keys) {\n for (let key in keys) {\n this.unset(keys[key]);\n }\n return this.toObject();\n }",
"function remove() {\n var keys = [];\n for (var _i = 0; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
' Name : showCvvRequiredPopup ' Return type : none ' Input Parameter(s) : none ' Purpose : This method is used to show the CVV required popup. ' History Header : Version Date Developer Name ' Added By : 1.0 19 Apr 2014 UmamaheswaraRao ' | function showCvvRequiredPopup(){
showAnimatedPopup('cvvFill', 'mainContainIdNewPop');
} | [
"function cvvValidator () {\n let userCvv= cvv.value;\n \n if (payment.children[1].selected) {\n \n if (cvvRegex(userCvv)) { \n cvv.style.border = '2px solid green';\n cvv.style.color = 'green';\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
randomly select N images from "fullimage" folder of products and use for carousel slides | function genCarouselImages(count) {
var products = dataProvider.getProducts();
var cnt = count; var list = [];//index to product array
while(cnt > 0) {
var prd_idx = Math.floor(Math.random() * products.length);
if (!list.includes(prd_idx)) {
list.push(prd_idx);
... | [
"function randomPic() {\n while(randomImage.length < 6) {\n var randomNum = generateRandom();\n while(!randomImage.includes(randomNum)) {\n randomImage.push(randomNum);\n }\n }\n //This makes the 3 images\n for(var i = 0; i < 3; i ++) {\n var rand = randomImage.shift();\n picId[i].src = BusM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
BINARY FUNCTION / TWO INVOCATIONS Write a function liftf that takes a binary function , and makes it callable with two invocations var addf = liftf(add); addf(3)(4) > 7 | function liftf(binary) {
return function(first) {
return function(second) {
return binary(first, second);
};
};
} | [
"function liftf(binary) {\n // higher order functions are functions that take other functions as parameters and return other paramters as a results\n // liftf takes a binary function\n // that returns a function that returns first argument\n // that returns a function that takes the second argument\n // that r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
leaflet clear map logic | function clearMap() {
group.clearLayers();
} | [
"function clearMap() {\n\t\tmap.off(\"click\");\n\t\tmap.off(\"mousemove\");\n\t\tmap.removeLayer(\"forceIncidents\");\n\t\tmap.removeSource(\"dpdForceData\");\n\t}",
"function clearMap(){\n deleteAllMarkers();\n deleteAllPaths();\n deleteAllLatLngs();\n}",
"function clearMap() {\n for (var layerId in win... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true or false depending on if the profile is currently watched | function isWatching(name) {
if (profiles_watched == undefined) {
var list = localStorage.getItem(STORAGE_NAME);
if (list != undefined)
profiles_watched = list.split(STORAGE_SEP);
else
profiles_watched = new Array();
}
for (var i=0; i<profiles_watched... | [
"function isWatchPage() {\n return window.location.pathname === \"/watch\"; \n }",
"isOwnProfile() {\n\t\t\tconst topLink = document.querySelector(\"#top_myprofile_link\");\n\n\t\t\treturn topLink.getAttribute(\"href\") === CONTEXT.getLink();\n\t\t}",
"get isSyncable() {\n let addon = addonFor(this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format url to use whitelisted steam image domain | function FormatUrl(url)
{
let base = "http://cdn.akamai.steamstatic.com/steamcommunity/public/images/avatars/";
url = url.substring(url.indexOf('/avatars/') + 9, url.length);
url = base + url;
return url;
} | [
"function getUrlPic(picture) { return \"url(\"+host+picture+\")\"; }",
"function createPhotoUrl(){\n var url = 'https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg'\n}",
"function checkUrl(theUrl){\n\tif(theUrl.indexOf(\"gallery\") > -1){\n\t\treturn theUrl;\n\t}\n\tif(theUrl.length> 12){\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create Last 5 scores function | function LastFiveScores(timeTaken)
{
scoresArray.push(timeTaken);
scoresArray.shift();
document.getElementById("lastFiveScores").innerHTML = scoresArray.join("s ") + ("s");
} | [
"function lastScore (){\n return scores[scores.length-1];\n}",
"function fifthElement(highScores) {\n \n return highScores [4];\n\n}",
"function topScores() {\r\n //let tempArray = []; \r\n\r\n // tempArray holds all previous and new scores\r\n scoreJSON = pastScores.prevScores;\r\n scoreJSON.push(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |