query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
hard coded the DFP ad request here but eventually we could support different ad servers | function isAdRequest(request) {
return request.request.url.startsWith('https://securepubads.g.doubleclick.net/gampad/ads');
} | [
"async get_ad(ad_account_id, _campaign_id, _ad_group_id, ad_id) {\n return await this.request(`\\\n/v5/ad_accounts/${ad_account_id}/ads/analytics\\\n?ad_ids=${ad_id}&`);\n }",
"function initAdData () {\r\n\tvar config = {\r\n\t\t\t\"dfpTemplateType\" \t\t: \"headerOnly\",\r\n\t\t\t\"dfpSecondLevelAdUnit\"\t: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear address function used to keep one single zipcode in address array | function clearAddress() {
address = [];
} | [
"function removeAddress(){\n\tif(activeCounter >0){\n activeCounter--;\n\t\tif(markers[counter] != null){\n\t\t\tmarkers[counter].setMap(null);\n\t\t\tmarkers[counter] = null;\n if(activeCounter ==0){\n //if no active markers anymore, reinitialize the map\n initialize();\n }else{\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tells if the slides are animating | function isSlidesAnimating(){
if(g_objSlide1.is(":animated"))
return(true);
if(g_objSlide2.is(":animated"))
return(true);
if(g_objSlide3.is(":animated"))
return(true);
return(false);
} | [
"function animationRunning(){\r\n\treturn animations.length > 0;\r\n}",
"function checkAnimation() {\n var $elems = $('.animate_when_in_view:not(.start)');\n\n // If the animation has already been started\n // if ($elem.hasClass('start')) return;\n\n $elems.each(function(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates an effect loop | function loop(effects, rep = 1) {
return new EffectLoop(effects, { num: rep });
} | [
"function loopAnim() {\n // flake.animate({\n // top: 0,\n // left: thisLeft + Math.floor(Math.random() * (max - min + 1)) + min\n // }, 0)\n // .animate({\n // top: '100%',\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maximal dijkstra may not work if there is a cycle, but since we don't have cycles then that's fine | function maxDijkstra(adjmat, weight, start) {
var nvertices = adjmat.length;
var intree = new Array(nvertices);
var distance = new Array(nvertices);
var v;
for(var i = 0; i < nvertices; i++){
intree[i] = false;
distance[i] = MININT;
}
distance[start] = weight[start];
va... | [
"function maxDistance(dist, intree)\n{\n var max = 0;\n var maxV = -1;\n\n // For all vertices, if v is not in the dijkstra MST\n // and max distance sofar is less than or equal to dist[v]\n for (var v = 0; v < dist.length; v++){\n if (intree[v] === false && max <= dist[v]){\n max =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create an agent + content pair from the received object | function createAgent(object, callback) {
agent = new TSchemas.Agent();
ContentModel = TSchemas.model(object.data.agentType);
contentObj = new ContentModel();
// create a content object from data.content
contentObj.create(object.data.content, function(err) { if(err) callback(err); else {
/... | [
"function createPassageObject (passage, noMeta) {\n var ret = {};\n // core data \n Object.assign(ret, {\n name : passage.name,\n pid : passage.id,\n tags : passage.tags.split(' ').filter( function (tag) { return !!tag; }),\n source : passage.source\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check start touch zoom | function checkTouchZoomStart(event){
if(g_temp.isZoomActive == true)
return(true);
var arrTouches = g_functions.getArrTouches(event);
if(arrTouches.length != 2)
return(true);
startTouchZoom(arrTouches);
} | [
"_onPinchStart(event) {\n const pos = this.getCenter(event);\n\n if (!this.isPointInBounds(pos, event)) {\n return false;\n }\n\n const newControllerState = this.controllerState.zoomStart({\n pos\n }).rotateStart({\n pos\n }); // hack - hammer's `rotation` field doesn't seem to prod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Definition of an animal type | function AnimalType() {
this.single = '';
this.plural = '';
this.health = 10;
this.healthGrowth = 1;
this.speed = 10;
this.speedGrowth = 0;
this.armor = 0;
this.armorGrowth = 0;
this.carry = 1;
this.carryGrowth = 0;
this.damage = 1;
this.damageGrowth = 0;
//these tags... | [
"function generateRandomAnimal() {\n // random index to choose animal type\n var animalIndex = generateRandomIndex(animals.length);\n // get a random animal\n var animal = animals[animalIndex];\n // identify and create animal\n if (animal instanceof PolarBear) return new PolarBear(generateRandomName(), genera... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DOMmethods updates user div in HTML (as well as progress bar i users.css)) | function updateUserDiv(user) {
var profileUsername = document.getElementById("profileUsername");
var profileDescription = document.getElementById("profileDescription");
var profileProgressBar = document.getElementById("profileProgressBar");
profileUsername.innerHTML = user.firstName + " " + user.lastNam... | [
"function update_user_elements() {\n $('.echo-item-authorName, .echo-item-avatar').each( function() {\n if(!$(this).hasClass('initialized')) {\n var container = $(this).parents('.echo-item-container');\n \n var userName = container.find('.echo-item-authorName').te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether icons or avatars are shown at the given position. | _hasIconsOrAvatarsAt(position) {
return this._hasProjected('icons', position) || this._hasProjected('avatars', position);
} | [
"function iconDisplay(profile){\n if (profile.isVegetarian === true && vegetarianCheck(props.ingredient) === true) {\n return false;\n } else if (profile.isVegan === true && veganCheck(props.ingredient) === true) {\n return false;\n } else if (profile.isGlutenFree === true && glutenFreeCheck(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This wraps __pyproxy_ensure_future and makes a function that converts a Python awaitable to a promise, scheduling the awaitable on the Python event loop if necessary. | _ensure_future() {
let ptrobj = _getPtr(this);
let resolveHandle;
let rejectHandle;
let promise = new Promise((resolve, reject) => {
resolveHandle = resolve;
rejectHandle = reject;
});
let resolve_handle_id = Module.hiwire.new_value(resolveHandle);
let reject_handle_id = Module.h... | [
"function ensureSync(value) {\n (0, _invariant.default)(!(0, _fp.is)(Promise, value), 'Unexpected Promise. Passed function should be synchronous.');\n return value;\n}",
"async function asyncFunc() {\n return 123;\n}",
"function _wrapInPromise(value) {\n\t\t\treturn $q.when(value);\n\t\t}",
"async promis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a unique identifier for this node userchosen name. This Identifier is unique for for every machine. | function unique_node_id(name, type) {
let idstring = node_machine_id_1.machineIdSync();
return NODE_TYPE[type] + '-' + crypto_1.createHash('sha1').update(`${idstring}-${name}`).digest('base64');
} | [
"static generateId() {\n return cuid_1.default();\n }",
"function generateUID() {\n return String(~~(Math.random()*Math.pow(10,8)))\n}",
"generatePrivateId()\n\t{\n\t\tvar nanotime = process.hrtime();\n\t\treturn String(nanotime[0]) + nanotime[1] + '-' + this.name;\n\t}",
"function uuid() {\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show missing trace assets. | function showMissingTraceAssets(drawingController) {
var missingAssets = drawingController.svgControl.getController("HighlightController").getMissingAssets('trace');
var missingAssetsMsg = getMessage('assetsNotFound');
var hasError = false;
if (missingAssets.assetFrom.length > 0) {
missingAssets... | [
"function showMissingTraceAssets() {\n var missingAssets = getMissingAssets('trace');\n var missingAssetsMsg = getMessage('assetsNotFound') + ':\\n';\n var hasError = false;\n if (missingAssets.assetFrom.length > 0) {\n missingAssetsMsg += '\\n' + getMessage('assetsNotFoundFrom') + ': [' + missin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cdnjs / microjs packages installer Ensures that both `~/.gimme/packages.json` and `~/.gimme/data.js` are here. Only fetch from remote if the file isnn't already there, may force the update if force param is passed in. | function load(force, cb) {
if(!cb) cb = force, force = false;
var done = {};
app = this,
config = app.get();
var packages = path.join(app.get('prefix'), 'cdnjs'),
datajs = path.join(app.get('prefix'), 'microjs'),
dictionnary = path.join(app.get('prefix'), 'gimme.json');
if(path.existsSync(dict... | [
"async function update_package_jsons() {\n const pkg = JSON.parse(fs.readFileSync(\"./package.json\"));\n pkg.version = NEW_VERSION;\n const pkg_json = `${JSON.stringify(pkg, undefined, 4)}\\n`;\n fs.writeFileSync(\"../package.json\", pkg_json);\n const packages = {};\n for (const ws of pkg.worksp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register global data to be used internally by Angular. See the ["I18n guide"](guide/i18ni18npipes) to know how to import additional locale data. | function registerLocaleData(data, localeId, extraData) {
if (typeof localeId !== 'string') {
extraData = localeId;
localeId = data[0 /* LocaleId */];
}
localeId = localeId.toLowerCase().replace(/_/g, '-');
LOCALE_DATA[localeId] = data;
if (extraData) {
LOCALE_DATA[localeId][1... | [
"function registerForLocalization(component) {\n component.contextType = __WEBPACK_IMPORTED_MODULE_2__globalization_GlobalizationContext__[\"a\" /* GlobalizationContext */];\n}",
"_setData() {\n this._global[this._namespace] = this._data;\n }",
"function add_i18n()\n {\n var i18n = {};\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get fireDistrict data for VIC | function cleanFireDistrictDataVIC(data, fireDistrict) {
const { results } = data;
const merged = mergeItems(results, fireDistrict);
return { [fireDistrict]: merged };
} | [
"function casesByCountry (){\n\n let today = dateToday();\n let endPoint = 'https://api.covid19tracking.narrativa.com/api/' \n let queryCountriesUrl = endPoint + today; \n let URL = {\n url: queryCountriesUrl,\n method: \"GET\" \n } \n\n // making request to pull all Covid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the assiciated course object, if the current page is from a known course (null if not) | function getCurrentCourse()
{
var foundcourse = null;
var currenturl = window.location.href;
courses.forEach(function(c) {
if(currenturl.includes(c.id)){
foundcourse = c;
}
});
if (foundcourse == null) { console.log("Not on known course page");}
else {console.log("On ... | [
"static async getCourseById(id) {\n const coursesData = await CourseModel.getAllCourses();\n let course = null;\n if(coursesData.length){\n course = coursesData.find(item => item.id === id);\n }\n return course;\n }",
"retrieveCourse (id) {\n return apiClient.retrieveCourse(id)\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function displays all posts. It also calls functions to add the comments section to each post and display all comments for each post. | function displayAllPosts() {
$.ajax({
"url": "services/allPosts.php",
"success": function(jsonResponse) {
$(jsonResponse).each(function(index, element) {
var postId = element.id;
var postTitle = element.ti... | [
"function renderPosts(posts){\n\n //jQuery ima each metodo s katero loop-amo\n\n $.each(posts, function (i, post) {\n\n\n //kot spremenljivke sem shranila te 4 elemente\n\n var $postContainer = $('<div>', {class:'post-container'});\n var $postTitle = $('<h1>', {class:'post-title', t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================= / Q9 ============================================================================= / Create a ReadingList class by using OOP concept, where: Your class should has: "read" for the number of books that finish reading "unRead" for the number of ... | function ReadingList()
{
var book={};
book.read = 0;
book.unread = 0;
book.toRead = [];
book.currentRead = undefined;
book.readBooks = [];
book.addBook = addBook;
book.finishCurrentBook = finishCurrentBook;
return book;
} | [
"function ReadingList(){\n var read = 0, unRead = 0, toRead = [], currentBook, readBooks = [];\n return{\n read : read,\n unRead : unRead,\n toRead : toRead,\n currentBook : currentBook,\n readBooks : readBooks,\n addBook : addBook,\n finishCurrentBook : finishCurrentBook\n }\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete Generic Distribution Provider Action by provider id. | static deleteByProviderId(genericDistributionProviderId, actionType){
let kparams = {};
kparams.genericDistributionProviderId = genericDistributionProviderId;
kparams.actionType = actionType;
return new kaltura.RequestBuilder('contentdistribution_genericdistributionprovideraction', 'deleteByProviderId', kparams... | [
"static deleteAction(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('contentdistribution_genericdistributionprovideraction', 'delete', kparams);\n\t}",
"static getByProviderId(genericDistributionProviderId, actionType){\n\t\tlet kparams = {};\n\t\tkparams.genericDistribut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modify the name of the job jobDetails is a JSON object specifying the required updates Returns a new promise | updateJob(jobId, jobDetails) {
return new Promise((resolve, reject) => {
deleteCacheById(jobId) // clear cache
.then(() => {
Job.findOneAndUpdate({
jobId: jobId
}, jobDetails, {
runValidators: tru... | [
"updateJob({\n JobID, Job, EnforceIndex = false, JobModifyIndex = 0, PolicyOverride = false,\n }, callback) {\n return this.request.postAsync({\n body: {\n Job,\n EnforceIndex,\n JobModifyIndex,\n PolicyOverride,\n },\n uri: esc`job/${JobID}`,\n })\n .bind(thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reduces a dependency tree (as read from a justmade npmshrinkwrap.json or from npm ls json) to just the versions we want. Returns an object that does not share state with its input | function minimizeDependencyTree(tree) {
function minimizeModule(module) {
var version;
if (module.resolved && ! isUrlFromRegistry(module.resolved)) {
version = module.resolved;
} else if (utils.isNpmUrl(module.from)) {
version = module.from;
} else {
version = module.version;
}
... | [
"tryEnsureDependencyVersion(dependencyName, tempProjectName, versionRange) {\n // PNPM doesn't have the same advantage of NPM, where we can skip generate as long as the\n // shrinkwrap file puts our dependency in either the top of the node_modules folder\n // or underneath the package we are lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the item isn't present or nothing follows it, the function should return nil in Clojure and Elixir, Nothing in Haskell, undefined in JavaScript, None in Python. nextItem([1, 2, 3, 4, 5, 6, 7], 3) 4 nextItem("testing", "t") "e" | function nextItem(xs, item) {
console.log(xs, item);
if (Array.isArray(xs) ) {
return xs.find((value) => value == item + 1)
}
else if (typeof(xs) == "string" && xs.includes(item)) {
let indexOfItem = xs.indexOf(item) + 1;
if (xs.charAt(indexOfItem) == '') {
return undefined;
}
else {
... | [
"function nextItem(object, item) {\n return (object.indexOf(item) != -1) ? object[object.indexOf(item)+1] : undefined;\n}",
"function nextItem(xs, item) {\n if( Array.isArray(xs) || typeof xs === 'string' ) {\n var idx = xs.indexOf(item);\n idx = idx === -1 ? xs.length : idx + 1;\n return xs[idx] || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set startAnimation state to false, so animation won't start again. | function preventStartUpAnimation(){
setStartUpAnimation(false);
} | [
"function removeAnim() {\n let removeStartAnim = (document.getElementById(\n \"slideAnimStart\"\n ).style.display = \"none\");\n content.style.visibility = \"hidden\";\n\n // display second layer of animation ONLY if the first layer has been removed\n if (removeStartAnim) {\n animEnd.style.display = \"bl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`obs.splice` is a mutable implementation of `splice()` that mutates both `list` and the internal `valueList` that is the current value of `obs` itself | function splice(index, amount) {
var obs = this
var args = slice.call(arguments, 0)
var valueList = obs().slice()
// generate a list of args to mutate the internal
// list of only obs
var valueArgs = args.map(function (value, index) {
if (index === 0 || index === 1) {
return... | [
"function nonMutatingSplice(cities) {\n return cities.splice(0, 3);\n\n}",
"function spliceMethod() {\n\tvar a=['man', 'animan', 1, 2, \"This is a statement\", 0.505, null, NaN];\n\tvar b=a.splice(1,2,'parrot', 1, 3, null);\n\tconsole.log(b);\t\n}",
"function applySplice(array, index, item1, item2) {\n arra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
divDisplayState(divId) divId = The id of the div. Return the display setting for divId. | function divDisplayState(divId) {
//console.log('divDisplayState('+divId+')');
if ( document.getElementById(divId) ) {
var e = document.getElementById(divId)
if (e.style.display) {
return e.style.display;
}
if (e.currentStyle) {
return e.currentStyle.display;
}
if (document.defaultView.getComputedS... | [
"function divHideShow(divId) {\n //console.log('divHide('+divId+')');\n\tif ( document.getElementById(divId) ) {\n\t\tif ( divDisplayState(divId) == 'none' ) {\n\t\t\tdivShow(divId);\n\t\t} else {\n\t\t\tdivHide(divId);\n\t\t}\n\t} else {\n\t\tconsole.warn('document.getElementById('+divId+') == udefined');\n\t}\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UserLogoutController for login logout | function UserLogoutController(__DataStore, __Auth, appServices) {
var scope = this;
__DataStore.post('user.logout').success(function(responseData) {
appServices.processResponse(responseData, function(reactionCode) {
// set user auth information
__Auth.ch... | [
"logoutUser() {\n this.get('session').invalidate();\n }",
"function logout(){\n tokenFactory.deleteToken();\n $window.location.reload();\n }",
"_handleLogout(){\r\n sessionStorage.clear();\r\n this.set('route.path', './login-page');\r\n }",
"function logOut() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check name exist or not | function check_name_exist() {
var parameters = '/users/checkExist?name=' + encodeURIComponent($.trim($name.val())) + '&id=' + $('#id').val();
check_exist($name_error,parameters,'该用户名称已存在!');
} | [
"function name_check() {\r\n name_warn();\r\n final_validate();\r\n}",
"function validName(input) {\n return input.length > 0\n }",
"function checkName(name) {\n it('Name is defined: ' + name, function() {\n expect(name).toBeDefined();\n expect(name.length).not... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=============================================================== Code to position a popup window in the center of the screen. This code also accounts for dual screens. =============================================================== | function centerPopupWnd(w, h){
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left,
dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top,
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ?
... | [
"function PopUp_Center() {\n if (_popUp) {\n _popUp.css({ \"left\": ($(\"html\").outerWidth() / 2) - (_popUp.outerWidth() / 2), \"top\": ($(\"html\").outerHeight() / 2) - (_popUp.outerHeight() / 2) });\n }\n\n return false;\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MAKE GRID make grid of tiles (buttons) in HTML | function createGrid() {
// set CSS properties
document.documentElement.style.setProperty('--grid_size', gridSize);
document.documentElement.style
.setProperty('--font_size_tile_adaptable', `${6 - gridSize/3}vh`);
// get grid HTML element and empty its content from previous grid
const grid = document.getE... | [
"function createGrid() {\n for (let i = 0; i < width * height; i++) {\n const cell = document.createElement('div')\n grid.appendChild(cell)\n cells.push(cell)\n }\n for (let i = 2; i < 22; i++) {\n rowArray.push(cells.slice(i * 10, ((i * 10) + 10)))\n }\n for (let i = 0; i < 20; i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Based on a phrase text that contains `n` plural forms separated by `delimeter`, a `locale`, and a `count`, choose the correct plural form, or none if `count` is `null`. | function choosePluralForm(text, locale, count){
var ret, texts, chosenText;
if (count != null && text) {
texts = text.split(delimeter);
chosenText = texts[pluralTypeIndex(locale, count)] || texts[0];
ret = trim(chosenText);
} else {
ret = text;
}
return ret;
} | [
"function checkPluralize(word, count) {\n var result = \"\";\n if (count > 1) {\n result = word + \"s\";\n } else {\n result = word;\n }\n return result;\n}",
"function plural(count) {\n return count == 1 ? \"\" : \"s\";\n}",
"function pluralise(n, noun, suffix){\n suffix = (t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle a subdomain management action: subdomain to remove a subdomain +subdomain,pass to create a new subdomain | HandleSubdomainMgmtAction(action, username, userpass)
{
let words = action.slice(1).split('|');
switch (action[0]) {
case '-':
if (this.list[words[0]]) {
delete this.list[words[0]];
this.SaveConfig();
}
... | [
"function allSub(callback) {\r\n var c = require('../config/production/config');\r\n Object.keys(c).length === 0 &&\r\n (c = require('../config/production/config.backup'));\r\n var botdomains = [];\r\n var m = c.botdomains.match(/{\\s*['\"][a-z0-9\\-]{1,200}['\"]\\s*}/gi);\r\n if (m) {\r\n m.forEach(func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if invites exist and display number above invitations tab on profile page | function showInvites(invites) {
if(invites.length > 0 ){
var invitationsContainer = el('div.invitationContainer')
var new_Invitations = el('a.newInvitation', {href : "/invitations.html"},invites.length + " " )
invitationsContainer.appendChild(new_Invitations)
docu... | [
"function checkForInvites() {\n debug('Checking for repository invites');\n github.users.getRepoInvites({}).then(invites => {\n invites.forEach(invite => {\n debug('Accepting repository invite', invite.full_name);\n github.users.acceptRepoInvite(invite);\n });\n });\n\n debug('Checking for organ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear error messages on input/select changes | function clearErrorMessage(){
$('.group input').keyup(function(){
$('.group input').each(function(){
if($(this).val().length > 0){
displayErrorMessage('');
}
})
})
$('.group select').on('change', function(event){
event.preventDefault();
displayErrorMessage('');
})
} | [
"function removeAllErrors() {\n this.select('errorMessageSelector').remove();\n this.select('errorGroupSelector').removeClass(this.attr.errorClass);\n}",
"updateErrors() {\n $('#rbro_style_panel .rbroFormRow').removeClass('rbroError');\n $('#rbro_style_panel .rbroErrorMessage').text('');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorting the Grocery list | function sortGroceries() {
let categories = Array.from(new Set(groceryList.map((grocery) => grocery.category))).sort();
let tempgroceryList = [];
categories.forEach((category) => {
let currentCategoryItems = groceryList.filter((grocery) => grocery.category == category);
currentCategoryItems ... | [
"rankWishes(){\n let sortedWishList = this.wishList\n sortedWishList.sort(function(a, b){return b.votes - a.votes})\n return sortedWishList \n }",
"sortAttack(items) {\n\n items.sort(function(a, b){\n\n if(a.atck < b.atck){ \n \n return -1;\n }\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create addChat function that will add messages to the message array when user enters a new message. Param x represents the text input in the chat, and param y represents which player entered this particular message. Bypasses this if the user enters 'clear' | function addChat(x, y) {
if (x.toLowerCase() !== 'clear') {
self.playerOneMessages.$add({
message: x,
id: y
});
self.playerTwoMessages.$add({
message: x,
id: y
});
self.playerOneMessages.$save();
self.playerTwoMessages.$save();
}
} | [
"function sendChatMessege()\n{\n var chat = cleanInput($(\"#chat-box\").val().substring(0, 100));\n\n if($.isBlank(chat))\n return;\n\n socket.emit('chat', chat);\n setPlayerMessege(player, chat);\n $(\"#chat-box\").val(\"\");\n}",
"function addMessage(msg, roomName, username, other) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the array for magnetic field lines 'maglines' | function PHSK_MagLineCalc() {
//counter to avoid centerpiece
let l = 0;
for (let i = 0; i < 26; i++) {
if(i == 13)
l+=1;
let anchorPos = new Vec3 ( - 4.5 + (4.5 * (l%3)) , - 4.5 + (4.5 * (Math.floor(l/3)%3)) , - 4.5 + (4.5 * (Math.floor(l/9)%3)));
l+=1;
//if(i%2 ==1)
// continue
maglines[i][... | [
"generateLines() {\n for (var f = 0; f < this.faceData.length/3; f++) {\n // Calculate index of the face\n var fid = f*3;\n this.edgeData.push(this.faceData[fid]);\n this.edgeData.push(this.faceData[fid+1]);\n\n this.edgeData.push(this.faceData[fid+1]);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads a list of predefined units (suggestions) from the server into a array that is available in scope. | function loadUnits() {
//Execute server request
UnitService.getPredefinedUnits(scope.unitFilter).then(function (response) {
//Success, set array
scope.unitList = response;
}, function () {
//Failure, no suggestions
scope... | [
"function findSpecialAbilityTemplatesQuery(str, callback) {\n var result;\n var suggestions;\n\n if (window.XMLHttpRequest) {\n xmlhttp=new XMLHttpRequest();\n } else {\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n\n xmlhttp.onreadystatechange=function() {\n if (xm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store a document in CouchDB. | function couchdb_put(doc_id, doc, success_callback, error_callback) {
var options = {
host: config.couch.host,
port: config.couch.port,
path: '/' + config.couch.db + '/' + doc_id,
method: 'PUT',
headers: {
"Content-Type": "application/json",
"User-Agent": user_agent,
"Accept": "a... | [
"function saveDocument() {\n if (current.id) {\n console.log(\"saveDocument(old) started\");\n var isUpdateSupported = current.resources.self && $.inArray('PUT', current.resources.self.allowed) != -1;\n if (!isUpdateSupported) {\n alert(\"You are not allowed to update this document\");\n return;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the current width of the sidebar. | function getSidebarWidth() {
return sidebarWidth;
} | [
"get width() {\n if ( !this.el ) return;\n\n return ~~this.parent.style.width.replace( 'px', '' );\n }",
"function assertSidebarWidth() {\n cy.get('#sidebar').should('have.css', 'width').and((width) => {\n expect(width).to.have.string('px');\n const val = parseInt(width.substring(0, width.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Click at the All Items link | async allItems() {
const allItemMenuLocator = await this.components.menuAllItemsLink()
await allItemMenuLocator.click()
} | [
"clickNavItem(item) {\n\t item.click()\n\t}",
"clickPayByCheckLink() {\n this.lnkPayByCheck.click();\n }",
"function getAllItems(){\n\n}",
"function onContentItemClick() {\n var elementId = $(this).attr(\"data-id\");\n showFolderOrFileContentById(elementId);\n }",
"clickCart() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether the mouse pointer is in the first half of the given target element. In Chrome we can just use offsetY, but in Firefox we have to use layerY, which only works if the child element has position relative. In IE the events are only triggered on the listNode instead of the listNodeItem, therefore the mouse po... | function isMouseInFirstHalf(event, targetNode, relativeToParent) {
var mousePointer = horizontal ? (event.offsetX || event.layerX)
: (event.offsetY || event.layerY);
var targetSize = horizontal ? targetN... | [
"function hitTest(node, x, y) {\n var rect = node.getBoundingClientRect();\n return x >= rect.left && x < rect.right && y >= rect.top && y < rect.bottom;\n }",
"function insideSelector(event) {\n var offset = $qsBody.position();\n offset.right = offse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifica dependiendo de los conceptos si se mostrara el campo de Ciudad | function validaCiudad(){
var concepto = $("#concepto option:selected").text();
if((/Comidas/.test(concepto))){
asignaClass("ciudad","req");
mostrarElemento("tr_ciudad");
}else
ocultarElemento("tr_ciudad");
} | [
"function validaComidasRepresentacion(){\r\n\t\tvar idConceptoComidaRepresentacion = 1;\r\n\t\tvar concepto = buscaConceptoporID(idConceptoComidaRepresentacion);\r\n\t\t\r\n\t\tif(concepto){\r\n\t\t\tasignaRequeridos();\r\n\t\t\tmostrarElemento(\"invitados_table\");\r\n\t\t\tasignaVal(\"agregar_invitado\", \" A... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an element that is being used as a label, extract its label text. | function getLabelFromElement(element) {
// We use innerText here instead of textContent because we want the rendered
// text. If, e.g., a text node includes a span with `display: none`,
// textContent would include that hidden text, but innerText would leave it
// out -- which is what we want here.
if ("selec... | [
"getLabel() { return this.labelP.innerText; }",
"function CLC_Content_FindLabelText(target){\r\n var logicalLineage = CLC_GetLogicalLineage(target);\r\n var labelText = \"\";\r\n for (var i=0; i < logicalLineage.length; i++){\r\n if (logicalLineage[i].tagName && (logicalLineage[i].tagName.toLowerCase()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
build 'renderComponent' helper that should render given react class | function renderComponent(ComponentClass, props = {}, state = {}) {
//ComponentClass refers to component class build (ex. CommentBox extends Component)
//make instance of said class (below)
//renderIntoDocument requires DOM, need react-dom library.
const componentInstance = TestUtils.renderIntoDocument(
// pr... | [
"function getRenderFunction(ReactComponent, baseProps) {\n return testProps => new ShallowRenderer().render(<ReactComponent {...baseProps} {...testProps} />);\n}",
"function renderComponent(node, eventNode, key) {\n var children = [];\n for (var i = 0; i < node.children.length; i++) {\n children.pus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes used data into cookies | function WriteData() {
setCookie_e(COOKIE_NAMES.user, MyUser);
setCookie_e(COOKIE_NAMES.password, MyPass);
setCookie_e(COOKIE_NAMES.zoom, MyZoom);
setCookie_e(COOKIE_NAMES.lat, wlat);
setCookie_e(COOKIE_NAMES.lng, wlon);
setCookie_e(COOKIE_NAMES.id, myloginid);
setCookie_e(COOKIE_NAMES.tel, ... | [
"function writeCookie(name, value)\n{\n var expire = \"\";\n expire = new Date((new Date()).getTime() + 24 * 365 * 3600000);\n expire = \"; expires=\" + expire.toGMTString();\n document.cookie = name + \"=\" + escape(value) + expire;\n}",
"function writeCookie(name, value, hours) {\r\n\tvar expire = \"\";... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
broadcast incoming event to components | emit(event, args){
if(this.listeners.has(event)){
Logger.info(`Broadcasting: #${event}, Data:`, args);
this.listeners.get(event).forEach((listener) => {
listener.callback.call(listener.component, args);
});
}
if(event !== 'ping' && event !... | [
"broadcast(...args) {\n if (!this.gameObject) {\n console.warn(\"No game object of this component!\")\n }\n\n this.gameObject.broadcast(this, ...args);\n }",
"bindEvents() {\n PubSub.subscribe(\"Location:location-data-loaded\", event => {\n const allLocations = event.det... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A wrapper for this.pyWorker.postMessage(). Unlike that function, which returns void immediately, this function returns a promise, which resolves when a ReplyMessage is received from the worker. | async postMessageAsync(msg) {
return new Promise((onSuccess) => {
const channel = new MessageChannel();
channel.port1.onmessage = (e) => {
channel.port1.close();
const msg2 = e.data;
onSuccess(msg2);
};
this.pyWorker.postMessage(msg, [channel.port2]);
});
} | [
"async runPyAsync(code, {\n returnResult = \"none\",\n printResult = false\n } = {\n returnResult: \"none\",\n printResult: false\n }) {\n const response = await this.postMessageAsync({\n type: \"runPythonAsync\",\n code,\n returnResult,\n printResult\n });\n if (response.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_generateRoute generates the new route object | _generateRoute( answers ) {
// monta a rota
let obj = {
route : `/${answers.path}`,
controller : `${answers.controller}Controller`,
function : `${answers.method}`,
method : answers.action,
is_public : ( answers.... | [
"_writeRoute( route ) {\n\n // transforma o json em string\n let route_str = ', '+JSON.stringify( route );\n\n // get the routes file\n const path = this.destinationPath(`src/config/routes.ts`);\n fs.readFile( path, 'utf8', ( err, data ) => {\n \n // check fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parseIssueSecurity Securities retain a summary of their transactions as attributes on the security object iself. Therefore, any transactions affecting this summary must be parsed to incorporate such relevant data in the summary. | function parseIssueSecurity(tran) {
var security = nullSecurity();
security.new_name = security.name = tran.attrs.security;
security.effective_date = tran.effective_date;
security.insertion_date = tran.insertion_date;
security.transactions.push(tran);
security.attrs = tra... | [
"function parse_summary() {\n\n var desc_elms = $('iframe#bookDesc_iframe').contents();\n var desc_text_elms = $(desc_elms).find('div#iframeContent').contents();\n var desc_text = $(desc_text_elms).map(function(i, e) {\n if (this.nodeType === 3) { return $(this).text(); }\n else { return $(this).prop('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the slide is ready, or we don't care, fire immediately, else wait for the slideContentReady event | function fireWhenReady(callback) {
if (!displayOnEvent || slideIsReady) {
callback();
} else {
slideReadyCallbacks.push(callback);
}
} | [
"function checkReadyState() {\n\t\t\t\tif (doc.readyState == 'complete') {\n\t\t\t\t\t// Clean-up\n\t\t\t\t\tdoc.detachEvent('onreadystatechange', checkReadyState);\n\t\t\t\t\twin.clearInterval(explorerTimer);\n\t\t\t\t\twin.clearInterval(readyStateTimer);\n\n\t\t\t\t\t// Process function stack\n\t\t\t\t\tprocess()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks all inputs of attendee hour form Enables submit button when all inputs are valid | function checkAttendeeHourForm() {
var canSubmit = true;
// Check for Attendee selected
var aId = $('#attendeeId').val();
if (aId === '')
canSubmit = false;
// Check for PD Hours
var pdHours = $('#PDHours').val();
if (pdHours === '')
canSubmit = false;
else {
pd... | [
"function checkAttendeeForm() {\n var canSubmit = true;\n\n // Check first name\n if ($('#firstName').val() === '')\n canSubmit = false;\n\n // Check last name\n if ($('#lastName').val() === '')\n canSubmit = false;\n\n // Check agency id\n if ($('#attendeeAgencyId').val() === '')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the parent of a node at a specific path. | parent(root, path) {
var parentPath = Path.parent(path);
var p = Node.get(root, parentPath);
if (Text.isText(p)) {
throw new Error("Cannot get the parent of path [".concat(path, "] because it does not exist in the root."));
}
return p;
} | [
"parent(root, path) {\n var parentPath = Path.parent(path);\n var p = Node$1.get(root, parentPath);\n\n if (Text.isText(p)) {\n throw new Error(\"Cannot get the parent of path [\".concat(path, \"] because it does not exist in the root.\"));\n }\n\n return p;\n }",
"get parent() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In case start or end date for the booking is missing focus on that input, otherwise continue with the default handleSubmit function. | handleFormSubmit(e) {
const { startDate, endDate, hourStart, hourEnd, numberPerson } = e || {};
if (!startDate) {
this.setState({ focusedInput: START_DATE });
return false;
} else if (!endDate) {
this.setState({ focusedInput: END_DATE });
return false;
} else if (... | [
"function parseInputs(e) {\r\n e.preventDefault();\r\n let startDate = document.querySelector(\"#startDate\");\r\n let endDate = document.querySelector(\"#endDate\");\r\n startDate = new Date(startDate.value).getTime();\r\n endDate = new Date(endDate.value).getTime();\r\n\r\n if (!startDate || ! e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store/Delete the login and the server IP. If isSaving is true then the data are saved otherwise it is removed. | async setInfo(isSaving){
try {
if(isSaving){
await AsyncStorage.setItem('ip', this.state.ip);
await AsyncStorage.setItem('login', this.state.login);
} else {
await AsyncStorage.removeItem('ip');
await AsyncStorage.removeItem('login');
}
} catch (err... | [
"save() {\n var string = JSON.stringify(this[PINGA_SESSION_STATE]);\n\n localStorage.setItem(this.userId, string);\n }",
"function save_options() {\n\t\n\tchrome.extension.getBackgroundPage().userSettings.ip = document.getElementById('ip').value; \n\tchrome.extension.getBackgroundPage().userSetti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the input of the first letter of the previous word in the clues list | function getPrevWord($current) {
var length = $('.crossword-clues li').length;
var index = $('.crossword-clues li').index($('.crossword-clues li.active'));
var prevWord;
if (index > 0) {
$prevWord = $('.crossword-clues li').eq(index-1);
} else {
$prevWord = $('.crossword-clues li').e... | [
"getIndexOfFirstWord() {\n let indexFirstWord = -1;\n\n this.recordingData.forEach((word, index) => {\n if (word[1] == -1) {\n indexFirstWord = index;\n return;\n }\n });\n\n return indexFirstWord;\n }",
"function findFirstLetter(word){\n\treturn word[0].toUpperCase();\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CHECK OPEN DOCUMENT Called from importSibyl Returns true if there's at least 1 document already open (see var msg just below) | function checkOpenDocument() {
var od = true;
if (app.documents.length > 0) {
var docA = app.activeDocument;
} else {
var msg = "Annoyingly, Illustrator won't set the colour space of an SVG ";
msg += "to CMYK unless there's already a file open! I'm going to open a new document, ";
msg += "but you'll h... | [
"function isDocumentNew(doc){\n\t// assumes doc is the activeDocument\n\tcTID = function(s) { return app.charIDToTypeID(s); }\n\tvar ref = new ActionReference();\n\tref.putEnumerated( cTID(\"Dcmn\"),\n\tcTID(\"Ordn\"),\n\tcTID(\"Trgt\") ); //activeDoc\n\tvar desc = executeActionGet(ref);\n\tvar rc = true;\n\t\tif (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Issue key pair Note: includes private, public and public_ssh (used to add to authorized_keys) keys. | function issueKeyPair(accessPointId) {
const keys = keypair(),
publicKey = forge.pki.publicKeyFromPem(keys.public)
keys.public_ssh = forge.ssh.publicKeyToOpenSSH(publicKey, accessPointId)
return keys;
} | [
"function generateKeypair(cmd) {\n\tlet keypair_path = cmd.output;\n\n\tif (keypair_path == null) {\n\t\tlet cfg_dir = configdir(\"webhookify\");\n\t\tif (!fs.existsSync(cfg_dir)) {\n\t\t\tmkdirp.sync(cfg_dir);\n\t\t}\n\t\tkeypair_path = path.join(cfg_dir, \"key.pem\");\n\t}\n\n\tif (fs.existsSync(keypair_path)) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if the NetSuite record type is flagged 'Export to OpenAir' | function isRecordMarkedExportToOpenAir (recordType)
{
var exportToOpenAirCF = getrecordTypeConfigOption(recordType,'export_oa_field');
if (exportToOpenAirCF === 'ALWAYS')
{
return 'T';
}
else if (exportToOpenAirCF === 'CUSTOM')
{
if (recordType === 'salesorder')
{
return isSalesOrderExportable();
... | [
"function isRecordTypeExportAble (recordType)\n{\n\t\n\tvar ssoTypesAndCustomFields = ssoRecordTypeMap(recordType); \n\tif (typeof ssoTypesAndCustomFields === 'object') \n\t{\n\t\treturn ssoTypesAndCustomFields.hasOwnProperty('export_oa_field');\t\t\n\t}\n\telse \n\t{\n\t\treturn false; \n\t}\n\n}",
"function isR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the time of the playback gong The Gong applet Return the time | function gongGetTime(gong) {
if (gong == null || !gong.isActive()) return "Gong Applet is not ready.";
if (useXML) {
var request = "<GetMediaTimeRequest xmlns=\"" + GASI_NAMESPACE_URI + "\">";
request += "<MediaType>audio</MediaType>";
request += "</GetMediaTimeRequest>";
if (go... | [
"function getVideoTime() {\n return player.getCurrentTime();\n}",
"function gongSetTime(gong, time) {\n if (gong == null || !gong.isActive()) return \"Gong Applet is not ready.\";\n\n if (useXML) {\n var request = \"<SetMediaTimeRequest xmlns=\\\"\" + GASI_NAMESPACE_URI + \"\\\">\";\n request... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the active connection. | function getConnection() {
return globalConnection;
} | [
"function getConnection() {\n return pool.getConnection().disposer(function(connection) {\n pool.releaseConnection(connection);\n });\n}",
"function isActive() {\n return socket && socket.readyState == WebSocket.OPEN;\n }",
"async function getConnection() {\n const url = DEV_NET;\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a function for updating a fields's frame with animation | function mmrpg_canvas_field_frame(thisField, newFrame){
// Generate a new frame if one was not provided
if (newFrame == ''){
// Collect a reference to the current field data
var thisFieldFrame = thisField.attr('data-frame');
var thisAnimateFrame = thisField.attr('data-animate').split(','... | [
"function animate() {\n requestAnimationFrame(animate);\n // Insert animation frame to update here.\n }",
"animate () {\n if (this.multiStep) this.animateSteps()\n this.animateDraws()\n }",
"function update()\r\n{\r\n rebind.update()\r\n requestAnimationFrame(update)\r\n}",
"fiel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert the SayHello string to lowercase and return it | function ConvertHello(value) {
//control and return statements
helloPrompt = value.toLowerCase();
console.log("I converted " + helloPrompt);
return;
} | [
"function lower(text) {\n return text.toLowerCase();\n }",
"function logWhisper(string) {\n console.log(string.toLowerCase());\n}",
"function lowercase(value) {\n return String(value).toLowerCase();\n}",
"function upper_lower(str) {\n if (str.length < 3) {\n return str.toUpperCase(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the feature selection state | resetFeatureSelection (sources = null) {
FeatureSelection.reset(sources);
} | [
"reset() {\r\n\t\tthis.changeState(this.initial);\r\n\t}",
"function clearSelectedStates() {\n _scope.ugCustomSelect.selectedCells = [];\n }",
"function resetSelectedRegion() {\n selectedRegion = undefined\n }",
"function unselectFeature() {\n if (hig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fires a custom event "clicksvg" when the use clicks anywhere on the canvas, except nodes. | function onSvgClick() {
if (d3.event.defaultPrevented) return;
let event = new CustomEvent('click-svg', {});
container.dispatchEvent(event);
} | [
"function mouseclicks()\n{\n //mouse makes yellow dot\n fill(255,255,0);\n circle(mousex, mousey, d);\n \n}",
"function clickOnPoint() {\n var x = 58,\n y = 275;\n _DygraphOps[\"default\"].dispatchMouseDown_Point(g, x, y);\n _DygraphOps[\"default\"].dispatchMouseMove_Point(g, x,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. Declare a function named ageChecker. 2. Function accepts parameter named age, whose value as an argument will be number. 3. When call function, return if the age is between 1319 it should return "You are a teenager!". If the age is 12 or below, it should return "You are a kid". If the age is above 19, it should retu... | function ageChecker(age){
if (age >= 13 && age <= 19) {
return "You are a teenager!";
} else if (age < 13) {
return "You are a kid";
} else {
return "You are a grownup";
}
} | [
"function basicTeenager(age)\n {if (age >= 13 && age <= 19){\n return \"You are a teenager!\";\n }\n }",
"function votingAge(age) {\n if (age > 18) {\n return true;\n }\n\n return false;\n}",
"function switchAge(age){\n switch (age) {\n case 13:\n case 14:\n case 15:\n case 16:\n ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
zooms into unmatched profile | function zoomIntoUnmatchedProfile () {
zoomIntoProfile();
appendZoomedChoiceBar();
} | [
"function zoom() {\n airbnbNodeMap.zoom();\n mapLineGraph.wrangleData_borough();\n}",
"function zoomIn(image) {\n zoomedIn = true;\n createAndAddOverlay();\n fillZoom(image);\n}",
"calculatePinchZoom() {\n let distance_1 = Math.sqrt(Math.pow(this.finger_1.start.x - this.finger_2.start.x, 2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies transformation rules until no changes occur or the resource limits are exceeded. | transform() {
var iter = 0;
while(true) {
var result = this.rulesApply();
if(!result)
break
if(this._text.length >= this._maxTokens || this._maxIterations <= ++iter)
break;
}
} | [
"function throttleEnforceEffect_(self, units, duration, costFn, burst = 0) {\n const loop = (tokens, timestamp) => CH.readWith(in_ => CH.unwrap(T.map_(T.zip_(costFn(in_), CL.currentTime), ({\n tuple: [weight, current]\n }) => {\n const elapsed = current - timestamp;\n const cycles = elapsed / duration;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the Tile at this SnakePart. | get tile()
{
return tileMap[this.y / tileSize][this.x / tileSize];
} | [
"get tileOffset() {}",
"getTile(x, y) {\n if (x < 0 || x >= this.gridSize.x || y < 0 || y >= this.gridSize.y) {\n return null;\n }\n return this.tiles[y][x];\n }",
"tilePos(){\n\t\treturn snapPoint(this.pos);\n\t}",
"function pickSpawnTile() {\n var tilePicked = false;\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check local storage for word replacements | function get_replacements()
{
var replacement_json = localStorage['word_replacements'];
if (replacement_json == undefined)
{
replacement_json = JSON.stringify({});
}
return JSON.parse(replacement_json);
} | [
"function processWord(url) {\n var word = getWordFromURL(url);\n if (word) {\n addToLocalStorage(word);\n updateStatus(\"word is \" + word);\n } else {\n updateStatus(\"No word detected\");\n }\n}",
"function checkSavedSearches() {\n var checkStorage = JSON.parse(localStorage.getItem(\"saved\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trigger when the stream fail to display | function FailToDisplay(err) {
console.log("Failed to get the stream display", err);
} | [
"function FailToPulish(err){\n console.log(\"Publish local stream error: \" + err);\n }",
"function onStreamError(err) {\n console.error('Log error:', err);\n process.exit(1);\n }",
"function onFailSensor(error){\n\t\tconsole.log(\"Fail : \" + error);\n\t}",
"onError(err) {\n\t\t\tconsole... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a record before `before` or append at the end of the list when `before` is null. Notes: This method appends at `this._appendAfter`, This method updates `this._appendAfter`, The return value is the new value for the insertion pointer. | _insertBeforeOrAppend(before, record) {
if (before) {
const prev = before._prev;
record._next = before;
record._prev = prev;
before._prev = record;
if (prev) {
prev._next = record;
}
if (before === this._mapHead)... | [
"function insertBefore(newNode, referenceNode){\n referenceNode.parentNode.insertBefore(newNode, referenceNode);\n}",
"prependDataBeforeVal(val, data){\n var node = new DLLNode(data);\n var runner = this.head;\n while(runner){\n if(runner.data === val){\n node.nex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
XXX currently all features are limited to "server = local folders" only | function getLocalFolders() {
var server = getLocalFoldersServer();
var folder = server.rootFolder;
return folder;
} | [
"function jsDAV_Directory() {}",
"function jsDAV_ServerPlugin() {}",
"function get_files_from_server(){\n //link with file containning the files and folders distribution\n fetch(\"https://raw.githubusercontent.com/Eduardo-Filipe-Ferreira/ADS-Files-Repository/main/FilesLocation.json\")\n .then(response => r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TEHRAN_EQUINOX_JD Calculate Julian day during which the March equinox, reckoned from the Tehran meridian, occurred for a given Gregorian year. | function tehran_equinox_jd(year) {
return floor(tehran_equinox(year));
} | [
"function persian_to_jd(year, month, day) {\n let epbase, epyear\n\n epbase = year - (year >= 0 ? 474 : 473)\n epyear = 474 + mod(epbase, 2820)\n\n return (\n day +\n (month <= 7 ? (month - 1) * 31 : (month - 1) * 30 + 6) +\n Math.floor((epyear * 682 - 110) / 2816) +\n (epyear - 1) * 365 +\n Math... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
project infections given the number of days | function infectionsByRequestedTimeCalc(
currentlyInfected,
noOfDays,
population
) {
const factor = Math.trunc(noOfDays / 3);
// const infectionsByRequestedTime = Math.min(
// currentlyInfected * (2 ** factor),
// population
// );
console.log(population);
const infectionsByRequestedTime = current... | [
"repeatCount(startGoal, endGoal) {\n var rule = 'FREQ=DAILY;COUNT=';\n var startday = startGoal.slice(3, 5);\n var endday = endGoal.slice(3, 5);\n var days = parseInt(endday, 10) - parseInt(startday, 10) + 1 ;\n rule = rule + days.toString();\n console.log(\"math\", startda... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add `editable` property to a thread item | function addEditable (userId, thread) {
thread.editable = userId === thread._author.toString();
return thread;
} | [
"function setEditableStatus() {\n var $cells = $(\"#notebook-container\").children();\n for (var cellIndex = 0; cellIndex < Jupyter.notebook.get_cells().length; cellIndex++) {\n if (cellShouldBeUneditable(cellIndex)) {\n Jupyter.notebook.get_cell(cellIndex).metadata[\"editable\"] = false;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The following convenience methods manipulate DOM objects. We use the javascript object 'visible' to keep track of which groups of objects are supposed to be visible and which are not. The properties of this object are matched up with CSS classes whose names start with 'vis_' or 'inv_'. If an object has CSS classes 'vis... | function hideByClass ( classname )
{
// We start by setting the specified property of visible to false.
visible[classname] = 0;
// All objects with class 'vis_' + classname must now be hidden, regardless of any other
// classes they may also have.
var list = document.getElementsByClassName('vis_' + class... | [
"function HiddenElements() {\n this.list = [];\n this.count = 0;\n this.hideDisplay = 0;\n this.hideVisibility = 0;\n this.hidePosition = 0;\n this.hideOpacity = 0;\n this.hideOverflow = 0;\n this.hideFontSize = 0;\n this.hideTextIndent = 0;\n th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles the bookmark adding or removing it from local storage. | toggleBookmark() {
this.$log.debug('toggle bookark');
//hide side navigation
this.sideNavService.hide();
const bookmarks = this.localStorageService.get(settings.LOCAL_STORAGE_KEY.BOOKMARKS) || {};
if(this.isBookmarked){
delete bookmarks[this.reviewId];
} else {
bookmarks[this.reviewId]... | [
"function BookmarkInit(urlValue, ImageUrl, selectedImageUrl) {\n\n // Check to see if bookmark exists, and create an local var with the information (or fresh)\n if (localStorage.getItem(\"bookmarks\") === null) {\n var bookmarks = [];\n } else {\n var bookmarks = JSON.parse(localStorage.getIt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
destroy the box, including it's tip object. | function destroyBox(target){
var tip = $.data(target, 'validatebox').tip;
if (tip){
tip.remove();
}
$(target).remove();
} | [
"function deleteBox() {\r\n\r\n var sO = CurStepObj;\r\n var len = sO.boxExprs.length;\r\n var pos = sO.focusBoxId; // delete pos\r\n\r\n // Remove box expression and attributes\r\n //\r\n sO.boxExprs.splice(pos, 1);\r\n sO.boxAttribs.splice(pos, 1);\r\n\r\n // change the input bo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert byte to hex | function toHex(byte) {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
} | [
"function bigInt2hex(i){ return i.toString(16); }",
"function Hex(n) {\n n=Math.round(n);\n if (n < 0) {\n n = 0xFFFFFFFF + n + 1;\n }\n return n.toString(16).toUpperCase();\n}",
"function intToHex(integer){if(integer<0){throw new Error('Invalid integer as argument, must be unsigned!');}var h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makes sure the number in threeOpt are unique | function isUnique() {
if (threeOpt[0] !== threeOpt[1] && threeOpt[1] !== threeOpt[2] && threeOpt[2] !== threeOpt[0]) {
return true;
} else {
return false;
}
} | [
"function getRandomOption() {\n for (var i = 0; i < 3; i++) {\n threeOpt.push(Math.floor(Math.random() * optionName.length))\n };\n // return console.log('You generated 3 random options', threeOpt);\n}",
"function generateThreeCorrectSlotsOfThree() {\r\n currentBlock = blockValues[i];\r\n firstCorrect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make Orders For Customer | function makeOrdersForCustomer(customer){
var orderCount = 1 + next(); // 1..10
var orderDates = getOrderDates(orderCount);
return orderDates.map(
function (orderDate) {return makeOrder(customer, orderDate);}
);
} | [
"function Order(custName,carModel,carPrice,carImage){\n this.custName = custName;\n this.carModel = carModel;\n this.carPrice = carPrice;\n this.carImage = carImage;\n all_orders.push(this);\n}",
"function Customer(name, address) {\n this.name = name;\n this.address = address;\n}",
"fetchOrders... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to create string of serialized data for form submission. Serializes form using only specific selectors. | function serializeSpecific(selector) {
var obj = "";
$(form).find(selector).each(function () {
obj += "&";
obj += $(this).attr("name");
obj += "=";
obj += $(this).val();
});
return obj;
} | [
"function buildForm(selector, data, arrRemove) {\n // remove submit button\n $('.svm-form-submit').remove();\n\n // remove successive elements\n $('form ' + selector).parent().nextAll().remove();\n $('form ' + selector).parent().parent().nextAll().remove();\n\n // remove duplicate html\n if (ty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fonction pour afficher l'alphabet en minuscule | function alphabet_az() {
var sequence = '';
// Ne rien modifier au dessus de ce commentaire
// Ne rien modifier au dessous de ce commentaire
return sequence;
} | [
"function hoofdletters(tekst) {\n return tekst.toUpperCase(); // dit is alles\n}",
"shifter(str) {\n\t\tlet newString = '';\n\t\tfor (const char of str) {\n\t\t\tnewString += /[a-z]/.test(char) ? String.fromCharCode(((char.charCodeAt(0) - 18) % 26) + 97) : char;\n\t\t}\n\t\treturn newString;\n\t}",
"function g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to append a number to the result | function appendNumber(number) {
appendNumberOrOperator(number);
} | [
"function appendNumberOrOperator(value) {\n resultInput.value += value;\n}",
"function addPrefixZero(num){\n if(num<10){\n return \"0\"+num;\n }\n return num;\n}",
"function addsNum(n) {\n\treturn (m) => m + n;\n}",
"function appendNum() {\n var para = document.createElement(\"p\");\n var c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Genera el calculo del total de la comprobacion | function calcularTotalComprobacion(){
var totalComprobacion = 0;
var eur = $("#valorDivisaEUR").val();
var usd = $("#valorDivisaUSD").val();
var tablaLength = obtenTablaLength("comprobacion_table");
for(var i = 1; i <= tablaLength; i++){
var divisa = parseInt($("#row_divisa"+i).val());
... | [
"get totals(){\n let mr=this.mass_ratios;//alias for code reduction\n let co=this.components; //alias for code reduction\n\n //COD fractions (Chemical Oxygen Demand)\n let bsCOD = co.S_VFA + co.S_FBSO; //bio + soluble COD\n let usCOD = co.S_USO; //unbio + soluble COD\n let bpCO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Trigger events for observed THREE objects | __handleObjectsEvents(evt) {
if (!isEmpty(this.state.objectsObservers) && hasParent(evt.target, this.viewer.container)) {
const viewerPos = getPosition(this.viewer.container);
const viewerPoint = {
x: evt.clientX - viewerPos.x,
y: evt.clientY - viewerPos.y
};
co... | [
"function addEvents(object)\n\t{\n\t\tvar theObject = object.obj;\n\t\t\n\t\ttheObject.addEventListener('cursorup', function(event) \n\t\t{\n\t\t\tif (editMode)\n\t\t\t{\t\t\n\t\t\t\tif (!isUserCurrentlyEditing)\n\t\t\t\t{\n\t\t\t\t\tif (!object.settings.currentlyBeingEdited && !object.settings.locked)\n\t\t\t\t\t{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the puzzle can be solved. Examples: isSolvable([3, 7, 6, 0, 5, 1, 2, 4, 8], 3, 3) // => false isSolvable([6, 4, 5, 0, 1, 2, 3, 7, 8], 3, 3) // => true | function isSolvable (puzzleArray, rows, cols) {
let product = 1
for (let i = 1, l = rows * cols - 1; i <= l; i++) {
for (let j = i + 1, m = l + 1; j <= m; j++) {
product *= (puzzleArray[i - 1] - puzzleArray[j - 1]) / (i - j)
}
}
return Math.round(product) === 1
} | [
"function checkSolution() {\r\n if (tileMap.empty.position !== 3) {\r\n return false;\r\n }\r\n\r\n for (var key in tileMap) {\r\n if (key == 1 || key == 9) {\r\n continue;\r\n }\r\n\r\n var prevKey = key == 4 ? 'empty' : key == 'empty'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a note and an interval, returns the interval note. note: (string) the string representation of the base note interval: (int) the interval distance return: (string) the string representation of the interval note. example: ('C4', 5) => G4 | function getIntervalNote(note, interval) {
var relative = getNote(note);
var octave = getOctave(note);
relative += interval - 1;
while (relative >= 8) {
relative -= 7;
octave += 1;
}
return toNote(relative, octave);
} | [
"function getSemitoneInterval(note1, note2) {\n\t// TOOD: better algo, this one feels kinda dumb\n\tvar note1semis = chordData.semitones[note1];\n\tvar note2semis = chordData.semitones[note2];\t\n\n\tif (note2semis < note1semis) {\n\t\tnote2semis += 12;\n\t}\n\n\treturn note2semis - note1semis;\n}",
"function get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to jump to a URL in a menu. In this case, the name of the array containing the URLs is determined based on the name of the pulldown menu. | function jumpToURL(formName,menuName) {
var obj = eval("document." + formName + "." + menuName);
var index = obj.selectedIndex;
var url = eval(menuName + "_URLs[" + index + "]");
if (url != "") {
location.href=url;
}
} | [
"function gotoTab() {\n let url_string = window.location.href;\n let url = new URL(url_string);\n let tab = url.searchParams.get(\"open\");\n // console.log('url', tab);\n if (tab) {\n // console.log('has tab');\n let idName = '#' + tab;\n let idTabName = idName + 'Tab';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will load the given component into the pageDiv's frame, then invoke the callback with resulting locus (provided by pageNumberAt). If the resulting page number is outside the bounds of the new component, (ie, pageNumberAt again requests a load), this will recurse into further components until nonloading locus is returne... | function loadPageAt(pageDiv, locus, onLoad, onFail) {
var cIndex = p.componentIds.indexOf(locus.componentId);
if (!locus.load || cIndex < 0) {
locus = pageNumberAt(pageDiv, locus);
}
if (!locus) {
return onFail ? onFail() : null;
}
if (!locus.load) {
return onLoad(locus);
... | [
"function goToPage(pageNr){\r\n\r\n}",
"function getPageNum(component) {\n let page = component.state.results.length / 20 + 1;\n if (Number.isInteger(page)) {\n return page;\n } else {\n return null;\n }\n }",
"function setCurPageToZero() {\n document.getElementById('page-l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
M18 T1: find enemies return either direction of targets or list of targets | function find_enemies(current_room, range, directions, type) {
//var distance = 0;
var enemy_list = [];
var direction = undefined;
// recursively find targets in same direction
function direction_helper(room, dir, distance) {
if (distance > range) {
display("max range " + room.ge... | [
"function find_viable_targets() {\n var monsters = Object.values(parent.entities).filter(\n mob => (mob.target == null\n || parent.party_list.includes(mob.target)\n || mob.target == character.name)\n && (mob.type == \"monster\"\n && (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate precision score for an individual user | function calculatePrecision(user, recommendations) {
const visitedPlaces = getVisitedPlaces(user);
let matches = 0;
recommendations.forEach(recommendation => {
if (visitedPlaces.indexOf(recommendation) > -1) {
matches++;
}
});
return matches/5;
} | [
"function fScore (precisie, recall) {\n return 2 * ((precisie * recall) / (precisie + recall))\n}",
"function getPromedio (scores) {\n return scores.reduce((acum, next) => {\n return acum + next.score / scores.length\n },0)\n}",
"function calculateScore() {\n for (var i = 0; i < quizLength; i++){\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Installs a test engine into the test profile. | function installTestEngine() {
removeMetadata();
removeCacheFile();
do_check_false(Services.search.isInitialized);
let engineDummyFile = gProfD.clone();
engineDummyFile.append("searchplugins");
engineDummyFile.append("test-search-engine.xml");
let engineDir = engineDummyFile.parent;
engineDir.create(C... | [
"async installProject() {\n // git clone\n await this.gitClone();\n\n // run hook\n await this.install();\n }",
"function addTest(name, exec) {\n tests.push({\n name: name,\n exec: exec\n });\n}",
"InstallMultipleComponents() {\n\n }",
"static install() {\n EmeEncryption... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when you start dragging a dish. Sets the data that should be transferred. | function drag(ev, dishID, dayID, mealID) {
// always send dish id
ev.dataTransfer.setData('dishID', dishID);
// if coming from a specific meal, we set that as well, so it can be
// trashed.
if (dayID != null && mealID != null) {
ev.dataTransfer.setData('dayID', dayID);
ev.dataTransfe... | [
"function DataTransfer() {\r\n this._dropEffect = 'move';\r\n this._effectAllowed = 'all';\r\n this._data = {};\r\n }",
"function dragStart() {\n colorBeingDragged = this.style.backgroundImage; // Will pick the color that is being dragged\n squareIdBeingDragged = parseInt(this.id); /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for a valid token address on the location path | checkForValidTokenPath(validTokens) {
const pathName = window.location.pathname.replace('/', '');
if (!pathName) {
return;
}
if (validTokens.includes(pathName)) {
this.getTokenDetails(pathName, this.state.lookupDate);
}
else {
window.history.pushState({}, null, '/');
th... | [
"function validateToken(req, res) {\r\n var token = getToken(req);\r\n var user = users.getUserByToken(token);\r\n var isValidToken = user != undefined && user != '';\r\n console.log('[validToken] req=' + req.url);\r\n console.log('[validToken] Is Valid Token=%s User=%s', isValidToken, user);\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a function that takes two dates and returns the number of days between the first and second date. | function getDays(date1, date2) {
console.log(date1)
return date1 - date2
} | [
"function diffInDays(a, b) {\r\n const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());\r\n const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());\r\n\r\n return Math.floor((utc2 - utc1) / _MS_PER_DAY);\r\n}",
"function calculate_days_left(start_date, end_date){\n const seconds_left ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
USER CONSENT check if user agreed to cookies | function userHasConsented() {
return typeof Cookies.get("cookieConsent") !== "undefined";
} | [
"isNewUserCheck() {\n let userCookie = this.helper.getCookieInfo('userName');\n\n // If cookie exists, it means that user visited site earlier.\n if (userCookie.cookieExists) {\n this.userCookie = userCookie.value;\n }\n\n return !userCookie.cookieExists;\n }",
"function MM_FlashUserDemurred(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an and gate. | function andGate () {
return {
id: nextId(),
type: 'and',
inputs: [pin(), pin()],
outputs: Object.seal([pin()])
}
} | [
"getAndNode() {\n return new AndNode();\n }",
"addAndThenExpression() {\n const thenExpression = AndThenExpression.new({\n leftExpression: this.assertionExpression,\n rightExpression: null,\n })\n\n this.assertionExpression = thenExpression\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start a new mode with a `lexeme` to process. | function startNewMode(mode, lexeme) {
var node
if (mode.className) {
node = build(mode.className, [])
}
if (mode.returnBegin) {
modeBuffer = ''
} else if (mode.excludeBegin) {
addText(lexeme, currentChildren)
modeBuffer = ''
} else {
modeBuffer = lexeme
}
... | [
"function pushlex(type, info) {\n var result = function(){\n lexical = new CSharpLexical(indented, column, type, null, lexical, info)\n };\n result.lex = true;\n return result;\n }",
"function startVoiceContext(id) {\n id = id || '';\n if (!id && context !== result) {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |