query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Binds Back Key Events. | function bindBackKeyEvents() {
document.addEventListener('tizenhwkey', function keyEventHandler(ev) {
var page = document.getElementsByClassName("active")[0],
pageId = page ? page.id : "";
if (ev.keyName === "back") {
if (pageId === "page-main") {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onBackKey(){\n\tif(app.session.data.extra_prev_state > 0){\n\t\tback_to_pre();\n\t}else{\n\t\thide_all_pages();\n\t\tif(app.session.data.cstate > 0){\n\t\t\tvar callback = app.session.data.state_back_callback[app.session.data.cstate];\n\t\t\tif(callback !== null)\n\t\t\t\tcallback();\n\t\t}\n\t\tstop_proc... | [
"0.67798173",
"0.66035974",
"0.6569989",
"0.6569989",
"0.65219736",
"0.6511795",
"0.63995606",
"0.63196754",
"0.6290865",
"0.62608725",
"0.62608725",
"0.62483335",
"0.6231515",
"0.6203613",
"0.62021244",
"0.619766",
"0.6179629",
"0.6174018",
"0.6171884",
"0.6168639",
"0.61645... | 0.6928747 | 0 |
tracks player hits slaps player, reducing his health | function slap() {
if (Player.health <= 0) {
return;
}
Player.health -= 1 - (1 * Player.addMods());
Player.damageMods();
document.getElementById("armor-message").innerText = ""
//this is to keep the health bars current
Player.hits++;
update();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"player_got_hit()\n {\n const newAudio = this.sound.damage.cloneNode();\n newAudio.play();\n this.health--;\n if(this.health <=0)\n this.gameOver=true;\n this.tookDamage=true;\n\n }",
"use(player) {\n player.health -= 15;\n if (player.health < 0... | [
"0.71109784",
"0.67970055",
"0.6659851",
"0.66256726",
"0.6599294",
"0.6561999",
"0.6557888",
"0.649079",
"0.64621687",
"0.6449899",
"0.64467496",
"0.6409693",
"0.64032984",
"0.6398046",
"0.6384212",
"0.63530916",
"0.6343251",
"0.6339024",
"0.6314367",
"0.6294774",
"0.6271788... | 0.6833303 | 1 |
punches player, reducing his health | function punch() {
if (Player.health <= 0) {
return;
}
Player.health -= 5 - (5 * Player.addMods());
Player.damageMods();
document.getElementById("armor-message").innerText = ""
//this is to keep the health bars current
Player.hits++;
update();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"damagePlayer(player) {\r\n player.health -= this.damage;\r\n player.damageTakenSound.play();\r\n }",
"function punch() {\n health -= 2 + target.modifier\n health.hit++\n drawhealth()\n console.log(\"punchworks\")\n}",
"use(player) {\n player.health -= 15;\n if... | [
"0.7289409",
"0.72362715",
"0.7218669",
"0.6991284",
"0.6968673",
"0.69316304",
"0.6868106",
"0.6812836",
"0.6801563",
"0.6800645",
"0.67703384",
"0.67660475",
"0.6755601",
"0.6733757",
"0.6725758",
"0.66933036",
"0.6641545",
"0.6635801",
"0.6635074",
"0.66208255",
"0.6539409... | 0.7562534 | 0 |
kicks player, reducing his health | function kick() {
if (Player.health <= 0) {
return;
}
Player.health -= 10 - (10 * Player.addMods());
Player.damageMods();
document.getElementById("armor-message").innerText = ""
//this is to keep the health bars current
Player.hits++;
update();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function kick() {\n health -= 3 + target.modifier\n hit++\n drawhealth()\n console.log(\"kickworks\")\n}",
"use(player) {\n player.health -= 15;\n if (player.health < 0) player.health = 0;\n }",
"function healPlayer(val) {\n\tplayer.health.now += val;\n\tif(player.health.no... | [
"0.7616606",
"0.7592347",
"0.7241616",
"0.7235035",
"0.68838483",
"0.6857338",
"0.68411565",
"0.6773824",
"0.6758481",
"0.67526656",
"0.6723547",
"0.6704554",
"0.67038596",
"0.66687924",
"0.6656413",
"0.66454405",
"0.6634948",
"0.663318",
"0.6620355",
"0.6618874",
"0.6615954"... | 0.77268255 | 0 |
utility that returns 2d array filled with random numbers or with value s, if provided | function randn2d(n, d, s) {
const uses = typeof s !== 'undefined';
const x = [];
for (let i = 0; i < n; i++) {
const xhere = [];
for (let j = 0; j < d; j++) {
if (uses) {
xhere.push(s);
} else {
xhere.push(randn(0.0, 1e-4));
}
}
x.push(xhere);
}
return x;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _2DArray(rows,cols)\n{\n\tvar i;\n\tvar j;\n\tvar a = new Array(rows);\n\tfor (i=0; i < rows; i++)\n\t{\n\t\ta[i] = new Array(cols);\n\t\tfor (j=0; j < cols; j++)\n\t\t{\n\t\t\tif ((rand() & 0xF) == 0)\n\t\t\t\ta[i][j] = 999;\n\t\t\telse\n\t\t\t\ta[i][j] = rand() & 0xF;\n\t\t}\n\t}\n\treturn(a);\n}",
"f... | [
"0.67940646",
"0.67472583",
"0.67193437",
"0.65923893",
"0.6507754",
"0.6481577",
"0.6470633",
"0.64700603",
"0.64194554",
"0.6411394",
"0.6375117",
"0.6362497",
"0.6360548",
"0.6340194",
"0.6295483",
"0.62811947",
"0.6274302",
"0.62727684",
"0.62446827",
"0.6234044",
"0.6208... | 0.6813342 | 0 |
compute L2 distance between two vectors | function computeVectorDistance(x1, x2) {
const D = x1.length;
let d = 0;
for (let i = 0; i < D; i++) {
const x1i = x1[i];
const x2i = x2[i];
d += (x1i - x2i) * (x1i - x2i);
}
return d;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function vectorDist(a, b) {\n return Math.sqrt(\n Math.pow(a[0]-b[0], 2) +\n Math.pow(a[1]-b[1], 2) +\n Math.pow(a[2]-b[2], 2)\n );\n}",
"function distance(v1, v2) {\n return Math.sqrt((v1[0] - v2[0])*(v1[0] - v2[0]) +\n (v1[1] - v2[1])*(v1[1] - v2[1]));\n}",
"function Vecto... | [
"0.79782254",
"0.7524434",
"0.7474241",
"0.744544",
"0.7380993",
"0.731887",
"0.7293463",
"0.72837746",
"0.72698045",
"0.70598316",
"0.7040607",
"0.70161986",
"0.69944984",
"0.6952989",
"0.6934314",
"0.69021153",
"0.688133",
"0.68525976",
"0.6849292",
"0.684186",
"0.6791963",... | 0.7577057 | 1 |
compute pairwise distance in all vectors in X | function pairwiseDistances(X) {
const N = X.length;
const dist = zeros(N * N); // allocate contiguous array
for (let i = 0; i < N; i++) {
for (let j = i + 1; j < N; j++) {
const d = computeVectorDistance(X[i], X[j]);
dist[(i * N) + j] = d;
dist[(j * N) + i] = d;
}
}
return dist;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function computeVectorDistance(x1, x2) {\n\tconst D = x1.length;\n\tlet d = 0;\n\tfor (let i = 0; i < D; i++) {\n\t\tconst x1i = x1[i];\n\t\tconst x2i = x2[i];\n\t\td += (x1i - x2i) * (x1i - x2i);\n\t}\n\treturn d;\n}",
"_computeDistances(vector) {\n\t\tvar subdims = this.centroids.shape[0];\n\t\tvector = vector... | [
"0.67998064",
"0.6411161",
"0.59750426",
"0.576232",
"0.57241946",
"0.5700649",
"0.5672103",
"0.5642947",
"0.5568429",
"0.55175316",
"0.5471849",
"0.5456604",
"0.54566026",
"0.5413681",
"0.5394374",
"0.5389145",
"0.5358496",
"0.5347907",
"0.53396475",
"0.5328411",
"0.52821803... | 0.8258238 | 0 |
this function takes a given distance matrix and creates matrix P from them. D is assumed to be provided as a list of lists, and should be symmetric | initDataDist(distancesMatrix) {
const N = distancesMatrix.length;
assert(N > 0, ' X is empty? You must have some data!');
// convert D to a (fast) typed array version
const convertedDistances = zeros(N * N); // allocate contiguous array
for (let i = 0; i < N; i++) {
for (let j = i + 1; j < N; j++) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mds( D )\n\n // Perform Classic MDS based on tweet dissimilarity matrix\n //\n // D: Dissimilarity matrix\n{\n var B;\t\t\t\t// Double centering matrix\n var D_sqr = [ ];\t\t\t// Squared dissimilarity matrix\n var diag;\t\t\t\t// Matrix w/sqrt(eigenval) on diagonal\n var E;\t\t\t\t// Eigenve... | [
"0.5453278",
"0.5306738",
"0.5277364",
"0.5151982",
"0.5084324",
"0.50751644",
"0.50529987",
"0.5027569",
"0.5009152",
"0.49836004",
"0.49595344",
"0.48947534",
"0.4856972",
"0.48176765",
"0.47064492",
"0.46824858",
"0.46785057",
"0.4675893",
"0.46327743",
"0.46094295",
"0.46... | 0.61841744 | 0 |
(re)initializes the solution to random | initSolution() {
// generate random solution to t-SNE
this.solution = randn2d(this.N, this.dim); // the solution
this.gains = randn2d(this.N, this.dim, 1.0); // step gains to accelerate progress in unchanging directions
this.ystep = randn2d(this.N, this.dim, 0.0); // momentum accumulator
this.iter = 0;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setRandom() {\n let temp_matrix = [];\n let temp_i = -1;\n let temp_j = -1;\n let countRand = 0;\n\n //get index with minimal set\n for (let i = 0; i < 9; i++) {\n temp_matrix[i] = [];\n for (let j = 0; j < 9; j++) {\n temp_mat... | [
"0.70148134",
"0.6831272",
"0.659193",
"0.64774525",
"0.6405429",
"0.6405429",
"0.63934517",
"0.63639027",
"0.6358013",
"0.6336986",
"0.6312261",
"0.62264585",
"0.61989546",
"0.618042",
"0.6141901",
"0.60949457",
"0.60718006",
"0.60697794",
"0.6069623",
"0.60508686",
"0.60413... | 0.76283205 | 0 |
return pointer to current solution | getSolution() {
return this.solution;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get currentSolution() {\n return this.solutions.find(x => x.id == this.solutionFlag);\n }",
"function findSolution(target) {\n function find(current, history) {\n if(current == target) {\n return history;\n }else if (current > target) {\n return null;\n } else {\n return find(c... | [
"0.73726845",
"0.6223094",
"0.6115984",
"0.599003",
"0.5907227",
"0.58772546",
"0.5794574",
"0.57893026",
"0.5692364",
"0.56859523",
"0.5634287",
"0.56332546",
"0.56037897",
"0.55916244",
"0.5525878",
"0.54701096",
"0.54701096",
"0.54502237",
"0.54427546",
"0.54239714",
"0.54... | 0.6441046 | 1 |
return cost and gradient, given an arrangement | costAndGradient(solution) {
const N = this.N;
const dimentions = this.dim; // dim of output space
const P = this.P;
const pmul = this.iter < 100 ? 4 : 1; // trick that helps with local optima
// compute current Q distribution, unnormalized first
const Qu = zeros(N * N);
let qsum = 0.0;
for (le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function run_gradient_descent(x, y, w, iterations, learning_rate, is_stochastic, batch_size){\n\n\n\n //cancel all the previous requestanimation frames..\n cancelAnimationFrame(lr_reg_status.reqID);\n\n if(reg_data.x == undefined){\n alert(\"fitst load the data..\")\n return;\n }\n\n /... | [
"0.565154",
"0.5487681",
"0.5469936",
"0.5465018",
"0.5435751",
"0.5380501",
"0.5365264",
"0.52906096",
"0.5258342",
"0.5220387",
"0.516321",
"0.50890964",
"0.5075672",
"0.50665003",
"0.5054902",
"0.5030769",
"0.5012262",
"0.50042325",
"0.49642757",
"0.49631065",
"0.49602196"... | 0.70056146 | 0 |
get_filter function adds checked checkboxes in array filter[]. This is applied to each class of checkboxes | function get_filter(classname) {
// empty array
let filter = [];
// Activates push function for each checked box
// :checked marks each checked or selected element
$('.' + classname + ':checked').each(function () {
filter.push($(this).val());
});
// r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_filter(class_name)\n{\n var filter = [];\n $('.'+class_name+':checked').each(function(){\n filter.push($(this).val());\n });\n return filter;\n}",
"function get_filter(class_name){\n\t\tvar filter = [];\n\t\t$('.' + class_name + ':checked').each(function(){\n\t\t\tfilter.push($(th... | [
"0.7613181",
"0.7391507",
"0.713585",
"0.6803096",
"0.6717814",
"0.6711833",
"0.66052306",
"0.66049707",
"0.65720195",
"0.655363",
"0.6514464",
"0.6420189",
"0.638065",
"0.6372369",
"0.63519794",
"0.6338536",
"0.6328553",
"0.6274964",
"0.6271032",
"0.62693226",
"0.6267828",
... | 0.758367 | 1 |
here is where the main rules of the game exists. your player card element and sum el is initialized, with the rendering of the game, a loop picks through your array of randomized numbers and prints it on to the screen and then your two cards are added together and printed. then conditionals determine if youre sum is lo... | function renderGame(){
plCardEl.textContent = "Your Cards: "
for(let i = 0; i < plcards.length; i++) {
plCardEl.textContent += plcards[i] + " "
}
plSumEl.textContent = "Your Sum: " + plcardSum
dealerCardEl.textContent = "Dealer Cards: "
for(let i = 0; i < dlcards.length; i++) {
dealerCardEl.textContent += d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function renderGame(){\n cardsEl.textContent=\"Cards: \" \n for (let i = 0; i < cards.length; i++){\n cardsEl.textContent += cards[i] + \" \"\n }\n sumEl.textContent =\"Sum: \" + sum\n if (sum <= 20){\n message = (\"Draw a new card?\"); \n } else if (sum===21){\n message = (\... | [
"0.7527733",
"0.7149799",
"0.701767",
"0.7010972",
"0.69798625",
"0.6972199",
"0.6792785",
"0.6779997",
"0.6771088",
"0.67706627",
"0.67662483",
"0.6710595",
"0.6702653",
"0.6650927",
"0.6623958",
"0.66032976",
"0.6544223",
"0.6535478",
"0.6533608",
"0.653208",
"0.649951",
... | 0.77590096 | 0 |
grants a new card thats pushed into the deck and added to the card sum | function newCard() {
//draw a new card by pushing a card into the deck
//then add this card into the sum
if( isAlive === true && hasBlackJack === false) {
let newPlCardDrawn = getPlayerRandomCard()
let newDlCardDrawn = getDealerRandomCard()
plcardSum += newPlCardDrawn
dealercardSum += newDlCardDrawn
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"add(card){\n\t\tthis.theDeck.push(card);\n\t}",
"exchangeGainCard(card) {\n this.cards.push(card);\n ++this.numCards;\n }",
"addCard(card) {\n this._decks.forEach(deck => deck.addCard(card));\n return super.addCard(card);\n }",
"gainCard(card) {\n this.cards.push(card);\n this.out = false... | [
"0.74629176",
"0.7314382",
"0.7097267",
"0.7069585",
"0.70495164",
"0.7029359",
"0.69912624",
"0.6853683",
"0.68392843",
"0.6820903",
"0.6809426",
"0.6765736",
"0.6693063",
"0.66920286",
"0.659339",
"0.65737903",
"0.6559601",
"0.65469074",
"0.6541091",
"0.6535015",
"0.6526435... | 0.77273566 | 0 |
every time you win blackjack the game restarts and depletes your money | function betGame() {
if(hasBlackJack === true && chips > 0) {
chips -= 10
}
else {
restartGame()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function blackjack() {\n if (totalPlayerScore === 21) {\n window.alert('You were dealt a BLACKJACK, you WIN!')\n location.reload()\n }\n }",
"function blackjackDeal(){\n if(blackjackGame.turnsOver === true && blackjackGame.player_1 === false){\n blackjackGame.turnsOver === false;... | [
"0.7746004",
"0.73588675",
"0.73114",
"0.72164917",
"0.71493024",
"0.698252",
"0.6864359",
"0.6824855",
"0.68214935",
"0.68185693",
"0.68181694",
"0.6810524",
"0.6771786",
"0.6768024",
"0.6765757",
"0.6761313",
"0.6760874",
"0.6702007",
"0.66858685",
"0.6671456",
"0.6669173",... | 0.7422751 | 1 |
clip features between two axisparallel lines: | | ___|___ | / / | \____|____/ | | | function clip(features, scale, k1, k2, axis, minAll, maxAll, options) {
k1 /= scale;
k2 /= scale;
if (minAll >= k1 && maxAll < k2) return features; // trivial accept
else if (maxAll < k1 || minAll >= k2) return null; // trivial reject
var clipped = [];
for (var i = 0; i < features.length; i+... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clipLine(start, end) {\n const s = Victor.fromObject(start)\n const e = Victor.fromObject(end)\n const bounds = [-this.sizeX, -this.sizeY, this.sizeX, this.sizeY]\n\n clip(s, e, bounds)\n return [s, e]\n }",
"function clipLine(stream){var point0,// previous point\nc0,// code for previous point\nv... | [
"0.64439726",
"0.6072373",
"0.6070558",
"0.60508245",
"0.6040297",
"0.6040297",
"0.5904837",
"0.5904837",
"0.5904837",
"0.5904837",
"0.5904837",
"0.5904837",
"0.59000576",
"0.59000576",
"0.59000576",
"0.5895271",
"0.5895073",
"0.5893275",
"0.5893275",
"0.5893275",
"0.5893275"... | 0.63703763 | 1 |
Transforms the coordinates of each feature in the given tile from mercatorprojected space into (extent x extent) tile space. | function transformTile(tile, extent) {
if (tile.transformed) return tile;
var z2 = 1 << tile.z,
tx = tile.x,
ty = tile.y,
i, j, k;
for (i = 0; i < tile.features.length; i++) {
var feature = tile.features[i],
geom = feature.geometry,
type = feature.ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function transformTile(tile, extent) {\n if (tile.transformed) return tile;\n\n var z2 = tile.z2,\n tx = tile.x,\n ty = tile.y,\n i, j, k;\n\n for (i = 0; i < tile.features.length; i++) {\n var feature = tile.features[i],\n geom = feature.geometry,\n type ... | [
"0.7430802",
"0.7430802",
"0.7362763",
"0.73590916",
"0.589642",
"0.5706755",
"0.56569093",
"0.5552452",
"0.5432117",
"0.5389353",
"0.5360217",
"0.53365284",
"0.53229845",
"0.5316295",
"0.5305569",
"0.5297544",
"0.5266166",
"0.5227623",
"0.5215546",
"0.5204007",
"0.5198465",
... | 0.74535275 | 0 |
`nThis` is how we avoid counting the topmost msg | function count (msg, nThis) {
var n = (msg.related || []).reduce(function (n, msg) {
return n + count(msg, 1)
}, 0)
if (mode == 'thread') {
if (n > 0 || msg.value.content.type == 'post')
return nThis + n
}
return 0
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function EX_11(messageBeforeCount, messageAfterCount, countMessage, countDownFrom)\n\t{\n\t// INSERT YOUR CODE HERE\n\t}",
"function vivocha_media_unreadCounter() {\r\n if (!vivocha.contact) {\r\n return;\r\n } //prevent badge on first bot message\r\n var t = vivocha.$(\"#vvc_widget_\" + widget.custom.id +... | [
"0.5678568",
"0.56729",
"0.54815567",
"0.54542917",
"0.54180336",
"0.5384247",
"0.535169",
"0.534756",
"0.5328936",
"0.5323503",
"0.5316327",
"0.5276001",
"0.52437913",
"0.5242714",
"0.5220439",
"0.5209949",
"0.5190033",
"0.5189407",
"0.5183122",
"0.5172767",
"0.5168581",
"... | 0.65315896 | 0 |
Request handler: deserializes request packet calls AMF service serializes response packet | function onRequest( req, res ){
// we must work in binary, UTF-8 strings will be handled by deserializer
req.setEncoding('binary');
// collect body on data events
var body = '';
req.addListener('data', function( chunk ){
body += chunk;
} );
// ready for processing when body fully collected
req.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function respond(){\n\t\t\t\t\t// flush HTTP response\n\t\t\t\t\tvar bin = responsePacket.serialize();\n\t\t\t\t\t//sys.puts( utils.hex(bin) );\n\t\t\t\t\t//sys.puts( sys.inspect(responsePacket) );\n\t\t\t\t\tres.writeHead( 200, {\n\t\t\t\t\t\t'Content-Type': 'application/x-amf',\n\t\t\t\t\t\t'Content-Length': bin... | [
"0.557037",
"0.55681837",
"0.55469453",
"0.5474627",
"0.54245704",
"0.52556026",
"0.52395594",
"0.52395594",
"0.5235314",
"0.5217574",
"0.520828",
"0.5158615",
"0.51017743",
"0.50961053",
"0.5089392",
"0.5082284",
"0.5072275",
"0.50706005",
"0.5065686",
"0.5056364",
"0.504795... | 0.7079801 | 0 |
Get Hourly Snapshots of given time range | async function getHourlySnapshots(from, to, kioskId) {
const rangeDates = DateManager.getRange(from, to);
const stations = await Station.find({
kioskId,
at: {
$gte: rangeDates.current,
$lt: rangeDates.next,
},
})
.select('-_id -__v')
.populate('_entry', '-_id -__v')
.exec();
if (!... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"hydrateAvailableHours (start, end, workHours = {}) {\n const numHours = this.countHours(start, end);\n let availability = [];\n for (let i = 0; i < numHours; i++) {\n const availHour = moment(start).utcOffset('+0000').add(i, 'hours').format('YYYY-MM-DD HH:00:00');\n if (!... | [
"0.60592306",
"0.60045224",
"0.59164894",
"0.588883",
"0.58490133",
"0.5731104",
"0.56911737",
"0.56875277",
"0.5635606",
"0.5599017",
"0.5588369",
"0.5499598",
"0.5485657",
"0.5449831",
"0.5449364",
"0.5433127",
"0.53848743",
"0.5374556",
"0.5363285",
"0.52567047",
"0.523809... | 0.67641985 | 0 |
Resets the current keys chain | reset() {
this.#keyslist.length = 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"reset() {\n // Shortcut\n const hasher = this._hasher; // Reset\n\n hasher.reset();\n hasher.update(this._iKey);\n }",
"reset () {\n chainCache = {}\n }",
"async reset () {\n let keys = await this.client.zRange(this.ZSET_KEY, 0, -1);\n await this.safeDelete(keys);\n }",
"reset() {... | [
"0.7208143",
"0.7144312",
"0.6785566",
"0.6732802",
"0.66573215",
"0.6612424",
"0.6584119",
"0.6581411",
"0.650391",
"0.6449615",
"0.63893265",
"0.6342624",
"0.62873495",
"0.62873495",
"0.62873495",
"0.62670803",
"0.6226232",
"0.6115101",
"0.60650015",
"0.60562986",
"0.604485... | 0.7526454 | 0 |
Sets enabled to true, shorthand for CheatCodetoggle(true) | enable() {
this.toggle(true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"toggle() {\n this.enabled = !this.enabled;\n }",
"function setEnabled(enabled){_enabled=!!enabled;}",
"function setEnabled(enabled){_enabled=!!enabled;}",
"set enabled(value) {}",
"set enabled(value) {}",
"set enabled(value) {}",
"set enabled(value) {}",
"function setEnabled(enabled) {\n _... | [
"0.7609168",
"0.7210796",
"0.7210796",
"0.70182395",
"0.70182395",
"0.70182395",
"0.70182395",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",
"0.6900489",... | 0.7347625 | 1 |
Renders the bill status this should be called in all search functions and initial bill on load. If the status code matches the button ID, light that button. // All buttons should have default of grey. | function renderBillStatus(billData) {
// $(".status-button").each(function () {
if (billData.house_passage === null && billData.senate_passage === null) {
$("#introduced").addClass("active-status");
$("#introduced").removeClass("inactive-status");
return;
}
if (billData.house_passage !== null && bi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeStatus(){\r\n\t\t\t\tvar button_id= $(this).attr(\"id\"); \r\n\t\t\t\t\r\n\t\t\t\t console.log(button_id);\r\n\t\t\t\t\r\n\t\t\t\t $.ajax({\r\n\t\t\t\t\t url:\"/SurveyProjectMVC/rest/admin/changeSurveyStatus?surveyId=\"+button_id,\r\n\t\t\t\t\t\r\n\t\t\t\t\t type : \"GET\",\r\n\t\t\t\t\t\r\n\t\... | [
"0.6508838",
"0.64509195",
"0.6419471",
"0.64135367",
"0.6395276",
"0.61751616",
"0.6129374",
"0.6124887",
"0.6049362",
"0.6022506",
"0.6020908",
"0.6003952",
"0.5920921",
"0.5909223",
"0.5890959",
"0.58902067",
"0.58615154",
"0.5838068",
"0.5830455",
"0.58269405",
"0.5797218... | 0.7490706 | 0 |
Setup header link hover effects | function bindHeaderLinkHover(button) {
button.bind({
'mouseenter': function() {
var $this = $(this);
var text = $('> i', $this);
T(text, dur, {css: {color: '#7D3407'}});
},
'mouseleave': function() {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function HighlightLinkInHeader() {\n\tlet element = document.querySelector(\"ul.highlight\");\n\tif (!element) {\n\t\treturn;\n\t}\n\n\tlet list = element.querySelectorAll(\"li a\");\n\tlet target = window.location.pathname.replace(/\\/$/, \"\");\n\tfor (let i=0; i<list.length; i++) {\n\t\tlet location = list[i].p... | [
"0.6278508",
"0.6049433",
"0.6026793",
"0.5936955",
"0.588844",
"0.5813658",
"0.5803509",
"0.57492226",
"0.57368594",
"0.5681599",
"0.56727916",
"0.56323195",
"0.56275827",
"0.56232196",
"0.5616448",
"0.559932",
"0.5588263",
"0.55403084",
"0.5524501",
"0.54980654",
"0.5485626... | 0.7395341 | 0 |
drawCard :: undefined > undefined | function drawCard() {
var card = draw.pop();
if (card) {
discard.push(card);
showCard(card);
} else {
shuffleCards();
drawCard();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"drawNewCard() {\n return this.#deck.drawCard();\n }",
"draw(){\n let cardNumber = Math.round(Math.random() * 77);\n return this.cards[cardNumber];\n }",
"drawCard() {\n let drawnCard = super.drawCard();\n this._decks.forEach(deck => deck.removeCard(drawnCard));\n return drawnCa... | [
"0.7356171",
"0.72182137",
"0.7156325",
"0.71503764",
"0.7015842",
"0.6988545",
"0.6955786",
"0.69384927",
"0.69234157",
"0.6906234",
"0.68793523",
"0.68547076",
"0.6773946",
"0.67651063",
"0.67456394",
"0.6730785",
"0.67252785",
"0.67048144",
"0.67032236",
"0.6699209",
"0.66... | 0.74688023 | 0 |
storeCards :: [Card] > [Card] | function storeCards(cs) {
cards = cs;
return cs;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"transfer(cards) {\n this.cards = [];\n for (let i = 0; i < cards.length; i++) {\n this.cards[i] = cards[i];\n }\n }",
"function addToflippedCards(card) {\n flippedCards.push(card);\n console.log(flippedCards)\n}",
"collectCard(card) {\n this.state.cards.push(\n card\n ... | [
"0.7239605",
"0.7008786",
"0.6893123",
"0.68712085",
"0.6869031",
"0.6823007",
"0.6796934",
"0.67840785",
"0.6781957",
"0.6750659",
"0.6735573",
"0.6735573",
"0.671217",
"0.66230714",
"0.6617546",
"0.6525695",
"0.64987063",
"0.6493475",
"0.6493385",
"0.6448503",
"0.64044905",... | 0.77819085 | 0 |
Create and cache all kernels we will need to process the image | createTransitionKernels(width)
{
this._cachedKernels = [];
// record shape (topology) -> linear interpolation... if custom
// reduce in width until we reach identity.
// incomplete here
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"runKernelFunc(kernelParams) {\n let outputs;\n let saved = [];\n const isTapeOn = this.isTapeOn();\n const startingBytecount = this.state.numBytes;\n const startingNumTensors = this.state.numTensors;\n if (this.shouldCheckForMemLeaks()) {\n this.state.numDataMov... | [
"0.6069546",
"0.5806816",
"0.54822516",
"0.5433756",
"0.5406179",
"0.53672683",
"0.5364578",
"0.5339345",
"0.5310689",
"0.52309364",
"0.51891905",
"0.5183381",
"0.5146614",
"0.5135887",
"0.5100679",
"0.51004034",
"0.5097411",
"0.5080262",
"0.5076664",
"0.5060374",
"0.5057417"... | 0.5866091 | 1 |
redefine download url & sort it | async function redefineListDownloadLink(list) {
// re-define download url
for (const el of list) {
const data = await fetchWithHeader(el.href);
el.href = data.direct_link;
}
// sort the list
return list.sort();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sortBySeedsDescending() {\n var url = window.location.href,\n searchPattern = /(\\/[0-9]+\\/)(99)(\\/[0-9])+/,\n browsePattern = /browse\\/[0-9]+$/;\n if (url.match(searchPattern)) {\n var newUrl = url.replace(searchPattern, \"$17$3\");\n window.location.replace(newUrl);\n ... | [
"0.6332353",
"0.6259895",
"0.59504527",
"0.59486294",
"0.59481686",
"0.5894486",
"0.5856475",
"0.58114934",
"0.58107734",
"0.57744575",
"0.5746588",
"0.57136655",
"0.5709193",
"0.5703676",
"0.5608948",
"0.55896497",
"0.5559008",
"0.5524368",
"0.5483936",
"0.54820484",
"0.5481... | 0.7073697 | 0 |
this return Translator Module required for all other modules to import required pipes and directives parameter : specify as root or as child module so not inject TranslateService Multi times . | function RegisterTranslatorModule(AsRootModule) {
if (AsRootModule)
return core_2.TranslateModule.forRoot({
loader: {
provide: core_2.TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [http_1.HttpClient]
}
});
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createTranslateLoader(http) {\n return new __WEBPACK_IMPORTED_MODULE_13__ngx_translate_http_loader__[\"a\" /* TranslateHttpLoader */](http, './assets/i18n/', '.json');\n}",
"function createTranslateLoader(http) {\n return new __WEBPACK_IMPORTED_MODULE_8__ngx_translate_http_loader__[\"a\" /* Transl... | [
"0.58471644",
"0.5840019",
"0.5835738",
"0.5629878",
"0.562006",
"0.56108874",
"0.552422",
"0.5521625",
"0.5518704",
"0.5500704",
"0.55002564",
"0.5483678",
"0.5481587",
"0.54768366",
"0.5469622",
"0.54596597",
"0.5418146",
"0.5350771",
"0.53466195",
"0.52672154",
"0.5217319"... | 0.65565974 | 0 |
Send email to reset passwrod | function sendResetPassword(to, id,string){
let link = "https://wcu-surveytool.herokuapp.com/setPassword/" + string ;
//let link = "http://localhost:3000/confirm/" + randomString;
//console.log(link);
const msg = {
to: to,
from:"wcu.SurveyTool@gmail.com",
subject: "Password Reset",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_sendPasswordReset(user, password) {\n return this.mailer.reset({email: user.email, password: password})\n }",
"function sendResetPasswordMail(user,api_url){\n\n var FROM_ADDRESS = 'support@Certspring.com';\n var TO_ADDRESS = user.student_active_email;\n var SUBJECT = 'Reset Password Link';\n\n var html ... | [
"0.74155676",
"0.7326289",
"0.72708064",
"0.7267828",
"0.71359485",
"0.70492834",
"0.70446616",
"0.70446616",
"0.70446616",
"0.70334995",
"0.7016526",
"0.6827241",
"0.6771681",
"0.6742221",
"0.6722829",
"0.6715507",
"0.6712668",
"0.66994745",
"0.6692742",
"0.6684419",
"0.6670... | 0.74547994 | 0 |
A wellknown NativeObject instance that was created in native code | function KnownNativeObject(nativeTypeName) {
// Don't call the base constructor, because we initialize this.handle differently
this._eventHandlers = {};
this._properties = {};
// Get an existing instance of a well-known named object
this.handle = ace.ToNative.queueGetInstanceMessage(this, nativeTyp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function NXObject() {}",
"GetNativeBufferPtr() {}",
"constructor(Addr) {\n this._Addr = Addr;\n this._Obj = host.createPointerObject(\n this._Addr,\n Module,\n 'JSObject*'\n );\n\n this._Properties = [];\n const Group = this._Obj.group_.value;... | [
"0.6828499",
"0.6731523",
"0.6365704",
"0.63345",
"0.6282562",
"0.62268937",
"0.6005425",
"0.6005425",
"0.5960551",
"0.5944629",
"0.583646",
"0.5799217",
"0.57962203",
"0.578264",
"0.5756964",
"0.57516265",
"0.5704118",
"0.5704118",
"0.5694961",
"0.56889886",
"0.56255215",
... | 0.7316837 | 0 |
No troubles are handled. | canHandle(trouble) {
// ˅
return false;
// ˄
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function somethingBad() {\n nock.cleanAll()\n }",
"beforeHandling() {}",
"function reportCarelessErrors() {\n win.print = win.confirm = win.alert = win.open = function () {\n throw new Error(\"Careless method called.\");\n };\n }",
"afterHandling() {}",... | [
"0.5999392",
"0.5858164",
"0.5784524",
"0.57730895",
"0.57726294",
"0.5734828",
"0.5734828",
"0.5734828",
"0.5725705",
"0.5709246",
"0.5691047",
"0.568241",
"0.5681033",
"0.56565684",
"0.56509876",
"0.5648521",
"0.56484574",
"0.5634699",
"0.5629181",
"0.5629181",
"0.5628396",... | 0.59297794 | 1 |
Returns an upper bound of evaluating the given polynomial (using Horner's Algorithm) where all coefficients are made positive. | function maxAbsCoeffPolyEval(p, x) {
p = absCoeff(p);
return Horner(p, Math.abs(x)) * (1 + γ1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function HornerExact(p, x) {\n let q = p[0];\n for (let i = 1; i < p.length; i++) {\n q = fes(p[i], sce(q, x));\n }\n return q;\n}",
"function upperToLowerBound(positiveUpperBoundFunction) {\n return (p) => {\n let result = 1 / positiveUpperBoundFunction(invert(p));\n //consol... | [
"0.6341952",
"0.568098",
"0.54000384",
"0.5258549",
"0.5219218",
"0.51748013",
"0.5116393",
"0.5075626",
"0.50660884",
"0.50472766",
"0.504557",
"0.49901488",
"0.49745673",
"0.49719363",
"0.49702376",
"0.4947854",
"0.49360272",
"0.4935905",
"0.4935905",
"0.4935905",
"0.493590... | 0.7556061 | 0 |
Fix a bug from leaflet.css and webpack cssloader From | fixLeaftletCssBug() {
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: marker2x,
iconUrl: marker1x,
shadowUrl: markerShadow
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"loaders(sourceMaps) {\r\n return [{\r\n loader: 'stylus-loader' + (sourceMaps ? '?sourceMap' : ''),\r\n options: this.pluginOptions\r\n }];\r\n }",
"function generate_extract_css_loaders(after_style_loader, development)\n{\n\treturn [{\n\t\tloader: MiniCssExtractPlugin.load... | [
"0.62935114",
"0.5623617",
"0.55537736",
"0.5471185",
"0.5446695",
"0.54040295",
"0.5402053",
"0.5397445",
"0.53694016",
"0.53163207",
"0.5292415",
"0.5279892",
"0.5268963",
"0.52587247",
"0.5227524",
"0.5202652",
"0.51776695",
"0.5164464",
"0.5156725",
"0.51544034",
"0.51464... | 0.7003698 | 0 |
Capitalize the first letter of each part of the city name. | function capitalizeCityName(cityName) {
var tokens = cityName.split(' ');
for (var i = 0; i < tokens.length; i++) {
if (tokens[i].length === 1) {
tokens[i] = tokens[i].toUpperCase();
} else {
tokens[i] = tokens[i].charAt(0).toUpperCase() + tokens[i].substring(1).toLowerCa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"formatCity (city) {\n const words = city.split(' ');\n let newWords = [];\n for (let word of words) {\n word = word.slice(0,1).toUpperCase().concat(word.slice(1).toLowerCase());\n newWords.push(word);\n }\n return newWords.join(' ');\n }",
"function cityFormat(CityInput){\n CityInput... | [
"0.7956991",
"0.7643968",
"0.7373341",
"0.7317328",
"0.7280136",
"0.72590005",
"0.7250795",
"0.7250795",
"0.7220412",
"0.72105294",
"0.72051865",
"0.72038513",
"0.7192614",
"0.7168387",
"0.7157321",
"0.7152176",
"0.7149071",
"0.7145964",
"0.71437347",
"0.7127233",
"0.7107743"... | 0.8336641 | 0 |
the renderer type name is based on the "view" selected in the UI: pileup, coverage, etc | get rendererTypeName() {
const viewName = getConf(self, 'defaultRendering')
const rendererType = rendererTypes.get(viewName)
if (!rendererType)
throw new Error(`unknown alignments view name ${viewName}`)
return rendererType
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getRenderer () {}",
"get renderer() {\n return this._renderer;\n }",
"function getRenderer(type, data) {\n switch (type) {\n case CHRONOLOGICAL:\n return new ChronologicalRenderer(data);\n case MINOR_RELEASE:\n return new MinorReleaseRenderer(data);\n case COMPARE_VERSIONS:\n ... | [
"0.68779874",
"0.6351577",
"0.6339432",
"0.6297404",
"0.62667954",
"0.6242021",
"0.62266976",
"0.6221579",
"0.6221579",
"0.6221579",
"0.6199602",
"0.60767144",
"0.60767144",
"0.5999376",
"0.5989389",
"0.5989389",
"0.5975623",
"0.5972769",
"0.59696895",
"0.5948657",
"0.5912004... | 0.7710644 | 0 |
the react props that are passed to the Renderer when data is rendered in this track | get renderProps() {
// view -> [tracks] -> [blocks]
const config = self.rendererType.configSchema.create(
getConf(self, ['renderers', self.rendererTypeName]) || {},
)
return {
...self.composedRenderProps,
...getParentRenderProps(self),
config,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get props() { return this._props }",
"get props () { return this.target.props }",
"get props() {\n return this._props;\n }",
"function componentProps(){\n\t\tvar props = {};\n\t\tlog(arguments);\n\t\tfor(var i = 0; i< arguments.length; i++){\n\t\t\tvar arg = arguments[i];\n\t\t\tlog(arg);\n\t\t\tvar prop... | [
"0.7032973",
"0.6597308",
"0.64650935",
"0.64033943",
"0.62726384",
"0.62174547",
"0.6137141",
"0.61156225",
"0.6097172",
"0.6034322",
"0.60038286",
"0.58853465",
"0.5877822",
"0.58667505",
"0.58554745",
"0.58040655",
"0.5795827",
"0.57736605",
"0.5771573",
"0.5724556",
"0.57... | 0.6988498 | 1 |
Returns [sn, cn, dn](u + iv|m). | function ellipticJi(u, v, m) {
var a, b, c;
if (!u) {
b = ellipticJ(v, 1 - m);
return [[0, b[0] / b[1]], [1 / b[1], 0], [b[2] / b[1], 0]];
}
a = ellipticJ(u, m);
if (!v) return [[a[0], 0], [a[1], 0], [a[2], 0]];
b = ellipticJ(v, 1 - m);
c = b[1] * b[1] + m * a[0] * a[0] * b[0] * b[0];
return [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMessageWithIv(message, iv) {\n return converterWrapper.arrayBufferToBase64String(message) + converterWrapper.arrayBufferToBase64String(iv);\n }",
"function vmul(m, v){\n v = v.slice();\n //homog coord\n v.push(1);\n var ret = [0, 0, 0, 0];\n for (var r = 0... | [
"0.5175488",
"0.5075512",
"0.5066985",
"0.505671",
"0.5055632",
"0.50349784",
"0.49629825",
"0.49323943",
"0.49106365",
"0.48793682",
"0.48793682",
"0.48782822",
"0.48727554",
"0.48727554",
"0.48727554",
"0.48727554",
"0.48727554",
"0.48727554",
"0.48727554",
"0.48727554",
"0... | 0.5608156 | 0 |
Test error counter. Prints the name of the test function. This should be included at the beginning of each test | function TEST_TITLE() {
var ownName = arguments.callee.caller.toString();
// Trim off "function ".
ownName = ownName.substr('function '.length);
// Trim off everything after the function name.
ownName = ownName.substr(0, ownName.indexOf('('));
LOG('========================================');
LOG('Running ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function TEST_SUMMARY() {\n var ownName = arguments.callee.caller.toString();\n // Trim off \"function \".\n ownName = ownName.substr('function '.length);\n // Trim off everything after the function name.\n ownName = ownName.substr(0, ownName.indexOf('('));\n if (0 == numErrors_) {\n LOG('');\n LOG(own... | [
"0.73222923",
"0.68238497",
"0.681988",
"0.6812608",
"0.6516263",
"0.6495132",
"0.648487",
"0.6409448",
"0.63941664",
"0.62456137",
"0.6021294",
"0.5973176",
"0.593266",
"0.59057194",
"0.59036523",
"0.5891356",
"0.5874604",
"0.5858457",
"0.5824505",
"0.58171225",
"0.5816051",... | 0.7224873 | 1 |
Prints the name of the test function. This should be included at the beginning of each test | function TEST_SUMMARY() {
var ownName = arguments.callee.caller.toString();
// Trim off "function ".
ownName = ownName.substr('function '.length);
// Trim off everything after the function name.
ownName = ownName.substr(0, ownName.indexOf('('));
if (0 == numErrors_) {
LOG('');
LOG(ownName + ' <font ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function TEST_TITLE() {\n var ownName = arguments.callee.caller.toString();\n // Trim off \"function \".\n ownName = ownName.substr('function '.length);\n // Trim off everything after the function name.\n ownName = ownName.substr(0, ownName.indexOf('('));\n LOG('========================================');\n ... | [
"0.79611844",
"0.66810006",
"0.6655251",
"0.65872526",
"0.6475697",
"0.6466652",
"0.6452013",
"0.6451345",
"0.6395361",
"0.634424",
"0.6320126",
"0.62990475",
"0.6260864",
"0.6255077",
"0.6255077",
"0.6244966",
"0.61968243",
"0.61440444",
"0.61420804",
"0.61420804",
"0.614208... | 0.73762643 | 1 |
EXPECT_NEAR checks if floating point numbers are close to each other. | function EXPECT_NEAR(x1, x2, tolerance, stringOnFail) {
if (isNaN(x1) || isNaN(x2)) {
LOG('EXPECT_NEAR FAILED');
LOG('x1: ' + x1);
LOG('x2: ' + x2);
LOG(stringOnFail);
numErrors_ += 1;
} else {
if (Math.abs(x2 - x1) > tolerance) {
LOG('EXPECT_NEAR FAILED');
LOG('x1: ' + x1);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function floatEq(a, b) {\n return a == round(b);\n }",
"function floatEqual (f1, f2) {\n return (Math.abs(f1 - f2) < 0.000001);\n }",
"function floatEqual (f1, f2) {\n return (Math.abs(f1 - f2) < 0.000001);\n }",
"function floatEqual (f1, f2) {\n return (Math.abs(f1 - f2) < 0.000001);\n }",
... | [
"0.6777735",
"0.6621312",
"0.6621312",
"0.6621312",
"0.64498854",
"0.6392783",
"0.63672495",
"0.63425833",
"0.63425833",
"0.62417454",
"0.6043856",
"0.600916",
"0.6004354",
"0.59387285",
"0.5928021",
"0.59256774",
"0.5920193",
"0.58422387",
"0.5835115",
"0.58064604",
"0.57755... | 0.7459273 | 0 |
EXPECT_EQ checks if numbers are equal | function EXPECT_EQ(x1, x2, stringOnFail) {
if (isNaN(x1) || isNaN(x2) || x1 != x2) {
LOG('EXPECT_EQ FAILED');
LOG('x1: ' + x1);
LOG('x2: ' + x2);
LOG(stringOnFail);
numErrors_ += 1;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function testEqual (num) {\r\n if (num == 12) {\r\n return \"equal\";\r\n }\r\n return \"not equal\";\r\n}",
"function testEqual(val) {\n if (val == 12) {\n return \"equal\";\n }\n return \"not equal\";\n}",
"function testStrictEqual(val){\n if (val === 7){\n return \"Equal\";\n... | [
"0.7003403",
"0.68892604",
"0.6879589",
"0.6863156",
"0.6807817",
"0.6745368",
"0.6710215",
"0.6629864",
"0.65871745",
"0.65871745",
"0.65542555",
"0.653",
"0.65064603",
"0.65064603",
"0.64668226",
"0.6445607",
"0.6443303",
"0.6415596",
"0.6414721",
"0.6414721",
"0.6410087",
... | 0.70314 | 0 |
The CKEditor5 editor constructor. | function EditorConstructor() { } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(config, editor)\n {\n this.editor = editor;\n this.config = config;\n this.oEditor = null;\n }",
"function Editor() { }",
"function Editor() { }",
"function BaseEditor() { }",
"function BaseEditor() { }",
"constructor() {\n /**\n * Target for editing\... | [
"0.72325164",
"0.7130651",
"0.7130651",
"0.6995454",
"0.6995454",
"0.6853547",
"0.6714432",
"0.66913843",
"0.64588636",
"0.6445391",
"0.64348716",
"0.6426566",
"0.6370235",
"0.6332908",
"0.63309187",
"0.63099796",
"0.6297143",
"0.6265412",
"0.622602",
"0.6185108",
"0.6175598"... | 0.7943545 | 1 |
The base Editor class. See | function BaseEditor() { } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Editor() { }",
"function Editor() { }",
"function EditorConstructor() { }",
"function EditorConstructor() { }",
"constructor() {\n /**\n * Target for editing\n * @protected\n * @type {IEditorFunction}\n */\n this.editor = null;\n }",
"function Tex... | [
"0.8350814",
"0.8350814",
"0.81105953",
"0.81105953",
"0.76742995",
"0.7490007",
"0.7280395",
"0.7280395",
"0.7262727",
"0.6874235",
"0.684905",
"0.6841937",
"0.6840867",
"0.6831706",
"0.6793877",
"0.67371285",
"0.67208403",
"0.6714317",
"0.66487473",
"0.6637245",
"0.66018313... | 0.8648415 | 1 |
The CKEditor5 DataApi interface. See | function DataApi() { } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"GetData() {}",
"getData(){}",
"getData () {\n }",
"getData() {\n \n}",
"getData() { return this.doc.data; }",
"get data () {return this._data;}",
"get Data () {\n return this._data\n }",
"function ProviderData() { }",
"function ProviderData() { }",
"function ViewData() {}",
"function Vie... | [
"0.6189746",
"0.6059222",
"0.6049483",
"0.60256517",
"0.5813103",
"0.5794317",
"0.5748805",
"0.5729725",
"0.5729725",
"0.57105774",
"0.57105774",
"0.57105774",
"0.57051635",
"0.56917477",
"0.56828606",
"0.56828606",
"0.56759167",
"0.56441724",
"0.56441724",
"0.56441724",
"0.5... | 0.71314746 | 1 |
Adds/appends text to an div | function addText(divID, text){
var theDiv = document.getElementById(divID);
theDiv.innerHTML = "";
var content = document.createTextNode(text);
theDiv.appendChild(content);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function appendTextToElement(element, text){\n jQuery(element).append(currentDocument.createTextNode(\"\"+text));\n jQuery(element).append(currentDocument.createElement(\"br\"));\n }",
"function addTextToDom(text, id) {\n var element = document.getElementById(id);\n element.innerText =... | [
"0.7052283",
"0.68929064",
"0.68913424",
"0.6837058",
"0.6825099",
"0.6690187",
"0.66895497",
"0.66825396",
"0.6669515",
"0.6669515",
"0.6668922",
"0.664163",
"0.6626357",
"0.66200846",
"0.65978295",
"0.6576774",
"0.6553558",
"0.65534633",
"0.6551628",
"0.6551628",
"0.6542700... | 0.78111136 | 0 |
Adding the base HTML for the site | function addingBaseHTML(){
addHTML("div", null, "infoTopContainer", null, null, "mapContainer");
addHTML("div", null, "map", null, null, "mapContainer");
addHTML("div", null, "rightWindow", null, null, "mapContainer");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function defaultHtml (incomingData) {\n var data = assign({\n charset: 'utf-8',\n metaViewport: true,\n html: '',\n relative: false\n }, incomingData)\n var sep = data.relative ? '' : '/'\n var result = ['<!doctype html>']\n var add = function () {\n result.push.apply(result, arguments)\n }\n\... | [
"0.66840327",
"0.64385206",
"0.6419104",
"0.62263644",
"0.6012608",
"0.59659916",
"0.59621733",
"0.59523803",
"0.57984877",
"0.5794014",
"0.57590055",
"0.5742782",
"0.57319033",
"0.57284594",
"0.57196504",
"0.571148",
"0.5678961",
"0.5644599",
"0.56379926",
"0.5636538",
"0.56... | 0.70425713 | 0 |
Given a string indexed from 0, print its evenindexed and oddindexed characters as spaceseparated strings on a single line. FUNCTIONS | function siftEvenOddChars(str) {
let even = '';
let odd = '';
for (let i = 0; i < str.length; i++) {
const char = str.charAt(i);
if (isEven(i)) {
even += char;
} else {
odd += char;
}
}
console.log(even, odd);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function evenPositionElement (input) {\n let numbers = input\n .filter((number, index) => index % 2 === 0)\n .join(' ');\n\n console.log(numbers);\n}",
"function everyOtherWord(x){\n let y = []\n for (let i = 0; i < x.length; i++){\n if (i % 2 === 0){\n y.push(x[i])\n \... | [
"0.69410926",
"0.6650951",
"0.66461766",
"0.66359437",
"0.6531154",
"0.6479538",
"0.64439416",
"0.63838947",
"0.634525",
"0.62910247",
"0.6216522",
"0.616986",
"0.6169626",
"0.6151749",
"0.6142137",
"0.6108893",
"0.60871786",
"0.6065616",
"0.60503006",
"0.60454106",
"0.601379... | 0.6871313 | 1 |
Remove all styles or tag from clipboard when paste | _strip(e) {
e.preventDefault();
let text = e.clipboardData.getData("text/plain");
text = text.substring(0, 70);
document.execCommand("insertHTML", false, text);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cut (event) {\n event.preventDefault();\n event.stopPropagation();\n document.execCommand(\"copy\");\n this.replaceText(this.selection.start, this.selection.end, \"\");\n }",
"handlePaste() {\n this._pasting = true;\n }",
"paste (event) {\n event.preventDefault();\n event.stopPropagation... | [
"0.6475478",
"0.6436365",
"0.64118683",
"0.6387745",
"0.6299386",
"0.6217721",
"0.62071943",
"0.6204606",
"0.62025565",
"0.6194765",
"0.61058474",
"0.60766333",
"0.6048705",
"0.60184294",
"0.6003345",
"0.59923154",
"0.59678537",
"0.59641194",
"0.59029114",
"0.5901206",
"0.589... | 0.68232965 | 0 |
url String userIds Array url String iframeName String postData String | function postIframeData(url, iframeName, postData) {
var $input = $('<input name="postData" type="hidden" />').val(postData);
var $form = $('<form style="position:absolute;top:-1200px;left:-1200px;" action="' + url + '" method="POST" target="'+iframeName+'"></form>').appendTo(document.body);
$form.append($i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function postToIframe(jiframe, url, params) {\n var name = jiframe.attr('name');\n var k, f;\n if (!name) { name = 'k' + Math.round(Math.random() * 9999); jiframe.attr('name', name); }\n f = $('<form id=\"jiframeForm\" target=\"' + name + '\" method=\"post\" action=\"' + url + '\"></form>');\n\n for... | [
"0.56746995",
"0.5417914",
"0.53940094",
"0.53829944",
"0.53597736",
"0.52997696",
"0.5274916",
"0.52235377",
"0.51618874",
"0.51394403",
"0.512418",
"0.5109014",
"0.5026556",
"0.5025383",
"0.50143594",
"0.50057924",
"0.49977687",
"0.49710628",
"0.49703056",
"0.49683422",
"0.... | 0.6045006 | 0 |
Function to increment the slide by one or minus one | function incrementIndex(increment){
var indexMax = $(".slide").length - 1;
slider.currentIndex += increment;
if(slider.currentIndex < 0){
slider.currentIndex = indexMax;
}
else if(slider.currentIndex > indexMax){
slider.currentIndex = 0;
}
setSlide(slider.currentIndex);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function plusSlides(n){\r\n showSlides(slideInd += n - 1);\r\n}",
"function plusSlides(n) {\n // Increment or decrement slideIndex and display\n showSlides(slideIndex += n);\n}",
"function plusSlide() {\n showSlides(slideIndex += 1);\n}",
"function plusSlides(num) {\n //add or minus by 1 to slid... | [
"0.7488704",
"0.7424315",
"0.732737",
"0.73239195",
"0.7313375",
"0.73042816",
"0.7279255",
"0.7258333",
"0.72511554",
"0.72260064",
"0.7221822",
"0.72204477",
"0.720389",
"0.71982545",
"0.7182296",
"0.7153045",
"0.7126891",
"0.7122612",
"0.70961887",
"0.7094709",
"0.7094507"... | 0.76157606 | 0 |
Function to create an interval on incrementIndex. When the user uses the slider, it clears interval functions for 30 seconds | function autoSlide(){
slider.timerOn = true;
return setInterval(function(){incrementIndex(1)}, "8000");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createAutoPlay(){\n interval = setInterval(function(){\n changeIndexNext()\n }, timeauto);\n}",
"function startTimer() {\n counter = 15;\n intervalId = setInterval(decrement, 1000);\n }",
"function startTimer(){\r\n timer = setInterval(function(){\r\n ... | [
"0.6659971",
"0.6594414",
"0.65390503",
"0.6424085",
"0.6373529",
"0.63684237",
"0.63663477",
"0.6355589",
"0.6348091",
"0.6321375",
"0.63137114",
"0.62369144",
"0.6214997",
"0.6210155",
"0.62066174",
"0.61971074",
"0.61622584",
"0.61514634",
"0.61490864",
"0.6073849",
"0.606... | 0.67909235 | 0 |
Define functions for calculating V, I and R. Each function takes the unknowns in order of the operation it does (Voltage is I R, so it's parameters are i, r. Current is V / R, so it's parameters are v, r) | function voltage(i, r){
console.log("CALLED");
console.log(i);
return i * r;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function evaluate_at(p, pi, swap_degree, v00, v01, v02, v10, v20, v11) {\n var degu = swap_degree ? p.degv : p.degu;\n var degv = swap_degree ? p.degu : p.degv;\n p.points[pi].copy(v00).normalize_rational_point();\n // surface normal\n // n = rv cross ru (but use a normalized derivative)\n {\n ... | [
"0.5909517",
"0.5704744",
"0.5565328",
"0.55068946",
"0.5394634",
"0.5356815",
"0.5349018",
"0.52963203",
"0.5286212",
"0.52828556",
"0.52804047",
"0.52746415",
"0.5250602",
"0.5245718",
"0.5232059",
"0.52044964",
"0.51969624",
"0.51722205",
"0.51359564",
"0.5110052",
"0.5106... | 0.66886765 | 0 |
Function for rounding a number to a given decimal place. Takes num (the number to round) and dp (the decimal places to round to) | function round(num, dp){
return Math.round((num * (Math.pow(10, dp))))/Math.pow(10, dp);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function round(num, dp) {\n return Math.round(num * Math.pow(10, dp)) / Math.pow(10, dp);\n}",
"function roundit(num,dex) {\n return parseFloat(num).toFixed(dex);\n }",
"function roundTo(nr, dec){\r\n\tif(Math.abs(nr) < 1/Math.pow(10,dec)){\r\n\t\treturn 0;\r\n\t}\r\n\telse if(Math.abs(nr)-Math.ab... | [
"0.8525784",
"0.70544344",
"0.67792726",
"0.6663698",
"0.6658805",
"0.6624176",
"0.6609162",
"0.65957534",
"0.65690666",
"0.6565897",
"0.65019697",
"0.6481813",
"0.64568096",
"0.6438325",
"0.64188695",
"0.6402853",
"0.63984466",
"0.63887274",
"0.6358048",
"0.634077",
"0.63206... | 0.8524435 | 1 |
Displays the phrase placeholders, broken down to letters, in the DOM. | addPhraseToDisplay() {
const ul = document.querySelector('#phrase ul');
let phraseTemplate = '';
for(let i = 0; i < this.phrase.length; i++) {
if(this.phrase[i] == ' ') {
phraseTemplate += `<li class="space"> </li>`;
} else {
phraseTemplate += `<li class="hide letter ${this.phras... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"addPhraseToDisplay(){\r\n\r\n const phraseSection = document.getElementById('phrase');\r\n const phraseArr = this.phrase.split(' ');\r\n\r\n // Creates letters placeholders with spaces between each word\r\n let html = `<ul>`;\r\n phraseArr.forEach( word => {\r\n for (l... | [
"0.70578325",
"0.7003736",
"0.6899209",
"0.6817539",
"0.6805493",
"0.6780921",
"0.67238903",
"0.67128557",
"0.6705681",
"0.6705386",
"0.66986376",
"0.66915476",
"0.66556156",
"0.66437846",
"0.66364664",
"0.6624027",
"0.6605836",
"0.6599292",
"0.6594396",
"0.6583138",
"0.65600... | 0.70274687 | 1 |
pour savoir si les lignes de ventes sont vierge | function lignes_vente_vierge()
{
vierge=true;
$('.ligne_vente').each(function(){
$('input',this).each(function(){
if($(this).val()!='')
{
vierge=false;
return false;
}
});
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkTirEnCours() {\n tirEnCours = false;\n equipes.forEach((e) => {\n e.joueurs.forEach((j) => {\n if (j.vitesse > 0) tirEnCours = true;\n });\n });\n }",
"function Deplacement_ennemiLimitrophe(Territoire){\r\n\tif (Territoire.army < 2) {return false}\r\n for (var i=0 ; i ... | [
"0.6710886",
"0.64018244",
"0.6356419",
"0.6216201",
"0.60610616",
"0.5963253",
"0.5954752",
"0.593488",
"0.59318024",
"0.5895018",
"0.5887537",
"0.5856693",
"0.5807102",
"0.5746362",
"0.5746362",
"0.5743402",
"0.5714861",
"0.5714785",
"0.57118076",
"0.56856906",
"0.56838614"... | 0.672082 | 0 |
function to show card flip when reset button clicked | function resetFlip() {
if (event.target.matches(".start_button") || event.target.matches(".playAgain_button")) {
return;
}
let resetInfo = document.querySelectorAll(".card");
function flipUp() {
resetInfo.forEach(function (card) {
setTimeout(card.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cardFlip(card) {\n if (this.allowedToFlip(card)) {\n this.soundControl.flip();\n this.totalClicks++;\n this.ticktok.innerText = this.totalClicks;\n card.classList.add('visible');\n\n if(this.verifyCard) {\n this.checkForCardMatch(card);\n... | [
"0.75395155",
"0.74038595",
"0.73947936",
"0.7337774",
"0.7244794",
"0.72315085",
"0.71902734",
"0.71881926",
"0.71827495",
"0.7111992",
"0.7108787",
"0.7095836",
"0.70549154",
"0.70246077",
"0.69721514",
"0.69707817",
"0.6969664",
"0.6969086",
"0.69474626",
"0.69035566",
"0.... | 0.7523012 | 1 |
Returns an enhanced version of the name from given spec node that represents its type | _getTypedName(spec) {
if (spec.namespaced)
return spec.id;
if (spec.name[0] === "[")
return spec.name;
switch (spec.type) {
case DeclarationFileParser_1.SpecNodeType.TypeOrEnum:
return "type " + spec.name;
case DeclarationFileParser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getTypeName(node) {\n if (node.type == 'Identifier') {\n return node.name;\n } else if (node.type == 'QualifiedTypeIdentifier') {\n return getTypeName(node.qualification) + '.' + getTypeName(node.id);\n }\n\n throw this.errorWithNode('Unsupported type: ' + node.type);\n }",
"funct... | [
"0.63410044",
"0.62750524",
"0.62750524",
"0.6209451",
"0.5991333",
"0.5869165",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
"0.5869087",
... | 0.7026601 | 0 |
Applies pageintro section from miscellaneous content, if any | _addPageIntro() {
let intro = this._misc.getContentFor(this.doc.id + ":pageintro");
if (intro) {
this.data.pageintro = intro
.replace(/([\n\r]+)/g, "$1 ")
.replace(/\`([\w\.\@\(\)]+)\`/g, "<code>$1</code>");
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pre(context) {\n const { request, content } = context;\n const { document } = content;\n const $ = jquery(document.defaultView);\n\n // Expose the html & body attributes so they can be used in the HTL\n [document.documentElement, document.body].forEach((el) => {\n el.attributesMap = [...el.attribu... | [
"0.58777153",
"0.5816651",
"0.5713055",
"0.558954",
"0.5573841",
"0.5531714",
"0.5474272",
"0.5464951",
"0.5453752",
"0.5453616",
"0.54360235",
"0.54027516",
"0.53645295",
"0.5346938",
"0.5334163",
"0.5331173",
"0.5325451",
"0.5323235",
"0.5321734",
"0.5302143",
"0.5296189",
... | 0.7363613 | 0 |
Turn IDs in given string into markdown links | _addIdLinks(str) {
return str.replace(/`[^`\n]+`/g, (code) => code
.replace(
// v-- symbols or start, v-- keywords v-- token v-- brackets
/((?:(?:[\:|>,]\s+)|\<|`)(?:extends\s+|implements\s+|typeof\s+)?)([\@\w\.]+(?:\(\))?)(\s+)?/g, (s, impl, token, spac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function linkifyText(nm) {\n let md = nm\n // eg [[Something nice]] --> [Something nice](#something-nice)\n md = md.replace(/\\[\\[([^|\\]]+?)\\]\\]/g, (match, p1) => {\n return `[${p1}](#${getIdFromName(p1)})`\n })\n // eg [[Something|Somethings]] --> [Somethings](#something)\n md = md.replace(/\\[\\[([^... | [
"0.66572624",
"0.61898446",
"0.58870083",
"0.5866817",
"0.57309234",
"0.56623954",
"0.5606395",
"0.5530041",
"0.5504631",
"0.549454",
"0.54767126",
"0.5473731",
"0.54628855",
"0.5444249",
"0.5444249",
"0.5444249",
"0.54302514",
"0.5422903",
"0.54109776",
"0.54015",
"0.5387168... | 0.7126282 | 0 |
As first rough approach use remainingTestsCount as value for remainingTime | _calcRemainingTime() {
return this._remainingTestsCount;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_getTestsCountToSplit() {\n return Math.floor(this._remainingTestsCount / 2);\n }",
"CountRemaining() {}",
"function reduceTime() {\n timeLeft = timeLeft - 10;\n}",
"function getTestRunTimeout() {\n var difference = Date.now() - nextTestRun,\n pad = difference > 0 ? 0 : testInterval + Math.abs(diffe... | [
"0.6546334",
"0.64036345",
"0.6276717",
"0.6226311",
"0.61898184",
"0.61719084",
"0.6156715",
"0.6032576",
"0.6018168",
"0.5989456",
"0.59756666",
"0.5923491",
"0.5916642",
"0.591194",
"0.5895055",
"0.58729815",
"0.58472335",
"0.5808688",
"0.58074164",
"0.58049613",
"0.575840... | 0.80178094 | 0 |
This props needs the following props passed in titles : an array of election titles dates : an array of election dates organizations : an array of organizations Each child component takes the following: title date organization | render() {
var boxes = [];
if(this.props.titles && this.props.dates && this.props.organizations)
{
for(var i = 0 ; i <this.props.titles.length ; i++){
boxes.push(<UpcommingElectionBox key = {this.props.titles[i] + "upcomming"}
title = {this.props.titles[i]}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"render() {\n let content = this.props.data.data.map((publications) => {\n var dateRange = {\n \"date\": publications['date']\n };\n return (\n <div className=\"col-sm-12\">\n <h4 className=\"strike-through\">\n ... | [
"0.6469955",
"0.599773",
"0.59539956",
"0.5732789",
"0.57055277",
"0.5677785",
"0.5658892",
"0.55964744",
"0.5432101",
"0.5400823",
"0.535911",
"0.5245606",
"0.5221953",
"0.5218842",
"0.51851994",
"0.51813346",
"0.5180872",
"0.518",
"0.51753014",
"0.51672095",
"0.5155793",
... | 0.65119755 | 0 |
Try to determine authentication failures and unreachable TURN servers by using heuristics on the candidate types gathered. | function getFinalResult() {
let result = 'Done';
// if more than one server is used, it can not be determined
// which server failed.
if (servers.length === 1) {
const server = JSON.parse(servers[0].value);
// get the candidates types (host, srflx, relay)
const types = candidates.map((cand) => can... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function tryFallbackHosts() {\n\t\t\t/* if there aren't any fallback hosts, fail */\n\t\t\tif(!candidateHosts.length) {\n\t\t\t\tvar err = new Error('Unable to connect (no available host)');\n\t\t\t\terr.statusCode = 404;\n\t\t\t\terr.code = 80000;\n\t\t\t\tcallback(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t/* before... | [
"0.54898196",
"0.50236446",
"0.50176924",
"0.49629632",
"0.48740956",
"0.4805363",
"0.4797045",
"0.47672412",
"0.47510904",
"0.47496858",
"0.47344595",
"0.4732248",
"0.46841505",
"0.46309215",
"0.45980987",
"0.459328",
"0.4581849",
"0.4576669",
"0.45725623",
"0.45492968",
"0.... | 0.63648665 | 0 |
Returns a promise that resolves with a redis client that has established a connection | function getConnectedRedisClient(kinesisCallback) {
return new Promise((resolve, reject) => {
const client = redis.createClient({
host: REDIS_ENDPOINT,
port: 6379
});
// If we encounter a Redis error (like ECONNREFUSED or who knows what else)
// report an error back to Kinesis.
// The ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"connect() {\n return new Promise(async (resolve, reject) => {\n if (this.publisher !== undefined) {\n this._log(this.levels.info, 'connect', 'Tried to connect a publisher that is already connected.');\n return reject(new Error('Publisher already connected.'));\n ... | [
"0.74290776",
"0.71309817",
"0.70918244",
"0.70285213",
"0.6972966",
"0.6931833",
"0.6839677",
"0.67505556",
"0.6674407",
"0.6646187",
"0.66429794",
"0.6605509",
"0.656712",
"0.64556336",
"0.64377743",
"0.6425586",
"0.64080477",
"0.64080477",
"0.6385842",
"0.6373591",
"0.6372... | 0.7528593 | 0 |
You are given a list of positive integers. The odd numbers from the list will fight using their 1 bits from their binary representation, while the even numbers will fight using their 0 bits. If present in the list, number 0 will be neutral, hence not fight for either side. You should return: odds win if number of 1s fr... | function bitsBattle(numbers) {
let odds = [];
let evens = []
for(let i = 0; i < numbers.length; i++){
if (numbers[i] % 2 === 0){
evens.push(numbers[i].toString(2))
}else{
odds.push(numbers[i].toString(2))
}
}
console.log(evens)
console.log(odds)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function multinomial_mod_2(list){\r\n let old_sum = list[0];\r\n for(let i = 1; i < list.length; i++){\r\n for(let j = 1; j <= Math.min(old_sum, list[i]); j = j<<1) {\r\n if (((j & old_sum ) === j) && ((j & list[i]) !== 0) ) {\r\n return 0;\r\n }\r\n }\r\n ... | [
"0.5987933",
"0.59118426",
"0.5887562",
"0.58519953",
"0.5802578",
"0.57898116",
"0.5789407",
"0.57125556",
"0.57063335",
"0.5671067",
"0.56698406",
"0.5661509",
"0.5649583",
"0.5622777",
"0.56216913",
"0.56173545",
"0.55670536",
"0.55653507",
"0.55580086",
"0.5551731",
"0.55... | 0.6040117 | 0 |
log out by clearing authentication cache or providing wrong credentials to apache | function logout() {
if (!document.execCommand("ClearAuthenticationCache")) {
$.ajax({
async: false,
url: "/.login",
type: 'GET',
username: 'logout'
});
}
window.location = "/";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"logOut() {\n authContextApi.logOut();\n }",
"function Logout(){\n AuthenticationService.ClearCredentials();\n $state.go('Login');\n }",
"logout() {\n // remove authentication credentials\n this.credentials = null;\n }",
"deauthenticate(): void {}",
"function _logOutUser ()... | [
"0.7178023",
"0.7174315",
"0.7091865",
"0.7074932",
"0.7009705",
"0.69987744",
"0.69676155",
"0.6961236",
"0.6930328",
"0.6929955",
"0.69253546",
"0.6915796",
"0.6880959",
"0.6778997",
"0.67418593",
"0.6704802",
"0.6689939",
"0.66645026",
"0.66438925",
"0.6635803",
"0.6615459... | 0.71827924 | 0 |
Create a function which returns new instances of FormatWrap for simple syntax like: require('winston').formats.json(); | function createFormatWrap(opts) {
return new Format(opts);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Format() {}",
"function Format() {}",
"function format()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(_metadata_min_json_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])\r\n\treturn _es6_format__WEBPACK_IMPORTED_MODULE_4__[\"default\"].apply(this, parameters)\r\n}... | [
"0.6646282",
"0.6646282",
"0.65806097",
"0.6458385",
"0.6032779",
"0.59551275",
"0.5821948",
"0.5821948",
"0.5821948",
"0.57953227",
"0.5790699",
"0.5790699",
"0.5764918",
"0.570215",
"0.56374776",
"0.56374776",
"0.5613538",
"0.5598985",
"0.55791795",
"0.5567479",
"0.5526298"... | 0.77768266 | 0 |
Configures the logging level. | setLoggingLevel(logLevel) {
this.logLevel = logLevel;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set logLevel(level) {\n winston.level = level\n winston.debug('Requested log level to to: ' + level)\n winston.debug('Log level is now: ' + winston.level)\n }",
"setLogLevel(logLevel) {\n if (this.availableLogLevels.indexOf(logLevel) > -1) {\n this.logLevel = logLevel;\n }\n }",
"setLevel... | [
"0.72163135",
"0.66253835",
"0.64861286",
"0.6372985",
"0.6330135",
"0.6324224",
"0.6253458",
"0.6253458",
"0.6253458",
"0.6244276",
"0.6241881",
"0.6238352",
"0.62337786",
"0.62231296",
"0.62121516",
"0.6187105",
"0.61678606",
"0.61667526",
"0.6053197",
"0.60043687",
"0.6004... | 0.70731866 | 1 |
Adds a logs handler. | addLogsHandler(logsHandler) {
this.logsHandlers.push(logsHandler);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"addHandler(handler) {\n handlers.push(handler);\n }",
"addHandler (handler, type) {\n\t\tthis.handlers.push(handler)\n\t}",
"addHandler(handler) {\n if (Handler.validate(handler)) {\n this.handlers[handler.id] = handler;\n }\n }",
"initializeLogHandlers() {\n this.removeAll... | [
"0.6213625",
"0.59514177",
"0.59508926",
"0.5741364",
"0.56345475",
"0.5545898",
"0.5355219",
"0.5354219",
"0.5354219",
"0.5349876",
"0.52659637",
"0.52606183",
"0.5202784",
"0.5189194",
"0.5164593",
"0.51507807",
"0.51507807",
"0.5131693",
"0.51090115",
"0.5105313",
"0.50887... | 0.809733 | 0 |
store for allEvents state | function allEventsStore() {
return {
allEvents: [],
addAnEvent(event) {
this.addEvents.push(event);
},
addEvents(events) {
this.allEvents = [...this.allEvents, ...events];
},
clearAllEvents() {
this.allEvents = [];
},
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"mapStoreEvents() {\n\t\tconst events = this.handleStoreEvents();\n\t\tfor (const eventType in events) {\n\t\t\t/* eslint-disable no-prototype-builtins */\n\t\t\tif (events.hasOwnProperty(eventType)) {\n\t\t\t\tthis.storage.on(eventType, events[eventType]);\n\t\t\t}\n\t\t}\n\t}",
"function storeEvents() {\n lo... | [
"0.7066782",
"0.69339365",
"0.6878414",
"0.6846465",
"0.6692961",
"0.6583096",
"0.6496028",
"0.6335819",
"0.63107014",
"0.6289805",
"0.62460047",
"0.62460047",
"0.6201632",
"0.6140251",
"0.6130563",
"0.60862535",
"0.60853946",
"0.6038835",
"0.6020982",
"0.6001552",
"0.5990522... | 0.7381755 | 0 |
Toggle expanded and pressed states if applicable | activate() {
const { expanded, pressed } = this
if(expanded !== undefined) {
this.expanded = !expanded
}
if(pressed !== undefined) {
this.pressed = !pressed
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"toggle() {\n this.expanded = !this.expanded;\n }",
"toggle() {\n this._setState({\n expanded: !this.state.expanded,\n });\n }",
"function toggle() {\n setOpened(!opened);\n expandedCallback(!opened);\n }",
"justToggleExpand() {\n this.setState({\n expa... | [
"0.7361756",
"0.72603834",
"0.72039527",
"0.7138318",
"0.7138318",
"0.7105225",
"0.7055345",
"0.7055345",
"0.69256073",
"0.6904873",
"0.68408036",
"0.6777545",
"0.67496836",
"0.6733591",
"0.6708908",
"0.6652497",
"0.6622119",
"0.6601241",
"0.6601241",
"0.6574548",
"0.65619045... | 0.75898814 | 0 |
Get and format the validation messages from the form. | getValidationMessages (errors = {}) {
var validationMessages = []
for (var error in errors) {
if (errors[error]) {
validationMessages.push([errors[error][0] ? errors[error][0].message : ''])
}
}
return validationMessages
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get validationMessage() {\n return this.getInput().validationMessage;\n }",
"function formatValidationError(fields) {\n\t\t\tvar msg = \"\";\n\t\t\t\n\t\t\tangular.forEach(fields, function (field, index) {\n\t\t\t\t//Manually change label to name\n\t\t\t\tif (field === 'label') {\n\t\t\t\t\tfield = 'na... | [
"0.65471905",
"0.648676",
"0.6485657",
"0.63664865",
"0.62796664",
"0.62791526",
"0.6272237",
"0.6182965",
"0.61440253",
"0.60775703",
"0.60064983",
"0.59844804",
"0.5906767",
"0.5894796",
"0.582935",
"0.58288586",
"0.58265376",
"0.58088106",
"0.5798909",
"0.57916766",
"0.579... | 0.6765719 | 0 |
Return the validation error message if validation fails. | getValidationErrorMessage () {
return VALIDATION_ERROR_MESSAGE
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get validationMessage() {\n return this.getInput().validationMessage;\n }",
"function validationMessage(validationResult, fieldName) {\n\treturn validationResult.errors[fieldName];\n}",
"getValidationMessage(){\n\t\treturn this.validationMessage;\n\t}",
"function getErrorMsg() {\r\n ... | [
"0.75468546",
"0.7452453",
"0.73450863",
"0.7172942",
"0.6698725",
"0.6612634",
"0.65913475",
"0.6562528",
"0.65377134",
"0.6528353",
"0.6473122",
"0.6472773",
"0.64171517",
"0.6350072",
"0.6346522",
"0.63443816",
"0.63443816",
"0.63443816",
"0.6245377",
"0.6233625",
"0.61919... | 0.76459855 | 0 |
Add http to data url | function addDataUrlHttp(url) {
if (!/^(?:f|ht)tps?\:\/\//.test(url)) {
url = "http://" + url;
}
return url;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addHttp(url) {\n if (url.substr(0, 4) !== 'http')\n return 'http://' + url;\n return url;\n}",
"function addhttp(url) {\n if (!/^(f|ht)tps?:\\/\\//i.test(url) && \"\"!= url) {\n url = \"http://\" + url;\n }\n return url;\n}",
"function agregarHttp(url) {\n return'http://'+ur... | [
"0.6958686",
"0.6763663",
"0.6608419",
"0.65244496",
"0.61945194",
"0.5936179",
"0.58541423",
"0.584761",
"0.58001006",
"0.5798677",
"0.5718108",
"0.56821847",
"0.56787467",
"0.56738573",
"0.5613654",
"0.5592501",
"0.5550308",
"0.55371106",
"0.5517559",
"0.5516353",
"0.549798... | 0.864988 | 0 |
Move suggested item selection | function moveSelectSuggestedItem(direction) {
var $allSuggestedItems = $("." + searchItemClass);
if($allSuggestedItems.length) {
var $current = $("." + searchItemClass + ".selected");
if($current.length) {
$current.removeClass("selected");
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function moveSelected() {\n viewModel.waitRelease(true)\n viewModel.moveItems = viewModel.selectedItems().slice()\n viewModel.itemList.removeAll(viewModel.moveItems)\n viewModel.selectedItems.removeAll()\n viewModel.moveParent = viewModel.parent()\n}",
"function moveSelected(delta) {\n setSelec... | [
"0.6890867",
"0.6887327",
"0.66227806",
"0.65990984",
"0.6565417",
"0.65342367",
"0.64129615",
"0.63513887",
"0.63319606",
"0.6222085",
"0.6152686",
"0.6139111",
"0.6123673",
"0.60910887",
"0.60511434",
"0.6026562",
"0.6011811",
"0.59838057",
"0.59831667",
"0.59782165",
"0.59... | 0.7749536 | 0 |
Show selected search suggested item | function showSelectedSuggestedItem() {
$("." + searchItemClass + ".selected").each(function() {
$(this).removeClass("selected");
});
$(this).addClass("selected");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showHelp() { \n var search = $(select).find(':selected').nextAll().andSelf();\n var num_display = 1;\n\n // Clear out div.\n $(suggest_div).find('.suggest-prompt').empty();\n \n // Add help text.\n for (var i = 0; i < Math.min(nu... | [
"0.71003956",
"0.6743476",
"0.6654009",
"0.6432376",
"0.62942415",
"0.62942415",
"0.62735105",
"0.6270711",
"0.6260115",
"0.6230486",
"0.62086284",
"0.62059873",
"0.61225057",
"0.6122199",
"0.61205673",
"0.61050683",
"0.6080042",
"0.60464513",
"0.6042115",
"0.60339105",
"0.60... | 0.77635086 | 0 |
Hide selected search suggested item | function hideSelectedSuggestedItem() {
$(this).removeClass("selected");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function hideSuggest()\n{\n var results = document.getElementById(\"results\");\n if(results.hasChildNodes()) results.removeChild(results.firstChild);\n \n document.getElementById(\"keyIndex\").value = \"-1\"; // reset the suggestions index\n}",
"function hideSuggest(e) {\n\n \n\n ... | [
"0.7145858",
"0.68550396",
"0.6794564",
"0.670722",
"0.6668939",
"0.6645055",
"0.65840435",
"0.64505684",
"0.6422779",
"0.6387036",
"0.6359669",
"0.6347395",
"0.63173246",
"0.627952",
"0.62633526",
"0.6248525",
"0.618711",
"0.61671114",
"0.61668205",
"0.6158488",
"0.6145841",... | 0.7932293 | 0 |
Search suggestion item click handler | function onSearchSuggestionItemClick(e) {
e.preventDefault();
e.stopPropagation();
var searchInput = $("#search-input").focus().val('');
searchInput.parent().addClass("active");
var searchInputText = $(this).attr("data-search-text");
var searchInputUrl = $(this).at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleSearchClick(){\r\n var temp = document.getElementById('searchText').value;\r\n fetchRecipesBySearch(temp);\r\n }",
"function suggestItemHandler(trackingVersion, suggestItems) {\n\n \n\n // bind mouseenter/mouseleave to suggest options\n\n \... | [
"0.7194769",
"0.7151788",
"0.7102348",
"0.6989344",
"0.68388563",
"0.6815527",
"0.6784575",
"0.6767696",
"0.6741959",
"0.67397827",
"0.66995114",
"0.66864836",
"0.66437465",
"0.66116726",
"0.6593627",
"0.6593474",
"0.65871775",
"0.6578561",
"0.6539763",
"0.64590997",
"0.64172... | 0.7605013 | 0 |
Initializes the bullet information according to the firing position of the bullet | init(x,y)
{
this.bulletX = x; //bullet position
this.bulletY = y; //bullet position
this.isUsed = 1; //used or not
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setBulletPosition() {\n\t\tthis.x = Math.round(this.originalPosition.x);\n\t\tthis.y = Math.round(this.originalPosition.y);\n\t}",
"function Bullet() {\n this.x = -1;\n this.y = -1;\n this.velX = 0;\n this.velY = 0;\n this.elem = 'fire';\n }",
"setupBullets() {\n ga... | [
"0.70702976",
"0.7025819",
"0.6982016",
"0.69669485",
"0.68187994",
"0.6782529",
"0.67103326",
"0.66373456",
"0.66298264",
"0.6584934",
"0.65526366",
"0.655257",
"0.6517352",
"0.6513043",
"0.6402829",
"0.6384025",
"0.63817537",
"0.6372226",
"0.63718194",
"0.63651067",
"0.6339... | 0.77409065 | 0 |
Initializes the bullet information according to the firing position of the bullet | init(x,y)
{
this.bulletX = x; //bullet position
this.bulletY = y; //bullet position
this.isUsed = 1; //used or not
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setBulletPosition() {\n\t\tthis.x = Math.round(this.originalPosition.x);\n\t\tthis.y = Math.round(this.originalPosition.y);\n\t}",
"function Bullet() {\n this.x = -1;\n this.y = -1;\n this.velX = 0;\n this.velY = 0;\n this.elem = 'fire';\n }",
"setupBullets() {\n ga... | [
"0.70702976",
"0.7025819",
"0.6982016",
"0.69669485",
"0.68187994",
"0.6782529",
"0.67103326",
"0.66373456",
"0.66298264",
"0.6584934",
"0.65526366",
"0.655257",
"0.6517352",
"0.6513043",
"0.6402829",
"0.6384025",
"0.63817537",
"0.6372226",
"0.63718194",
"0.63651067",
"0.6339... | 0.77409065 | 1 |
Displays the score ,level and the amount of blood | function showStatus()
{
/* score */
fill(255);
textSize(16);
text("score:"+score, 5, 16);
/* level */
fill(255);
textSize(16);
text("level:"+level, 5, 32);
/* bullet left */
fill(255);
textSize(16);
text("bullet:"+bnum, 5, 48);
/* blood */
fill(255);
textSize(16);
text("blood:"+blood, 5, 64);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayScore() {\n\ttheBoard.context.fillStyle = \"green\";\n\ttheBoard.context.font = \"bold 24px Times\";\n\ttheBoard.context.fillText(\"Score: \" + theBoard.score, 7, 22);\n\ttheBoard.context.fillText(\"Level: \" + theBoard.level, 700, 22);\n}",
"function showLevel(){\r\n $('#score').text(level + 1)... | [
"0.6786489",
"0.677811",
"0.6764111",
"0.6749396",
"0.673492",
"0.66944396",
"0.66021043",
"0.65714556",
"0.65362984",
"0.64217997",
"0.6419945",
"0.63944334",
"0.6385564",
"0.637383",
"0.6366837",
"0.6357871",
"0.63528913",
"0.63459504",
"0.63332963",
"0.6331874",
"0.6329171... | 0.6816286 | 0 |
work on font outline colors | function CreateOutlineTextColors() {
var colorBoxes = document.querySelector(".font-outline-color-choice");
function changeMemeFontColor() {
currentTextOutline = this.style.backgroundColor;
redrawMeme(window.imageSrc, window.topLineText, window.bottomLineText, currentFontColor, this.style.backg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get textColor() {\n return brushToString(this.i.a5);\n }",
"set FontOutline(value) {\n this._outline = value;\n }",
"get outlineColor() {\n\t\treturn new Color(this.__Internal__Dont__Modify__.outlineColor);\n\t}",
"function onChangeStrokeColor(txt, color) {\n changeStrokeColor(txt, col... | [
"0.6687277",
"0.6653287",
"0.660201",
"0.6585239",
"0.6317925",
"0.6239075",
"0.6236153",
"0.6235595",
"0.61316466",
"0.61283743",
"0.61283743",
"0.61221445",
"0.6116759",
"0.6091552",
"0.60012287",
"0.59934944",
"0.59840924",
"0.5951959",
"0.5919629",
"0.59115785",
"0.587214... | 0.70440936 | 0 |
NOTE this is a bit brittle there's not a 1:1 relationship between what's in the branch field and the invite it was replying to e.g. if there were 2 requests, I think the next reply will always point to the _last_ request, not just any request this will cause problems with ephemeral requests / replies maybe? | function getReply (request, replies) {
return replies.find(reply => {
const branch = get(reply, 'value.content.branch')
return (Array.isArray(branch))
? branch.find(b => b === request.key)
: branch === request.key
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static requestNextBlock(request) {\n const message = request.originalMessage;\n const connection = request.connection;\n // requests for the next block are a new message with a new message id\n const oldMsgID = message.messageId;\n message.messageId = connection.lastMsgId = incre... | [
"0.56242836",
"0.5125321",
"0.5001499",
"0.4989735",
"0.4981913",
"0.49653965",
"0.4910562",
"0.4896308",
"0.4851222",
"0.4839403",
"0.48007593",
"0.4795174",
"0.47840354",
"0.4772392",
"0.47659296",
"0.47313598",
"0.47152814",
"0.47020733",
"0.46970096",
"0.4681737",
"0.4677... | 0.6123081 | 0 |
Calculate the distance of a single point to a single centroid | function calculateCentroidDistance(point, centroid) {
//euclidian distance function
var point_linear_sum = [];
var centroid_linear_sum = calculateCentroid(centroid.linear_sum, centroid.n_samples)
for (var p = 1; p<point.length; p++) { //id is first attribute in array
point_li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findClosestCentroid(point)\n {\n var closest = {\n i: -1,\n distance: width * 2\n };\n centroids.forEach(function(d, i)\n {\n var distance = getEuclidianDistance(d, point);\n // Only update when the centroid is closer\n ... | [
"0.71087307",
"0.6911727",
"0.6871623",
"0.6527796",
"0.6436302",
"0.6404081",
"0.6170792",
"0.6118414",
"0.6083268",
"0.6055755",
"0.6055534",
"0.6051529",
"0.6051529",
"0.60488075",
"0.603641",
"0.60331154",
"0.60331154",
"0.60331154",
"0.60331154",
"0.60331154",
"0.6032217... | 0.80462414 | 0 |
Split a node if there is no place for a new subcluster in the node | function split_node(node, threshold, branching_factor) {
//initialize two new empty nodes and two empty subclusters
var is_leaf = node.is_leaf;
var n_features = node.n_features;
var new_node1 = new CFNode(is_leaf);
var new_node2 = new CFNode(is_leaf);
var new_subcluster1 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"split(node) {\n let newNode = new BNode();\n let newNodeIsLeafOldValue = newNode.isLeaf;\n newNode.isLeaf = node.isLeaf;\n this.addAtLastIndexOfCallStack(\n () => {\n newNode.isLeaf = newNodeIsLeafOldValue;\n }\n );\n while (node.size()... | [
"0.6521846",
"0.6429968",
"0.5786998",
"0.5786998",
"0.5786998",
"0.5786998",
"0.5786998",
"0.57789135",
"0.57681876",
"0.57681876",
"0.57681876",
"0.57356197",
"0.5710757",
"0.56565887",
"0.56551915",
"0.56551915",
"0.56551915",
"0.56188136",
"0.56017417",
"0.55961263",
"0.5... | 0.73212737 | 0 |
get feature vector from single datapoint | function datapointToVector(datapoint){
var result = [];
// result.push(new Date(datapoint["TIMESTAMP"]));
result.push(parseInt(datapoint["DETECTOR_NUMBER"]));
result.push(parseInt(datapoint["FLOW_IN"]));
result.push(parseInt(datapoint["AVERAGE_SPEED"]));
result.push(parse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getVector(category, field, rows, cols, rowIndex) {\n var ret = [];\n for (var i = 1; i <= rows; i++) {\n ret[i - 1] = category.getColumn(field + \"[\" + i + \"]\").getFloat(rowIndex);\n }\n return ret;\n }",
"get vector4Value() {}",
"ge... | [
"0.6011472",
"0.5606094",
"0.5567303",
"0.5551952",
"0.5546031",
"0.54275715",
"0.5382129",
"0.5377535",
"0.5286164",
"0.52858263",
"0.52858263",
"0.5266193",
"0.52478486",
"0.5231247",
"0.52224314",
"0.52185786",
"0.52185786",
"0.5208657",
"0.51953787",
"0.5195113",
"0.51796... | 0.68208456 | 0 |
create CFSubcluster from datapoint vector | function CFSubcluster(datapointVector){
//attributes
this.n_samples = 0;
this.linear_sum = null;
this.squared_sum = null;
if (datapointVector != undefined) {
this.id = datapointVector[5];
}
if (datapointVector != null){
this.n_samples = 1;... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get Clustering() {}",
"function test_crosshair_op_cluster_vsphere65() {}",
"distanceBasedClustering2 () {\n\t\tlet dataSize = this.dataIn.length;\n\t\tlet dataOut = {\n\t\t\tclusters: [],\n\t\t\tdataLabel: new Array( dataSize ).fill( -1 ),\n\t\t\tdataSize: dataSize,\n\t\t\tnumClusters: null, // filled later\n\... | [
"0.5441479",
"0.5254476",
"0.5131035",
"0.51087993",
"0.50979435",
"0.5057582",
"0.50524324",
"0.50345355",
"0.49720395",
"0.49521682",
"0.4947518",
"0.48865172",
"0.48372388",
"0.47876",
"0.47492927",
"0.4740629",
"0.47366467",
"0.47257274",
"0.47062397",
"0.46938357",
"0.46... | 0.78733563 | 0 |
A list of all registered strategy names | get strategyNames() {
return Object.keys(this.strategies);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get strategyNames () {\n return Object.keys(this.strategies);\n }",
"getStrategies (...names) {\n // Returns all strategies for a list of names (including undefined)\n return names.map(name => this.strategies[name])\n .filter(current => !!current);\n }",
"getStrategies(...names) {\n retu... | [
"0.8399943",
"0.7430715",
"0.7205871",
"0.64177424",
"0.5890338",
"0.56432676",
"0.5592835",
"0.54991174",
"0.54941875",
"0.54579896",
"0.5455823",
"0.54508036",
"0.5395866",
"0.53909427",
"0.53645295",
"0.535879",
"0.5297331",
"0.52944946",
"0.5282591",
"0.5282572",
"0.52575... | 0.8572502 | 0 |
Register a new authentication strategy under a given name. | register(name, strategy) {
// Call the functions a strategy can implement
if (typeof strategy.setName === 'function') {
strategy.setName(name);
}
if (typeof strategy.setApplication === 'function') {
strategy.setApplication(this.app);
}
if (typeof s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"register (name, strategy) {\n // Call the functions a strategy can implement\n if (typeof strategy.setName === 'function') {\n strategy.setName(name);\n }\n\n if (typeof strategy.setApplication === 'function') {\n strategy.setApplication(this.app);\n }\n\n if (typeof strategy.setAuthent... | [
"0.80991757",
"0.7010093",
"0.6235593",
"0.57097703",
"0.52662593",
"0.5139004",
"0.5105554",
"0.50589234",
"0.5057859",
"0.5040054",
"0.5040054",
"0.5040054",
"0.5029494",
"0.5005959",
"0.49377272",
"0.4935949",
"0.48791003",
"0.48633435",
"0.48500365",
"0.48417827",
"0.4834... | 0.8080122 | 1 |
Get the registered authentication strategies for a list of names. | getStrategies(...names) {
return names.map(name => this.strategies[name])
.filter(current => !!current);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getStrategies (...names) {\n // Returns all strategies for a list of names (including undefined)\n return names.map(name => this.strategies[name])\n .filter(current => !!current);\n }",
"get strategyNames () {\n return Object.keys(this.strategies);\n }",
"get strategyNames() {\n return O... | [
"0.73128986",
"0.5945166",
"0.5938324",
"0.5863371",
"0.55247104",
"0.5181404",
"0.51438177",
"0.50929266",
"0.5085672",
"0.5027813",
"0.47412053",
"0.46880612",
"0.46536052",
"0.46379086",
"0.4616537",
"0.45178282",
"0.45178282",
"0.45178282",
"0.45178282",
"0.45178282",
"0.... | 0.70595413 | 1 |
Create a new access token with payload and options. | createAccessToken(payload, optsOverride, secretOverride) {
return __awaiter(this, void 0, void 0, function* () {
const { secret, jwtOptions } = this.configuration;
// Use configuration by default but allow overriding the secret
const jwtSecret = secretOverride || secret;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async createAccessToken (payload, optsOverride, secretOverride) {\n const { secret, jwtOptions } = this.configuration;\n // Use configuration by default but allow overriding the secret\n const jwtSecret = secretOverride || secret;\n // Default jwt options merged with additional options\n const optio... | [
"0.725604",
"0.65342605",
"0.63434356",
"0.62700534",
"0.62408495",
"0.6229512",
"0.62162",
"0.6210445",
"0.6210445",
"0.6210445",
"0.6209543",
"0.62057745",
"0.618417",
"0.6167167",
"0.6162246",
"0.60028785",
"0.5989022",
"0.58985937",
"0.5898092",
"0.5867506",
"0.58583784",... | 0.71733016 | 1 |
Authenticate a given authentication request against a list of strategies. | authenticate(authentication, params, ...allowed) {
return __awaiter(this, void 0, void 0, function* () {
const { strategy } = authentication || {};
const [authStrategy] = this.getStrategies(strategy);
const strategyAllowed = allowed.includes(strategy);
debug('Runn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async authenticate (authentication, params, ...allowed) {\n const { strategy } = authentication || {};\n const [ authStrategy ] = this.getStrategies(strategy);\n\n debug('Running authenticate for strategy', strategy, allowed);\n\n if (!authentication || !authStrategy || !allowed.includes(strategy)) {\n... | [
"0.62313855",
"0.54604095",
"0.51399237",
"0.5054592",
"0.49704114",
"0.4838752",
"0.4816298",
"0.47498694",
"0.47485566",
"0.47446832",
"0.46898776",
"0.46869773",
"0.4674161",
"0.46494237",
"0.46494237",
"0.4635957",
"0.4635957",
"0.4596821",
"0.4593494",
"0.45871952",
"0.4... | 0.6145386 | 1 |
write the new position of the ball to the data base | function writePosition(x,y){
//set will set new values to the x and yinside the data base
//position.x=recent position of the ball from the data base and x=new position of hypnotic ball on the canvas(when moved with w,a,s,d keys)
database.ref('ball/position').set({
'x':position.x+x,
'y':position.y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function writePosition(x,y){\n //first refer to the point and set the value\n database.ref('ball/position').set({\n 'x':position.x+x,\n 'y':position.y+y\n })\n}",
"function writePosition(x,y){\n //updating the x and y position in the database\n database.ref(\"ball/position\").set({\n ... | [
"0.7395527",
"0.7384787",
"0.67416084",
"0.6690604",
"0.6532697",
"0.6519712",
"0.63855135",
"0.6356844",
"0.62286973",
"0.6212654",
"0.61954683",
"0.60045385",
"0.59916645",
"0.593055",
"0.59104",
"0.5873165",
"0.5853094",
"0.58375406",
"0.5824914",
"0.58210534",
"0.57991415... | 0.8350626 | 0 |
shows the error if problem in reading the value | function showError( ){
console.log("error in reading the position");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"validateValues() {\n if (this.getBeer() == undefined) {\n return chalk.bgRed('Error reading beer details');\n } else if (this.getTemperature() == undefined) {\n return chalk.bgRed('Error reading container temperature');\n } else if (this.getBeer().getMinTemperature() == u... | [
"0.64954054",
"0.6260011",
"0.6188414",
"0.61823636",
"0.61823636",
"0.6151502",
"0.60870206",
"0.6029247",
"0.59865904",
"0.5971876",
"0.5939155",
"0.5936393",
"0.59190947",
"0.5892014",
"0.5892014",
"0.5882119",
"0.58504313",
"0.58451355",
"0.58288026",
"0.5803013",
"0.5771... | 0.6273089 | 1 |
When you click on button, series will be saved to firebase | handleClickSeries(e) {
const seriesItem = e.target.value;
const seriesId = seriesItem.split(`/`);
// split the url at the slash points and store last value in array --> series ID
const collection = {
id: "",
series: seriesId[6]
};
if (firebase.auth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleSave(e) {\r\n let target = e.target,\r\n query = target.dataset.query;\r\n\r\n if (query) {\r\n switch (query) {\r\n case \"saveSetting\": {\r\n let settings = list.map((item) => {\r\n return item.value;\r\n ... | [
"0.6083584",
"0.6049893",
"0.6040165",
"0.5995146",
"0.59930164",
"0.5983086",
"0.598016",
"0.59751856",
"0.5928101",
"0.59072447",
"0.5893765",
"0.5856724",
"0.5848101",
"0.58445287",
"0.578528",
"0.5783139",
"0.57162654",
"0.5690703",
"0.56886065",
"0.5654836",
"0.56533635"... | 0.67853594 | 0 |
Prints API assets to console. | function outputAssets() {
utils.outputPaths(modelPaths, 'Models');
utils.outputPaths(controllerPaths, 'Controllers');
utils.outputPaths(routePaths, 'Routes');
console.log('\n'); // eslint-disable-line no-console
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static print() {\n console.log(\"snapClinical JS SDK Version: \" + \"1.2.15\" );\n }",
"function printMarkersFromApiRest() {\n dibujaMarcadores(estaciones, \"EstacionesLectoras\");\n}",
"function debug(title, url, body, method, headers) {\n if (__DEV__) {\n const d = new Date();\n ... | [
"0.55218834",
"0.55129874",
"0.5444806",
"0.53476137",
"0.5270144",
"0.5261214",
"0.523079",
"0.5226948",
"0.52037",
"0.52037",
"0.52027225",
"0.5153658",
"0.51393455",
"0.5134274",
"0.51081693",
"0.5089298",
"0.5083479",
"0.5081514",
"0.5080768",
"0.5069615",
"0.50644374",
... | 0.67070556 | 0 |
Print current selected files ID. | function printSelectedFilesId() {
console.log("Selected Files Id:" + rows_selected);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displaySingleSelection(fileName) {\n var baseName = fileName.replace(/^.*[\\/\\\\]/, \"\");\n $(\".upload-filelist\").empty();\n $(\".upload-filelist\").append($(\"<li/>\").text(baseName));\n }",
"function displayFileDetails(file, side){\n side.innerHTML = file.name + \" (... | [
"0.6374252",
"0.60515606",
"0.60480565",
"0.5996897",
"0.5926389",
"0.57749164",
"0.5765063",
"0.57212496",
"0.5686471",
"0.56378394",
"0.5633563",
"0.5630813",
"0.5578531",
"0.5570112",
"0.55304",
"0.551908",
"0.5478083",
"0.54561627",
"0.5434247",
"0.54314715",
"0.54300773"... | 0.8033109 | 0 |
handle uploading finish event. | function uploadCompleteHandler() {
console.log("Upload finished.");
getAllFiles();
/*
Do what you like here.
*/
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function finishUpload()\n {\n aws_params.MultipartUpload = {\n Parts: aws_parts \n };\n console.log('Completing...', aws_parts);\n\n s3.completeMultipartUpload(aws_params, function(err, data) {\n if (err) setError('Error completing upload: ' + err);\n ... | [
"0.7867457",
"0.7853716",
"0.784667",
"0.765773",
"0.7625084",
"0.76195276",
"0.7585472",
"0.732096",
"0.7309414",
"0.7268667",
"0.72543895",
"0.72139627",
"0.716442",
"0.715353",
"0.7121852",
"0.70312655",
"0.70189315",
"0.6948813",
"0.6917565",
"0.6774209",
"0.6661949",
"... | 0.78865194 | 0 |
Make this function return the input string wrapped to 40 characters per line. This means you'll have to insert a newline character after every 40 characters in the input string. If the next character after a cut is a space, then do not display it. To represent a newline character, you can use "\n". | function wrapAfter40Chars(str) {
if(typeof str !== "string"){
return undefined;
} else {
let charArray = str.split("");
for(let i = 0; i <= charArray.length - 1; i++){
if(i > 0 && i % 40 === 0){
if (charArray[i] === " "){
charArray.splice(i,1,"\n");
} else {
cha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function wrapAfter40Chars(str) {\n let line = str.length;\n let i = 0;\n let maxChar = 40;\n while (line > maxChar) {\n line = line - maxChar;\n i = i + maxChar;\n str = str.substring(0, maxChar) + \"\\n\" + str.substring(maxChar);\n }\n return str;\n}",
"function wrapAfter40Chars(str) {\n let wra... | [
"0.8127282",
"0.7524158",
"0.65187305",
"0.6454092",
"0.6333829",
"0.63283366",
"0.63198227",
"0.622296",
"0.62196225",
"0.62186855",
"0.61981523",
"0.61589694",
"0.6147688",
"0.6135176",
"0.6133881",
"0.6029552",
"0.6002997",
"0.59941435",
"0.5981994",
"0.5904625",
"0.588795... | 0.80691475 | 1 |
Progression 1: Names and Input 1.1 Create a variable `ProGrad1` with the driver's name. 1.2 Print `"The driver's name is XXXX"`. 1.3 Create a variable `ProGrad2` with the navigator's name. 1.4 Print `"The navigator's name is YYYY"`. | function get_names() {
var proGrad_1 = process.argv[2];
console.log(`" The driver\'s name is ${proGrad_1}"`);
var proGrad_2 = process.argv[3];
console.log(`" The navigators\'s name is ${proGrad_2}"`);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function profVarFunc() {\n let profVar;\n let toolProf1;\n let toolProf2;\n let vehiclesProf;\n\n toolProf === null ? toolProf1 = \"\" : toolProf1 = toolProf;\n background === \"Criminal/Spy\" ? toolProf2 = \"Thieves' Tools\" : toolProf2 = \"\";\n background === \"Folk Hero\" || \"Soldier\" ? vehiclesProf =... | [
"0.6009946",
"0.58343786",
"0.57662797",
"0.57169116",
"0.56863374",
"0.56804717",
"0.56668615",
"0.5611606",
"0.5604257",
"0.55900484",
"0.5585463",
"0.55356824",
"0.55345976",
"0.5517171",
"0.551581",
"0.55063677",
"0.54927576",
"0.5488129",
"0.54840684",
"0.5471229",
"0.54... | 0.70810586 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.