query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Tells the server to delete the task. | function deleteTask(task) {
const params = new URLSearchParams();
params.append('id', task.id);
fetch('/delete-task', {method: 'POST', body: params});
} | [
"function deleteTask(task) {\r\n const params = new URLSearchParams();\r\n params.append('id', task.id);\r\n fetch('/delete-task', {method: 'POST', body: params});\r\n}",
"delete(task) {\n this.$http.delete('/api/teams/' + this.currentTeam.id + '/tasks/' + task.id);\n\n this.removeTaskFro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Have the function flip(input) take the input parameter, comprised of As and Zs being passed and return the string with each character flipped. For example: if the input string is "AAZZA" then your program should return the string "ZZAAZ". | flip(input){
// get letters from A to Z and swap letter values
// using regex with global parameter
//
let swapChr = input.replace(/A/g, "_").replace(/Z/g, "A").replace(/_/g, "Z");
// output results
return swapChr;
} | [
"flip(input) {\n //Split string into array of letters\n //Iterate through letters\n //if letter is \"A\" then update letter to \"Z\"\n //else letter update letter to \"A\"\n //join letters \n //return output with flipped input \n\n let letters = input.split(\"\");\n for (let i = 0; i < let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates table of images based on chosen manuscripts | function generateTable(sizeChoice, imageChoice){
//pulls selected manuscripts and creates array chosenManuscripts
var chosenManuscripts = getChosenValuesFromList("manuscripts");
//pulls letters and creates array chosenLetters
var chosenLetters = getChosenValuesFromList("letters");
var chose... | [
"function generateTable(sizeChoice, imageChoice){\n\n //change triangle\n var string = window.location.href + \"images/closedTriangle.png\";\n document.getElementById('img2').innerHTML = ' <img src=\"'+string+'\" width = 15px>';\n secondTriangle = \"closed\";\n\n //pulls selected manuscripts and crea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parentDims: This is an xstream operator that will take a stream of elements, and return a stream of [offsetWidth, offsetHeight] parent resizes. | function parentDims(element$) {
const resizes$ = xs.merge(xs.of(undefined), fromEvent(window, 'resize'));
return xs.combine(element$, resizes$)
.filter(([el]) => el && el.parentNode)
.map(([el]) => [el.parentNode.offsetWidth, el.parentNode.offsetHeight])
.compose(dropRepeats(([a, b], [c, d]) => a === c ... | [
"parentSize() {\n if (!this.parent) {\n console.warn('HView#parentSize; no parent!');\n return [0, 0];\n }\n if (this.parent.elemId === 0) {\n return ELEM.windowSize();\n }\n else {\n return ELEM.getSize(this.parent.elemId);\n }\n }",
"function calcParentSizes(elements) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[0, 6] is week offset 0. [7, 13] is offset 1. [1, 7] is offset 1. | function weekOffset(dayOffset) {
if (dayOffset >= 0) {
return Math.floor(dayOffset / 7);
}
dayOffset = -dayOffset;
dayOffset--;
return -Math.floor(dayOffset / 7) - 1;
} | [
"_startOfWeekOffset(day, dow) {\n // offset of first day corresponding to the day of week in first 7 days (zero origin)\n const weekStart = MathUtil.floorMod(day - dow, 7);\n let offset = -weekStart;\n if (weekStart + 1 > this._weekDef.minimalDaysInFirstWeek()) {\n // The prev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if an offset/length value is valid. (Throws an exception if check fails) | function checkOffsetOrLengthValue(value, offset) {
if (typeof value === 'number') {
// Check for non finite/non integers
if (!isFiniteInteger(value) || value < 0) {
throw new Error(offset ? ERRORS.INVALID_OFFSET : ERRORS.INVALID_LENGTH);
}
}
else {
throw new Error... | [
"function checkOffset (offset, ext, length) { // 811\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') // 812\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Before a Carmel Packager can be used, we have to load it into memory. | load () {
if (!this.exists) {
// We can't load it because it doesn't exist
throw new Carmel.Error(Carmel.Error.PACK.NOT_FOUND);
}
} | [
"static packager(test) {\n // Create an empty Packager with a temporary root directory\n let dir = path.join(test.spec.tmpDir, 'packages');\n let packager = new Carmel.Packager(dir);\n\n // Initialize the Packager\n fs.mkdirsSync(dir);\n test.expect(fs.existsSync(dir)).to.be.true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display Draw the hunter as an ellipse on the canvas with a radius the same size as its current health. Draw the image in the ellipse Draw only if alive | display() {
if (this.health > 0) {
push();
noStroke();
fill(this.fillColor);
this.radius = this.health;
ellipse(this.x, this.y, this.radius * 2);
image(this.image, this.x, this.y, this.radius, this.radius);
pop();
} else {
var removed = hunterList.splice(this.inde... | [
"display() {\n push();\n noStroke();\n this.radius = this.health;\n imageMode(CENTER);\n if (this.radius > 1) {\n image(this.image,this.x, this.y, this.radius * 3, this.radius * 3);\n }\n pop();\n }",
"function drawPlayer() {\n fill(250,20,50,playerHealth);\n ellipse(playerX,playerY,playe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
external to_int32: t > int32 Provides: ml_z_to_int32 Requires: ml_z_to_int | function ml_z_to_int32(z1) { return ml_z_to_int(z1) } | [
"function ml_z_of_int32(i32) {\n return ml_z_of_int(i32);\n}",
"function ml_z_to_int32(z1) {\n return bigInt(z1).toJSNumber();\n}",
"function ml_z_of_int32(i32) {\n return bigInt(i32);\n}",
"function ml_z_fits_int32(z1) {\n return ml_z_fits_int(z1);\n}",
"function ToInt32(v) { return v >> 0; }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the signal exception handler. | function setExceptionHandler(handler) {
var old = Private.exceptionHandler;
Private.exceptionHandler = handler;
return old;
} | [
"function setExceptionHandler(handler) {\n var old = Private.exceptionHandler;\n Private.exceptionHandler = handler;\n return old;\n }",
"function setExceptionHandler(handler) {\n var old = Private$4.exceptionHandler;\n Private$4.exceptionHandler = handler;\n return old;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Contact lens power measured in diopters (0.25 units). | get power() {
return this.__power;
} | [
"get power() {\n return this.intensity * 4 * Math.PI;\n }",
"get power() {\n return this.intensity * Math.PI;\n }",
"get arousePower() {\n return this.charisma + this.dexterity * 0.25\n }",
"function panel_power(mesh, direction, sun_v, time){\r\n\r\n var panel_v = new THREE.Vector3(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
disallowModify(input_object[,message[,true]]) Checks a form field for a value different than defaultValue. Optionally alerts and focuses | function disallowModify(obj) {
var msg;
var dofocus;
if (arguments.length>1) { msg = arguments[1]; }
if (arguments.length>2) { dofocus = arguments[2]; } else { dofocus=false; }
if (getInputValue(obj) != getInputDefaultValue(obj)) {
if (!isBlank(msg)) {... | [
"function disallowModify(obj){\r\n\tvar msg=(arguments.length>1)?arguments[1]:\"\";\r\n\tvar dofocus=(arguments.length>2)?arguments[2]:false;\r\n\tif (getInputValue(obj)!=getInputDefaultValue(obj)){\r\n\t\tif(!isBlank(msg)){alert(msg);}\r\n\t\tif(dofocus){\r\n\t\t\tif (isArray(obj) && (typeof(obj.type)==\"undefined... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolves Preload config per destination | static async resolveDestinationPreloadConfig(router, destination) {
const requests = [];
await new Tasks_1.default()
.add(...router.preloadRequests.options)
.onTaskDone((result) => {
requests.push(...result.map(r => ({ ...r, destination })));
})
.r... | [
"static async resolvePreloadConfig(router) {\n const preloadRequests = [];\n const tasks = new Tasks_1.default();\n const destinations = router.getDestinations();\n // Compile all the requests and options across all destinations\n if (!Object.keys(destinations).length) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
iv. Fill input value whose element id firstname using javascript. | function first(){
var firstname=document.getElementById('first-name');
firstname.nodeValue="mushi";
} | [
"function updateNameSurname() {\n nameSurname = document.getElementById(\"name-surname\").value;\n}",
"function update_primary(){\n $('input#person_primary_salutation').val($('select#person_primary_title_id').find('option:selected').html()\n + \" \" + $('input#person_first_name').val()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a mutation batch and the associated document mutations. | function removeMutationBatch(txn, userId, batch) {
var mutationStore = txn.store(DbMutationBatch.store);
var indexTxn = txn.store(DbDocumentMutation.store);
var promises = [];
var range = IDBKeyRange.only(batch.batchId);
var numDeleted = 0;
var removePromise = mutationStore.iterate({... | [
"function removeMutationBatch(txn, userId, batch) {\n var mutationStore = txn.store(DbMutationBatch.store);\n var indexTxn = txn.store(DbDocumentMutation.store);\n var promises = [];\n var range = IDBKeyRange.only(batch.batchId);\n var numDeleted = 0;\n var removePromise = mutationStore.iterate({ ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Traite toutes les collisions | function collisions() {
collisonBords(ballon);
equipes.forEach((eq) => {
eq.joueurs.forEach((e) => {
// Touche le cote droit
collisonBords(e);
});
});
let collision = false;
// Pour toutes les equipes
equipes.forEach((e) => {
// Pour chaque joueur de chaque é... | [
"resolveCollisions() {\r\n this.narrowPhaseCollision(this.broadPhaseCollision());\r\n }",
"function collisionsCleaner(){\n rightcollision=false;\n leftcollision=false;\n bottomcollision=false;\n topcollision=false;\n }",
"updateCollisions() {\n this.model.scene.forEac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the type specification from the directive meta. This type is inserted into .d.ts files to be consumed by upstream compilations. | function createDirectiveType(meta) {
const typeParams = createDirectiveTypeParams(meta);
return expressionType(importExpr(Identifiers$1.DirectiveDefWithMeta, typeParams));
} | [
"function createDirectiveType(meta) {\n const typeParams = createDirectiveTypeParams(meta);\n return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));\n}",
"function createDirectiveType(meta) {\n var typeParams = createBaseDirectiveTypeParams(meta); // Directives have no NgContentSe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print all the cookies whose value contain one of the names in PI store. Only fields with tags "usernameXXX" and "emailXXX" are checked. | function print_cookies_with_values_containing_usernames(domain) {
var cb_cookies = (function(domain, event_name) {
return function(all_cookies) {
var tot_hostonly = 0;
var tot_httponly = 0;
var tot_secure = 0;
var tot_session = 0;
var detected_usernames = {};
var pi_usernames = get_all_usernames... | [
"function checkForOurCookiesValue() {\n var allTheCookies = document.cookie;\n\n console.log(allTheCookies);\n\n if(allTheCookies.includes(this_cookies_value)) {\n jQuery(\".exampleSection\").css(\"opacity\",1);\n } else {\n jQuery(\".exampleSection\").css(\"opacity\",0);\n };\n\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
utility to convert the indexed member of args to a Boolean. alters args and returns it too. defaults to changing the last member in args. | function jum_arg_to_boolean(args, ind) {
if (typeof ind == 'undefined' || ind == null) ind = args.length - 1;
args[ind] = eval(args[ind]) ? true : false;
return args;
} | [
"_parseBooleanArg(value) {\n return Array.isArray(value) ? value.pop() : value;\n }",
"function getBooleanValues(args, config) {\n function getBooleanValues(argsAndLastOption, arg) {\n var _a = getParamConfig(arg, config), argOptions = _a.argOptions, argName = _a.argName, argValue = _a.argValue;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fill the filtered books depending on categories | function filterByCat( categ ){
filteredBooks = [];
for (let i = 0; i < allBooks.length; i++) {
if (allBooks[i].categories == categ ) {
filteredBooks.push(allBooks[i]);
}
}
} | [
"filterBooks(category) {\n this.currentCategory = category;\n if (this.currentCategory == \"Todos\") {\n this.currentBooks = this.books;\n } else {\n this.currentBooks = this.books.filter(this.applyFilter);\n }\n }",
"filterBooksByRa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
buildCompactText Compact box with labelicon to the left | function buildCompactText( options ){
var $result = $();
options.title = options.title || (options.label ? options.label.text : null);
$result = $result.add(
$._bsCreateIcon(
{icon: options.label ? options.label.icon : 'fas fa_'... | [
"get short_text () {\n return new IconData(0xe261, {fontFamily: 'MaterialIcons', matchTextDirection: true});\n }",
"get label_outline () {\n return new IconData(0xe893, {fontFamily: 'MaterialIcons', matchTextDirection: true});\n }",
"get wrap_text () {\n return new IconData(0xe25b, {fontFamily: 'Mate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a local path from a plugin folder to a full path relative to the webserver's main views folder. Allows a plugin to bundle views/layouts and make them available to the webserver's renderer. | getLocalView(path_to_view) {
if (this.webserver) {
return path.relative(path.join(this.webserver.get('views')), path_to_view);
}
else {
throw new Error('Cannot get local view when webserver is disabled');
}
} | [
"function basepath(uri) {\n\t\t\treturn 'dist/views/' + uri;\n\t\t}",
"function pluginPath()\n{\n var path = MSPluginManager.mainPluginsFolderURL();\n\n path = [path absoluteString]\n path = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]\n path = [path stringByReplacingOccurrencesOfS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unload a model's relationships payload. | unload(modelName, id) {
var modelClass = this._store._modelFor(modelName);
var relationshipsByName = Ember.get(modelClass, 'relationshipsByName');
relationshipsByName.forEach((_, relationshipName) => {
var relationshipPayloads = this._getRelationshipPayloads(modelName, relationshipName, false);
... | [
"unload(modelName, id) {\n var modelClass = this._store.modelFor(modelName);\n var relationshipsByName = Ember.get(modelClass, 'relationshipsByName');\n relationshipsByName.forEach((_, relationshipName) => {\n var relationshipPayloads = this._getRelationshipPayloads(modelName, relationshipName... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test helpers: sendMin(), sendTXSelf() send the minimum amount | async sendMin({ to, value }) {
const txHash = await this.send({ to: to, value: 1000000000000 })
console.log("TX:", txHash)
return true
} | [
"async ensureMinimumEther(dest,toWrio) { //TODO: add ethereum queue for adding funds, to prevent multiple funds transfer\n var ethBalance = await this.getEtherBalance(dest)/wei;\n logger.debug(\"Ether:\",ethBalance);\n if (ethBalance < min_amount) {\n logger.info(\"Adding minium ethe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the tabs scrollers to show or not, dependent on the tabs count and width | function setScrollers(container, state) {
if (!state) state = $.data(container, 'tabs');
var opts = state.options;
var header = state.dc.header;
var tool = header.children('div.tabs-tool');
var sLeft = header.children('div.tabs-scroller-left');
var sRight = header.childre... | [
"function setScrollers(container) {\n\t\tvar header = $('>div.tabs-header', container);\n\t\tvar tabsWidth = 0;\n\t\t$('ul.tabs li', header).each(function(){\n\t\t\ttabsWidth += $(this).outerWidth(true);\n\t\t});\n\t\t\n\t\tif (tabsWidth > header.width()) {\n\t\t\t$('.tabs-scroller-left', header).css('display', 'bl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the width of the given rule from the css style. | function getWidth(ruleName){
var mysheet=document.styleSheets[0];
var myrules=mysheet.cssRules? mysheet.cssRules: mysheet.rules
let targetrule;
for (let i = 0; i < myrules.length; i++){
if(myrules[i].selectorText.toLowerCase() == ruleName){
targetrule=myrules[i];
break;... | [
"function getWidth( elem ) {\n // Gets the computed CSS value and parses out a usable number\n return parseInt( getStyle( elem, 'width') );\n}",
"function getWidth(elem) {\n return parseInt(getStyle(elem, \"width\"));\n }",
"function getWidth (node) {\n return parseInt(window.getCompu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get room data array Add map to the array Broadcast map | function map(msg)
{
var thisData = getRoom(msg["room"]);
thisData.push(msg["mapURL"]);
web.io.emit("servermessage", {
"room": msg["room"],
"command": "send_map",
"mapURL": msg["mapURL"]
});
} | [
"processRoomMaping(response) {\n const rooms = {};\n let room;\n if (typeof response.result !== 'object') {\n return false;\n }\n\n for (let r in response.result) {\n room = response.result[r];\n rooms[room[1]] = room[0];\n }\n adapte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the parent key. If the key is toplevel, return null. mkey String Examples: > parent("alpha") null > parent("alpha>beta") "alpha" > parent("alpha>beta|gamma") "alpha>beta" Returns String or null. | function keyParent(mkey) {
var path = keyToPath(mkey)
, pathLen = path.length
return pathLen === 1 ? null : path[pathLen - 2]
} | [
"get parentChangeKey()\n\t{\n\t\tif (!this._parentChangeKey) {\n\t\t\tthis._parentChangeKey = this.getAttributeByTag(\"t:ParentFolderId\", \"ChangeKey\", null);\n\t\t}\n\t\treturn this._parentChangeKey;\n\t}",
"function rawGetParentKey(parent, childkey, separator, allow_empty)\n{\n\tif(!rawIsSafeString(childkey))... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Synthesize and validate a single stack | synthesizeStack(stackName) {
const stack = this.getStack(stackName);
// first, validate this stack and stop if there are errors.
const errors = stack.validateTree();
if (errors.length > 0) {
const errorList = errors.map(e => `[${e.source.path}] ${e.message}`).join('\n ');
... | [
"function IsStackValid() {\n if (!isNaN(stackVal) && isFinite(stackVal)) { return (true); } return (false);\n }",
"async validateStacks(stacks) {\n stacks.processMetadataMessages({\n ignoreErrors: this.props.ignoreErrors,\n strict: this.props.strict,\n verbose: th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates date input. Returns whether validation succeeded and either the parsed and normalized value or a message the bot can use to ask the user again. | static validateDate(input) {
// Try to recognize the input as a date-time. This works for responses such as "11/14/2018", "today at 9pm", "tomorrow", "Sunday at 5pm", and so on.
// The recognizer returns a list of potential recognition results, if any.
try {
const results = Recog... | [
"function dateValidation(input) {\n if(!DateValidation.isDate(input)) {\n return SURVEY_CLIENT.MESSAGES.INVALID_DATE;\n }\n\n return null;\n}",
"function dateValidation(date) {\n\tif (!date) {\n\t\treturn true;\n\t}\n\n\tvar currentDate = getCurrentDate();\n\n\tvar year = +date.substring(0, 4);\n\tvar month... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Translate a 32bit thumb instruction. Returns nonzero if the instruction is not legal. | function disas_thumb2_insn(/* CPUARMState * */ env, /* DisasContext * */ s, /* uint16_t */ insn_hw1)
{
var /* uint32_t */ insn, imm, shift, offset, addr;
var /* uint32_t */ rd, rn, rm, rs;
var op;
var shiftop;
var conds;
var logic_cc;
if (!(arm_feature(env, ARM_FEATURE_THUMB2)
|| ... | [
"function castToI32(lctx) {\n const currentType = currentTempType(lctx);\n if (currentType === 'i32') {\n return '';\n }\n\n if (currentType === 'i1') {\n const currentName = currentTempName(lctx);\n const castedName = nextTempName(lctx);\n const castBlock = TAB() + castedName + ' = zext i1 ' + curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Event for when the user alters the theme selector. | function themeSelectChange(event) {
Common.setTheme(event.target.value);
} | [
"function themeChangedEventListener(event)\r\n{ \r\n\tchangeThemeColor();\r\n}",
"function onThemeSelected(){\n setTheme(dropdown.value);\n}",
"function themeSelectMenu() {\n $(\"#zenTheme\").on('change', function() {\n setTheme($(this).val());\n });\n }",
"function themeChanged(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
func: delete_load desc: Deletes load w/ load_id | function delete_load (load_id) {
const l_key = datastore.key( ['LOAD', parseInt(load_id, 10)] ); // Create key for ds entity deletion
return datastore.delete(l_key); // Delete entity and return to calling function
} | [
"function delete_load(load_id) {\n if (typeof(load_id) == \"string\")\n load_id = parseInt(load_id);\n var key = datastore.key([LOAD, load_id]);\n return datastore.delete(key).then(\n (entity) => { return {}; }\n );\n}",
"function delete_loadFromBoat(boat_id, load_id){\n const loadKey = datastore.key... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get lumen price in terms of btc | function getLumenPrice() {
return Promise.all([
rp('https://poloniex.com/public?command=returnTicker')
.then(data => {
return parseFloat(JSON.parse(data).BTC_STR.last);
})
.catch(() => {
return null;
})
,
rp('htt... | [
"async function price() {\n const obj = await wallet.lcd.market.swapRate(new Terra.Coin('uluna', '1000000'), 'uusd');\n return parseFloat(obj.toData().amount) / DIVISOR;\n}",
"function ltcDollar() {\n requestify.get('https://min-api.cryptocompare.com/data/price?fsym=LTC&tsyms=USD')\n .then(function(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function returns all techs used in a project | function getProjectTechs (req, res) {
// var techss = []
PROJECTTECHS.findAll({
where: {
ProjectId: req.params.id
}
}).then(techs => {
resolveTechs(techs, res)
// res.send(techs)
}).catch(err => {
console.log(err)
res.send(false)
})
} | [
"function getUsingTechs() {\n if (getUsingTechs.vals) return getUsingTechs.vals;\n\n var lang = getProp('lang');\n var type = getProp('type');\n var level = getProp('level');\n \n var techNames = getLangSet('tech');\n var urlPointer = lang+'-'+type;\n var usingCriteria = getUsingCriteria();\n var usingTech... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the player buys or sells an item, this method determines whether an inspection occurs. Returns true if no inspection is performed. If an inspection is performed and the player is caught, the player's contraband cargo is confiscated, the player is fined, and their standing with the market's faction is decreased. Th... | transactionInspection(item, amount, player) {
if (!player || !this.faction.isContraband(item, player))
return true;
// the relative level of severity of trading in this item
const contraband = data_1.default.resources[item].contraband || 0;
// FastMath.abs... | [
"function handleAffliction(affliction, monId) {\n // Afflictions that take a Tick of Hit Points\n if (affliction == \"Burned\" || affliction == \"Poisoned\") {\n\n // Calculating max_hp\n var max_hp = gm_data[\"pokemon\"][monId]['level'] + gm_data[\"pokemon\"][monId]['hp'] * 3 + 10;\n\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Aligns nodes by depth or by link weight | function alignNodes() {
graph.style.align = !graph.style.align
applyScale(data.tree)
update(data.tree)
applyScaleText()
addNodeStyle()
addLinkStyle()
updateInternalLabels(graph.style.parentLabels)
if (graph.style.barChart) {
graph.element.sele... | [
"function node_weight(d) {\r\n d.weight = links.filter(function(l) {\r\n return l.source.index == d.index // || l.target.index == d.index \r\n }).length\r\n return d.weight\r\n }",
"function justify(node, n) {\n return node.sourceLinks.length ? node.depth : n - 1;\n}",
"function computeNodeDepth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Freeze page content scrolling | function freeze() {
if($("html").css("position") != "fixed") {
var top = $("html").scrollTop() ? $("html").scrollTop() : $("body").scrollTop();
if(window.innerWidth > $("html").width()) {
$("html").css("overflow-y", "scroll");
}
//$("html").css({"w... | [
"function freeze() {\n if($(\"html\").css(\"position\") != \"fixed\") {\n var top = $(\"html\").scrollTop() ? $(\"html\").scrollTop() : $(\"body\").scrollTop();\n if(window.innerWidth > $(\"html\").width()) {\n $(\"html\").css(\"overflow-y\", \"scroll\");\n }\n $(\"html\").css({\"width... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
en que dia cae el primer dia del mes | function cual_es_el_primerdia_del_mes(){
let primer_dia=new Date(año_actual,mes_actual,1);
//me devuelve numeros desde 0 a 7,en caso el dia sea domingo no devolvera 0
return((primer_dia.getDay()-1)=== -1)? 6: primer_dia.getDay()-1;
} | [
"function ultimo_mes(){\n if(mes_actual!=0){\n mes_actual--;\n }else if(mes_actual==0){\n mes_actual=10;\n año_actual--;\n }\n dibujar_fecha();\n escribir_mes();\n escogerdia1();\n escogerdia2();\n}",
"function proximo_mes(){\n if(mes_actual!=10){\n mes_actual++... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method: remove Remove data at given path from remote storage. Parameters: path absolute path (starting from storage root) callback see for details on the callback parameters. | function remove(path, cb) {
if(isForeign(path)) {
return cb(new Error("Foreign storage is read-only"));
}
var token = getSetting('bearerToken');
setBusy();
return getputdelete.set(resolveKey(path), undefined, undefined, token, cb).
then(releaseBusy);
} | [
"function remove(path, remote, callback) {\n\n if (repository(path)) {\n\n var command = 'git remote rm ' + remote;\n var stdin = \"\"; // must be an empty String or buffer;\n var result = SystemWorker.exec(BIC + ' \"' + command + '\"', stdin, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle HTTP route GET /:username i.e. /chalkers | function user(request, response) {
//if url == "/...."
var username = request.url.replace("/", "");
if(username.length > 0) {
response.writeHead(200, {'Content-Type': 'text/plain'}); // response.writeHead(statusCode[, statusMessage][, headers])
response.write("Header\n"); /... | [
"function userRoute(request, response) {\n\n var username = request.url.replace(\"/\", \"\");\n if(username.length > 0){\n response.writeHead(200, {'Content-Type': 'text/plain'});\n response.write(\"Header\\n\");\n response.write(username + \"\\n\");\n response.end('Footer\\n');\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if department with provided dept_id exists | departmentExists(company, dept_id){
let flag = false;
let allDepartments = companydata.getAllDepartment(company);
allDepartments.forEach(e => {
if (dept_id == e.dept_id) {
flag = true;
}
});
return flag;
} | [
"function validateDepartment(department){\n\t//obj is not null\n\t//proprties not null\n if (department) {\n \tif (department.name && department.id) {\n \t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}",
"ifDeptExist(dept) {\n var deptExist = \"select name from department where name = ?;\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to unsave article | function unsaveArticle(){
// Grab the id associated with the article from the submit button
var thisId = $(this).attr("data-id");
$.ajax({
method: "POST",
url: "/unsave/" + thisId,
})
// With that done
.done(function(data) {
// Log... | [
"function articleUnsave() {\n var articleElement = $(this).parents(\".card\")\n var articleToUnsave = articleElement.attr(\"data\");\n articleElement.remove();\n unsaveArticles(articleToUnsave).then(function(response) {\n window.location.href = \"/saved\"\n })\n}",
"function unsaveArticle(event)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
H. Create 2dimensional unit vector from two points | function unitVector(P1, P2) {
var x1 = P1[0];
var y1 = P1[1];
var x2 = P2[0];
var y2 = P2[1];
var v = [x2-x1, y2-y1];
var v1 = v[0];
var v2 = v[1];
var u1 = v1 / norm(v);
var u2 = v2 / norm(v);
var u = [u1, u2];
return u;
} | [
"function getUnitVector(x,y){var d=Math.sqrt(x*x+y*y);x/=d;y/=d;if(x===1&&y===0)return xUnitVector;else if(x===0&&y===1)return yUnitVector;else return new UnitVector(x,y);}",
"function getUnitVector(x, y) {\n\t var d = Math.sqrt(x * x + y * y);\n\n\t x /= d;\n\t y /= d;\n\n\t if (x === 1 && y === 0) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculateTenure(person) returns 2020 the year when they joined | function caculateTenure(person) {
return new Date().getFullYear() - person.joinedAt.getFullYear();
} | [
"function calculateAge(personName){\n var currentYear = 2018;\n return currentYear - personName.birthYear; \n}",
"function howOldwhenjoined(person) {\r\n\r\n return person.joinedAt.getFullYear() - person.dateOfbirth.getFullYear()\r\n\r\n}",
"function calcAge(yearBorn) {\n return 2018 - yearBorn;\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert a jq object into a Coords object, handling all the nicenmessy offsets and margins and crud | function jq2Coords( jq, dx, dy )
{
var x1,y1, x2, y2;
if( !dx ) dx=0;
if( !dy ) dy=0;
if( jq.parent().length > 0 )
{
x1 = dx + jq.offset().left - (parseInt(jq.css("margin-left"))||0);
y1 = dy + jq.offset().top - (parseInt(jq.css("margin-top" ))||0);
x2 = x1 + jq.outerWidth( true);
y2 = y1 + jq.... | [
"function coordsToPosition(data){\n return {\n 'coords':{\n 'latitude':data.latitude,\n 'longitude':data.longitude,\n }\n }\n}",
"function getCoordinate(obj) {\n var x = obj.x;\n var z = obj.z;\n return {x: x, z: z};\n }",
"function convertGeoJso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders list of memes fetch memes and iterate through each meme and render Meme component for each one of them function : handleDelete invoke dispatch by passing type and payload to delete meme from memes list App > MemeList > Meme | function MemeList() {
const memes = useSelector(store => store.memes);
const dispatch = useDispatch();
function handleDelete(evt){
console.log("deleting")
const id = evt.target.id
console.log("deleting id", id)
dispatch({type: "DELETE_MEME", payload : id})
}
const memeDisplay = memes.map((me... | [
"function MemeList({ memes }){\n const dispatch = useDispatch()\n\n function deleteMeme(evt){\n dispatch({type: \"DELETE_MEME\", payload: evt.target.id})\n }\n\n return (\n <div className=\"MemeList\">\n {memes.map(meme => <>\n <MemeCard key={meme.id}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function which checks if two boards are equal | function EqualBoards(board1, board2) {
//JSON.stringify => method converts a JavaScript object or value to a
//JSON string
if (JSON.stringify(board1) === JSON.stringify(board2)) {
return true;
} return false
} | [
"function equalBoards(b1, b2) {\n for (let x = 0; x < b1.length; x++) {\n for (let y = 0; y < b1[x].length; y++) {\n if (b1[x][y] !== b2[x][y]) {\n return false;\n }\n }\n }\n return true;\n}",
"function boardEquals(board1,board2) {\n for(var i=0; i<board.length; i++) {\n for (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test if the element is a multiselect | function isMultiselect($el) {
var elSize;
if ($el[0].multiple) {
return true;
}
elSize = attrOrProp($el, "size");
if (!elSize || elSize <= 1) {
return false;
}
return true;
} | [
"function is_multiselect(element)\n {\n return (element.is('select') && typeof element.attr('multiple') !== 'undefined' && element.attr('multiple') !== false);\n }",
"function isMultiselect($el) {\n var elSize;\n\n if ($el[0].multiple) {\n return true;\n }\n\n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Link mainToggleSwitch to all the tables | linkMainToggleSwitchToTables(){
this.getStructuredData()
.then((structuredData) => {
for(let i = 0; i < structuredData.length; i++){
const LastIndex= structuredData[i][0][0].indexOf(0);
const portName = structuredData[i][0][0].substring(0, LastIndex);
... | [
"function toggles() {\n $('#table-toggle').click(function(){\n $('tbody').toggle();\n $('.dataTables_scrollBody').toggle();\n });\n $('#map-toggle').click(function(){\n $('#map').toggle();\n // updates isTheMapVisible and re-loads the map \n if (isTheMapVisible) {\n // map i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
METHOD: CALCULATE AND ASSIGN ABILITY SCORES | abilityScores(){
let diceList = [null, null, null, null, null, null]; //initialise attribute array
for (let i=0; i<6; i++){ //for all attributes
let tempList = [null, null, null, null];
for (let j=0; j<4; j++) {
tempList[j] = D6[Math.floor(Math.random() * 6)];
}
let min = Math.min(...tempList);
for (let... | [
"function _calcSkills(ability)\n{\n var numskills = SkillsCount();\n for (var i = 1; i <= numskills; i++)\n {\n var key = \"Skill\" + FormatNumber(i) + \"Ab\";\n if (String(sheet()[key].value).toLowerCase() == ability)\n SkillLookUpKeyAb(sheet()[key]);\n }\n}",
"function generateAllAbilityScores() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Go the the previous task | function previousTask() {
if(tasks.length == 1) return;
hideCurrentTask();
changeCurrentIndex(-1);
var id = tasks[current_task];
if(id) $("task-"+id).className = "active";
} | [
"runOneStepBackwards() {\n this.stateHistory.previousState()\n }",
"goBack() {\n if(this.canGoBack()) {\n // get the current event\n let curr = this._stack[this._pointer];\n // get the most recent \"related\" event\n let prev = this.getPrevRelated(curr,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The directory entry callback | function gotDir(d){
console.log("got dir");
alert("d-"+JSON.stringify(d));
DATADIR = d;
var reader = DATADIR.createReader();
reader.readEntries(function(d){
// gotFiles(d);
appReady(d);
},onError);
} | [
"function gotDirEntry(dirEntry) {\n var directoryReader = dirEntry.createReader();\n directoryReader.readEntries(win,fail);\n }",
"function gotDirEntry(dirEntry) {\n var directoryReader = dirEntry.createReader();\n directoryReader.readEntries(success,fail);\n }",
"ondir() {}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
script validasi formlogin jika ada kolom yang tidak diisi atau kosong | function validateFormlogin() {
if (document.forms["formlogin"]["email"].value == "") {
alert("Email Tidak Boleh Kosong");
document.forms["formlogin"]["email"].focus();
return false;
}
if (document.forms["formlogin"]["password"].value == "") {
alert("Password Tidak Boleh Kosong");
document.forms["formlogin"... | [
"function walgreensValidateLoginForm(formObj){\n\t if(CUtils.isEmpty(formObj.username.value) == true){\n\t formObj.username.focus() ;\n\t alert(\"Username cannot be empty.\") ;\n\t return false ;\n\t }\n\t if(CUtils.isEmpty(formObj.password.value) == true){\n\t formObj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We've got some basic info about Karen's home Debug the type of data provided Return the types concatenated in a single variable We've got some basic information about Karen's home. Find out the type of each data. Create a function `moreAboutHome()` which takes `address, distanceFromTown, hasNeighbours` as arguments and... | function moreAboutHome(address, distanceFromTown, hasNeighbours){
// var address, distanceFromTown, hasNeighbours;
return typeof(address)+typeof(distanceFromTown)+typeof(hasNeighbours);
} | [
"function displayHometownData () {\n let homeTown = instructorData.additionalData.moreDetails.hometown;\n for(let key in homeTown) {\n console.log(homeTown[key]);\n }\n}",
"function displayHometownData() {\n let hometown = instructorData.additionalData.moreDetails.hometown;\n for(let key in hometown) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Formats the Cocktail Recipe Data | function formatDrinkData(data) {
cockTailData = data;
removeSearchDropdowns();
cocktailSearchResultsBody.classList.remove("hide");
for (i = 0; i < 3; i++) {
cocktailName = cockTailData.drinks[i].strDrink;
cocktailImage = cockTailData.drinks[i].strDrinkThumb;
cocktailID = cockTailData.drinks[i].idDr... | [
"function formatCocktailRecipeData(data, drinkID) {\n cocktailRecipe = data;\n //=================================================================\n cocktailName = cocktailRecipe.drinks[0].strDrink;\n cocktailImage = cocktailRecipe.drinks[0].strDrinkThumb;\n meas1 = cocktailRecipe.drinks[0].strMeasure1;\n mea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simplifies and returns Poke details | getPokeDetails(){
let pokeData = this.props;
return {
name: pokeData.name,
imgData: this.getPokeImgs(pokeData.sprites),
type: this.getPokeType(pokeData.types),
hp: pokeData.base_experience
}
} | [
"function pokeInfo (pkm) {\n P.getPokemonByName(pkm) // with Promise\n .then(function (response) {\n // console.log(response)\n msg.channel.send('name: ' + response.name + '\\nid: ' + response.id + '\\nheight: ' + response.height / 10 + ' m \\nweight: ' + response.weight / 10 + 'kg')\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
showing the amount of money | function updateMoney() {
moneyText.text = money.toString();
} | [
"showBalance(){\n this.balance = Number(this.budgetObj - this.totalExpenses).toFixed(2);\n this.uiBalance.innerText = this.balance;\n }",
"function show_money() {\r\n\t$(\"#money\").html(\"Balance: \" + money + \" €\");\r\n}",
"showTotal(){\n let total = 0;\n for(let i = 0; i < this.expenseObj.leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the event (digg, comment) date related with this user. | set eventDate(aValue) {
this._logger.debug("eventDate[set]");
this._eventDate = aValue;
} | [
"set eventDate(aValue) {\n this._logService.debug(\"gsDiggUserDTO.eventDate[set]\");\n this._eventDate = aValue;\n }",
"function setUserEvDate(value) {\n user_evt_date = value;\n}",
"set date(aValue) {\n this._logger.debug(\"date[set]\");\n this._date = aValue;\n }",
"get eventDate() {\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a list of specific spot requests | async listSpotRequests(conditions = {}, client = undefined) {
assert(typeof conditions === 'object');
return this._listTable('spotrequests', conditions, client);
} | [
"function requestSpots()\n{\n // Show the loading indicator\n $('#map-loader').css('visibility', 'visible');\n // console.log(\"MAP LOADER VISIBLE\");\n // Record the download request\n downloadingSpots = true;\n\n // console.log(\"REQUESTING SPOT DATA\");\n // console.log('ENDPOINT SPOTS: ' + refs['endpoint... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
html_entity_decode from (MIT Licensed) | function html_entity_decode(string, quote_style) {
// http://kevin.vanzonneveld.net
// + original by: john (http://www.jd-tech.net)
// + input by: ger
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + ... | [
"function html_entity_decode(str) {\n\treturn String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n}",
"function decodeHtmlEntity(str) {\n return str.replace(/&#(\\d+)/g, function(match, dec) {\n return String.fromCharCode(dec);\n });\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
eql a b If the value of a and b are equal, then store the value 1 in variable a. Otherwise, store the value 0 in variable a. | eql(a, b) {
this.registers[a] = this.get(a) === this.get(b) ? 1 : 0;
} | [
"function _eq (a, b) {\n return a === b\n}",
"function sameValue(a, b) {\n return a == b\n}",
"function isEqual(a,b){\n return a === b\n}",
"function sameValueBoth(a, b) {\n var result = sameValue(a, b);\n assertTrue(result === sameValueZero(a, b));\n return result;\n}",
"function isEqual(a,b){\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the current line. May become public. | get currentline() {
return this._currentline;
} | [
"get currentLine() {\n return this.lines[this.lineIndex];\n }",
"get line() {\n return this.getLine();\n }",
"get line() {\n return this._line;\n }",
"getCurrentBufferLine() {\n return this.editor.lineTextForBufferRow(this.getBufferRow());\n }",
"function getCurrLine() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
obtain a map from URL to Set of saved windows, for use on initial attach. returns: Map> | getUrlBookmarkIdMap () {
const bmEnts = this.bookmarkIdMap.entrySeq()
// bmEnts :: Iterator<[BookmarkId,TabWindow]>
const getSavedUrls = (tw) => tw.tabItems.map((ti) => ti.url)
const bmUrls = bmEnts.map(([bmid, tw]) => getSavedUrls(tw).map(url => [url, bmid])).flatten(true)
const groupedIds = bm... | [
"function saveWindow(){\n var folder = document.getElementById(\"curr-folder-name\").innerHTML\n\n chrome.windows.getCurrent({populate:true},function(window){\n //collect all of the urls here\n window.tabs.forEach(function(tab){\n\n var myURL = {\n url: tab.url,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper to the validatePhone() function | function helperValidatePhone() {
//sends the error state to change the background
sendState(on, "phone");
//adds the error to the array
addDataAllErrors(allErrorMess[3]);
} | [
"function simplePhoneValidation(phoneNumber) {\n\n}",
"processPhone() {\n let input = this.phone\n resetError(input)\n\n if (isEmpty(input)) {\n this.valid = false\n } else if (isNumber(input)) {\n this.valid = false\n } else if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Marks this injector as ready. This means all dependencies are registered and resolvable. | ready() {
if (!this._ready) {
this._listeners.forEach(listener => listener());
this._ready = true;
}
else {
console.warn('Injector already marked as ready!');
}
} | [
"markAsReady() {\n\t\tthis._ready = true;\n\t\tthis._emitter.emit('ready');\n\t}",
"function ready() {\n this._isAttached = true;\n this._isReady = true;\n this._callHook('ready');\n }",
"ready() {\n this.isReady = true;\n if (this.onLoad) {\n this.onLoad.call();\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to enable or disable the ability to swipe open the menu. | swipeGesture(shouldEnable, menuId) {
return _ionic_core__WEBPACK_IMPORTED_MODULE_5__["menuController"].swipeGesture(shouldEnable, menuId);
} | [
"function enableSwipe() {\n allowSwipe = true;\n }",
"enableTouchSwipes() {\n\t\tvar boundToggleMenu = this.toggleMenu.bind(this);\n\t\tthis.swipe1 = new Swipe(this.nav, null, boundToggleMenu, null, boundToggleMenu);\n\t\tthis.swipe2 = new Swipe(this.pullOutOverlay, null, boundToggleMenu, null, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get single odds info | function getSingleOddsInfo(mutexObject, betslip, betslipMap, betslipStake, isBoosting, boostBets) {
const oddsInfoMap = [];
const bonus = [];
const qualifyingOddsLimit = betslipStake.qualifyingOddsLimit;
const bonusRatios = betslipStake.bonusRatios;
const betslips = betslip.betslips || [];
const outcomeMap = get... | [
"function returnFirstOddNumber() {\n\tfor (var i = 0; i < numbers.legnth; i++) {\n\t\tif (numbers[i] % 2 != 0) {\n\t\t\treturn numbers[i];\n\t\t}\n\t}\n}",
"function returnFirstOddNumber(array) {\n\t\tfor (let i = 0; i < array.length; i++) {\n\t\t\tif (array[i] % 2 === 1) {\n\t\t\t\treturn array[i];\n\t\t\t}\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the value of the first vector, rotated towards the second by multiplicative percent | static RotateTowardsMult(vec1, vec2, percent) {
let A = new Vec2(vec1);
let B = new Vec2(vec2);
return A.RotateTowardsMult(percent, B);
} | [
"RotateTowardsMult(percent, x, y) {\n let Mag = this.Magnitude();\n let B = new Vec2(x, y).Normalize();\n this.Normalize();\n let VecLine = Vec2.Subtract(B, this).Multiply(percent);\n this.Add(VecLine);\n this.Normalize().Multiply(Mag);\n return this;\n }",
"rot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation of localStorage API to save filters to local storage. This should get called everytime an onChange() happens in either of filter dropdowns | function saveFiltersToLocalStorage(filters) {
// TODO: MODULE_FILTERS
// 1. Store the filters to localStorage using JSON.stringify()
let filtersData = JSON.stringify(filters);
localStorage.setItem("filters", filtersData)
return true;
} | [
"function setFilters(filterData) {\n localStorage.setItem(\"filters\", JSON.stringify(filterData));\n setFilterState(filterData);\n }",
"function saveFiltersToLocalStorage(filters) {\n // TODO: MODULE_FILTERS\n // 1. Store the filters to localStorage using JSON.stringify()\n localStorage.setItem('filter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all input tags in current page | function GetAllInputTags(rootId) {
let inputTags = [];
let document = GetCurrentDocument();
let rootElement = document.getElementById(rootId);
let elements = GetAllElements(rootElement);
// loop through and get input tags
elements.forEach((element) => {
if (element.tagName === "INPUT") {
inputTa... | [
"static getEnabledInputTags () {\r\n return document.querySelectorAll('.tag--enabled > input');\r\n }",
"function getInputs() {\n var inputs = document.querySelectorAll('input, textarea');\n return inputs;\n}",
"static getDisabledInputTags () {\r\n return document.querySelectorAll('.tag--... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use this from a test suite (i.e. inside a describe() clause) to start the given server. If the same server is used by multiple tests, the server is reused. | function useServer(server) {
before(async function () {
if (!_servers.has(server)) {
_servers.set(server, server.start(this));
}
await _servers.get(server);
});
// Stopping of the started-up servers happens in cleanup().
} | [
"function start() {\n // Run the server tests\n printHeader('SERVER');\n\n // We need to set the reporter when the tests actually run to ensure no conflicts with\n // other test driver packages that may be added to the app but are not actually being\n // used on this run.\n if (reporter == 'junit') {\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
myDate function This function is called on every HTML page in the body tag | function myDate()
{
var d = new Date();
//The current date is saved to the date string
document.getElementById("date").innerHTML = d.toDateString();
} | [
"function dateRendered() {\r\n \"use strict\";\r\n //define all variables\r\n var todaysDate;\r\n\r\n //get date and make pretty\r\n todaysDate = new Date();\r\n todaysDate = todaysDate.toDateString();\r\n\r\n //display date\r\n document.write(\"Rendered: \" + todaysDate);\r\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if image is on last row | function lastRowImage(image) {
return image.row == lastRowIndex;
} | [
"isLastImageReached(){\n if(this.imageIndex < this.images.length-1){\n return false;\n }\n else{\n return true;\n }\n }",
"function imageIsLast() {\n let current_image_index = parseInt($('.fs-image')[0].id);\n if (current_image_index == 1)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function calculates the gamma values for the rotational matrix. | function GetGammaValue() {
var _DETECTOR_ORIENTATION = $('#' + DOM_FieldID_DetectorOrientation).val ();
var gamma = (((+_DETECTOR_ORIENTATION) - 45) * (Math.PI / 180));
return gamma;
} | [
"function gamma(z) {\r\n if (z < 0.5) {\r\n return Math.PI / (Math.sin(Math.PI * z) * gamma(1 - z));\r\n }\r\n else {\r\n z -= 1;\r\n var x = gamma_C[0];\r\n for (var i = 1; i < gamma_g + 2; i++) {\r\n x += gamma_C[i] / (z + i);\r\n }\r\n var t = z + gam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
keydown handler booleans for button presses for moving player | function keydownEventHandler(e) {
// key movement for player up, down, left, right
if (e.keyCode == 87) { // W key
playerUp = true;
}
if (e.keyCode == 83) { // S key
playerDown = true;
}
if (e.keyCode == 65) { // A key
playerLeft = true;
}
if (e.keyCode == 68) { // D key
playerRight = ... | [
"function keydownEventHandler(e) {\n // key movement for player up, down, left, right\n if (e.keyCode == 87) { // W key\n keyUp = true;\n }\n if (e.keyCode == 83) { // S key\n keyDown = true;\n }\n if (e.keyCode == 65) { // A key\n keyLeft = true;\n }\n if (e.keyCode == 68) { // D key\n keyRig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET CITES FROM WOK | function getWokCites(title, year){
// Go to WOK web page
iimPlay('CODE: URL GOTO=http://apps.webofknowledge.com');
//Prepare search fields and click search button
if (year && year > 0){
iimPlay('CODE: TAG POS=1 TYPE=SELECT FORM=NAME:UA_GeneralSearch_input_form ATTR=ID:select1 CONTENT=%TI\n' +
'TAG... | [
"function getClips() {\n const game = 'League of Legends';\n const limit = 10;\n const period = 'day';\n const language = 'en';\n const id = nconf.get('twitchclient');\n const options = {\n method: 'get',\n url: `https://api.twitch.tv/kraken/clips/top?game=${game}&limit=${limit}&period=${period}&languag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
const input = "3,26,1001,26,4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,1,28,1005,28,6,99,0,0,5"; | function parseInput(input){
return input.split(",").map(x => Number(x));
} | [
"function parseNumbers(s) {\n var result = [];\n s.split(',').forEach(x => {\n let m = x.match(/(\\d+)\\s*\\-\\s*(\\d+)/);\n if (m) {\n for (let i = parseInt(m[1]); i <= m[2]; i++) {\n result.push(i);\n }\n } else {\n result.push(parseInt(x)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Safely compare two MACs. This function will compare two MACs in a way that protects against timing attacks. TODO: Expose elsewhere as a utility API. See: | function compareMacs(key, mac1, mac2) {
var hmac = forge.hmac.create();
hmac.start('SHA1', key);
hmac.update(mac1);
mac1 = hmac.digest().getBytes();
hmac.start(null, null);
hmac.update(mac2);
mac2 = hmac.digest().getBytes();
return mac1 === mac2;
} | [
"compare(a, b) {\n return __awaiter(this, void 0, void 0, function* () {\n const macKey = yield this.randomBytes(32);\n const signingAlgorithm = {\n name: 'HMAC',\n hash: { name: 'SHA-256' },\n };\n const impKey = yield this.subtle.imp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a string in the form of type[length] we want to split this into an object that extracts that information. We want to note that we could possibly have nested arrays so this should only check the furthest one. It may also be the case that we have no [] pieces, in which case we just return the current type. | function ctParseType(str)
{
var begInd, endInd;
var type, len;
if (typeof (str) != 'string')
throw (new Error('type must be a Javascript string'));
endInd = str.lastIndexOf(']');
if (endInd == -1) {
if (str.lastIndexOf('[') != -1)
throw (new Error('found invalid type with \'[\' but ' +
'no correspon... | [
"function ctParseType(str)\n {\n \tvar begInd, endInd;\n \tvar type, len;\n \tif (typeof (str) != 'string')\n \t\tthrow (new Error('type must be a Javascript string'));\n \n \tendInd = str.lastIndexOf(']');\n \tif (endInd == -1) {\n \t\tif (str.lastIndexOf('[') != -1)\n \t\t\tthrow (ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert github issue state to agm syntax | function convertState(state) {
return (state === 'closed' ? 'Done' : 'New');
} | [
"function resolveState(state) {\n var retStr = \"\";\n if (state == \"Unseen\") {\n retStr += \"and G = \\'\\' \";\n } else if (state == \"Denied\") {\n retStr += \"and G = \\'n\\' \";\n } else if (state == \"Approved\") {\n retStr += \"and G = \\'y\\' and H != \\'y\\' \";\n } else if (state == \"Paid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
solve function for challege 1 default challenge Find the shortest path from start to exit of the grid. | function solve(){
var grid = cGrid;
var point = {
row: 0,
col: 0
};
stepCount = 0; //resetStep
exitRow = grid.length-1;
var minDistance = -1;
//2. Walk through grid, loop each step
do{
let nextSteps = [];
let step = {};
for( var direct in direct... | [
"function solvePath(){\n var grid = cGrid;\n stepCount = 0; //resetStep\n startRow = 0;\n exitRow = grid.length-1;\n var point = {\n row: 0,\n col: 0\n };\n\n //1. Loop start row , find the start col and mark\n let startCol = point.col;\n for ( ;startCol < grid[startRow].le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Populate the already selected items from the cookies and update the displayed list of components to match. | function loadSelectionsFromCookies() {
// Iterate over all items, selecting those that have a cookie stored which is equal to "selected"
Object.keys(allItemNames).forEach(itemName => {
itemNameSafe = allItemNames[itemName]
itemCookie = localStorage.getItem(itemNameSafe)
if (itemCookie != null) {
... | [
"populateActiveChoices() {\n /**\n * Remove children instead of clearing innerHTML, to keep change listener.\n */\n while (this.activeList_.firstElementChild) {\n this.activeList_.firstElementChild.remove();\n }\n this.activeList_.insertAdjacentHTML('beforeend', '<option></option>');\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
part D Create a deleteTask function: i. It receives a string as a parameter called task. ii. It removes that string from the array. iii. It prints in console a message indicating the deletion. iv. It returns the number of elements in the array after the deletion | function deleteTask(task) {
var index;
index = myTaskArray.indexOf(task);
if (index > -1) {
myTaskArray.splice(index, 1);
console.log("Item " + task + " has been deleted from the array");
}
else {
console.log("Item " + task + " is not in the array");
}
return myTaskAr... | [
"function deleteTask(task) {\n // var taskIndex = array.indexOf(task);\n // if (taskIndex > -1) {\n // array.splice(taskIndex, 1);\n // console.log(`${task} deleted`);\n // }\n tasks = tasks.filter(function (t) {\n return t !== task;\n });\n console.log(task + \" deleted\");\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an activity bubble for the specified commit | function createActivityBubble (commit) {
var bubble = new ActivityBubble();
bubble.user.login = commit.committer.login;
bubble.user.name = commit.commit.committer.name;
bubble.commitUrl = commit.url;
bubble.fixBugCommit = commit.commit.message.indexOf("fix") > -1 && commit.commit.message.indexOf("bug") > -1;
bubb... | [
"function createItem(revision) {\n\n var block = $('<div></div>').attr('class', 'commit-item2');\n var actions = $('<div></div>');\n\n var title = $('<div></div>')\n .text(revision.Message)\n .attr('class', 'commit-title2')\n .appendTo(block);\n\n $('<div></div>')\n .tex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
.closest recurses up the DOM from the target node, checking if the current element matches the query fluent doc(target).closest(query); legacy doc.closest(target, query); | function closest(target, query){
target = getTarget(target);
if(isList(target)){
target = target[0];
}
while(
target &&
target.ownerDocument &&
!is(target, query)
){
target = target.parentNode;
}
return target === doc.document && targ... | [
"closest(selectors) {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let node = this;\n while (node) {\n if (node.matches(selectors)) {\n return node;\n }\n node = node.parent;\n }\n return null;\n }",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens a new window with analysis result as a string | function openResultWindow(collaboratorsAnalysisResult){
var recipe = window.open("",'Analysis Result','width=800,height=600');
var html = "<html><head><title>Analysis Result</title></head><body>" + JSON.stringify(collaboratorsAnalysisResult) + "</body></html>";
recipe.document.open();
recipe.document.write(ht... | [
"function showExecuted () {\n instrWin = new BrowserWindow({ width: 400, height: 600 })\n\n instrWin.loadFile(\"executedInstr.html\")\n\n instrWin.on('closed', () =>{\n instrWin = null\n })\n}",
"function showVAASTViewer() {\n var polymode = \"\";\n var runid = getQueryVariable(\"run\");\n var gen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The router file's path is invalid | function testRouterInvalidJsonPath() {
var routerJsonPath = ".invalidJson",
proxyManager = new ProxyManager(routerJsonPath, {});
A.areEqual(routerJsonPath, proxyManager.proxyConfig, 'Router jsonpath doesn\'t match');
} | [
"function testRouterValidJsonPath() {\n\n var routerJsonPath = \"./config/router.json\",\n proxyManager = new ProxyManager(routerJsonPath, {});\n A.areEqual(routerJsonPath, proxyManager.proxyConfig, 'Router jsonpath doesn\\'t match');\n }",
"createRouteFile() {\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handles the input change of the newest card | function handleCardInputChange(evt) {
setNewCard({
...newCard,
[evt.target.name]: evt.target.value,
});
} | [
"function cardUpdateListener(data) {\n AppData.setCardContent(data[\"card\"], data[\"newContent\"]);\n \tAppData.saveData();\n }",
"function handleCardsInputChange(evt, idx) {\n const dupeCards = [...cards];\n dupeCards[idx][evt.target.name] = evt.target.value;\n setCards(dupeCards);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the selected instructor in the instructor select element | function selectInstructorDropDown() {
let instructorId = document.getElementById('selectedInstructorId');
if (instructorId != null) {
let dropDown = document.getElementById('selectInstructor');
for (let i=0; i < dropDown.options.length; i++) {
if (dropDown.options[i].value == instructorId.value) {
... | [
"function SetupInstructorOptions(e) {\n\tvar DEBUG_setInstructor = true;\n\tvar c,\n\t\t\tthisSelectId, thisSelect;\n\tif ( DEBUG_setInstructor ) { console.log('BEGIN SetupInstructorOptions[e.id='+e.id+']'); }\n\tvar eIdParts = e.id.split('_');\n\tvar scmId = eIdParts[1];\n\tvar campusIndex = parseInt(eIdParts[2]);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructors Initialize a new instance of `PdfGridEndPageLayoutEventArgs` class. | function PdfGridEndPageLayoutEventArgs(result){return _super.call(this,result)||this;} | [
"function PdfGridBeginPageLayoutEventArgs(bounds,page,startRow){var _this=_super.call(this,bounds,page)||this;_this.startRow=startRow;return _this;}",
"function PdfGridEndPageLayoutEventArgs(result) {\n return _super.call(this, result) || this;\n }",
"function BeginPageLayoutEventArgs(bounds,page){var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If `range` is a proper range with a start and end, returns the original object. If missing an end, computes a new range with an end, computing it as if it were an event. TODO: make this a part of the event > eventRange system | function ensureVisibleEventRange(range) {
var allDay;
if (!range.end) {
allDay = range.allDay; // range might be more event-ish than we think
if (allDay == null) {
allDay = !range.start.hasTime();
}
range = $.... | [
"function ensureVisibleEventRange(range) {\n\t\tvar allDay;\n\n\t\tif (!range.end) {\n\n\t\t\tallDay = range.allDay; // range might be more event-ish than we think\n\t\t\tif (allDay == null) {\n\t\t\t\tallDay = !range.start.hasTime();\n\t\t\t}\n\n\t\t\trange = {\n\t\t\t\tstart: range.start,\n\t\t\t\tend: t.getDefau... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Splits a string of text into chunks. | function splitText(text) {
let parts = textchunk.chunk(text, maxCharacterCount);
var i = 0;
parts = parts.map(str => {
// Compress whitespace.
// console.log("-----");
// console.log(str);
// console.log("-----");
return str.replace(/\s+/g, ' ');
}).map(str => {
// Trim whitespace from t... | [
"function splitTextIntoChunks(text, chunksize, delimiter){\n\n delimiter = typeof(delimiter) === 'undefined' ? \" \" : delimiter;\n\n var letter_counter = 0;\n var word_counter = 0;\n var text_chunks = new Array();\n var current_chunk = \"\";\n\n while(letter_counter < text.length){\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the state to off when the pump disables itself. | function pumpStateOff(triggerFunc) {
Object.assign(state, {
isOn: false,
deviceSequence: state.deviceSequence + 1
});
triggerFunc();
} | [
"setOff() {\n this.setFrame(0);\n this.on = false;\n }",
"switchOff () {\n if (!this._isOn()) { return }\n\n if (!this._eventDispatched('SwitchToggledOff')) { return }\n\n this._setOffState()\n }",
"function off() {\n gpio.write(pin, 0, (err) => {\n if (err) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fill the array with the content of the name attribute of the images | function fill_array() {
for(var i=0;i<16;i++){
array.push(document.images[i].name);
clicked.push(false);
}
} | [
"function init() {\r\n\tlet images = document.querySelectorAll(\"img\");\r\n\tfor (let i=0; i<16; i++) {\r\n\t\tarray[i]=images[i].getAttribute(\"name\");\r\n\t}\r\n}",
"function fill_array() {\n\tvar div = document.getElementById(\"grid\");\n\tvar img = div.getElementsByTagName(\"img\");\n\tfor (var i = 0; i < i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to update last online activity | function updateLastActivity(){
var handlerUrl = runtime.handlerUrl(element, 'updateLastOnline');
$.ajax({
type: "POST",
url: handlerUrl,
data: JSON.stringify({"hello": "world"}),
success: function(result){
console.log("u... | [
"static updateActivity() {\n let numStreams = Object.keys(this.onlineChannels).length;\n let activity = `${numStreams} stream${numStreams == 1 ? \"\" : \"s\"}`;\n this.discordClient.user.setActivity(activity, {\n \"type\": \"WATCHING\"\n });\n\n console.log('[StreamActivity]', `Update current ac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update card probabilities in table | function updateProbTable()
{
console.log("update probability table");
var table = document.getElementById("probabilityTable").rows; // get probability table, collection of all rows
// update suspect probabilities
var i, d;
for(i = 1; i < 7; i++) // iterate through rows, row header at 0, 6 suspects
{
d = tabl... | [
"function updateCapacitiesForCard(card) {\n\n\tfor (var model_number= 0; model_number<card.models.length; model_number++ ) {\n\t\tmodel = card.models[model_number];\n\t\tfor (var i=0; i<model.capacities.length; i++ ) {\n\t\t\tmodel_capa = model.capacities[i];\n\t\t\t// search in capacities\n\t\t\tif (model_capa._i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SEND LOGIN ////////////////////////////////////////// triggered by: the submission of the add_login form, or a reconnect if global user data are set or cordova login arguemnts: user and password as string what it does: send the data UNDCODED TODO why: ... ///////////////////////////////////////// SEND LOGIN | function send_login(user,pw){
$("#login_node").remove();
if((user=="" || pw=="") || (user=="nongoodlogin" && pw=="nongoodlogin")){
// empty form send
add_login("please enter a user name and a password");
} else {
// store to reconnect without prompt
g_user=user;
g_pw=pw;
// hash the password, combine ... | [
"function submitLogin(type, data, extra, callback) {\n console.log(\"Logging in with \" + type);\n setTitle(TITLE_POST_AUTH);\n\n // Add the login type.\n data.type = type;\n\n // Add the device information, if it was provided.\n if (extra.device_id) {\n data.device_id = extra.device_id;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make sure a colors number is valid | function isValidColorsNumber(colors) {
return colors > 2
&& colors < Infinity
&& !isNaN(colors)
&& colors % 1 === 0;
} | [
"function validateColorInput(value) {\n // #000 or #000000 is acceptable\n if (value.length !== 7 && value.length !== 4) { return false; }\n if (value[0] !== '#') { return false; }\n return true;\n }",
"function validateColorField(value) {\n\tvar regex = '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets appropriate value for the temperature given returns a number between the limits low and high | function getColorValue(temp, low, high) {
// make sure that the temperature doesn't fall out of bounds
temp = (temp < LOW_TEMP) ? LOW_TEMP : temp;
temp = (temp > HIGH_TEMP) ? HIGH_TEMP : temp;
// the (|| 1) is to make sure divisor is not 0
let divisor = (HIGH_TEMP - LOW_TEMP) || 1;
let color = low + (temp... | [
"function getTemperatureEval(low, high){\n if (high < 5){\n return 1;\n } else if (high < 10){\n return 2;\n } else if (high < 17){\n return 3;\n } else if (high < 24){\n return 4;\n } else {\n return 5;\n }\n}",
"function temperature(fr) {\n return maxTemp ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |