query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Watch for changes in slider | function startSliderWatch() {
$(".donate-range").change(function(){
var $thisVal = $(this).val();
updateSliderValue($thisVal);
updateSliderMessage($thisVal);
$('.donate-slider-amount').removeClass('blank').html('$'+$thisVal);
});
setTimeout(function(){ updateSliderValue($(".donate-range").val()); },5... | [
"function startSliderWatch() {\n\t\t$(\".donate-range\").change(function(){\n\t\t\tvar $thisVal = $(this).val();\n\t\t\tupdateSliderValue($thisVal);\n\t\t\tupdateSliderMessage($thisVal);\n\t\t});\n\n\t\t\n\n\t\tsetTimeout(function(){ updateSliderValue($(\".donate-range\").val()); },50);\n\t}",
"function detect_ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or Sets the height type for selected rows. | get heightType() {
return this.heightTypeIn;
} | [
"set heightType(value) {\n if (value === this.heightTypeIn) {\n return;\n }\n this.heightTypeIn = value;\n this.notifyPropertyChanged('heightType');\n }",
"get rowHeight() { return this._rowHeight; }",
"get rowHeight() {\n return this._rowHeight ? this._rowHeight... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks to see which nodes are in old graph but not in new graph | function oldNotInNew() {
oldNodes = new Set();
for (const [examName, examValue] of Object.entries(oldGraphPoints)) {
for (const [gradeName, node] of Object.entries(examValue)) {
if (!(gradeName in newGraphPoints[examName])) {
oldNodes.add([examName, gradeName, node.value].toS... | [
"function newNotInOld() {\n newNodes = new Set();\n for (const [examName, examValue] of Object.entries(newGraphPoints)) {\n for (const [gradeName, node] of Object.entries(examValue)) {\n if (!(gradeName in oldGraphPoints[examName])) {\n newNodes.add([examName, gradeName, node.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! Function : WebSocketIFHandlePacket | function
WebSocketIFHandlePacket
(InData)
{
var packet;
var packettype;
packet = JSON.parse(InData);
n = packet.packetid;
if ( n > 0 ) {
WebSocketIFID = n;
}
packettype = packet.packettype;
if ( packettype == "request" ) {
W... | [
"function\nWebSocketIFHandleRequest\n(InPacket)\n{\n\n}",
"function\nWebSocketIFHandleResponse\n(InPacket)\n{\n if ( InPacket.status == \"Error\" ) {\n SetMessageError(InPacket.message);\n return;\n }\n\n console.log(InPacket);\n if ( InPacket.status == \"OK\" ) {\n WebSocketIFID = InPacket.packetid ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Activate projectile object for a specific id | function activateProjectile(id, list, currentX, currentY, isTargeted, targetX, targetY) {
//get index of id
var index = list.map(function (proj) { return proj.id; }).indexOf(id);
//update projectile properties
list[index].createTime = Date.now();
list[index].isAlive = true; //now... | [
"function CreateNewProjectile(intBaseYPosition)\n{\n let projectile = new Projectile(objDefaultProjectileSprite, intBaseYPosition, 12, 1);\n //Add it to the game objects array\n arr_activeProjectiles.push(projectile);\n}",
"fireProjectile () {\n this.gameObjectsGroup.projectilesGroup.spawn(this.sp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Import and load legacy keys | _importMigratedKeys (migratedKeys) {
migratedKeys = JSON.parse(migratedKeys)
const getHDNode = (seed) => {
const seedNode = HDNode.fromSeed(seed)
return seedNode.derivePath(BASE_PATH_LEGACY)
}
const rootNode = getHDNode(migratedKeys.seed)
this._rootKeys = this._deriveKeySet(rootNode)
... | [
"async load() {\n const keys = await Store.get(this.keyId);\n this.privateKey = await crypto.subtle.importKey(\n 'jwk',\n keys.privateKey,\n this.getAlgos(),\n true,\n [\"sign\"]\n );\n this.publicKey = await crypto.subtle.importKey(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
normalize the mappings into a consistent object format | function normalizeMappings(mappings) {
if (Array.isArray(mappings)) {
return mappings.reduce((normalizedMappings, key) => {
normalizedMappings[key] = key;
return normalizedMappings;
}, {});
}
return mappings;
} | [
"normalizeFields(fields) {\n if (_isEmpty(fields)) {\n return fields\n }\n\n return _fromPairs(_map(fields, (value, key) => [key, value.toString()]))\n }",
"function convertGridInfoMap(){\n\tgridInfoByField = {};\n\tgridInfoById = {};\n gridChildrenInfoMap = {};\n\t\n\t//-- where is this p prope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If there is only one matching item and the search text matches its display value exactly, automatically select that item. Note: This function is only called if the user uses the `mdselectonmatch` flag. | function selectItemOnMatch () {
var searchText = $scope.searchText,
matches = ctrl.matches,
item = matches[ 0 ];
if (matches.length === 1) getDisplayValue(item).then(function (displayValue) {
var isMatching = searchText == displayValue;
if ($scope.matchInsensitive && !isMatc... | [
"function selectItemOnMatch () {\n var searchText = $scope.searchText,\n matches = ctrl.matches,\n item = matches[ 0 ];\n if (matches.length === 1) getDisplayValue(item).then(function (displayValue) {\n if (searchText == displayValue) select(0);\n });\n }",
"function selectIt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
21 KLOC test cases | function GetTestCase_KLOC () {
var testCases = [];
for (S = 1; S < 4; S++) {
if (S == 1) session = 0;
if (S == 2) session = 1;
if (S == 3) session = 255;
testCases.push({'session':session});
}
return testCases;
} | [
"function KDRunTests() {\n\tKDDebug = true;\n\tif (KDTestMapGen(100, [0, 6, 12, 18,], [0, 1, 2, 3, 11,])\n\t\t&& KDTestFullRunthrough(3, true, true)) {\n\t\tconsole.log(\"All tests passed!\");\n\t}\n\tKDDebug = false;\n}",
"function kangaroo(x1, v1, x2, v2) {\n if ((x1 > x2 && v1 > v2) || (x2 > x1 && v2 > v1)) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toggle Toggles an element's class Arguments: $section [jQuery Element] The section to be toggled className [String] The classname to toggle | function toggle($section, className) {
return $section.hasClass(className) ? $section.removeClass(className) : $section.addClass(className);
} | [
"function toggleClass(element, clas) {\n element.classList.toggle(clas);\n}",
"function classToggle(el, classname, callback) {\n\t\tif ((el !== undefined && el instanceof Node) && (classname !== undefined && typeof classname === 'string')) {\n\t\t\t\n\t\t\tel.classList.toggle(classname);\n\t\t\tif (typeof call... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================================================= FUNCTIONS ================================================= Get file prefix | function getFilePrefix(experiment) {
if (experiment === "control") {
return "control_";
} else {
return "audio_"
}
} | [
"#getFilenamePrefix() {\n let prefix = this.settings.fs.prefix;\n let sep = '_';\n\n return (prefix ? prefix + sep : '') + this.host + sep;\n }",
"function getFilenamePrefix(widgetType)\n {\n return filenamePrefixes[widgetType];\n }",
"function GetScriptPrefix()\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format the fund input. Makes it easier to process. | static formatFundInput(input) {
if (input == null) {
return null;
}
// Replace.
let formattedInput = input.replace(this.formatGold, " gold ");
formattedInput = formattedInput.replace(this.formatCopper, " copper ");
formattedInput = formattedInput.replace(this.... | [
"function input(){\n\n var varInput = prompt(\"Please enter data\", \"$1,299.99, 3 people, food\");\n var varInput=varInput.replace(',','').replace(/[#$\\]\\\\@]/,'').split(',');\n\n var basePrice=parseFloat(varInput[0]);\n var people = parseFloat(varInput[1]);\n var markup = varInput[2].split(\" \")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a HexColor with the current value, e.g. Hex("FFFFFF"). | toHexColor() {
const R = this.R.toHex().valueOf();
const G = this.G.toHex().valueOf();
const B = this.B.toHex().valueOf();
return new HexColor(`#${R}${G}${B}`);
} | [
"toHexColor() {\n const R = this.R.toHex().valueOf();\n const G = this.G.toHex().valueOf();\n const B = this.B.toHex().valueOf();\n return new HexColor(`#${R}${G}${B}`);\n }",
"get colorHex() {\n return `#${this.color.toString(16).padStart(6, '0')}`;\n }",
"hex() {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts a loop that will break only if the poller is done or if the poller is stopped. | async startPolling() {
if (this.stopped) {
this.stopped = false;
}
while (!this.isStopped() && !this.isDone()) {
await this.poll();
await this.delay();
}
} | [
"function polling_method()\n{\n\n while (keepPollThreadAlive)\n {\n try\n {\n if (shouldContinuePolling)\n {\n\t\tvar retrieve = getEvents();\n\t\tvar initiate = createEvent();\n\t\tvar terminate = terminateEvents(retrieve);\n\n try\n {\n pollingThread.sleep(POLLING_INTERVAL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
El campo dni no puede estar vacio | function checkDNI(){
if(form['dni'].value==""){
innerAlert("dniLabel","Este campo no puede estar vacio")
return false
}
} | [
"function comprobarVacio(campo){\n\tif((campo.value==null)||(campo.value.length==0)){ //comprueba si el campo esta vacio\n\t\talert('El atributo '+campo.name+' no debe estar vacio');\n\t\tcampo.focus();\n\t\treturn false;\n\t}\n\treturn true;\n}",
"function nonnull(o,n){\n if(o==\"\" || o==null){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
displays all the moves of the user selected pokemon | function displayYourPokemonMoves(pokemon) {
// for (i = 0; i < pokemon.moves.length; i++) {
// console.log(pokemon.moves[i].move.name);
// }
yourPokemonMoves = pokemon.moves.map((move) => {
return move.move
})
moves = pokemon.moves.map((move) => {
return move.move.name
})
... | [
"function displayYourPokemon(pokemon) {\n scrollUp();\n $('.pokemon-selector-grid').html(\"\")\n $(\"#your-pokemon\").html(`<h1>You picked <font color=\"#0000e5\">${pokemon.species.name}</font>!</h1>\n <p><center><img src=\"${pokemon.sprites.front_default}\"></center></p>\n <p><h2>Choose 4 Moves ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resetting video element to live stream | function resetVideo(){
video.removeAttribute('controls')
video.autoplay=true
video.src = URL.createObjectURL(stream);
} | [
"resetVideo() {\n this.videoElt.pause();\n this.videoElt.currentTime = 0;\n this.videoElt.style.display = 'none';\n }",
"function resetVideo() {\n video.currentTime = 0;\n}",
"function reiniciarVideo() {\n video.currentTime = 0;\n}",
"function reiniciar() {\r\n video.currentTime... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the cart hash in both session and local storage | function set_cart_hash( cart_hash ) {
if ( $supports_html5_storage ) {
localStorage.setItem( cart_hash_key, cart_hash );
sessionStorage.setItem( cart_hash_key, cart_hash );
}
} | [
"function set_cart_hash( cart_hash ) {\r\n if ( $supports_html5_storage ) {\r\n localStorage.setItem( cart_hash_key, cart_hash );\r\n sessionStorage.setItem( cart_hash_key, cart_hash );\r\n }\r\n }",
"function set_cart_hash( cart_hash ) {\n/* 28 */ \t\tif ( $supports_html5_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var debugLine; //////////////////////// THREE.js Initializations | function init(){
scene = new THREE.Scene();
scene.userData = { objectType: objType.SCENE };
//debugLine = new LineChain(0, 0);
//scene.add(debugLine.line);
canvasWidth = window.innerWidth - 10;
canvasHeight = window.innerHeight - 10;
var aspect = canvasWidth / canvasHeight;
camera = n... | [
"function myDebug(){\n\tvar test1 = new THREE.BoxGeometry(0.1,0.1,0.05);\n\tvar material1 = new THREE.MeshLambertMaterial({color: 0x00FF00});\n\tvar cube1 = new THREE.Mesh( test1, material1 );\t\n\tvar test2 = new THREE.BoxGeometry(0.1,0.1,0.05);\n\tvar material2 = new THREE.MeshLambertMaterial({color: 0x00FF00});\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepare the weird canvas covers to fake animate letters. | function prepareAnimateLetters() {
var els = slideEls[currentSlideNumber].querySelectorAll('.letter-animate')
var globalCount = 0
var zIndex = 0
els.forEach(function(el) {
if (el.classList.contains('letter-animate-done')) {
return;
}
el.classList.add('letter-animate-done')
// Figure out... | [
"function drawChar(x, y, scal, dY, state)\r\n{\r\n if(state == 1)\r\n {\r\n push();\r\n translate(x, y);\r\n scale(scal);\r\n\r\n stroke(1);\r\n fill(charColor);\r\n rect(-charW / 2, -charH / 2, charW, charH);\r\n\r\n drawEyes();\r\n pop();\r\n }\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add interest for specified user then update list of interests | async addInterest(interest) {
await UserService.createInterest(interest, this.props.username).then(response => {
this.fetchInterests();
});
} | [
"function addToInterests(user_interests){\r\n interestFactory.getInterestById(int_id).then(function(response){\r\n user_interests.push(response.data.resource_uri);\r\n var news_result = response.data.news_result;\r\n var num_imports = response.data.num_of_imports;\r\n num_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bindr The constructor for the injection container. | function Bindr() {
// Save all of the injections.
this.injections = {};
} | [
"function Injector() {\n this.components = {};\n this.instances = {};\n this.stack = [];\n }",
"bind(binder, bindAs) {\n const result = binder(this, this.resolve(ConfigRepository_1.ConfigRepository));\n if (!(result === null || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the mesh needs to be updated, i.e. a new section has been added, the current mesh is removed, and a new mesh for the skidmarks is generated. | function LateUpdate()
{
if(!updated)
{
return;
}
updated = false;
var mesh : Mesh = GetComponent(MeshFilter).mesh;
mesh.Clear();
var segmentCount : int = 0;
for(var j : int = 0; j < numMarks && j < maxMarks; j++)
if(skidmarks[j].lastIndex != -1 && skidmarks[j].lastIndex > numMarks - maxMarks)
segmentCo... | [
"function updateMesh() {\n \n var argVals = [];\n\t\n for ( var i = 0, len = U.params.length; i < len; i++ ) {\n argVals.push( U.params[i].value );\n }\n\t\n\tif (S.mesh) {\n\t\tS.scene.remove( S.mesh );\n\t}\n \n var userGeo = U.func.apply( this, argVals );\n // TODO Check that userGeo ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Look up the field by its ID attribute and change the class property to "". | function makeFieldNonMandatory(fieldIDAttribute)
{
obj = getObj(fieldIDAttribute);
obj.className=""
} | [
"function idToClass(idName) {\n return idName.replace(/\\//g,\"_\").replace(\":\",\"___\");\n}",
"function resetFieldById(id) {\n var field = enableFieldById(id);\n field.value = \"\";\n updateCharCount(field);\n return field;\n}",
"function ClearField(field)\n{\n\tClassSub = field.value.substrin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
manage new image output | function createImage(data) {
//image output
var img_output;
//clear image search value
$(".contextual-choice input").val("");
if (data !== "") {
//create each image element
var $img = $('<img class="flex-img">').attr("src", data);
//add image
img_output = $img;
}
//ch... | [
"function image_result_streamization() {\r\n \r\n}",
"function guardarImg(img, format, output, name){ IJ.saveAs(img, format, output+name) }",
"imageProcessed(img, eventname) {\n console.log(img.hist);\n this.allpictures.insert(img);\n console.log(\"image processed \" + this.allpictures.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region Panel : User Articles | function initializePanel_userArticles()
{
panel_userArticles.initializeButtons(listUserArticles, null);
} | [
"function ManageArticles() {\n\t}",
"function showUserArticles() {\n let url = window.API_HOST + '/articles?owned=1';\n fetch(url, {\n headers: { authorization: localStorage.access_token },\n })\n .then(response => response.json())\n .then(response => {\n for (let i = 0; i < response.length; i +=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates next board states(next potential moves), of current root node; | buildTree(depthLimit, boardState, currPlayer = 'RR') {
this.root = new Node(boardState, 0, null); // current board state.
let nodes = [this.root];
let childrenNodes = [];
for (let j = depthLimit; j > 0; j--){ // limits the depth of the tree. **most computers can't calculate all potenti... | [
"runSimulation() {\n\n // Initial values\n var state = this.state // No need to copy because we do not modify it\n var node = this.nodes.get(state.hash)\n var winner = null\n var deeps = 0\n\n var visitedStates = new Set()\n visitedStates.add(state)\n\n // Run... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is called periodically from setInterval function to spawn another ship in game. It finds first dead ship, refills it with new question and answer, moves it to the top and respawns it. | _spawnShip() {
// Find first dead ship and prepare it for respawn
for (let ship of this.ships) {
if (ship.dead) {
// Generate new question and answer
ship.setData(this.generator.generate());
// Move ship to the top
ship.setPosi... | [
"function placeShip(ship, board)\r\n{ \r\n var rNum = getRandomNumber();\r\n var rX = Math.floor(rNum/10) ;\r\n var rY = rNum%10 ;\r\n var dir = rNum%2 ; // If rNum is even => horizontal else vertical.\r\n /*Get the inclusive final co-ordinate .. not exclusive.*/\r\n var rX1 = (dir==0)?... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
in this render, we are using bootstrap's `ToggleButtonGroup`. I would be lying if I told you this was a cakewalk so don't worry if it seems confusing. It was mostly reading bootstrap's docs and stackoverflow. I also added some css to make it look a little better | render() {
return (
<div className="outer">
<h3>How would you describe the task</h3>
<ToggleButtonGroup name="exciting" className="buttonGroup"
value={this.state.exciting} onChange={e => this.setState({ exciting: e })}>
<ToggleB... | [
"render() {\n return (\n <div>\n <br/><br/>\n <span>OFF - <Toggle \n defaultChecked={this.state.ON} \n icons={false}\n onChange={this.handleToggle} \n /> - ON</span>\n </div>\n )\n }",
"re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
simple wrapper to call all the metric update functions | function update_metrics() {
metric_signups();
past_events();
photos_count();
upcoming_events();
past_events_photos();
avg_event_photos();
revenue();
} | [
"onMetricChanged(metricName, methodName, ...args) {\n console.info(...args);\n }",
"update (){\n for (let [key, func] of this._updateFuncs){\n func()\n }\n }",
"async function refreshCustomMetrics() {\n // reset metrics\n resetMetricsIfNeeded();\n // basic metrics\n gaugeCpuLoad.set(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mock an asset like Webpack's fileloader. | function mockAsset(modulePath) {
const path = require.resolve(modulePath);
require.cache[path] = {
exports: path
};
} | [
"LoadAsset() {}",
"_injectTmpLoader(data) {\n const requestParts = webpackMajorVersion >= 5\n ? data.createData.request.split(\"!\")\n : data.request.split(\"!\");\n const requestedFile = path.resolve(data.context, requestParts.pop());\n // If a mapping from addTestFile exists add the loader\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use the forEach method to add the name of each planet to a div element in your HTML with an id of "planets". | function populateSolarSystem(planet){
var el = document.getElementById("planets");
el.innerHTML += '<div>' + planet + '</div>'
} | [
"function loadPlanets() {\n for (i = 0; i < planets.length; i++) {\n $(planetSlider).append('<div class=\"planet-container\" data-planet=\"' + planets[i].name + '\"><img class=\"planet-image\" src=\"' + planets[i].img + '\"><h1>' + planets[i].name + '</h1><div class=\"view-images pc' + i + '\"><h2>View Im... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getCompiledSelector should take file as the parameter, not fileSearch then addSelectorHighlights will have access to the correct file | function updateCompiledSelectorView(fileSearch, selection, callback) {
var hasText = selectionHasText(selection);
var compiledSelectors = hasText ? getCompiledSelector(fileSearch, selection) : [];
if (!hasText) {
getCompiledSelector(false);
}
callback(compiledSelectors);
} | [
"static parseFilePathToSelector(path) {\n var name = path.split('\\\\').pop().split('/').pop(); // Get the final part (file name).\n var dirs = path.substring(0, path.lastIndexOf(\"/\") + 1); // The path without the trailing portion.\n return \"f[path='\" + dirs + \"'][name='\" + name + \"']\"; // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
specifies the click events when the user selects a trip the methods receive the id of the trip selectQueryDBTripTitle is used to retrieve data about the trip, like the title and id selectQueryDBStory is sued to retrieve all the stories related to that trip | function setClickEventToTrip(li)
{
li.addEventListener('click', function () {
selectQueryDBTripTitle(li.id);
selectQueryDateStory(li.id);
}, false);
} | [
"function tripClick(trip) {\n let { first, last } = trip.firstAndLastTimes;\n first = d3.timeMinute.offset(first, -1);\n last = d3.timeMinute.offset(last, +1);\n // Update zoom status to reflect change in domain\n that.g.diagram.call(that.zoomBehaviour.transform, d3.zoomIdentity\n .s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given two points, return the line that goes through them in the form of ax + by + c = 0 | static get_line_equation_through_points(p1, p2) {
const a = (p2[1] - p1[1]);
const b = (p1[0] - p2[0]);
// If the points are the same, no line can be inferred. Return null
if ((a == 0) && (b == 0)) return null;
const c = p1[1]*(p2[0] - p1[0]) - p1[0]*(p2[1] - p1[1]);
re... | [
"function line(x1, y1, x2, y2, points) {\n var line = [];\n var m = (y2 - y1) / (x2 - x1);\n var b = -m * x1 + y1;\n if (x1-x2 == 0) {\n var src = Math.min(y1, y2), dst = Math.max(y1, y2);\n } else {\n var src = Math.min(x1, x2), dst = Math.max(x1, x2);\n }\n for (var x = src; x <... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius just... | static findPets({ tags, limit }) {
return new Promise(
async (resolve) => {
try {
resolve(Service.successResponse(''));
} catch (e) {
resolve(Service.rejectResponse(
e.message || 'Invalid input',
e.status || 405,
));
}
},
... | [
"marketsList() {\n let list = Object.values( this.marketsData );\n\n // apply search\n if ( this.marketsSearch.length > 1 ) {\n const match = String( this.marketsSearch ).trim().replace( /[^\\w]+/g, '|' );\n const regxp = new RegExp( '^.*\\/('+ match +')$', 'i' );\n list = list.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collapses all opened panels. | collapseAll() {
this.panels.forEach((panel) => { this._changeOpenState(panel, false); });
} | [
"collapseAll() {\n this.panels.forEach(panel => panel.collapse());\n }",
"closeAll() {\n this.closeSidepanels(this.openedSidepanels);\n }",
"expandAll() {\n if (this.closeOtherPanels) {\n if (this.activeIds.length === 0 && this.panels.length) {\n this._change... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempt to return the real system arch (not process.arch, which is only the Node binary's arch) | async getRealArch () {
if (this._cachedArch) return this._cachedArch
async function _getRealArch () {
const osPlatform = os.platform()
// eslint-disable-next-line no-restricted-syntax
const osArch = os.arch()
debug('detecting arch %o', { osPlatform, osArch })
if (osArch === 'arm... | [
"function getArch() {\n switch (process.arch) {\n case \"arm\":\n return \"armv6l\";\n case \"x32\":\n case \"ia32\":\n return \"i386\";\n case \"x64\":\n return \"x86_64\";\n }\n}",
"function getPlatformArch() {\n var platform = process.platform\n var arch\n if (process.arch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EVENT LISTENER encrypts the text entered by user | function encrypt(e) {
$.originalText.blur();
$.label2.enabled = true;
$.encryptedText.enabled = true;
//Encryption of text
var crypto = require("/crypto");
crypto.init("KEYSIZE_AES128");
$.encryptedText.text = crypto.encrypt({
source : $.originalText.getValue(),
type : "TYPE_HEXSTRING"
});
} | [
"function getText() {\n\t\tvar input = document.getElementById(\"inputText\").value;\n\t\tinputArr = input.split(\"\");\n\t\tencrypt();\n\t}",
"function encrypt () {\n var text = document.getElementById(\"decrypt-textarea\").value;\n document.getElementById(\"encrypt-textarea\").value = (encryptText(text.to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Forces redraw all canvas in the current collection | static redraw() {
let i = 0;
let s = SmartCanvas.collection.length;
for (; i < s; i++) {
SmartCanvas.collection[i].redraw();
}
} | [
"_refreshCanvas() {\n this._refreshCanvasSize();\n this.renderCanvas();\n }",
"function reDrawCanvas() {\n context.clearRect(0, 0, canvas.width, canvas.height);\n for(let i=0;i<rects.length;i++){\n rect(rects[i]);\n }\n}",
"redrawObjs() {\n\t\t\tthis.clearObj();\n\t\t\tthis.drawObjs();\n\t\t}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs an action if it exists. You can pass as many arguments as you want to this function; the only rule is that the first argument must always be the action. | function doAction()
/* action, arg1, arg2, ... */
{
var args = slice.call(arguments);
var action = args.shift();
if ('string' === typeof action) {
_runHook('actions', action, args);
}
return MethodsAvailable;
} | [
"function doAction( /* action, arg1, arg2, ... */\n ) {\n var args = Array.prototype.slice.call(arguments);\n var action = args.shift();\n if (typeof action === 'string') {\n _runHook('actions', action, args);\n }\n return MethodsAvailable;\n }",
"performAction () {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds nodes with missing properties such as name, description etc. They only have a valid id. | getEmptyNodes () {
var toFetch = []
this.g.graph.nodes().forEach((n) => {
if (n.properties === undefined) {
toFetch.push(n.id)
}
})
return toFetch
} | [
"function getAllNonRootNodes(fn) {\n db.find({ parentID: { $exists: true }, nodeID: { $ne: \"rootNode\" } }, { parentID: 1, processName: 1 }, returnDocs);\n}",
"function findNoID(elements) {\n for (var i = 0; i < elements.length; i++) {\n if (elements[i].id === \"\") {\n return elements[i];\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
todo: implement markTile volajte to cez konzolu | function markTile(row, col) {
// markne dlazdicu ked je CLOSED
// nastavi CLOSED, pokial bola predtym MARKED
} | [
"function modifyTileInCurrentDashboard(tile) {\n for (var tilesCount = 0; tilesCount < _currentDashboard.tiles.length; tilesCount++) {\n if (_currentDashboard.tiles[tilesCount].id == tile.id) {//todo verify if same object\n _currentDashboard.tiles[tilesCount].name = tile.name;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse and acts as a bridge between motion values and removeAxisDelta | function removeAxisTransforms(axis, transforms, _a) {
var _b = __read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];
removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale);
} | [
"function removeAxisTransforms(axis,transforms,_a,origin,sourceAxis){var _b=__read(_a,3),key=_b[0],scaleKey=_b[1],originKey=_b[2];removeAxisDelta(axis,transforms[key],transforms[scaleKey],transforms[originKey],transforms.scale,origin,sourceAxis);}",
"function removeAxisTransforms(axis, transforms, _a) {\n\t va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A player joins a lobby. Return true if successful, otherwise false. | joinLobby(playerId, playerSocket) {
let playerIndex = this.lobbyPlayers.findIndex(player => player.pid == playerId);
// Player is not in lobby yet; add them
if (playerIndex == -1) {
this.lobbyPlayers.push({ pid: playerId, socket: playerSocket, status: "In Lobby", type: "Human" });
return true;
}
return... | [
"function joinLobby(lobbyId) {\n playerPaddle.gameId = lobbyId;\n connection.invoke(\"AddPlayer\", lobbyId, playerPaddle.isOnRight, userHash);\n gameLoaded = true;\n //position player paddle\n playerPaddle.hitbox.topLeft = playerPaddle.isOnRight ? { X: 1250 - 20, Y: 0 } : { X: 20, Y: 0 };\n}",
"asy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change the play/stop button label | function updatePlayLabel(playState) {
isPlaying = playState;
var playLabel = isPlaying ? "Stop" : "Play";
playStopButton.value = playLabel;
} | [
"function changePlayButtonCaption()\n {\n if(mmuVideo.paused===true)\n {\n playButton.innerHTML=\"Play\";\n }\n else\n {\n playButton.innerHTML=\"Pause\";\n }\n }",
"function updatePlayStatusBtn() {\n toggleEl.tex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send search input to Redux searchReducer | sendSearchInput() {
var searchInput = this.searchInput.value;
this.props.sendSearchInput(searchInput);
} | [
"search (event) {\n this.props.dispatch({\n type: 'UPDATE_SEARCH_VALUE',\n value: event.target.value\n });\n }",
"saveSearch (state, payload) {\n state.search = payload.search\n }",
"function searchReducer(search = { isFetching: false, results: {}}, action) {\n console.debug(\"searchReduce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a hero ranking given the hero id and list of ranking details | function idToHeroRanking (rankings, heroId) {
for (let i = 0; i < rankings.length; i++) {
if (rankings[i].hero_id == heroId) {
return `${+(100 * rankings[i].percent_rank).toFixed(2)}%`;
}
}
return 'Unknown';
} | [
"function getRankedStats(app) {\n let url = makeUrl(`/lol/league/v3/positions/by-summoner/${app.data.summoner.id}`);\n request(url, function (error, response, body) {\n try {\n let obj = JSON.parse(body);\n let outputText = `You are ranked ${obj.tier} ${romanTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
User deletion with the auth firebase NOTE: THIS FUNCTION WILL WORK ONLY IF A USER IS SIGNED RECENTLY OTHERWISE YOU NEED TO REAUTHENTICATE, SEE DETAILS IN THE FIREBASE DOCUMENTATION | function userAccountDelete(){
// using delete will return a promise, and it will activate the onDelete function in the firebase.functions
var user = auth.currentUser;
user.delete().then(() => {
//user deleted
}).catch(err => {
//some error happened
});
} | [
"function deleteUser() {\n firebase\n .database()\n .ref('users/1234')\n .remove();\n }",
"function deleteAccount(){\n var user = auth.currentUser;\n var uid = user.uid;\n var password = document.getElementById(\"retype-pass\");\n const credential = firebase.auth.EmailAuthProvider.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a symlink, overwriting the target link, file, or directory if it exists | function symlinkWithOverwrite(source, target) {
var args = [source, target];
if (process.platform === "win32") {
if (!files.stat(source).isDirectory()) {
throw new Error("symlink source must be a directory: " + source);
}
args[2] = "junction";
}
try {
files.symlink.apply(files, args);
... | [
"createSymboliclink(target, link, done) {\n const commands = [\n 'mkdir -p ' + link, // Create the parent of the symlink target\n 'rm -rf ' + link,\n 'mkdir -p ' + utils.realpath(link + '/../' + target), // Create the symlink target\n 'ln -nfs ' + target + ' ' + li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to store rejected question add 10 point to the score array print the question to the page | function storeRejected(){
if(document.getElementById("question").value != ''){
//adds new score to score array
score.push(10);
//adds new question value from the input field to qAccepted array
qRejected.push(document.getElementById("question").value);
//prints array qRejected to the page
document.getElemen... | [
"function storeAccepted(){\n\t//adds new question value from the input field to qAccepted array\n\tif(document.getElementById(\"question\").value != ''){\n\t\t//adds new score to score array\n\t\tscore.push(1);\n\t\tqAccepted.push(document.getElementById(\"question\").value);\n\t\t//prints array qAccepted to the pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MAP Write a function called extractKey which accepts an array of objects and some key and returns a new array with the value of that key in each object. | function extractKey(arr, key) {
return arr.map(function(val){
return val[key];
})
} | [
"function extractKey(arr, key){\n return arr.map(function(obj){\n return obj[key];\n })\n}",
"function extractKey(array, key) {\n\treturn array.map(function(value) {\n\t\treturn value[key];\n\t})\n}",
"function extractKey(array, key) {\n\treturn array.map(function(value) {\n\t\treturn value[key];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the input box for the selected ... icon. | function getInputForIcon( moreIcon ) {
var input = moreIcon.nextElementSibling;
if ( input !== null && input.tagName !== 'INPUT' && input.tagName !== 'TEXTAREA' ) {
// Workaround for 1Password.
input = input.nextElementSibling;
}
return input;
} | [
"function getIcon() {\n\t\t\tif (buttonIcon) {\n\t\t\t\treturn buttonIcon;\n\t\t\t}\n\n\t\t\tconst activeOption = options.find((control) => control.value === currentValue);\n\n\t\t\tif (activeOption) {\n\t\t\t\treturn icons[activeOption.icon] ?? activeOption.icon;\n\t\t\t}\n\n\t\t\treturn icons[options[0].icon] ?? ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the tagline image | function initializeTagline() {
Snap.load('assets/images/tagline3.svg', animateTagline);
} | [
"constructor(img, tags) {\n this.img = img;\n this.tags = tags;\n }",
"drawTagLine() {\n if (!this.top || this.layerIndex > 0) {\n return;\n }\n\n const wordWidth = this.word.textWidth;\n\n if (wordWidth < this.config.wordBraceThreshold) {\n // Draw a single vertical line\n this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up the integrations | setupIntegrations() {
if (this._isEnabled() && !this._integrationsInitialized) {
this._integrations = setupIntegrations(this._options.integrations);
this._integrationsInitialized = true;
}
} | [
"setupIntegrations() {\n if (this._isEnabled() && !this._integrationsInitialized) {\n this._integrations = setupIntegrations(this._options.integrations);\n this._integrationsInitialized = true;\n }\n }",
"setupIntegrations() {\n if (this._isEnabled() && !this._integrationsInitialized... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test JWT authorization flow | function testJWT() {
//open link in browser to provide consent for server to impersonate user
// ignore site can't be reached error as long as code appears in the URL
var res = getApplicationConsentURI();
debug(res)
// generate the encrypted JWT, then use the JWT to request an access token
var jwt = genera... | [
"function authJwt() {\n const secret = process.env.secret;\n const api = process.env.API_URL;\n console.log(\"I am getting called\");\n return expressJwt({\n secret,\n algorithms: [\"HS256\"],\n // isRevoked: isRevoked,\n }).unless({\n path: [\n {\n url: /\\/api\\/v1\\/books(.*)/,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort the provided markers from north to south based on the vessels GPS coordinates. | function markerSortNS(a, b) {
return Number(a.vessel.lat) - Number(b.vessel.lat);
} | [
"function sortStations(stations, latLng) {\n stations.sort((a, b) => a.distance - b.distance);\n }",
"function markerSortWE(a, b) {\n return Number(a.vessel.lon) - Number(b.vessel.lon);\n}",
"function sortAndCreateMarker() {\n let sortedPlaces = \n places.sort(function (a, b) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`getSubjects` returns all subjects that match the pattern. Setting any field to `undefined` or `null` indicates a wildcard. | getSubjects(predicate, object, graph) {
var results = [];
this.forSubjects(function (s) {
results.push(s);
}, predicate, object, graph);
return results;
} | [
"getSubjects(predicate, object, graph) {\n var results = [];\n this.forSubjects(function (s) { results.push(s); }, predicate, object, graph);\n return results;\n }",
"getSubjects(predicate, object, graph) {\n const results = [];\n this.forSubjects(s => {\n results.push(s);\n }, predicate, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sortPosts sort the this.props.posts. sort order is decided by this.state.postOrder. | sortPosts() {
const orderBy = this.state.postsOrder;
this.props.posts.sort((post1, post2) => {
switch (orderBy) {
case 'timestamp' : return post1.timestamp - post2.timestamp;
case 'voteScore' : return post2.voteScore - post1.voteScore;
... | [
"async sortPosts(sortStyle) {\n let posts = this.posts;\n if (sortStyle === \"post-sort-asc\") {\n posts.sort( function(a , b){\n if(a.date > b.date) {\n return 1;\n }\n if(a.date < b.date) {\n return -1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that returns a promise to get and return the user's location | function getUserLocation() {
let url = "https://www.googleapis.com/geolocation/v1/geolocate?key=" + MAPSKEY;
const request = new Request(url, {method: "POST"});
return new Promise((resolve, reject) => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(positi... | [
"function getUserLocation() {\n if (navigator.geolocation) {\n return new Promise((resolve, reject) =>\n navigator.geolocation.getCurrentPosition(resolve, reject)\n );\n } else {\n return new Promise(resolve => resolve({}));\n }\n}",
"function location(){\n\t\tconst promis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a sample code to call CreditApi, call createCredit method to process a credit | function processACredit() {
try{
var apiClient = new CybersourceRestApi.ApiClient();
var instance = new CybersourceRestApi.CreditApi(apiClient);
clientReferenceInformation = new CybersourceRestApi.V2paymentsClientReferenceInformation();
clientReferenceInformation.code = "12345678";
orderInfor... | [
"createAccount(data, customerid) {\n \n var createAccountURL = this.baseURL + \"/customers/\" + customerid + \"/accounts\" + \"?key=\" + this.API_KEY;\n \n /* data schema\n {\n \"type\": \"Credit Card\",\n \"nickname\": \"string\",\n \"rewards\": 0,\n \"balance\": 0,\n \"acco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles click for each modificable tags, it will trigger some methods depending on the type of the Cream Tag | function HandleClick(tag, event) {
var creamType = tag.dataset.creamToppingType;
//Changing color to edit color
$(tag).css("border", "3px solid #38220f");
// Editing creamText
if (creamType == "text") {
//Setting text to content editable
$(tag).attr("contenteditable", true);
}
... | [
"function HandleClick(tag, event) {\n var creamType = tag.dataset.creamType;\n //Changing color to edit color\n $(tag).css(\"border\", \"3px solid #38220f\");\n // Editing creamText\n if (creamType == \"text\") {\n //Setting text to content editable\n $(tag).attr(\"contenteditable\", tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom tracking for Editors' Picks component | function trackEditorsPicks(msg) {
var s = s_gi(s_account);
s.trackExternalLinks = false;
s.linkTrackVars = 'prop6,eVar6';
s.tl(this, 'o', msg);
} | [
"logPicking() {\n if (this.scene.pickMode === false) {\n if (this.scene.pickResults != null && this.scene.pickResults.length > 0) {\n for (let i = 0; i < this.scene.pickResults.length; i++) {\n const obj = this.scene.pickResults[i][0];\n if (obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end Discipline start Paper_format_other | function Paper_format_other(){
} | [
"function\n oddlyFormatted() {}",
"enterReportGroupDescriptionEntryFormat2(ctx) {\n\t}",
"function Ending4() {\n _super.call(this, \"The Negotiation\", \"The other person agrees that he/she does\\nnot think he/she could beat you in a 1-on-1\\nfight. He/She decides to think of a solution\\nalong ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a function, that, as long as it continues to be invoked, will not be triggered. The function will be called after it stops being called for N milliseconds. If `immediate` is passed, trigger the function on the leading edge, instead of the trailing. | function debounce(func, wait, immediate) {
var timeout;
return function () {
var args = arguments,
callNow = immediate && !timeout,
later = function () {
timeout = null;
if (!immediate) {
func.app... | [
"function debounce(N, fn, immediate = false) {\n let timeout;\n return function(...args) {\n const later = function() {\n timeout = null;\n if (!immediate) fn(...args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, N);\n if (callNo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates an existing Verification | function updateVerification(id, object, done, next){
Verification.findOneAndUpdate({ _id: id}, object).then((verification) => {
getVerification(verification._id, (verify) => {
return done(verify);
}, next);
}).catch(next);
} | [
"function updateChallengeToVerified(challenge) {\n const params = {\n TableName: 'VerificationChallenges',\n UpdateExpression: 'SET isVerified = :isVerified',\n ExpressionAttributeValues: {\n ':isVerified': { BOOL: true }\n },\n Key: {\n createdDate: { S: challenge.Item.createdDate.S },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render Custom Send Button | renderSendButton(props) {
return (
<Send {...props}>
<View style={Styles.chatView}>
<Icon name="rightcircle" type="AntDesign" style={Styles.arrowStyle} />
</View>
</Send>
);
} | [
"get sendBtn() {\n return app.client.$(\"button=Send\");\n }",
"function sendButtonMessage(recipientId, title, buttons) {\n /*if (!buttons) {\n buttons = [{\n type: \"web_url\",\n url: \"https://www.oculus.com/en-us/rift/\",\n title: \"Open Web URL\"\n }, {\n type: \"postback\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if there is another possible move for the given word Returns false if there is not another possible move | function hasMoreMoves (wordArray) {
var word = formWord(wordArray);
for (var i = 0; i < wordArray.length; i++) {
// Only check if a word can be made by changing the letter at i if
// the letter is actually available for changing
if (!(wordArray[i].color === state.toColor)) {
... | [
"function checkWord() {\n\t// clears the pos array so that a player cannot highlight the same word twice\n\tfunction clearPos(p) {\n\t\tp.start = p.end = 0;\n\t\treturn true;\n\t}\n\t// user highlights from first letter to last\n\tif (pos.some(function(o) {\n\t\treturn o.start === click.startPos && o.end === click.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new `AWS::CloudFront::CloudFrontOriginAccessIdentity`. | constructor(scope, id, props) {
super(scope, id, { type: CfnCloudFrontOriginAccessIdentity.CFN_RESOURCE_TYPE_NAME, properties: props });
cdk.requireProperty(props, 'cloudFrontOriginAccessIdentityConfig', this);
this.attrS3CanonicalUserId = cdk.Token.asString(this.getAtt('S3CanonicalUserId'));
... | [
"static fromOriginAccessIdentityName(scope, id, originAccessIdentityName) {\n try {\n jsiiDeprecationWarnings.print(\"aws-cdk-lib.aws_cloudfront.OriginAccessIdentity#fromOriginAccessIdentityName\", \"use `fromOriginAccessIdentityId`\");\n }\n catch (error) {\n if (process.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When `super` is called, we need to find the name of the current method we're in, so that we know how to invoke the same method of the parent class. This can get complicated if super is being called from an inner function. `namedMethod` will walk up the scope tree until it either finds the first function object that has... | namedMethod() {
var ref;
if (((ref = this.method) != null ? ref.name : void 0) || !this.parent) {
return this.method;
}
return this.parent.namedMethod();
} | [
"namedMethod() {\n var ref;\n if (((ref = this.method) != null ? ref.name : void 0) || !this.parent) {\n return this.method;\n }\n return this.parent.namedMethod();\n }",
"function _super(methodName, args) {\n\n // Keep track of how far up the prototype chain we have traversed,\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this pulls the data from the friends API and uses the structure built in the POSTtoDOM function to build the cards. It is used in the DOMappender to create the DOM for the message page. | listCards() {
const formArticle = document.createElement("article");
formArticle.classList.add("card-deck")
formArticle.id = "friends-article";
formArticle.appendChild(build.elementWithText("h1", `${window.sessionStorage.getItem("userName")}'s Friends: `, "friendPageHeader"));
fetch.getAll(`users/${... | [
"function populateFriendWrap(friend, areFriends, requestedFriend) {\n\t\n\tvar friendImage = document.createElement(\"IMG\");\n\tfriendImage.setAttribute(\"src\", friend.avatar);\n\tfriendImage.setAttribute(\"alt\", friend.name);\n\tfriendImage.className = \"friend-image\";\n\t_friendWrap1.appendChild(friendImage);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes a MySQL query to fetch information about a single specified user based on its ID. Does not fetch post, comment, and like data for the users. Returns a Promise that resolves to an object containing information about the requested user. If no user with the specified ID exists, the returned Promise will resolve t... | async function getUserByUserId(id) {
const [ results ] = await mysqlPool.query(
'SELECT * FROM users WHERE userId = ?',
[ id ]
);
return results[0];
} | [
"function getUserById(id) {\n return new Promise((resolve, reject) => {\n mysqlPool.query(\n 'SELECT * FROM Users WHERE id = ?',\n [ id ],\n (err, results) => {\n if (err) {\n reject(err);\n } else {\n resolve(results[0]);\n }\n }\n );\n });\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
first creates a counter of how many random numbers we see before it stops, this counter is also random (between 2040) to create differences in timing | function createRandomCounter() {
var randomCounter = mathRand(10) + 20;
return randomCounter;
} | [
"function randomCount(){\n\treturn Math.floor(Math.random() * 10) + 1 ;\n}",
"function randomGame() {\n var timerId = setInterval(randomNumberPicker, 1000);\n var counter = 0;\n function randomNumberPicker() {\n var randomNumer = Math.random();\n counter++;\n console.log(randomNumer);\n if (randomN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
REMOVE column from series Eg. s_io.remove(series, metric_name) | function remove(series, metric_name) {
var mcolumn = series.meta.columns.indexOf(metric_name); // test for metric_name
if (mcolumn >= 0) {
series.data.splice(mcolumn,1);
return true;
}
else
return -1;
} | [
"remove() {\n const series = this, chart = series.chart;\n // column and bar series affects other series of the same type\n // as they are either stacked or grouped\n if (chart.hasRendered) {\n chart.series.forEach(function (otherSeries) {\n if (otherSeries.type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the cliententered passwords match, and enable 'Register' button if so. Also display messages in the DOM to let the client know whether or not their passwords match | function passwordsMatch() {
if (register_password.value.length !== 0 && register_password_again.value.length !== 0) {
if (register_password.value === register_password_again.value) {
document.querySelector('.btn-register').disabled = false;
document.querySelector('#passwords_match').classList.... | [
"function comparePassword() {\n let passwordsMatch = false;\n let pwd1 = $(\"#user_key\").val();\n let pwd2 = $(\"#user_key_check\").val();\n if (pwd1 == pwd2) {\n $(\"#password_confirm\").text(`Passwords match!`);\n $(\"#register_user_button\").removeClass(\"disabled\");\n passwordsMatch = true;\n } ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets option "triggerGlobalClose" value. | get triggerGlobalClose() {
return this._triggerGlobalClose;
} | [
"get closeButtonMode() {\n\t\treturn this.nativeElement ? this.nativeElement.closeButtonMode : undefined;\n\t}",
"get autoClose() {\n\t\treturn this.hasOwnProperty('_autoClose') ? this._autoClose : !this.clickOnly;\n\t}",
"function optionPopUpClose(){\n//\thighLightId();\n\tif ($('#StatTerminal').is(':checked')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the game as content of the 'target' node. | function renderGame( game, queue ) {
setRandomPosition();
var t = getTemplate( game );
if ( t === null ) {
if ( queue ) {
queue.push( { target: game.target, id: game.getId() } );
//Setup handler to wait for template...
ce.attachEven... | [
"function display($target) {\n\n $target.html(render());\n\n }",
"function render() {\n //reset prev target styling\n if (prevTarget) {\n let prevTargetEl = document.getElementById(`c${prevTarget}`);\n prevTargetEl.style.backgroundColor = DEFAULT_CELL_COLOR;\n prevTargetEl.sty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert and Copy first row Formulas to new inserted rows | function addNewRows(sheet, rowNum, numberOfRows, content){
var curSheet = ss.getSheetByName(sheet);
var formulaRow = curSheet.getRange(rowNum, 8, 1,curSheet.getLastColumn());
curSheet.insertRowsAfter(rowNum, numberOfRows).activate().getActiveRange();
var brandRow = rowNum +1;
var newRows = curSheet.getRange(b... | [
"insertRowBefore() {\n this.insertRow();\n }",
"function addRow() {\n var $newRow = lastRow().clone(true).insertAfter(lastRow());\n clearRow($newRow.get());\n }",
"insertRow(data) {\n this.sheet.insertRowBefore(this.firstRow);\n this.updateRow(this.firstRow, data);\n return this.firstRow;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate random authentication number | function getAuthNum() {
return Math.floor(Math.random() * 90000) + 10000
} | [
"function makeAuthNumber() {\n var characterSelection = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var authNum = '';\n var digit;\n for (digit = 0; digit < 16; digit++) {\n authNum += characterSelection.charAt(Math.floor(Math.random() * characterSelection.length));\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the students' answers to the table | function addAnswersToTable(nextRow, student) {
let tdString = `<td>${student.name}</td>`
for(let key in ANSWERS_SUM) {
tdString += `<td>${student[key]}</td>`
}
nextRow.innerHTML += tdString
} | [
"function createAnswerTable() {\r\n var header = document.getElementById('myTable').getElementsByTagName('thead')[0]\r\n var newHeader = header.insertRow()\r\n var headerCell = newHeader.insertCell(0)\r\n headerCell.innerHTML = \"<b>Answers</b>\"\r\n tagInfo.forEach(obj => {\r\n addTableAnswer(obj.question)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an origin c and direction defining vertex d, returns a comparator for points. The points are compared according to the angle they create with the vector cd. | function angleCompare (c, d) {
var cd = span(c, d);
// Compare angles ucd and vcd
return function (u, v) {
var cu = span(c, u);
var cv = span(c, v);
var cvxcu = cross(cv, cu)
// Check if they happen to be equal
if (cvxcu == 0 && dot(cu, cv) >= 0)
return 0;
var cuxcd = cross(cu, cd);
... | [
"comparePolyPoints(c) {\n const center = c;\n return (p1, p2) => {\n const a = p1,\n b = p2;\n\n if (a.x - center.x >= 0 && b.x - center.x < 0) {\n return -1;\n }\n if (a.x - center.x < 0 && b.x - center.x >= 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a new `Highlight` instance. | function Highlight(){
if (!(this instanceof Highlight)) return new Highlight();
this.languages = {};
this.prefix('Highlight-');
} | [
"function CustomHighlight() {}",
"function initHighlighting() {\n if (initHighlighting.called)\n return;\n initHighlighting.called = true;\n\n var blocks = document.querySelectorAll('pre code');\n Array.prototype.forEach.call(blocks, highlightBlock);\n }",
"get highlight() { return this._highl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
With alpha set to false on 2d context for optimized performance, set bg color styles. | _setBackgroundLayerStyles() {
this.b.fillStyle = "white";
this.b.fillRect(0, 0, WORLD.WIDTH, WORLD.HEIGHT);
} | [
"function setBackground()\n{\n canvas.style.backgroundColor = 'rgb(' + [paintColor[0],paintColor[1],paintColor[2]].join(',') + ')';\n}",
"background(r, g, b) {\n this.ctx.canvas.style.backgroundColor = getColorString(this.palette, r, g, b);\n }",
"function background () {\n\tcontext.fillStyle = \"#\" + bgC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the movie inside the "db". | save(movie) {
movie.id = crypto.randomBytes(20).toString('hex'); // fast enough for our purpose
this.movieList.push(movie);
return 1;
} | [
"save(callback, movie) {\n startconnection();\n movie.id = crypto.randomBytes(20).toString('hex');\n connection.query(\"INSERT INTO movie SET ?\", movie, function(err,result,fields) {\n if(err) {\n stopconnection();\n callback(0);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bind router handler service. | bindRouteHandler() {
this.app.singleton('router.handler', _Handler.default);
} | [
"bindRouteHandler() {\n\t\tthis.app.singleton('router.handler', Handler);\n\t}",
"function bindFunction(prefix,route, handler) {\n route = routeSplit(route);\n router[route.method](opts.prefix+prefix+route.routePath,handler);//register router\n }",
"function bindHandlers() {\n\tconst apibuilder = APIBuil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exported ExplorableNumberlineTitle / global ExplorableHintedText | function ExplorableNumberlineTitle(options) {
let backgroundColor,
coordinates,
fontSize,
fontFamily,
fontWeight,
foregroundColor,
string,
textAnchor,
title,
where;
title = this;
init(options);
return title;
function init(options) {
_required(options);
_default... | [
"exuentText() { return helper.playbill_title(this.title) + \"*A game of text-based intrigue and betrayal has been cancelled successfully.*\"; }",
"function TextExt() {}",
"function ExplorableNumberlineOrientationMarker(options) {\n let backgroundColor,\n coordinates,\n fontFamily,\n fontSize,\n fon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
metodo prdicado que valida si el numero es multiplo de Mil (1.000) | function multiploDeMil(vlRecarga){
var residuo = (vlRecarga/1000) % 1;
return !(residuo === 0);
} | [
"function isMultiplier(value,multiple){\tif(isNumber(value) && isInt()){if(Math.floor(value/multiplier) == value/multiplier){\treturn true}\treturn false;}\treturn null; }",
"function excercice(num) {\n if(num <= 0 || isNaN(num)){\n return(\"ERROR\");\n } else if (num >= 1000000){\n return(num... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Defines a nonenumerable property on the given object. | function addNonEnumerableProperty(obj, name, value) {
Object.defineProperty(obj, name, {
// enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
value: value,
writable: true,
configurable: true,
});
} | [
"function addNonEnumerableProperty(obj, name, value) {\n Object.defineProperty(obj, name, {\n // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it\n value: value,\n writable: true,\n configurable: true,\n });\n }",
"function fixedProp (obj, na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates the debug mode for all interpreters | function updateDebugMode(mode) {
debugMode = mode;
if (interpreters !== null) {
for (var i = 0; i < numRobots; i++) {
interpreters[i].setDebugMode(mode);
}
}
updateBreakpointEvent();
} | [
"updateDebugMode() {\n if (this.isDebug === true) {\n this.log = console.log.bind(console);\n this.error = console.error.bind(console);\n this.warn = console.warn.bind(console);\n }\n else {\n this.log = R.identity(undefined);\n this.error ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function initializes the module. Makes use of Twitter Bootstrap Popover to create an overlay experience. Popover is shown when user hovers over the elements that have ".boxart" css class. | function init() {
$(".boxart").popover({
content: getPopoverContent,
trigger: 'hover',
html: true,
container: 'body',
viewport: ".content-wrap",
placement: "auto"
});
} | [
"function initPopovers() {\n $(function () {\n $('[data-toggle=\"tooltip\"]').tooltip();\n });\n\n $(function () {\n $('[data-toggle=\"popover\"]').popover();\n });\n }",
"function initialisePopover() {\n\t$('[data-toggle=\"popover\"]').popover();\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add courses array to local storage | function addToLocalStorage(arr) {
localStorage.setItem("myCourses", JSON.stringify(arr));
} | [
"function saveCourseLocalStorage(course){\r\n let courses;\r\n courses=getCoursesLocalStorage();\r\n courses.push(course);\r\n localStorage.setItem('courses',JSON.stringify(courses));\r\n}",
"function savecourseLocalStorage(course) {\r\n let courses;\r\n // Take the value of an array with LS or empty data\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gridToCenterPx : Number > Number converts the grid position into its bitmap position (center of the grid) | function gridToCenterPx(grid) {
var x = grid.x * CELLSIZE + 10;
var y = grid.y * CELLSIZE + 10;
return new Posn(x, y);
} | [
"gridPosition()\n {\n var gridCoord = this.pos.copy();\n gridCoord.div_int(this.cellSize);\n gridCoord.ceil();\n gridCoord.x = -gridCoord.x\n\n return gridCoord;\n }",
"function getCenterCoords(rowNum, columnNum){\n\t\treturn {y: rowNum*70+75, x: columnNum*70+35};\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle between showing and hiding the navigation menu links when the user clicks on the hamburger menu / bar icon | function toggleNavLinks() {
let hamburgerLinks = document.getElementById("myLinks");
if (hamburgerLinks.style.display === "block") {
hamburgerLinks.style.display = "none";
} else {
hamburgerLinks.style.display = "block";
}
} | [
"function ShowHideMenu() {\n $(\".nav__icon\").toggleClass('change'); // toggle menu icon (X)<-->hamburger\n $(\".nav__menu\").toggleClass('is-open'); // show/hide dropdown menu\n} // END ShowHideMenu",
"function toggleMobileNav() {\n var x = document.getElementById('mobileLinks');\n if (x.style.display === '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if current build's PR has given label | function hasLabel(label) {
return map(context.payload.pull_request.labels, (label) => label.name).includes(label)
} | [
"function checkLabel(issue, label) {\n if (!issue.labels)\n return false;\n \n for (var i = 0; i < issue.labels.length; i++) {\n if (issue.labels[i].name === label) {\n return true;\n }\n }\n\n return false;\n }",
"async... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
6) Arrays prependKitten(name) prepends a kitten to the kittens array and returns a new array, // // leaving the kittens array unchanged: | function prependKitten(name){
var newArray = [name, ...kittens];
return newArray;
} | [
"function prependKitten(name){\n var ckittens = kittens\n var dkittens = [...ckittens]\n dkittens.unshift(name)\n return dkittens\n ckittens\n}",
"function prependKitten(){\n return ['Arnold',...kittens];\n}",
"function destructivelyPrependKitten(name){\n kittens.unshift(name);\n return kittens;\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the helper version of TLiteral.prototype.getOpenCLSize() These functions should be in sync. Argument 't' is some scalar or pointer type | function getOpenCLSize(type) {
var base_type = stripToBaseType(type);
if(base_type === type) {
switch (base_type) {
case "signed char":
case "unsigned char":
case "unsigned /* clamped */ char":
return 1;
... | [
"function __getTypeSize(typeTable, typeName)\r\n{\r\n var nativeType = host.getModuleType(typeTable.__boundModule, typeName);\r\n if (nativeType != null && nativeType !== undefined)\r\n {\r\n return nativeType.size;\r\n }\r\n else\r\n {\r\n return __getSyntheticTypeSize(typeName, typ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get List of filtered Management | getListManagement(req, res) {
Management.findAll({
where: {
'ManagementType': req.params.id
}
}).then(function(Management) {
if (Management) {
res.json(Management);
} else {
res.send(401, "Management not foun... | [
"getFilteredList(filter) {\n var fl = [];\n for(i in this.card) {\n var c = this.card[i];\n if(filter(c))\n fl.push(c);\n }\n return fl;\n }",
"function measuresList() {\n return $filter('familyFilter')(vm.srcData, vm.familyFilter);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SETUP SIZE WIDTH/HEIGHT MARGIN ON PAGINNER + Total distance is calculated by 'marginright' & 'marginbottom' > Not effect to size 100% & position of pagination > Check vertical tabs outside > remove width on pagInner | function SetupSizeOnInner() {
var wInner = isHor ? (op.typeSizeItem == 'max' ? p.wMax : p.wMin) : p.wMax, hInner = !isHor ? (op.typeSizeItem == 'max' ? p.hMax : p.hMin) : p.hMax, styles = {
'width': wInner,
'height': hInner
};
// Ad... | [
"function SetupSizeOnInner() {\n var wInner = isHor ? (op.typeSizeItem == 'max' ? p.wMax : p.wMin) : p.wMax,\n hInner = !isHor ? (op.typeSizeItem == 'max' ? p.hMax : p.hMin) : p.hMax,\n styles = {\n 'width' : (is.pagOutside && !isHor) ? '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
restore notes from trash | function restoreNote(divNo) {
titles.push(trashTitles[divNo]); //restore title in array titles
notes.push(trashNotes[divNo]); //restore note in array notes
setArray("titles", titles); //restore also under localStorage
setArray("notes", notes); //restore also under localStorage
trashTitles.splice(divNo, 1); /... | [
"function removeNotes() {\n localStorage.setItem(\"backupNotes\", localStorage.getItem(\"notes\"));\n localStorage.removeItem(\"notes\");\n location.reload();\n}",
"function saveTrashState(){\n localStorage.setItem('trash', JSON.stringify(trashNotes));\n return false;\n }",
"function removeN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trigger sparkline draw for each currency pair in array. | drawSparkLine(currencyList) {
currencyList.forEach(pair => {
pair.drawSparkLine()
})
} | [
"drawSparkLine(currencyPairList) {\n currencyPairList.forEach(pair => {\n pair.drawSparkLine()\n })\n }",
"function updateSparkLine() {\n for (let index in midPrices) {\n const spark = document.getElementById(index);\n Sparkline.draw(spark,midPrices[index])\n }\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |