query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Add a stylesheet, replacing any previous custom stylesheet (adapted from TW) | function setStylesheet(s) {
var id = "AMMLcustomStyleSheet";
var n = document.getElementById(id);
if (document.createStyleSheet) {
// Test for IE's non-standard createStyleSheet method
if (n) {
n.parentNode.removeChild(n);
}
// This failed without the
document
... | [
"function addStylesheet() {\n if (document.getElementById(\"test-style\"))\n return;\n var style = document.createElement(\"link\");\n style.setAttribute(\"href\", \"data:text/css;charset=utf-8,\" +\n encodeURIComponent(stylesheet));\n style.setAttribute(\"rel\", \"stylesheet\");\n style.setAttribute(\"i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a Search Marker, defining the base location for any research | function addSearchMarker(position)
{
if (searchMarkers.length) {
searchMarkers.forEach(function (marker) {
marker.setMap(null);
});
searchMarkers = [];
}
var marker = new google.maps.Marker({
map: map,
position: pos... | [
"function setSearchMarker(data) {\n removeSearchMarker();\n if (!data || !data.latitude) return;\n if (mapMode == \"google\") {\n searchMarker = new google.maps.Marker({\n icon: {\n path:\n \"M20.5,0.5 c11.046,0,20,8.656,20,19.333c0,10.677-12.059,21.939-20,38.667c-5.619-14.433-20-27.989-2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the file path for the heartbeat file. | get heartbeatPath() {
const environment = this.services.get(environment_1.IEnvironmentService);
return path.join(environment.userDataPath, "heartbeat");
} | [
"function reminderFile() {\n return path.join(u.dataLoc(), 'eskill-alarm.txt')\n}",
"function datafilePath() {\n return path.resolve(__dirname, DOWNLOAD_STATS_FILENAME);\n}",
"get filepath() {\n\t\tif (!this._filepath) {\n\t\t\tthis._filepath = (this.options.directory) ? `${this.options.directory}/${this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Edit list item and I feel lucky modal windows | function editlistitem(target, owner) {
let itemid = target.parentElement.parentElement.parentElement.id;
$.get("editlistitem.php",
{
itemid: itemid
}
).done(function(jdata) {
let data = JSON.parse(jdata);
$("#editmodal-window input[name='id']").val(itemid);
$("#editmodal-window input[nam... | [
"function state_editListItemForm()\n\t{\n\t\t//close edit list form\n\t\tcloseEditListForm(editListForm);\n\t\t//open list edit form\n\t\texpandEditListForm(editItemForm);\n\t}",
"function state_editListItems()\n\t{\n\t\t//close edit list form\n\t\tcloseEditListForm(editListForm);\n\n\t\t//close editItemForm\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a `StateKey` that can be used to store value of type T with `TransferState`. Example: ``` const COUNTER_KEY = makeStateKey('counter'); let value = 10; transferState.set(COUNTER_KEY, value); ``` | function makeStateKey(key) {
return key;
} | [
"function makeStateKey(key) {\n return key;\n }",
"function makeStateKey(key) {\n return key;\n}",
"function makeStateKey(key) {\n return key;\n}",
"createState(key, value) {\n\t\tthis.stateTable[key] = value;\n\t}",
"async addState(state) {\n // @nt: Call replacement for ctx.stub.createC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function to get Members and then render our list of Members | function getMembers() {
$.get("/api/members", renderMemberList);
} | [
"displayMembersList(){\n let memberListDiv = document.querySelector(\"#members-list\");\n let membersHeading = document.createElement(\"strong\");\n membersHeading.textContent = \"Members: \"\n memberListDiv.append(membersHeading)\n for(var i = 0; i < this.members.length; i++){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends out/Updates the scores to all of the players | function sendScores(){
var scores = {
P1:-1,
P2:-1,
P3:-1,
P4:-1
};
if(DominoesPlayers[0] != null){
scores.P1 = DominoesPlayers[0].wins;
console.log("P1:"+DominoesPlayers[0].wins)
}
if(DominoesPlayers[1] != null){
scores.P2 = DominoesPlayers[1].wins;
... | [
"function submitScores () {\n\t\tsocket.emit('scored', scores);\n\t}",
"function updateScoreboard() {\n var scoreboard = currentMatch.getScoreboard();\n\n var pairs = [\n [Hearts.NORTH, $('#score-north')],\n [Hearts.EAST, $('#score-east')],\n [Hearts.SOUTH, $('#score-south')],\n [Hearts.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that creates a container for the wolf and adds positions the body parts corretly on the wolf Input: none, Output: wolf object | function createWolf(){
var wolf = new THREE.Object3D(); //Container for wolf
var head = createWolfHead();
wolf.add(head);
//Create and position left ear
var leftEar = createWolfEar();
leftEar.position.set(0,70,-15);
leftEar.rotation.x = -wolfParams.earRotation;
//Create and position right ear
var r... | [
"function createContainer(){\n const body = document.querySelector(\"body\");\n const bodyNameLevel = body.classList[0];\n const container = document.createElement('div');\n container.classList = 'container';\n body.insertBefore(container, levelModal);\n const headingContainer = document.createElement('div');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FINDING GRID COORDINATES///// This function will make use of other functions to determine the closest coord (i.e. closest dot) based on the touch coordinates x and y. | function findClosestCoord(x, y){
//find the x grid coordinate
var xCoord = findXCoord(x);
//If the value returned by findXCoord(x) is a whole number, then the closest dot will be based on y coordinate only. This is because the x Distance to another point can never be smaller than the y distance to ... | [
"getNeighbourCoords(){\n const neighbourArr = []\n neighbourArr.push({row: this.row + 1, col: this.col})\n neighbourArr.push({row: this.row, col: this.col + 1})\n neighbourArr.push({row: this.row - 1, col: this.col})\n neighbourArr.push({row: this.row, col: this.col - 1})\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Swaps a given tile with the adjacent empty tile, if it exists. return bool whether move happened | move(tileIndex) {
const emptyTile = this.getEmptyTile();
if(this.neighbors(tileIndex, emptyTile.index)) {
this.swap(tileIndex, emptyTile.index)
return true;
}
return false;
} | [
"function moveable(tile) {\n\t\tvar x = parseInt(window.getComputedStyle(tile).left);\n\t\tvar y = parseInt(window.getComputedStyle(tile).top);\n\t\t// check for empty adjacents\n\t\tif((x - TILE_SIZE == EMPTY_X || x + TILE_SIZE == EMPTY_X || x == EMPTY_X) && \n\t\t\t\t(y - TILE_SIZE == EMPTY_Y || y + TILE_SIZE == ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============== Three Cols Box ============== Instruksi ========= Buatlah sebuah function bernama drawThreeColsBox yang menjalankan proses dengan menggunakan looping (boleh dengan while atau for) dan menerima satu parameter bernama height. Buatlah sebuah angka dengan pola pemunculan tiga angka berurut sebagai berikut: c... | function drawThreeColsBox(height) {
let num = height * 3;
let arr = [];
for (num; num >= 1; num--) { //push urutan angka kedalam array (bisa aja kondisinya i<height*3) dari nomor terbesar. [max,.....,min]
arr.push(num);
}
let str = "";
let count = 0;
for (let i = 0; i < arr.len... | [
"function drawThreeColsBox(height) {\n counter = height * 3;\n for (let i = 0; i < height; i++) {\n let returnStr = \"\";\n for (let j = 0; j < 3; j++) {\n returnStr += counter + \" \";\n counter--;\n }\n console.log(returnStr);\n }\n}",
"function drawThreeColsBox(height) { \n var ko... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. Write a function that rotates a list by k elements. For example [1,2,3,4,5,6] rotated by two becomes [3,4,5,6,1,2] | function rotate(array, k) {
for (var j = 0; j < k; j++) {
var p = array[0];
for (var i = 0; i < array.length - 1; i++) {
array[i] = array[i + 1];
}
array[array.length - 1] = p;
}
return array;
} | [
"function rotate(list, k) {\n var newList = [];\n var j = 0;\n for (var i = 0; i < list.length; i++) {\n if (i > k - 1) {\n newList[j] = list[i];\n j++;\n //console.log(newList);\n }\n }\n\n for (i = 0; i < k; i++) {\n newList[j] = list[i];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ClientAccept Called when a client acception has been accepted, but before its gamelevel connection string has been received. | function ClientAccept(socket) {
socket.onmessage = function (buffer) {
PacketEvent(socket, buffer);
};
socket.onclose = function () {
ClientDisconnected(socket);
};
} | [
"registerAccept(client) {\n if (!this.clientToMatchId.has(client)) {\n return false\n }\n\n const id = this.clientToMatchId.get(client)\n const oldMatch = this.matches.get(id)\n const match = oldMatch.setIn(['clients', client], STATUS_ACCEPTED)\n\n if (!match.clients.every(status => status ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to show greetings after clearing the terminal | function greetings(term) {
term.echo(
"'||''|. || '||' '||' . \n" +
" || || .... .... ... .. ... ... . || || .... .... ... .. .||. .... \n" +
" ||''|' '' .|| .| '' || || || || || ||''''|| .... | [
"function greetings(term) {\n\t\t\tterm.echo('STAR WARS ASCIIMACTION\\n'+\n\t\t\t\t\t'Simon Jansen (C) 1997 - 2008\\n'+\n\t\t\t\t\t'www.asciimation.co.nz\\n\\n'+\n\t\t\t\t\t'type \"play\" to start animation, '+\n\t\t\t\t\t'press CTRL+D to stop');\n\t\t}",
"function printGreeting(){\n clearConsole();\n conso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HELPER FUNCTIONS find maximum Y value of within all symptom data | function findMaxY(data, goal) {
var allYValue = data.slice(0);
allYValue.push({date: xDomain.max, value: goal});
return d3.max(allYValue, function(d) { return d.value; });
} | [
"function getYMax() {\n return d3.max(getYFuncts().map(function (fn) {\n return d3.max(chart.data, fn);\n }));\n }",
"function getMaxY(data) {\n let max = 0;\n let possibleMaxNumbers = data.values.map(function(cur){\n return cur.y;\n })\n max = Math.max.apply(null, possibleMaxNumbers)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieves session from html | function getSession (html) {
let start = html.indexOf('jsessionid=') + 'jsessionid='.length
let end = html.indexOf('?', start)
return html.substr(start, end - start)
} | [
"function getSession(url)\r\n{\r\n var fragmento = url.substring( url.search(\"session=\") );\r\n partes = fragmento.split(\"&\");\r\n return partes[0];\r\n}",
"function getSession(requestURLGoesHere) {\n var url_array = requestURLGoesHere.split('&')\n console.log(url_array);\n console.log(\"---... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts letter in forward direction | convertForwards(letter) {
const inIndex = this._inputIndex(letter)
letter = this._rotor.alphabet.charAt(inIndex)
const outIndex = this._outputIndex(letter, plainAlphabet)
return plainAlphabet.charAt(outIndex)
} | [
"convertBackwards(letter) {\n const inIndex = this._inputIndex(letter)\n letter = plainAlphabet.charAt(inIndex)\n const outIndex = this._outputIndex(letter, this._rotor.alphabet)\n return plainAlphabet.charAt(outIndex)\n }",
"backwardChar() {\n let p = this;\n const oldNode = this.node;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find all repeated sequences for strings starting at [row, col] | function repeatsFor(index, row, col) {
var r = new Array();
var directions = new Array(
new Array(0, 1), // right
new Array(1, 1), // right-down
new Array(1, 0), // down
new Array(1, -1), // left-down
new Array(0, -1), // left
new Array(-1, -1), // left-up
new Array(-1, 0), // up
new Arra... | [
"function repeatedDNASequences(s) {\n //Build our map/histogram\n var symbolMap = {A: 0, C: 1, G: 2, T: 3},\n oneM = (1<<20)-1,\n histogram = new Array(oneM+1),\n output = [];\n\n //Prepare the string\n var curVal = 0;\n for(var i=0; i<9; ++i)\n curVal = curVal*4 + symbolM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Complete the URL by filling the parameter placeholders with the data arguments. | function finalizeRequest(endpoint, data) {
// No need to do anything if the URL is static (no parameters)
if (!endpoint.parameters) {
return { url: endpoint.url, payload: data };
}
// Swap all the parameter placeholders with the arguments.
let url = endpoint.url;
for (let index = 0; index < Object.key... | [
"function updateUrl() {\n var selectionData = getSelectionData();\n var string = parseSelectionData(selectionData);\n setParameter(string);\n}",
"_buildTargetUrl(data) {\n // only supported in search\n let query = Object.keys(data)\n .map(\n (i) => `${encodeURIComp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the number of (weighted) connections between each pair of communities | function calculateCommunityConnections() {
var community_matrix = {}; //Get the number of connections between the communities
edges.forEach(function (d) {
var sc = node_by_id[d.source].community;
var tc = node_by_id[d.target].community;
if (typeof sc === 'undefined' || typeof tc === 'undefine... | [
"function calculateCommunityConnections() {\r\n let community_matrix = {}\r\n //Get the number of connections between the communities\r\n edges.forEach(d => {\r\n let sc = node_by_id[d.source].community\r\n let tc = node_by_id[d.target].community\r\n if(typeof s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set Hyperlink content to tool tip element | setHyperlinkContentToToolTip(fieldBegin, widget, xPos) {
if (fieldBegin) {
if (this.owner.contextMenuModule &&
this.owner.contextMenuModule.contextMenuInstance.element.style.display === 'block') {
return;
}
if (!this.toolTipElement) {
... | [
"function attachTooltip(link, tooltip) {\n\tlet type = tooltip[0];\n\tif(type == NO_TOOLTIP) return link;\n\n\t// Attach tooltips if requested\n\tif(type == LINK_TOOLTIP) {\n\t\tlink.attr(\"data-tip-routing\", JSON.stringify(tooltip[1]));\n\t} else if(type == SECTION_TOOLTIP) {\n\t\t// Use first sentence of section... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a goal to the navigation stack with the given pose. | function sendGoal(pose) {
// create a goal
var goal = new ROSLIB.Goal({
actionClient : actionClient,
goalMessage : {
target_pose : {
header : {
frame_id : '/map'
},
pose : pose
}
}
});
goal.send();
// create a marker for th... | [
"function sendGoal(pose) {\n // create a goal\n var goal = new ROSLIB.Goal({\n actionClient : actionClient,\n goalMessage : {\n target_pose : {\n header : {\n frame_id : 'map'\n },\n pose : pose\n }\n }\n });\n goal.send();\n\n // cre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Form fields do not have autocomplete with value 'off'. See also: hasFieldsWithValidAutocompleteAttributes() and hasNoFieldsWithEmptyAutocomplete(). | function hasNoFieldsWithAutocompleteOff() {
const problemFields = inputsSelectsTextareas
.filter(field => field.autocomplete === 'off')
.map(field => stringifyElement(field));
if (problemFields.length) {
const item = {
// description: 'Autocomplete values must be valid.',
details: 'Found for... | [
"function turn_autocomplete_off() {\n $$('input[type=\"text\"]').each(function (e) {\n if (!e.hasClassName('autocomplete'))\n e.setAttribute(\"autocomplete\", \"off\");\n });\n}",
"function hasFieldsWithAutocompleteAttributes() {\n const problemFields = inputsSelectsTextareas\n .filter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function log Logs any value, objects are printed in prettified json syntax. Any value Value to log Number maxdepth (optional, default: false) maxdepth for objects/arrays. false acts like Infinity | function log(value, maxdepth = false) {
if (
typeof value === "object" &&
value !== null &&
!(value instanceof Promise) &&
Object.keys(value).length > 0
) {
printObject(value, 1, false, maxdepth);
} else {
print(` ${valueDescriptor(value)}`);
}
} | [
"function logValue(label, value, log_cb) {\n console.log(`In waterfall: ${label} = ${JSON.stringify(value)}`);\n\t if(label == \"parents\" || label == \"children\") {\n\t\t console.log(`${label} length is ${value.length}`);\n\t }\n log_cb(null, value);\n }",
"function log_change(name, value,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
showAxis helper function to displayparticular xAxis | function showAxis(xaxis, yaxis) {
g.select('.x.axis')
.call(xaxis)
//.attr('transform', 'translate(0,' + height + ')')
//.transition().duration(400)
//.call(xaxis)
//.selectAll('text')
//.style('text-anchor','end')
//.attr("dx", "-1em")
//.attr("dy", "-0.5em")
//.attr('tr... | [
"function showAxis() {\n g.select(\".x.axis\")\n .call(xAxisLine)\n .transition().duration(500)\n .style(\"opacity\", 1);\n\n g.select(\".y.axis\")\n .call(yAxis)\n .transition().duration(500)\n .style(\"opacity\", 1);\n }",
"function showAxis(axis) {\n g.select('.x.axis')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates the startAngle and endAngle properties. | _validateAngles() {
const that = this;
that._normalizedStartAngle = that._normalizeAngle(that.startAngle);
that.endAngle = that._normalizeAngle(that.endAngle);
if (that._normalizedStartAngle < that.endAngle) {
that.startAngle = that._normalizedStartAngle;
}
... | [
"function rotationAnglePropertyValidator(rotationAngle) {\n if (rotationAngle < 0 || rotationAngle >= 360)\n throw new Error('Rotation angles must be within [0, 360]');\n}",
"function validateStartEnd(start,end){return!!start&&!!end&&start.isValid&&end.isValid&&start<=end;}",
"function validateStartEn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is carried out when the 'Collect Water' button is clicked | function collectWater()
{
waterTurns--;
waterBank += 10;
action(1,1,1);
advanceTime();
updateDisp();
} | [
"function chooseMineralWater() {\n\tvar mineralWaterPushButton = document.getElementsByClassName('push-button-mineral')[0];\n\tmineralWaterPushButton.addEventListener(\"click\", function(event) {\n\t\tconsole.log('Func MineralWaterPushButton \\n \tEvent: ', event);\n\n\t\tif(machina.mineralWaterTitleState == 'activ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restaurant image URL Large. | static imageUrlForRestaurantL(restaurant) {
if (restaurant.photograph === undefined){
return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
}
return (`/img/800_${restaurant.photograph}.jpg`);
} | [
"static largeImageUrlForRestaurant(restaurant) {\r\n //Photos are named based on Restaurant IDs so use that to find the different sized images\r\n let photoRef = restaurant.id;\r\n return (`/images_sized/${photoRef}-large.jpg`);\r\n }",
"static largeImageUrlForRestaurant(restaurant) {\n\t\treturn (`/img/${r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add animation class to unwasteBtn | function animateBtn() {
unwasteBtn.classList.add('unwaste-btn-animate');
} | [
"function button_kagawa_animationRemove(){\n\t\t\tthat.button_kagawa_i1.alpha = 1;\n\t\t\tthat.button_kagawa_i2.alpha = 1;\n\t\t\tthat.button_kagawa_i3.alpha = 1;\n\t\t\tthat.button_kagawa_i4.alpha = 1;\n\t\t\t//that.button_kagawa_i5.alpha = 1;\t\t// notAvailable\n\t\t\t//that.button_kagawa_i6.alpha = 1;\t\t// notA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
format object to required layout | function formatObject () {
for (var i = 0; i < newData.length; i++) {
newData[i].name = preparingObj(newData[i].name);
newData[i].description = preparingObj(newData[i].description);
newData[i].date = formatDate(newData[i].date);
}
} | [
"static formatObject (pObject) {\n if (Output.isOutputFormatAllowed(\"json\")) {\n return OutputJson.formatJSON(pObject);\n }\n\n if (Output.isOutputFormatAllowed(\"nested\")) {\n return OutputNested.formatNESTED(pObject);\n }\n\n if (Output.isOutputFormatAllowed(\"yaml\")) {\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call server to reconfigure a game | function reconfig_game(game_id) {
var dataObj = {
"content" : [ {
"session_id" : get_cookie()
}, {
"game_id" : game_id
} ]
};
page = 'reconfig_game';
call_server('get_game', dataObj);
} | [
"function restartGame(){ setMode(currGame); }",
"restartGame() {\n this.newGame(this.options); // pass in same options\n }",
"function onResetGame(){\n io.sockets.emit(\"reset controllers\",{});\n globals.gameInProgress = false;\n}",
"restartGame() {\n this.robot.respawn();\n this.ui.changeT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare A with Memory Absolute Long 0xCF | function _cmpAAbsoluteLong() {
this.name = "Compare A with Memory Absolute Long"
this.argCount = 0;
this.size = Size.MEMORY_A;
this.addrMode = AddressingMode.ABSOLUTE_LONG;
this.mnemonic = 'CMP'
} | [
"function _cmpAAbsoluteLongX() {\n\tthis.name = \"Compare A with Memory Absolute Long Indexed X\"\n\tthis.argCount = 0;\n\tthis.size = Size.MEMORY_A;\n\tthis.addrMode = AddressingMode.ABSOLUTE_LONG_INDEXED_X;\n\tthis.mnemonic = 'CMP'\n}",
"function _cmpAAbsolute() {\n\tthis.name = \"Compare A with Memory Absolute... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch a list of port definitions (services) | function getPorts(){
$.get('/ports', function(data){
portList = data;
})
} | [
"async getPortsWithServiceType() {\n const ports = [];\n\n this.containers.forEach((container) => ports.push(...(container.ports || [])));\n (this.initContainers || []).forEach((container) => ports.push(...(container.ports || [])));\n\n // Only get services owned if we can access the service resource\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Address (string)> rid /cid | function getRIDCIDfromAddress(address) {
let cid = Number(address.charCodeAt(0)) - 65; //Number(B=66)
let rid = Number(address.slice(1)) - 1; //1 - 1
return { "rid": rid, "cid": cid }; // rid = 0 , cid = 1 -> (0,1)
} | [
"function getRIDCIDfromAddress(address) {\n let cid = Number(address.charCodeAt(0)) - 65;\n let rid = Number(address.slice(1)) - 1;\n return { \"rid\": rid, \"cid\": cid };\n}",
"function getRIDCIDfromAddress(address) {\n let cid = Number(address.charCodeAt(0)) - 65;\n let rid = Number(address.slice(1)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts webdevserver in watch mode. Configure it to ignore the CLI arguments but use the webdevserver.config.mjs file to load the server configuration. | async function startServer() {
await startDevServer({
readCliArgs: false,
readFileConfig: true
});
} | [
"startDevServer() {\n gutil.log('Starting development server. Hit Ctrl-c to quit.')\n const app = connect()\n livereload.listen({silent: false})\n app.use(serveStatic(this.settings.BUILD_DIR))\n app.use('/', serveIndex(this.settings.BUILD_DIR, {icons: false}))\n app.use(mou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
From is the index of the article (not of the page) | loadArticlesConfigFromIndex (from=0, cb) {
if (from < 0)
throw 'The index of article must be above 0.'
let to = Math.min(from + getMainConfig().content.articlesPerPage, this._articlesList.length);
let shortIdList = this._articlesList.slice(from, to);
this.loadArticlesConfigSubset(shortIdList, cb)... | [
"loadArticlesConfigFromIndex (from=0, cb) {\n if (from < 0)\n throw 'The index of article must be above 0.'\n\n let to = Math.min(from + getMainConfig().content.articlesPerPage, this._articlesList.length)\n let shortIdList = this._articlesList.slice(from, to)\n this.loadArticlesConfigSubset(shortId... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all questions stats | function getQuestionStats() {
return questions;
} | [
"function getQuestionStats() {\n return questions;\n }",
"async getAllQuestions() {\n const questionCollections = await questions();\n return await questionCollections.find({}).toArray();\n }",
"function getAll() {\n surveyStorage.getAll();\n }",
"async fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the internal audio graph. | buildAudioGraph() {
this.router = new FOARouter(this.config.channelMap);
this.bypass = Gain("foa-renderer-bypass");
this.input = Gain("foa-renderer-input", channelCount(4), channelCountMode("explicit"), channelInterpretation("discrete"), this.router, this.bypass);
this.output = Gain("foa... | [
"_buildAudioGraph() {\n this.input = this.context.createGain();\n this.output = this.context.createGain();\n this.bypass = this.context.createGain();\n this.rotator = new HOARotator(this.context, this.config.ambisonicOrder);\n this.convolver =\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Colocamos un valor por defecto al constructor, por si no llaman al metodo lugar() este tendra ya valores de nommbreLugar y tipoDescripcion | constructor(nombreLugar='Tierra de mordor', tipoDescripcion='Es un lugar rodeado de arboles muertos y arena negra, donde no se puede ver nada por su densa niebla.')
{
this.nombreLugar = nombreLugar;
this.tipoDescripcion = tipoDescripcion;
} | [
"function Mascota(nombre, especie, raza='')//no importa el orden de los datos\n//se pone comillas en la raza para que no te salga undefined por si no lo sabemos\n\n{\n this.nombre = nombre\n this.especie = especie\n this.raza = raza//los parametros de una funcion constructora son parametros y pueden tener ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find if a user is allowed to perform the action | async allows(action, ...args) {
this.resolveUser();
const { authorized } = await this.authorizeAction(action, args);
return authorized === true;
} | [
"is_authorized(){\n const validActions = Roles[this.user.role][this.object]\n const validatedAction = validActions.find(action => {\n return action === this.action\n })\n // TODO: maintain log of user and actions\n // console.info(`${this.user.name} ${validatedAction ? 'is' : 'is not'} authorize... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert the list of serialized MessagePieces into two arrays. One contains the literal string pieces and the other the placeholders that will be replaced by expressions when rendering `$localize` tagged template literals. | function processMessagePieces(pieces) {
const messageParts = [];
const placeHolders = [];
if (pieces[0] instanceof PlaceholderPiece) {
// The first piece was a placeholder so we need to add an initial empty message part.
messageParts.push(createEmptyMessagePart(pieces[0].sourceSpan.start));
... | [
"function processMessagePieces(pieces) {\n const messageParts = [];\n const placeHolders = [];\n if (pieces[0] instanceof PlaceholderPiece) {\n // The first piece was a placeholder so we need to add an initial empty message part.\n messageParts.push(createEmptyMessagePart(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input: distance matrix and route order output: distance of the route | function findDistances(matrix, route)
{
// [i][0] - city number
// [i][1] - distance
//console.log(route);
var previous = route[0][0];
var current = route[0][0];
var newRoute = [];
newRoute.push([current,0]);
for (var i = 1; i<route.length; i++)
{
current = route[i][0]
//push current city index... | [
"function findDistances(matrix, route)\n{\n\t// [i][0] - city number\n\t// [i][1] - distance\n\t//console.log(route);\n\tvar previous = route[0][0];\n\tvar current = route[0][0];\n\tvar newRoute = [];\n\tnewRoute.push([current,0]);\n\tfor (var i = 1; i<route.length; i++)\n\t{\n\t\tcurrent = route[i][0]\n\t\t//push ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log('get_leaderboard') get_leaderboard(time.happened_today) .then(console.log) .catch(console.error) | function get_leaderboard(time_function){
return new Promise(function (resolve, reject){
Actions.aggregate([
{ $match: { date:time_function() } },
{
$group: {
_id: "$login",
count: { $sum: 1 }
}
}
], function (err, leaderboard){
if (err) return reject(err);
// console.log(leaderboard);
... | [
"function getLeaderboard() {\n var user = \"\";\n send(json_get_leaderboard_message(user));\n}",
"function allTimeLeaderboard() {\n //Print leaderboard embed\n const embed = new Discord.MessageEmbed()\n .setTitle(\"All-time Leaderboard\")\n .setColor(0x00AE86)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
performs a focus on an the element with the name specified | function focusOnElementByName(name){
var theElement = jq("[name='" + escapeName(name) + "']");
if(theElement.length != 0){
theElement.focus();
}
} | [
"function focus_element_by_name(element_name){\n\tdocument.getElementsByName(element_name)[0].focus();\n}",
"function focusOnElementByName(name) {\r\n var theElement = jQuery(\"[name='\" + escapeName(name) + \"']\");\r\n if (theElement.length != 0) {\r\n theElement.focus();\r\n }\r\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the direct access link of the currently selected finding. | function getDirectLink(){
"use strict";
var node, sorttype, sortclass, id;
//Get all info about the currently clicked node.
node = $('.jstree-clicked');
id = node.parent().attr('class').split(' ')[0].slice(2);
sortclass = node.parent().parent().parent().attr('class').split(' ')[0];
sorttype ... | [
"getLink() {\n\t\t\tif (cur.module === \"profile\") {\n\t\t\t\treturn CONTEXT.getUserLink();\n\t\t\t} else {\n\t\t\t\tconst altItem = CONTEXT.getCurrentAltItem();\n\n\t\t\t\tif (altItem != null) {\n\t\t\t\t\treturn CONTEXT.getCurrentAltLink(altItem);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn CONTEXT.getPageLink();\n\t\t}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
contextually toggle custom fields connected to a connection service/ email provider | function toggle_connect_service_connected_fields(connection_service) {
// for other selected connect dependent settings fields, hide them if their dependent connection isn't selected.
// the code below apparently wont work for fields such as radio, checkbox
var selected_... | [
"function toggle_connect_service_email_list_field() {\n // Hide email list row if no option is found otherwise show it on admin page load.\n // '*=' selector check if the string after = is found in the element.\n // >= 2 is used because connection email list select-dropd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connect to the RabbitMQ server. | function connectRabbit() {
console.log(`Connecting to RabbitMQ server at ${RABBIT}.`);
return amqp.connect(RABBIT) // Connect to the RabbitMQ server.
.then(connection => {
console.log("Connected to RabbitMQ.");
return connection.createChannel() // Create a RabbitMQ messaging c... | [
"function connectRabbit() {\n\n console.log(`Connecting to RabbitMQ server at ${RABBIT}.`);\n\n return amqp.connect(RABBIT) // Connect to the RabbitMQ server.\n .then(connection => {\n console.log(\"Connected to RabbitMQ.\");\n\n return connection.createChannel(); // Create a Rabb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given item represents a process operation that spawns a child | function isProcessSpawnChildOperation(item) {
return isTrapConditionMet(PROCESS_MAP, "spawnChild", item);
} | [
"function isProcessExitOperation(item) {\n return isTrapConditionMet(PROCESS_MAP, \"exit\", item);\n}",
"function isChildProcessOf(file, argv, offset) {\n // There might be nested processes of the same file so we wanna go through all of them,\n // This variable represents how much skips will be done anytime ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns first element without removing from the queue | function peek(){
return queue[0];
} | [
"get _queueFirst() {\n return this._queue[0];\n }",
"poll(){\n if(this.isEmpty()) return null;\n let removed = this.queue.shift();\n if(this.isEmpty()){\n this.front = null;\n this.back = null;\n } else {\n this.front = this.queue[0];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ setMTAlpha / / This function sets/changes the rejection criterion (alpha) for the / _a_posteriori_ Multiple Comparison Tests. The criterion is necessary / because while comparing pairs of averages, starting on the two most / different (in magnitude) one has to decide when they are equal (thus / stopping the whole set... | function setMtAlpha() {
let mta = document.getElementById('mtests_alpha').value;
if ( mta != null ) {
mt_rejection_level = parseFloat(mta);
if ( mt_rejection_level != NaN) {
if(rejection_level > 1) rejection_level = 0.9999999;
if(rejection_level < 0) rejection_level = 0.0000001;
... | [
"function setAlpha() {\n rejection_level = parseFloat(document.getElementById('anova_alpha').value);\n if(rejection_level > 1) rejection_level = 0.9999999;\n if(rejection_level < 0) rejection_level = 0.0000001;\n \n // We should redisplay the ANOVA table as some of the\n // terms may now be statis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the API's current state is STATE_NOT_INITIALIZED | function isNotInitialized() {
return this.currentState === constants.STATE_NOT_INITIALIZED;
} | [
"function isInitialized() {\n return this.currentState === constants.STATE_INITIALIZED;\n }",
"isErrorState() {\n return this.currentStates.length === 0;\n }",
"isErrorState() {\r\n const gl = this.gl;\r\n return gl === null || gl.getError() !== gl.NO_ERROR;\r\n }",
"function is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Based one what kind of entity it is, change the color! | function EntityColorMapping(entity)
{
switch(entity.type)
{
case 'character':
{
if(parent.party_list.includes(entity.id))
{
return 0x1BD545;
}
else if(entity.npc == null)
{
return 0xDCE20F;
}
else
{
return 0x2341DB;
}
break;
}
case 'monster':
{
return 0xEE190E;
... | [
"renderColor() {\r\n if ((this.state.extType) === 'Normal') {\r\n return 'green';\r\n } else if ((this.state.extType) === 'Terminated') {\r\n return 'orange';\r\n } else if ((this.state.extType) === 'Absconding') {\r\n return 'red';\r\n } else {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter out arguments passed to specFn & hookFn, don't allow callbacks as there is no need for user to call e.g. `done()` | function filterSpecArgs(args) {
return args.filter((arg) => typeof arg !== 'function');
} | [
"function test_args() {\n return [];\n}",
"_failIfArgumentsAreNotAllChecked(f, context, args, description) {\n const argChecker = new ArgumentChecker(args, description);\n const result = currentArgumentChecker.withValue(argChecker, () => f.apply(context, args)); // If f didn't its... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fn_archive() Function is used to move message to archive | function fn_archive(msgid,id)
{
var dataparam = "oper=archivemsg"+"&msgid="+msgid;
$.ajax({
type: 'post',
url: 'tools/message/tools-message-message-ajax.php',
data: dataparam,
beforeSend: function(){
showloadingalert("Message storing in archive please wait");
},
success: function (data) {
setTi... | [
"toggleArchiveMessage() {\n const topic = this.model;\n\n if (topic.get(\"archiving\")) {\n return;\n }\n\n const backToInbox = () => this.gotoInbox(topic.get(\"inboxGroupName\"));\n\n if (topic.get(\"message_archived\")) {\n topic.moveToInbox().then(backToInbox);\n } els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTIONS /////////// Create Traffic Line Chart | function createTrafficChart(trafficData) {
const trafficChart = new Chart(trafficCanvas, {
// The type of chart we want to create
type: 'line',
// The data for our dataset
data: trafficData,
// Configuration options go here
options: trafficOptions
});
} | [
"function createLineChart(time) {\r\n\tvar myTrafficChart = new Chart($('#traffic-chart'), {\r\n\t\ttype: 'line',\r\n\t\tdata: {\r\n\t\t\tdatasets: [{\r\n\t\t\t\tdata: [\r\n\t\t\t\t{\r\n\t\t\t\t\tt:\"2018-3-16\",\r\n\t\t\t\t\ty: 250,\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tt:\"2018-3-22\",\r\n\t\t\t\t\ty:750\r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Approximate \int _0 ^sm(z) dt / (1 t^3)^(2/3) sm maps a triangle to a disc, sm^1 does the opposite | function sm_1(z) {
var k = [0, 0];
// rotate to have s ~= 1
var rot = complexPow(
w,
d3Array.scan(
[0, 1, 2].map(function(i) {
return -complexMul(z, complexPow(w, [i, 0]))[0];
})
)
);
var y = complexMul(rot, z);
y = [1 - y[0], -y[1]];
// McIlroy formula 5 p6 and table fo... | [
"function sm_1(z) {\n var k = [0, 0];\n\n // rotate to have s ~= 1\n var rot = complexPow(\n w,\n scan(\n [0, 1, 2].map(function(i) {\n return -complexMul(z, complexPow(w, [i, 0]))[0];\n })\n )\n );\n\n var y = complexMul(rot, z);\n y = [1 - y[0], -y[1]];\n\n // McIlroy formula 5 p6... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find all video from DB | static findVideo(req,res) {
console.log("Masuk ke static findAll")
Video.find({})
.then(lists => {
console.log("Hasil pencarian video: ", lists )
res.status(200).json({
msg: `List Video by all users`,
data: lists
... | [
"async videoAll(request, response) {\n \n try {\n const video = mongoose.model('video')\n \n const list = await video.find({})\n response.json(list)\n \n } catch(err) {\n response.json({ err: err })\n }\n }",
"function ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetches the data for the petition report. | fetchPetitionReport(petitionId) {
getPetitionReport(petitionId)
.then(response => {
this.setState({
isPetitionWinning: response.isPetitionWinning,
supportingSituation: response.supportingSituation,
supportingActionGoal: resp... | [
"function getElectedRepData()\n {\n var electedrep = {\"id\": klpData[\"report_info\"][\"dise\"],\n \"type\": repType};\n klp.dise_api.getElectedRepData(electedrep.id, electedrep.type,\n acadYear).done(function(diseData) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles new properties being passed into This will be replaced by static getDerivedStateFromProps(nextProps, prevState) in React 17. This sits in the lifecycle right before `shouldComponentUpdate`, `componentWillUpdate`, and most importantly `render`, so this is where we will call the plot's `reload` and `headermod` me... | UNSAFE_componentWillReceiveProps(nextProps) {
const {
data: currentData,
options: currentOptions,
layerOptions: currentLayerOptions,
} = this.props;
const {
data: nextData,
options: nextOptions,
layerOptions: nextLayerOptions,
} = nextProps;
// if new data has co... | [
"UNSAFE_componentWillReceiveProps(nextProps) {\n const {\n data: currentData,\n options: currentOptions,\n layerOptions: currentLayerOptions,\n } = this.props;\n\n const {\n data: nextData,\n options: nextOptions,\n layerOptions: nextLayerOptions,\n } = nextProps;\n\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var board = [[0,1,0],[0,0,1],[1,1,1],[0,0,0]] getLiveNeighborCount(0,1,board) // => 1 based on current cell value and live neighbor count, return what the next generation value should be | function getNewBoardValue(cellVal, liveNeighborCount){
if (cellVal === 1){
if (liveNeighborCount < 2) {
return 0;
} else if (liveNeighborCount > 3) {
return 0;
} else {
return 1;
}
} else {
// if cell val === 0
if (liveNeighborC... | [
"countLiveNeighbors(x, y, grid) {\n const height = grid.length;\n const width = grid[0].length;\n const size = { width, height };\n let count = 0;\n let row;\n \n let prevY = y - 1;\n let nextY = y + 1;\n let prevX = x - 1;\n let nextX = x + 1;\n \n if (prevY < 0) {\n prevY ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Chapter 12 After Class Jennifer Load | function C012_AfterClass_Jennifer_Load() {
// Loads the scene
LoadInteractions();
ActorLoad("Jennifer", "Dorm");
Common_PlayerPose = "";
if (C012_AfterClass_Jennifer_CurrentStage == 3915) Common_PlayerPose = "FoldPunishment";
// Jennifer's parameters
C012_AfterClass_Jennifer_CalcParams();
C012_AfterClass_Je... | [
"function learn(){\n\t\t//var notes=\"own .js notes\";\n\t\tconsole.log('learning with '+notes);\n\t}",
"function C002_FirstClass_Intro_Click() {\n\tTextPhase++;\n\tif (TextPhase >= 5)\n\t\tSetScene(CurrentChapter, \"Mildred\");\n}",
"function C012_AfterClass_Jennifer_ChangeToTrain() {\n\tif (ActorGetValue(Acto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a variable with a unique name | function createVariable() {
var id = nextVariableId++;
var name = '$V';
do {
name += variableTokens[id % variableTokensLength];
id = ~~(id / variableTokensLength);
} while (id !== 0);
return name;
} | [
"function createVariable() {\n var id = nextVariableId++;\n var name = '$V';\n\n do {\n name += variableTokens[id % variableTokensLength];\n id = ~~(id / variableTokensLength);\n } while (id !== 0);\n\n return name;\n}",
"function createVariable() {\n var id = nextVariableId++;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert string value to obj range | function strToRange(str) {
/* Clean String */
if (typeof str != 'undefined') {
str = str.replace(/%|\$/ig,'');
var obj = {
min: parseInt(Math.round(str)),
max: parseInt(Math.round(str))
};
if (str.split(',').length > 1) {
obj.min = parseInt(Math.round(str.split(',')[0]... | [
"convertRange (range) {\n return {\n startOffset: range.start,\n endOffset: range.end,\n count: 1\n }\n }",
"function convertRange(range) {\n return {\n startOffset: range.start,\n endOffset: range.end,\n count: 1\n }\n}",
"function RangeFromStr(str) {\n\tvals = str.split('-');\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that takes a patient from the waiting area and sends them to the operating room. | function sendToOperatingRoom(event) {
// If the div has no child nodes, proceed with sendint the patient in.
if (document.getElementById('operatingTable').hasChildNodes() === false) {
const patientId = event.currentTarget.getAttribute('data-patientid')
fetch('/api/patient/' + patientId, {
method: 'PAT... | [
"function send () {\n var out = {\n room: conf.room,\n gateway_id: macaddr,\n occupied: _occupied,\n confidence: _confidence,\n blees_occupancy: _blees_occupancy,\n blink_occupancy: _blees_occupancy,\n time: new Date().toISOString()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle clicking on a clue: show the question or answer. Uses .showing property on clue to determine what to show: if currently null, show question & set .showing to "question" if currently "question", show answer & set .showing to "answer" if currently "answer", ignore click | function handleClick(evt) {
// x will show* - if currently null, show question & set .showing to "question"
// y will show* - if currently "question", show answer & set .showing to "answer"
// z will show* - if currently "answer", ignore click
const $clickedClue = evt.target;
const x = $clickedClue.id[0];
const y =... | [
"function handleClick(evt) {\n let id = evt.target.id;\n let [catId, clueId] = id.split(\"-\");\n let clue = categories[catId].clues[clueId];\n\n let msg;\n\n /*if not showing we'll show the question, then if we are showing clue the we'll\n pull out the answer*/\n if(!clue.showing) {\n m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a waterlock instance | function Waterlock(){
events.EventEmitter.call(this);
this.sails = global.sails;
this.engine = _.bind(this.engine, this)();
this.config = _.bind(this.config, this)();
this.methods = _.bind(this.methods, this)().collect();
this.models = _.bind(this.models, this)();
this.actions = ... | [
"async createNewInstance () {\n this.waterline = new Waterline()\n }",
"async createNewInstance() {\n const adapters = this.processAdapters();\n const datastores = this.api.config.models.datastores;\n const models = await this.loadModels();\n\n const ormStart = promisify(Waterline.start);\n\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iterate through the array check if the current "max number" is > than the eval. result of passing current iteration through the callback if yes change if not continue on | function maxBy(arr, callback) {
let max = -Infinity;
for(let i = 0; i < arr.length; i++){
console.log(arr[i])
console.log(callback(arr[i]))
if(max < callback(arr[i])){
max = callback(arr[i]);
}
}
return max;
} | [
"updateMaxValue() {\n const data = this.data;\n let maxValue = data[0][0];\n\n for (let i = 0; i !== data.length; i++) {\n for (let j = 0; j !== data[i].length; j++) {\n const v = data[i][j];\n\n if (v > maxValue) {\n maxValue = v;\n }\n }\n }\n\n this.maxValue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets available CPUs of devices from ADB | function getAvailableCPUs(adbPath, device) {
try {
const baseArgs = ['-s', device, 'shell', 'getprop'];
let cpus = (0, _child_process().execFileSync)(adbPath, baseArgs.concat(['ro.product.cpu.abilist'])).toString(); // pre-Lollipop
if (!cpus || cpus.trim().length === 0) {
cpus = (0, _child_process(... | [
"async function getAvailableDevices(){\n var devices = (await executeAdb(\"adb devices\"))\n .res // get result\n .split(\"\\n\") // divide into lines\n .filter((item)=> item.includes(\"\\t\")) // filter out extra rows and text\n .map((item)=>{ // returns device list\n var parts = item.split(\"\\t\"); //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Captures where the user last clicked on the canvas and updates the shape position | captureCanvasClick (event) {
let parentHTMLNode = document.getElementsByClassName('konvajs-content')[0].offsetParent
let currentHTMLNode = document.getElementsByClassName('konvajs-content')[0]
let canvasOffsetLeft = currentHTMLNode.offsetLeft
let canvasOffsetTop = currentHTMLNode.offsetTop
while (pa... | [
"onMouseDown(coord, event) {\r\n // this.contextDraft.lineWidth = canvasSettings.strokeSize;\r\n // this.contextDraft.fillStyle = canvasSettings.colorFill;\r\n // this.contextDraft.strokeStyle = canvasSettings.colorStroke;\r\n this.origX = coord[0];\r\n this.origY = coord[1];\r\n }",
"handleCanvas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert to a cached group element. | toCached(cacheGroupElement) {
cacheGroupElement.yPlusX.add(this.Y, this.X);
cacheGroupElement.yMinusX.sub(this.Y, this.X);
cacheGroupElement.Z = this.Z.clone();
cacheGroupElement.T2d.mul(this.T, CONST_D2);
} | [
"toCached(cacheGroupElement) {\r\n cacheGroupElement.yPlusX.add(this.Y, this.X);\r\n cacheGroupElement.yMinusX.sub(this.Y, this.X);\r\n cacheGroupElement.Z = this.Z.clone();\r\n cacheGroupElement.T2d.mul(this.T, CONST_D2);\r\n }",
"_groupMap(type) {\n type = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Snapshot of main video | getSnapShot(){
var ret = null;
try {
var video = document.querySelector('video'), shrinkSz = .5, canvas, context;
if(video) {
var width = video.offsetWidth * shrinkSz, height = video.offsetHeight * shrinkSz;
canvas = canvas || document.createElem... | [
"function GetVideoSnapshot(type, width, height, bWideString) {\n return ATMPlayer.GetVideoSnapshot(type, width, height, bWideString);\n}",
"function makeSnapshot() {\n if (_video) {\n var patCanvas = document.querySelector('#snapshot');\n if (!patCanvas) return;\n\n\n patCanvas.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by LUFileParsernewEntityName. | enterNewEntityName(ctx) {
} | [
"enterNewEntityLine(ctx) {\n\t}",
"visitNewEntityName(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function parseEntity(e) {\n var entity = new pc__namespace.Entity(e.name);\n if (e.pos) {\n entity.setLocalPosition(e.pos[0], e.pos[1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates torrent settings in Database by applying a transformation function to each torrent | async function transformTorrentSettings (torrentDbPath, transform) {
let torrentsDB = await db.open(torrentDbPath)
let torrents = await torrentsDB.getAll('torrents')
let transformedTorrents = torrents.map(transform)
await Promise.all(transformedTorrents.map(torrent => torrentsDB.save('torrents', torrent.inf... | [
"function transformTorrentSettings (torrentDbPath, transform) {\n let torrentsDB\n\n return db.open(torrentDbPath)\n .then((torrentDatabase) => {\n torrentsDB = torrentDatabase\n return torrentDatabase.getAll('torrents')\n })\n .then(function (torrents) {\n return torrents.map(transform)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prompts server to update testData by removing the player to leave. Ensures player wants to leave the game with dialogue | function handleExit() {
if (confirm('Are you sure you want to leave the game?')) {
socket.emit('toLeave');
location.reload();
}
} | [
"function playerExitGame(data) {\n console.log('::::::::::::::::: playerExitGame Function :::::::::::::::'.cyan);\n console.log('Player ' + data.playerInfo.display_name + 'attempting to leave game: '.red + data.gameId );\n\n // Update the player's room (client side) to 'room1' (main chat)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::CodeDeploy::DeploymentGroup.TriggerConfig` resource | function cfnDeploymentGroupTriggerConfigPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDeploymentGroup_TriggerConfigPropertyValidator(properties).assertSuccess();
return {
TriggerEvents: cdk.listMapper(cdk.stringToCloudFormation)(propert... | [
"function hostedZoneResourceHostedZoneConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n HostedZoneResource_HostedZoneConfigPropertyValidator(properties).assertSuccess();\n return {\n Comment: cdk.stringToClo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For the base to be extensible, both objects must be pure JavaScript objects. The function assumes that base is undefined, or null or a pure object. | function extend (base, extension) {
if (isUndefined(base)) {
return copy(extension);
}
if (isUndefined(extension)) {
return copy(base);
}
if (isPureObject(base) && isPureObject(extension)) {
return utils.extendDeep(bas... | [
"function extend (base, extension) {\n\t if (isUndefined(base)) {\n\t return copy(extension);\n\t }\n\t if (isUndefined(extension)) {\n\t return copy(base);\n\t }\n\t if (isPureObject(base) && isPureObject(extension)) {\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolves the intended teams for the given |players|, a sequence. We achieve this by ranking all |players| based on their skill, and then evenodd dividing them into teams. | resolve(players) {
const scoresArray = [ ...this.computePlayerScores(players) ];
// (1) Sort the |scoresArray| in descending order based on the scores. That gives us the
// rankings based on which we can divide the teams.
scoresArray.sort((left, right) => {
if (left[1] === r... | [
"resolveForPlayer(player) {\n this.#teamAlphaScore_ = 0;\n this.#teamBravoScore_ = 0;\n\n // (1) Recalculate the total scores of both teams based on the adjusted rankings.\n const scores = this.computePlayerScores([ player ]);\n for (const [ participant, score ] of scores) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Signing function: adds key, timestamp and signature to params object | function sign(params) {
params.key = key;
params.timestamp = Math.round(new Date().getTime());
params.signature = crypto.createHmac('sha256', secret).update(params.key + params.timestamp).digest('hex');
return params;
} | [
"sign(privKey) {\n //\n // **YOUR CODE HERE**\n //\n this.sig2 = utils.sign(privKey, this.prelimHash());\n }",
"function signMethod(params){\n params.api_key = api_key;\n if(session_key) params.sk = session_key;\n var secret = '76a99e642cff2787b92cf8965828e0c6';\n var keys = [], str = '';... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return promise of absences | getAbs () {
if (this.absences.length !== 0) {
return this.$q.resolve(this.absences)
}
return this.$http.get(this.API_URL2)
.then(response => response.data)
} | [
"function get_management_absences() {\n var params = {};\n if (manage_mode_selfcare()) {\n params = {\n 'user-id': global_logged_user_id,\n 'date-not-before': moment().format('YYYY-MM-DD'),\n 'status': status_PENDING_OR_ACCEPTED\n };\n } else {\n params... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create GA cookie value | function createGaCookieValue(){
var O = window;
var M = [];
M.cookie = "cookieName=someValue";
var hd = function() {
return Math.round(2147483647 * Math.random())
}
function La(a) {
var b = 1, c;
if (a)
for (b = 0,
c = a.length ... | [
"function gengo_create_cookie(name, value) {\r\n\tvar date = new Date();\r\n\tdate.setTime(date.getTime() + 30000000);\r\n\tvar expires = \"; expires=\" + date.toGMTString();\r\n\tdocument.cookie = name + \"=\" + value + expires + \"; path=\" + cookie_path;\r\n}",
"function getPersadoIDCookie() {\n if (d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. .load jsprovider.dll .scriptload C:\Users\guyinatuxedo\Documents\windbg\strife.js dx Debugger.State.Scripts.strife.Contents.strife() vmbusvdev!VMBusUserModeTransportImpl::TryRead | function strife(name)
{
var ctl = host.namespace.Debugger.Utility.Control;
var returnAddress;
var currentInstruction;
var output = "";
var i;
var tabs = 0;
while (tabs >= 0) {
currentInstruction = ctl.ExecuteCommand("u rip")[1];
if (currentInstruction.includes("call")) {
output += "\t".repeat(tabs... | [
"function nvEditorRead(nn) {\n\t// start reading the NVs\n\tvar req = {direction:'tx', message:':S0FC0N71'+number2hex4(nn)+'01;'};\n\tconsole.log(\"req=\"+req+\" req.direction=\"+req.direction);\n\tgcSend(req);\n}",
"function FP_RTIMR_EVENT_HANDLER_002( argintThisObjectID ) \n//#else\n//# static function FP_RTI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add Node to ParentNode | function add (node, parent) {
parent.children.push(node)
if (parser.position) {
parent.position = {
start: parent.children[0].position.start,
end: node.position.end
}
}
} | [
"addToParent () {\n var parentNode = this.parentEl = this.parentNode;\n\n // `!parentNode` check primarily for unit tests.\n if (!parentNode || !parentNode.add || this.attachedToParent) { return; }\n\n parentNode.add(this);\n this.attachedToParent = true; // To prevent multiple attachments to same p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prompt for adding a key/value | function promptAdd() {
inquirer.prompt([
{
type: 'input',
message: "Enter key:",
name: "key"
},
{
type: 'input',
message: "Enter value:",
name: "value"
}
]).then((answers) => {
// console.log(answers.... | [
"function promptForCommandKey(sessionID) {\n\trl.question(\"> Insert Command Key: \", function (commandKey) {\n\t\t\n\t\trequests.requestCommandKey(sessionID, commandKey);\n\t\tconsole.log('> OK.\\n')\n\n\t\tpromptForCommandKey(sessionID);\n\t});\n}",
"function addManual() {\n return Dialog.prompt({\n title: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts the clock ticking on the CPU | startClock() {
const _this = this;
this.clock = setInterval(() => {
_this.tick();
}, 1); // 1 ms delay == 1 KHz clock == 0.000001 GHz
} | [
"startTicks() {\n this.tick();\n }",
"startClock() {\n // Every millisecond, perform one cpu cycle\n this.clock = setInterval(() => {\n this.tick()\n }, 1) // 1 ms delay == 1 KHz clock == 0.000001 GHz\n\n // Fire the timer interrupt\n // Every second, set th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inject service, router, middleware order does matter. | function inject(){
interceptor({
path: interceptorPath
})(app);
service({
path: servicePath
})(app);
middleware({
path: middlewarePath
})(app);
if(config.isDebug){
require('@root/devserver')(app, config.proxy);
}
router({
path: controllerPa... | [
"registerServices() {\n\t\tvar router_services = this.services;\n\t\tObject.keys(router_services).forEach( full_path => {\n\t\t\t// This is the name of the JS function which implement the service's logic\n\t\t\tvar service_function = router_services[full_path];\n\t\t\tvar path_items = full_path.split(' ');\n\t\t\t/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Override VLabScene.onLoaded and called when VLabScene nature JSON is loaded as minimum | onLoaded() {
console.log('BaseScene onLoaded()');
/**
* Trace VLabScene object (this)
*/
console.log(this);
this.manager.performance.lowFPSThreshold = 0;
var ambientLight = new THREE.AmbientLight(0x404040, 0.5); // soft white light
this.add(ambientLigh... | [
"onLoaded() {\n console.log('BaseScene onLoaded()');\n /**\n * Trace VLabScene object (this)\n */\n console.log(this);\n\n /*<dev>*/\n /**\n * dummyObject\n */\n this.dummyObject.position.copy(new THREE.Vector3(0.1, 0.1, 0.1));\n /*</d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setRotations Sets the rotation that each object sits at. | setRotations() {
this.room2_wall_info_4.rotation = 3.14;
this.room2_wall_info_5.rotation = 3.14;
this.room2_wall_info_6.rotation = 3.14;
this.leftArrow.setRotation(3.14);
this.returnDoor.angle = 270;
} | [
"setRotations() {\n this.room2_wall_info_4.rotation = 3.14;\n this.room2_wall_info_5.rotation = 3.14;\n this.room2_wall_info_6.rotation = 3.14;\n this.leftArrow.setRotation(3.14);\n }",
"setRotations() {\n this.SreBox.rotation = (3*3.14/2);\n this.IncStmBox.rotation = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
let a = new Affectation(new Sink(), new Literal(5)); | async function test() {
let a = new Sink("TestA");
a.interfaceIn("okookok");
let b = new Literal("TestB: kjojoj")
console.log(await b.interfaceOut());
let c = new Affectation(new Sink("TestC") ,new Literal(5));
await c.interfaceIn(active);
await c.interfaceIn(active);
await c.interfaceIn(inactive);
... | [
"function Emitter() {}",
"of(value) { return new StateEffect(this, value); }",
"function Example(a) {\n this.newBinding = a;\n}",
"function _AsExpressionEmitter() {\n}",
"function _AdditiveExpressionEmitter() {\n}",
"static enhance(): BehaviorInstruction {\n let instruction = new BehaviorInstruction()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateBlurAmt (1) Update "bluAmt" settings with user input (2) display updated blurAmt on popup modal (3) save settings (4) send updated settings to tab.js to modify active tab blur css | function updateBluramt () {
settings.blurAmt = document.querySelector("input[name=bluramt]").value
document.querySelector("span[name=bluramttext]").innerHTML = settings.blurAmt + "px"
browser.storage.sync.set({"settings": settings})
sendUpdatedSettings()
} | [
"function bpmBlurHandler(e) {\n let bpmVal = bpm.value;\n if ( bpmVal > 150 ) {\n bpm.value = 150;\n } else if ( bpmVal < 10 ) {\n bpm.value = 10;\n } else if ( isNaN(bpmVal) ) {\n bpm.value = 60;\n }\n localStorage.setItem(\"bpm\", bpm.value);\n}",
"updateBlurValue() {\n if (this.bl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
party member changed online status | function party_member_online(pc){
this.party_activity("Party member "+utils.escape(pc.label)+" has come online");
//this.sendActivity('MSG:party_online');
this.apiSendMsg({
type : 'party_online',
pc_tsid : pc.tsid
});
} | [
"function party_now_leader(){\n\n\tthis.party_activity('now leader of party');\n}",
"function onOnline()\n {\n onlineStatus = '<b>online</b>';\n }",
"updateFriendStatus(state, payload) {\n if(state.friends[payload.userId]) {\n state.friends[payload.userId].online = payload.online\n }\n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets parameter's value by id | function getParameter(inputId) {
var input = document.getElementById(inputId);
return input.value;
} | [
"function findParameter(id) {\n\tvar obj = searchToObject();\n return obj[id];\n}",
"function getParameter(name) {\n return getInputOrParameter(name, 'parameter', id);\n }",
"function getParameter(id) {\n var deferred = $q.defer();\n\n $http.get(BASE_URL + \"parameter/get/\" +id)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end activities listener req 5. / First program pick the first option paymentOptions[1] (credit card) of the drop down menu and assign the select. Second, the program manage the display of the divs with the payment information. | function initPayment(){
paymentOptions[1].selected = true;
//we use nextElementSibling because the divs don't have id or class in the HTML
displayPayment (creditCardDiv);
/* creditCardDiv.style.display = '';
paypalDiv.style.display = 'none';
bitcoinDiv.style.display = 'no... | [
"function selectPaymentDisplay(option) {\n //hide it all\n document.getElementById(\"credit-card\").style.display = \"none\"\n document.getElementById(\"paypal\").style.display = \"none\"\n document.getElementById(\"bitcoin\").style.display = \"none\"\n //display the appropriate one\n switch(option.value) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instructions: You're given the UI for a basic form. Your task is to hook it all up using refs. The `Focus X Input` buttons should focus that specific input field. The `Submit` button should log `name`, `email`, and `password` to the console. The `Reset` button should result all of the input fields to empty strings. | function ComplexForm() {
const handleSubmit = (e) => {
e.preventDefault();
console.group("Form Submit");
console.log(nameField.current.value);
console.log(emailField.current.value);
console.log(passwordField.current.value);
console.groupEnd();
};
const handleReset = () => {
nameField.... | [
"function ReactForm() {\n const txtName = useRef(null);\n const txtEmail = useRef(null);\n const txtPwd = useRef(null);\n const txtSearch = useRef(null);\n const componentRef = useRef({});\n const { current: cmp } = componentRef;\n cmp.timer = null;\n const handleSubmit = (e) => {\n console.log(txtName.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a panel to show the descriptions | function initHelpPanel(){
if (!YAHOO.example.help) {
YAHOO.example.help =
new YAHOO.widget.Panel("help",
{
width:"500px",
fixedcenter:true,
close:true,
draggable:true,
zindex:999,
modal:false,
visible:false
... | [
"function panelcreate() {\n\n// Create an intro panel with labels.\nvar intro = ui.Panel([\n ui.Label({\n value: 'Urban PM Explorer',\n style: {fontSize: '1.4pw', fontWeight: 'bold'}\n }),\n ui.Label({\n value:'Displayes PM₂.₅ values for all urban areas on Earth', style: {fontSize: '.9vw', fontWeight: '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
AJAX GET values to populate chart then draw it. | function getValues() {
$.get("/load_charts/get-charts/", function (data){ drawChart(data, threshold); });
} | [
"function getChartData() {\n\t$.get('servlets/VoteServlet', {dataType: \"application/json\"}, drawChart);\n}",
"function getGraphData() {\t\n\t\tif (currentStats.length != 0 ){\n\t\t jsonData = $.ajax({\n type: \"GET\",\n\t\turl: \"../v1.0/php/getGraphData.php\",\n\t\tdata: queryString,\n\t\tdataType:\"jso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given set of arrays interpolates based on first param | function interpolateArrays(entries, v) {
var current = entries[0];
if (v <= current[0]) {
return current.slice(1);
}
var i = 1;
var next;
while ((next = entries[i++])) {
if (v <= next[0]) {
// interpolate
var p = (v - current[0]) / (next[0] - current[0]);... | [
"function interpolate (arr0, arr1, p) {\n var q = 1 - p;\n return [q * arr0[0] + p * arr1[0], q * arr0[1] + p * arr1[1], q * arr0[2] + p * arr1[2]];\n }",
"function interpolateSet(a, b, n) {\n var i, j, c = [a];\n\n for (i = 0; i < a.length; i++) {\n for (j = 1; j < n; j++)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Animate a fade out of a single (Japanese) character on the canvas. Starting from opacity of startAlpha and stepping down to zero opacity | function fadeCharOnCanvas(char, startR, startG, startB, startAlpha, thisAlpha, msDelay, frameCount)
{
//calc the step down amount
var dec = startAlpha / frameCount;
//what will the *next* opacity be?
var nextAlpha = thisAlpha - dec;
//console.log('thisAlpha:' + thisAlpha + ' -- nextAlpha:'... | [
"update() {\n this.alphaFadeOutValue -= 0.05\n }",
"function AnimateHit():void {\n\tcharDummy.animation.CrossFade(\"hit\", 0.1);\n}",
"coinFadeOut() {\n var easeInOutTransition = new EaseInOutTransition();\n var coinAlphaTween = new Tween(this.coin, easeInOutTransition);\n coinAlp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the effective permissions for the user supplied | getUserEffectivePermissions(loginName) {
const q = this.clone(SharePointQueryable, "getUserEffectivePermissions(@user)");
q.query.set("@user", `'${encodeURIComponent(loginName)}'`);
return q.get().then(r => {
// handle verbose mode
return hOP(r, "GetUserEffectivePerm... | [
"getCurrentUserEffectivePermissions() {\r\n const q = this.clone(SharePointQueryable, \"EffectiveBasePermissions\");\r\n return q.get().then(r => {\r\n // handle verbose mode\r\n return hOP(r, \"EffectiveBasePermissions\") ? r.EffectiveBasePermissions : r;\r\n });\r\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trigger push notifications between a specific hours. This is really dirty :( Have to use trigger them in this way as Heroku Dynos aren't always on and I'm too tight to pay for the upgrade. | function triggerNotification(){
var hours = new Date().getHours();
if (hours >= 10 && hours < 11) {
console.log('[SW] Trigger notification');
fetch('/user/notification', {
method: 'GET',
credentials: 'include'
}).then(response => {
}).catch(err => {
console.log(... | [
"function pushData_createTimeTrigger() {\n var everyHour = ScriptApp.newTrigger(\"pushData\")\n .timeBased()\n .everyHours(1)\n .create();\n}",
"function triggerByHour(req, res) {\n const hours = getHours(new Date());\n\n if (hours > 8 && hours < 16) {\n res.json({ exchange_slug: DIALOGUE_OPEN });\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new version in the branch, the array of element is the same than the previous one Store the diff between the old and the current in the old version. | function commitFct() {
// create new version on same branch
var newVersion = new Version();
var currentVersion = this.lastVersion();
newVersion.elements.components = currentVersion.elements.getElements();
newVersion.previous = currentVersion._id;
// Search the old version
var branchOfTheOld... | [
"diffWithSplit() {\n const changes = this.currentState.diffWithSplit(this.previousState);\n \n if (this.classModel.auditable) {\n if (!changes.$set) {\n changes.$set = {};\n }\n changes.$set.revision = this.revision + 1;\n }\n\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |