query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Gather some caller info 3 stack levels up. See < | function getCaller3Info() {
var obj = {};
var saveLimit = Error.stackTraceLimit;
var savePrepare = Error.prepareStackTrace;
Error.stackTraceLimit = 3;
Error.captureStackTrace(this, getCaller3Info);
Error.prepareStackTrace = function (_, stack) {
var caller = stack[2];
obj.file = ... | [
"function getStackFromCaller() {\n\t\t\treturn getStack(4,-1);\n\t\t}",
"function getCaller3Info() {\n\t if (this === undefined) {\n\t // Cannot access caller info in 'strict' mode.\n\t return;\n\t }\n\t var obj = {};\n\t var saveLimit = Error.stackTraceLimit;\n\t var savePrepare = Er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the default driver to use for the cluster node instance | setDriver(driver) {
this.driver = driver;
this.pool = neo4j.getSessionPool(this.id, this.driver, 15);
} | [
"defaultDriver () {\n return this._config.default\n }",
"_initializeDriver() {\n if(Neo4jWrapper.drivers.get(this.host)) {\n this.driver = Neo4jWrapper.drivers.get(this.host);\n } else {\n this.driver = neo4j.driver(this.host, neo4j.auth.basic(this.username, this.password));\n Neo4jWrappe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the current game instance is full. | isGameFull(){
return Object.keys(this.players).length >= this.maxPlayers;
} | [
"isFull() {\n if (this.ammoCount >= this.canvasWidth * 0.6) {\n return true;\n }\n return false;\n }",
"isFull() {\n return this.container.getAllGameObjects().some(obj => obj.gameObject.takesWholeSector);\n }",
"function _isFull() {\n\t\treturn this._particleCount == this.system.totalPa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input: an array of Needs:"prereq". output: an HTML string that list all prereq.. | function parsePrereq(prereq)
{
if (prereq.length == 0)
return "None";
return $.map(prereq, function(record, index)
{
return record.Needs.replace(/\[/g,"<span class='course_symbol fakeLink'>").replace(/\]/g,"</span>");
}).join("");
} | [
"function processPrereqs(prereqs) {\n if (prereqs == \"\") {\n\t\tprereqs = \"--\";\n\t}\n else {\n\t while (prereqs.search(/GIR:/) >= 0) {\n\t\t gir = prereqs.match(/GIR:.{4}/);\n\t\t prereqs = prereqs.replace(/GIR:.{4}/, girData[gir].join(\" or \"));\n\t }\n\t while (prereqs.search(/[\\]\\[]/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Increase stamina_points. Can not regenerate above maximum stamina | regenerateStamina(amountToRegenerate){
//Determine maximum
let maxToRegen = this.props.stats_current.stamina - this.props.stamina_points;
//If trying to regenerate more than maximum, only regen up to maximum
let appliedAmountToRegenerate = ((amountToRegenerate > maxToRegen) ? maxToRege... | [
"function updateStamina() {\n // increase player stamina\n playerStamina += width / 3000;\n // Constrain the result to a sensible range\n playerStamina = constrain(playerStamina, 0, playerMaxStamina);\n //if the players stamina level drops below 5, reduce\n //player's max speed to 2, return to 4 after stamina... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
force the color of all icons to dark | function adjustIconColorDocument() {
$('.oi-icon').each(function(e) {
if(!$(this).hasClass('colored')) {
$(this).css('fill', '#3E2F24');
$(this).addClass('colored');
}
});
} | [
"get invert_colors_off () {\n return new IconData(0xe0c4,{fontFamily:'MaterialIcons'})\n }",
"function changeCurrentColors(icon) {\n if(icon == \"clear-night\" || icon == \"partly-cloudy-night\") {\n return 'black';\n } else {\n return '#E3DB25';\n }\n }",
"get invert_colors ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a thing to ask for a command | function askForPrompt() {
prompt.start();
prompt.get({"properties":{"name":{"description":"Enter a command", "required": true}}}, function (err, result) {
commandFinder(result.name)
})
} | [
"function cli_ask (question) {\n var rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n });\n return new ishido.Promise(function (resolve, reject) {\n rl.question(question, function (answer) {\n rl.close();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bugzilla: 1656351 Polarion: assignee: nansari startsin: 5.10 casecomponent: Services initialEstimate: 1/6h testSteps: 1. Create a service catalog with type orchestration template (heat or Aws) 2. Navigate to order page of service 3. Order the above service from global region expectedResults: 1. 2. 3. From global region... | function test_service_catalog_orchestration_global_region() {} | [
"function test_service_chargeback_multiple_vms() {}",
"function tc_Coventry_maintenance_testing_review_period_boundaries_suggested_tab()\n{\n login('cl3@regression','INRstar_5','Shared');\n add_patient('SORB_Coventry', 'review_period_validation', 'M', 'Shared'); \n add_treatment_plan('W','Coventry','','Shared'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
store tweet in local localStorage | function saveTweetsOnStorage(tweets){
localStorage.setItem('tweets',JSON.stringify(tweets));
//showTweets();
} | [
"function tweetSave(tweet) {\n var tweets = getTweetsFromLocalStorage();\n\n //Add the tweet/s to the array(list)\n tweets.push(tweet);\n\n // Convert tweet array into string\n localStorage.setItem(\"tweets\", JSON.stringify(tweets));\n}",
"function addTweetsToLocalStorage(tweet) {\n let tweets = getTweet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `ConfluencePageConfigurationProperty` | function CfnDataSource_ConfluencePageConfigurationPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an obj... | [
"function CfnDataSource_ConfluenceConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save the changes from the modal and posted to the table in the global variable if not saved the global variable will keep the records prechanges in the modal | function confirm_changes(){
"use strict"
//current_data_set; // contains all the records
//record_changed_dict; // contains the records changed with the modal
} | [
"function ModalStatusSave() {\n //console.log(\"=== ModalStatusSave =========\");\n\n // put values in el_body\n let el_body = document.getElementById(\"id_mod_status_body\")\n //const tblName = get_attr_from_el(el_body, \"data-table\")\n const data_ppk = get_attr_from_el(el_body... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log data got from promiseFunction | function printDataPromise() {
promiseFunction().then(data => {
console.log(data);
});
} | [
"function printDataPromise() {\n let p = promiseFunction();\n p.then(function(beta){\n console.log(beta);\n });\n}",
"async function printDataAsyncAwait() {\n const data = await promiseFunction();\n console.log(data);\n}",
"async function printDataAsyncAwait() {\n let p = promiseFunction();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the token if valid, otherwise throws an error | function processTokenCallback(kc, token) {
if (kc.debug) {
console.info('[SSI.KEYCLOAK] Processing Token');
}
try {
setTokenIfValid(kc, token);
} catch (e) {
return kc.onAuthError(e);
}
return kc.onAuthSuccess();
} | [
"validateToken(token) {\n return true;\n }",
"ensureValidToken () {\n if (this.isValid()) {\n return\n }\n\n throw new Error(`Invalid JWT. Looks like the token is neither signed nor encrypted. Received token: ${this.value}`)\n }",
"async validateToken () {\n\t\tif (!this.request... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return an array of lines wrapping the given text to the given width. This splits on whitespace. Single tokens longer than `width` are not broken up. | function textwrap(s, width) {
var words = s.trim().split(/\s+/);
var lines = [];
var line = '';
words.forEach(function (w) {
var newLength = line.length + w.length;
if (line.length > 0)
newLength += 1;
if (newLength > width) {
lines.push(line);
... | [
"function breakParagraphToFitWidth(text, width, widthMeasure) {\n var lines = [];\n var tokens = tokenize(text);\n var curLine = \"\";\n var i = 0;\n var nextToken;\n while (nextToken || i < tokens.length) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set note element click handle by id | function setNoteClickHandle(id) {
try {
var noteElm = getNoteElementById(id);
if (!noteElm) {
window.TextSelection.jsError("setNoteClickHandle undefined");
return;
}
noteElm.addEventListener("click", function () {
var noteId = noteElm.getAttribut... | [
"function handleNoteClick (e) {\n \n}",
"function clickOnNote(){\n $(\".noteheader\").click(function () {\n if(!editMode){\n //update active note\n activeNote=$(this).attr(\"id\");\n //fill text area\n $(\"textarea\").val($(this).fin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funzione eseguita ad ogni frame se il giocatore risulta "shielded" Gestisce il contatore e, quando questo arriva a 0, rimuove tale stato tramite lowerShield() | function shieldFrame()
{
if(shieldCooldown > 0)
{
shieldCooldown--;
document.getElementById("shieldMessage").style.visibility = "visible";
document.getElementById("shieldCounter").firstChild.nodeValue = shieldCooldown;
return;
}
if(shieldCooldown == 0)
... | [
"function raise(){\n clearTimeout(shield.coolDown);\n shield.dropped = false;\n}",
"function collidesShield(){\r\nif (player.x < shield.x + shield.w &&\r\n\tplayer.x + player.w > shield.x &&\r\n\tplayer.y < shield.y + shield.h &&\r\n\tplayer.y + player.h > shield.y) {\r\n\tgetshield();\r\n\t}\r\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
finds a UIVeri5 spec definition by a given Jasmine suite description i.e. given the description of one of the suites in a spec file, find the information for that file. | function _getSpecDetails(suite){
return specs.filter(function (suiteDetails) {
return suiteDetails.fullName === suite.description;
})[0];
} | [
"function getSpecName() {\n let spec = _.last(specs);\n let suite = _.last(suites);\n if (spec) {\n return spec.fullName;\n } else if (suite) {\n return suite.description;\n }\n throw new Error('Not currently in a spec or a suite');\n}",
"static findSpecs (projectRoot, specPattern) {\n debug('findi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the element tree has been changed, we need to wire up any event handlers in order to intercept Hammer and DOM events. | onDidChangeElementTree()/*: void*/ {
if (this.elementTree) {
for (let evt of this.DOM_EVENTS.split(" ")) {
this[_elementTree].addEventListener(evt, (e)=>this.emit("DOMEvent", e), true);
}
//this[_hammer] = new Hammer(this[_elementTree], {domEvents: true});
... | [
"attach() {\r\n if (this.rootElement) {\r\n Object.keys(this.handlers).forEach(\r\n event => this.rootElement.addEventListener(event, this.handlers[event])\r\n );\r\n }\r\n }",
"registerDomEvents() {/*To be overridden in sub class as needed*/}",
"function tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ToggleConnection: Toggles between Quit Session and Connect | function ToggleConnection()
{
if(false == g_bConnected)
{
//
// Establish Connection
//
RCConnect();
g_bConnected = true;
//...ConnectionId.innerText = L_QUITSESSION;
}
else
{
//
// Disconnect
//
RCDisconnect();
g_bConnected = false;
//..ConnectionId.innerText = L_CONNECT;
}
return;
} | [
"function ToggleConnection()\n{\n\tTraceFunctEnter(\"ToggleConnection\");\n\tif(false == g_bConnected)\n\t{\n\t\t//\n\t\t// Establish Connection\n\t\t//\n\t\tRCConnect();\n\t\tg_bConnected = true;\n\t}\n\telse\n\t{\n\t\t//\n\t\t// Disconnect\n\t\t//\n\t\tRCDisconnect();\n\t\tg_bConnected = false;\n\t}\n\t\n\tTraceF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reorder component price input index. | function reorderRow() {
pricingWrapper.find('.pricing-item').each(function (index) {
// reorder index of inputs pricing
$(this).find('input[name],select[name]').each(function () {
const pattern = new RegExp("pricing[([0-9]*\\)?]", "i");
const attributeName = $(this).attr('name').replace(pattern, 'pricin... | [
"function inputReorder(id) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<input type='number' onChange={(e) => setReorderNumber(e.target.value)} value={reorderNumber} />\n\t\t\t\t<button onClick={() => reorderItem(id)}>Enter Index</button>\n\t\t\t</div>\n\t\t);\n\t}",
"resetReorder() {\n this.$element.removeData('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function assigns the chosen number to a square if correct, or removes a life if incorrect | function updateSquare() {
// If a square and a number are both selected
if (selectedSquare && selectedNumber) {
// Assign the chosen number to the chosen square
selectedSquare.textContent = selectedNumber.textContent;
// If the number matches the number in the solution key
if (checkIfCorrect(selecte... | [
"function setSquare(thisSquare) {\n var currSquare = \"square\" + thisSquare;\n var colPlace = new Array(0,0,0,0,0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4);\n var colBasis = colPlace[thisSquare] * 15;\n var newNum;\n do {\n newNum = colBasis + getNewNum() + 1;\n }\n while (usedNum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs the card.getImageSource() method for each card in the player's hand, then returns an array of these strings. | getHandImages(){
let handImageSources = [];
this.hand.forEach(element => handImageSources.push(element.getImageSource()));
return handImageSources;
} | [
"getCards(imgPath){\n const suitMap = {\n 0: 'S',\n 1: 'H',\n 2: 'C',\n 3: 'D'\n }\n let allImages = []\n for (let i = 0; i < this.hand.length; i++){\n if (this.hand[i] === 0){\n allImages.push('Purple.png')\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
refeshes container1 to display tweets. This is where the magic happens. clears container1, from last (newest) to first (oldest) posts html divs for each tweet takes an optional string argument to post tweets from that user only | function refresh(nn){
var $body = $('.container1'); //clears container1
$body.html('');
nn = nn || streams.home;
var index = nn.length - 1;
while(index >= 0){
var tweet = nn[index];
var $tweet = $('<div class="tweetDiv ' + tweet.user + '"></div>');
v... | [
"function renderTweets(tweets) {\n const tweetLog = $('.tweets-container');\n tweetLog.empty()\n //prepend to render ontop of old tweets....append would be for bottom\n for(let tweet in tweets) {\n tweetLog.prepend(createTweetElement(tweets[tweet]));\n }\n }",
"function renderTweets(tweets) {\n $(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from functions/threads/ThreadLocalSet.java =================================================================== Needed early: Builtin Needed late: ArcThreadLocal | function ThreadLocalSet() {
} | [
"function SetThreadLocal() {\r\n}",
"function NewThreadLocal() {\r\n}",
"function ThreadLocalGet() {\r\n}",
"enterDataThreadLocalClause(ctx) {\n\t}",
"function h$gc(t) {\n if(h$currentThread !== null) throw \"h$gc: GC can only be run when no thread is running\";\n ;\n var start = Date.now();\n h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback for when the user says the identity is wrong. | identityWrong() {
this.identityReset();
this.setState({ flow: LOGIN_FLOW.GotoRegister });
} | [
"function partyIDmissing(){\n $ionicPopup.alert({\n title: 'Error',\n template: 'Something went wrong, please try to \"Invite Yotme Users\" again'\n }).then(function(){\n $ionicHistory.goBack();\n });\n }",
"function _authError() {\n next('Invalid User I... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Signal start of an incomplete line. | onLineStart() { } | [
"function takeEmptyLine() {\n\t\tnewBlock = true\n\t}",
"extendToLineStart() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.end.moveToLineStartInternal(this, true);\n this.upDownSelectionLength = this.end.location.x;\n this.fireSelectionChanged(true);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update PLC html table and show it. | function updateTable() {
// Check if plcs finished loading
for (var i = 0; i < g_plcs.length; ++i) {
if (g_plcs[i].err) {
moduleStatus("Error querying table");
return false;
}
if (g_plcs[i].ready != READY_ALL) return false;
}
$("#detail-table-body").html("");
for (var i = 0; i < g_plcs.length; ++i) {... | [
"function updatePinConfigTableData() {\n\n println(\"Update Pin Configuration Data.\")\n\n var pinconfigtypes = getHTMLValue(\"pinconfigtypes\");\n\n if(pinconfigtypes != \"Please Select\") {\n\n let tableData = ''\n tableData += '<br><br><table class=\"table table-striped\">\\\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This static method is used exclusively to produce type signature objects for use by macro definitions in macrolib. Specifically, it lets us specify which clauses a macro expects its lambda to have. | TypeSignature(clauses) {
return { pattern: "lambda", innerType: Lambda, clauses };
} | [
"\"\"() {\n\t\t\tObject.keys(this).forEach((key) => {\n\t\t\t\tif (key) {\n\t\t\t\t\tlet fn = this[key][0];\n\t\t\t\t\tlet typeSignature = this[key][1];\n\t\t\t\t\t/*\n\t\t\t\t\t\tOf course, the mandatory first argument of all macro\n\t\t\t\t\t\tfunctions is section, so we have to convert the above\n\t\t\t\t\t\tto ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `ProvisionedThroughputProperty` | function CfnSimpleTable_ProvisionedThroughputPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.validateNumber)(properties.readCapacityUnits)... | [
"function CfnTable_ProvisionedThroughputPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the lookup items. Items must be an array which has a length property. The item must be an object with the following properties. Name Path AllowNavigation | function createLookupItems(items) {
var TMPL_UL = '<ul class="ds-nav-lu-results-ul">';
var TMPL_BACK_ITEM = '<li class="ds-nav-lu-results-li"> <strong class="ds-nav-lu-results-li-item"><a href="#" class="ds-nav-lu-results-li-item-back"> <i class="fa fa-level-up"></i> </a></strong></li>';
... | [
"setupItems() {\n\t\tthis.items = {};\n\t\tObject.keys(ITEMS.default).forEach((item) => {\n\t\t\tthis.items[item] = new Item(ITEMS.default[item]);\n\t\t});\n\t}",
"function createSelectDataLookupObj(items) {\n\n var lookupObj = {};\n\n for (var i = items.length; i--;) {\n var type = items[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Match tags in token stream starting at `i` with `pattern`. `pattern` may consist of strings (equality), an array of strings (one of) or null (wildcard). Returns the index of the match or 1 if no match. | indexOfTag(i, ...pattern) {
var fuzz, j, k, ref, ref1;
fuzz = 0;
for (j = k = 0, ref = pattern.length; (0 <= ref ? k < ref : k > ref); j = 0 <= ref ? ++k : --k) {
if (pattern[j] == null) {
continue;
}
if (typeof pattern[j] === 'string') {
pattern[j] = [pattern[j]];... | [
"indexOfTag(i, ...pattern) {\n var fuzz, j, k, ref, ref1;\n fuzz = 0;\n for (j = k = 0, ref = pattern.length; (0 <= ref ? k < ref : k > ref); j = 0 <= ref ? ++k : --k) {\n if (pattern[j] == null) {\n continue;\n }\n if (typeof pattern[j] === 'string') {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The LookupSupportedLocales abstract operation returns the subset of the provided BCP 47 language priority list requestedLocales for which availableLocales has a matching locale when using the BCP 47 Lookup algorithm. Locales appear in the same order in the returned list as in requestedLocales. The following steps are t... | function /* 9.2.6 */LookupSupportedLocales (availableLocales, requestedLocales) {
var
// 1. Let len be the number of elements in requestedLocales.
len = requestedLocales.length,
// 2. Let subset be a new empty List.
subset = new List(),
// 3. Let k be 0.
k = 0;
/... | [
"function /* 9.2.6 */LookupSupportedLocales (availableLocales, requestedLocales) {\n\t var\n\t // 1. Let len be the number of elements in requestedLocales.\n\t len = requestedLocales.length,\n\t // 2. Let subset be a new empty List.\n\t subset = new List(),\n\t // 3. Let k be 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get date id format:yyyyMMdd | function getDateId() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth()+1;
var day = date.getDate();
return year+month+day;
} | [
"function genereID(){\nvar ref='DA-';\nvar date = new Date();\n\n // Format de l'ID de la demande d'achat DA-YYMMDD-HHMMSS\n ref+=(String(date.getFullYear())).slice(-2)+(\"0\"+ String(date.getMonth()+1)).slice(-2)+(\"0\" + String(date.getDate())).slice(-2);\n ref+=\"-\"\n ref+=(\"0\"+String(date.getHours())).sl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets if the provided structure is a MethodSignatureStructure. | static isMethodSignature(structure) {
return structure.kind === StructureKind_1.StructureKind.MethodSignature;
} | [
"static isCallSignature(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.CallSignature;\r\n }",
"static isSignatured(structure) {\r\n switch (structure.kind) {\r\n case StructureKind_1.StructureKind.Constructor:\r\n case StructureKind_1.StructureKind.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Time Scale Control set the time scale stopping any scheduled warping although .paused = true yields an effective time scale of zero, this method does not change .paused, because it would be confusing | setEffectiveTimeScale( timeScale ) {
this.timeScale = timeScale;
this._effectiveTimeScale = this.paused ? 0 : timeScale;
return this.stopWarping();
} | [
"setEffectiveTimeScale(timeScale){this.timeScale=timeScale;this._effectiveTimeScale=this.paused?0:timeScale;return this.stopWarping();}",
"setEffectiveTimeScale(timeScale) {\n this.timeScale = timeScale;\n this._effectiveTimeScale = this.paused ? 0 : timeScale;\n return this.stopWarping();\n }",
"setE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new AwsConnectionParams object filled with keyvalue pairs serialized as a string. | static fromString(line) {
let map = pip_services3_commons_node_2.StringValueMap.fromString(line);
return new AwsConnectionParams(map);
} | [
"static fromConfig(config) {\n let result = new AwsConnectionParams();\n let credentials = pip_services3_components_node_1.CredentialParams.manyFromConfig(config);\n for (let credential of credentials)\n result.append(credential);\n let connections = pip_services3_components_n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tries converting any value to a number. | function anyToNumber(value) {
if (_utils_Type__WEBPACK_IMPORTED_MODULE_3__["isDate"](value)) {
return value.getTime();
}
else if (_utils_Type__WEBPACK_IMPORTED_MODULE_3__["isNumber"](value)) {
return value;
}
else if (_utils_Type__WEBPACK_IMPORTED_MODULE_3__["isString"](value)) {
... | [
"function anyToNumber(value) {\n if (_utils_Type__WEBPACK_IMPORTED_MODULE_3__[\"isDate\"](value)) {\n return value.getTime();\n } else if (_utils_Type__WEBPACK_IMPORTED_MODULE_3__[\"isNumber\"](value)) {\n return value;\n } else if (_utils_Type__WEBPACK_IMPORTED_MODULE_3__[\"isString\"]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Example: For inputArray = [2, 4, 1, 0], the output should be arrayMaximalAdjacentDifference(inputArray) = 3. | function arrayMaximalAdjacentDifference(inputArray) {
let arr = [];
for (let i = 0; i < inputArray.length - 1; i++) {
arr.push(Math.abs(inputArray[i] - inputArray[i+1]));
}
arr.sort((a,b) => b > a);
return arr[0];
} | [
"function arrayMaximalAdjacentDifference(inputArray) {\n let maxDiff = 0;\n let currentDiff = 0;\n\n inputArray.forEach(function(item, i) {\n currentDiff = Math.abs(item - inputArray[i + 1]);\n if (currentDiff > maxDiff) {\n maxDiff = currentDiff;\n }\n });\n\n return maxDiff;\n}",
"function ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes all items from Chrome Storage | function clearStorage() {
wordList.empty();
chrome.storage.local.clear(function () {
log('Data removed from storage!');
let error = chrome.runtime.lastError;
if (error) console.error(error);
});
} | [
"async clear() {\n const storagePrefix = this.keyToExtensionLocalStorageKey(\"\");\n const storageEntries = await browser.storage.local.get();\n const keysToRemove = [ ];\n for(const key in storageEntries) {\n if(key.startsWith(storagePrefix)) {\n keysToRemove.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end acceptRequest / This function is called when a group join request is accepted | function acceptGroupJoin(feedRequest) {
Parse.Promise.when([
feedRequest.get("group"),
feedRequest.get("fromUser"),
feedRequest.get("toUsers")
]).then(function(group, user, toUsers){
var promises = [];
group.add('joinedUsers', user);
group.remove('pendingUsers', user);
promises.push(... | [
"function acceptJoinRequest() {\n\n console.log('Accept join request');\n\n joinRequest.accept()\n .then(function() {\n console.log('Join request accepted');\n document.getElementById('joinRequest').style.display = 'none';\n })\n .catch(fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make layer div again acc to the array | function updateLayersDiv(){
var node = document.querySelector(".layer-list");
node.innerHTML = '';
for(var i = layersArray.length-1; i>=0; i--){
node.appendChild(layersArray[i].layerIndicatorDiv)
}
} | [
"function layering() {\n\t//get all objectss\n\tlet items = document.getElementsByClassName(\"object\");\n\n\tfor(let j = 0; j < items.length; j++)\n\t{\n\t\t//layer is equal to y coordinate\n\t\t// console.log(items)\n\t\titems[j].style.zIndex = 5;\n\t}\n}",
"createLayerElements(){\n let arr = []\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handle all the children from the loaded json and attach them to given parent | function handle_children( parent, children ) {
var mat, dst, pos, rot, scl, quat;
for ( var objID in children ) {
// check by id if child has already been handled,
// if not, create new object
var object = result.objects[ objID ];
var objJSON = children[ objID ];
if ( object === undefined... | [
"function handle_children( parent, children ) {\n\n var mat, dst, pos, rot, scl, quat;\n\n for ( var objID in children ) {\n\n // check by id if child has already been handled,\n // if not, create new object\n\n var object = result.objects[ objID ];... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! Init all element to usage \param src source of the image \param boundingBox list of boundingBox from the server \param baselines list of baselines from the server | function init(src, boundingBox, baseline) {
var image = new ProcessingImage(src);
var imagePreview = new ProcessingImage(src);
var listRect = new Array();
for (var rect in boundingBox) {
listRect.push(new Rectangle({x:boundingBox[rect].x, y:boundingBox[rect].y, w:boundingBox[rect].width, h... | [
"function Baseline(lines) {\n this.lines = lines;\n this.visible = false;\n this.clickMargin = 0.4; //in percent of the image height\n}",
"static imageDataToView() {\n let currentImage = collectedData.current();\n let imgSource = currentImage.imageSource;\n let rectangles... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create Zip and download | function makeZip() {
const { filename, content } = fflateBuildZipContent()
const [zipPromise, resolve, reject] = makePromise()
fflate.zip(content, (err, data) => {
if (err) {
reject(err)
return
}
resolve(data)
})
return zipPromise.then(makeBlob).then(blob => {
saveAs(blob, filena... | [
"async function createByZip() {\n debug('zip mode');\n await download(zipUrl, target, { extract: true });\n }",
"async function createZip() {\n await zipFolder.zip(`${__dirname}/uploads`, `${__dirname}/archive.zip`);\n}",
"function createZip( itcb ) {\n Y.doccirrus.media.zip.create( zipNa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
saveQuestion once we wont implement backend persistence, this website stores the question using the WebStorage API. save quetions in local storage | saveQuestion() {
if (typeof(Storage) == undefined) {
alert("Você precisa habilitar o uso de cookies antes de usar o site!");
return;
}
/* store the set of answer to a given question */
localStorage.setItem(this.quizTitle + this.id + "statement", this.statement);
localStorage.setItem(this.quizTitle + th... | [
"function saveQuestions(questions){\n\tlocalStorage.setItem(\"questions\",JSON.stringify(questions)); // setItem = insere ou remplace un élément dans la memoir du navigateur/:\n}",
"function storeQuestions(questions) {\n localStorage.questions = JSON.stringify(questions);\n }",
"function saveQuestions... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates an INSERT SQL query dynamically based on input from client. Minimum information require is handle and name. | function makeInsertQuery(reqObj, safeFields) {
let query = `INSERT INTO companies (`;
let valuesArr = [];
let valueStr = ") VALUES (";
let idx = 1;
for (let key in reqObj) {
if (safeFields.includes(key)){
query+= `${key}, `;
valueStr += `$${idx}, `;
val... | [
"insert() {\n const insertValues = this.single.insert || [];\n let sql = this.with() + `insert into ${this.tableName} `;\n if (Array.isArray(insertValues)) {\n if (insertValues.length === 0) {\n return '';\n }\n } else if (typeof insertValues === 'object' && isEmpty(insertValues)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function which shows the result of patient treatment in the activity log | function treatmentResults(liveOrDie) {
const patientId = document.getElementById('operatingTable').childNodes[1]
.childNodes[3].childNodes[3].textContent
fetch('/api/patient/' + patientId)
.then((response) => response.json())
.then((data) => {
const activityLog = document.getElementById('activityL... | [
"function printResults(trialMatcherResult) {\n if (trialMatcherResult.status === \"succeeded\") {\n const results = trialMatcherResult.results;\n if (results != undefined) {\n const patients = results.patients;\n for (const patientResult of patients) {\n console.log(`Inferences of Patient ${... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal function to get the index of the given handler within the internal array. If the handler cannot be found, 1 is returned. | function getIndex(handler) {
var index = -1;
each(function (event, i) {
if (event.handler === handler) {
index = i;
}
return index === -1;
});
return index;
} | [
"findIndex(callback) {\n for (let i = 0; i < this.arr.length; ++i) {\n if (callback(this.arr[i])) {\n return i;\n }\n }\n\n return -1;\n }",
"function helper_get_data_item_index(arr, sel){\n for(var i=0; i<arr.length; i++) if(arr[i][0]==sel) return i;\n return (-1);\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bracket seeding / Pourpose: Seeds matches' decoys in bracket. Prec: decoys must be in order. decoys.length == 2^n Ret: balanced bracket with all decoys seed | function seed_decoys(decoys){
var fst = decoys.shift();
return decoys.reduce(place_decoy_in_bracket, fst);
} | [
"function BuildBracketSeedValues(BracketSize) {\n // Declaring variables.\n var i = 0;\n var j = 0;\n var BracketLayers = Math.log2(BracketSize);\n // Establishing address arrays.\n SeedAddressTmp = InitialiseArray(BracketSize, 1, 0);\n SeedAddressGlobal = InitialiseArray(BracketSize, 1, 0);\n\n See... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert the link root for aliCloud and amazonCloud | convertLinkRoot(json){
var txt = JSON.stringify(json);
var newTxt = txt.replace(/\/\/doporro-hangzhou.oss-cn-hangzhou.aliyuncs.com\/DE-Product-Images\//g, "//s3.eu-central-1.amazonaws.com/manufacture-shop-pictures/");
return JSON.parse(newTxt);
} | [
"function getBaseLink (link) {\n var tmpLinkArr = link.split(/\\//)\n return tmpLinkArr.slice(0, 3).join('/')\n }",
"function mapUrl(url) {\n\n if (url.includes(\"//www.dropbox.com\")) {\n return url.replace(\"//www.dropbox.com\", \"//dl.dropboxusercontent.com\");\n }\n else... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Carga una imagen de la ruta | function cargarImagen(ruta) {
root.actividad = 0
mapa.ocultarCanvas()
marca1.reset()
marca2.reset()
marca3.reset()
marca4.reset()
Glo.hayTrazoRojo = false
Glo.hayTrazoVerde = false
// ocultamos para liberar memoria (@todo: refactorizar)
mapa.ocultarTrazos()
mapa.mostrarTrazos()
miProxy.cargarI... | [
"function cargarImagenArticulo()\n{\n\tif(($photo.length != 0)){\n\t\t$('#preview img').attr('src', $basePath +\"/public/img/inventories/\"+ $photo);\n\t}\n}",
"function limpiar_foto(img_foto)\n{\n img_foto.src = \"../../../kernel/images/tools20/blanco.jpg\";\n}",
"function mostrarFoto(file, imagen) {\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a list of free time slots between the given bookings | function getFreeBookingSlots(list, min_size = 30) {
/* istanbul ignore else */
if (!list) {
return [
{
start: 0,
end: Object(date_fns__WEBPACK_IMPORTED_MODULE_1__["startOfMinute"])(new Date()).getTime() * 10,
},
];
}
const slots = [... | [
"function getFreeBookingSlots(list, min_size = 30) {\n if (!list) {\n return [\n {\n start: 0,\n end: dayjs__WEBPACK_IMPORTED_MODULE_4__().startOf('m').valueOf() * 10,\n },\n ];\n }\n const slots = [];\n let start = dayjs__WEBPACK_IMPORTE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
textSentiments function receives a text string and sentiment score object. Returns the sentiment score of the text. | function textSentiment(text,sentimentobject){
var sentiment_score = 0
var words = text.split(/[^\w\']/).filter(function(el) {return el.length != 0}); // Splits the text in to words.Filters empty strings.
var wordlen = words.length
for(var i=0;i<wordlen;i++){
if(words[i] in sentimentobject){
... | [
"function sentimentText(aTextSentences, sLangCode) {\n\n // Output\n var sentiment = {\n score: 0,\n comparative: 0,\n vote: 'neutral',\n accuracy: 0,\n meanings: [],\n positive: [],\n negative: []\n };\n\n // Iterate over array of sentences\n for (var i = 0; i < aTextSentences.length; i++... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show and hide captions on photos Inspirations page | function showCaption1() {
document.getElementById("caption1").style.display = "block";
} | [
"function showOrHideCaptionEditingModeElements(displayMode)\n{\n var photoSlideShowBackgroundDiv = document.getElementById('photoSlideShowBackground');\n photoSlideShowBackgroundDiv.style.display=displayMode;\n var photoSlideShowCanvas = document.getElementById('photoSlideShowCanvas');\n photoSlideShowCanvas.st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls the setData method of the model | setData(data){
this.model.setData(data);
} | [
"setData() {\n\t\tthis.data = this.getData()\n\t}",
"setData() {\r\n this.fireSlimGridEvent(\"onBeforeDataUpdate\", {});\r\n\r\n this.generateColumns();\r\n this.generateFilters();\r\n this.setOptions();\r\n\r\n this.dataView.beginUpdate();\r\n this.setDataViewData();\r\n this.dataView.endUpd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fomartBodyPages: sets basic structure for all body pages | function formatBodyPages(){
//applies upper frame
var topframe = "<div class='page-frame'></div>";
$('.body-page').prepend(topframe);
$(document.getElementsByClassName('body-page')[0]).addClass('page-active');
} | [
"function allPages(req, res, template, block, next) {\n \n calipso.theme.renderItem(req, res, template, block, {});\n next();\n \n}",
"function bodyLoadCommonAfter()\r\n{\r\n wireUpEventHandlers();\r\n loadSettings();\r\n\r\n // make body visible, now that we're ready to render\r\n document.body.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deleteAllBooks Function removes all book cards from the DOM and clears the libraryBooks array | function deleteAllBooks() {
const bookCards = document.querySelectorAll(".book-card");
bookCards.forEach((card) => {
card.remove();
libraryBooks = [];
});
} | [
"function clearBooks() {\n books = [];\n}",
"function clearDom(){\n Array.from(allBooks).forEach(book => {\n book.remove();\n });\n}",
"function deleteBookCards(){\n\tfor(const x of myLibrary){\n\t\tconst book = document.getElementById(\"\" + x.id);\n\t\n\t\t//check if book exists \n\t\tif(book)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The Debug mode generates a skeleton diagram for debugging. There will be a button at the top of the page, and click to generate a skeleton map. | async debugGenSkeleton(options) {
const switchElement = document.createElement('button');
switchElement.innerHTML = '开始生成骨架图';
Object.assign(switchElement.style, {
width: '100%',
zIndex: 9999,
color: '#FFFFFF',
background: 'red',
fontSize: '30px',
height: '100px',
});... | [
"function setupDebugDraw(){\n if(ctx == null) ctx = canvas.getContext('2d');\n \n var debugDraw = new b2DebugDraw();\n \n // Use the canvas context for drawing the debugging screen\n debugDraw.SetSprite(ctx);\n // Set the scale\n debugDraw.SetDrawScale(scale);\n // Set the alpha transpare... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if it has at least one castable important ability | hasCastableImportant(){
const actions = this.player.getActions('e');
for( let action of actions ){
if( action.hasTag([stdTag.acNpcImportant, stdTag.acNpcImportantLast]) && action.castable() )
return true;
}
} | [
"typecheck() {\n return this.is_compatible(this.a);\n }",
"_canAccess(obj) {\n // TODO: `Object.getPrototypeOf` can trigger a proxy trap; need to check on that as well.\n\n // check if objects of this type have already been floodgated\n return !this._readErrorsByType.has(Object.getPrototypeOf(o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
secretReveal When mouseover, secret is revealed | function secretReveal() {
// if ($(this).css('color') === 'black') {
$(this).css('color', 'orange');
secretsFound++;
$('#found').text(`${secretsFound}`);
$(this).off('mouseover');
// }
if (secretsFound === secretsTotal) {
$('body').append('<p id="ending"> You found all the secrets! </p>')
}
} | [
"function onMouserover(){\n // highlighting\n $(this).removeClass(\"secret\").addClass(\"found\");\n $(this).off('mouseover'); // it is found so no more mouseover handling\n secretsFound++; // increment the num of found secrets\n $(\"#secrets-found\").text(secretsFound); // update the ui\n}",
"function isOve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check slot status and if spun long enough stop it on result | function _check_slot( offset, result ) {
if ( now - that.lastUpdate > SPINTIME ) {
var c = parseInt(Math.abs( offset / SLOT_HEIGHT)) % ITEM_COUNT;
if ( c == result ) {
if ( result == 0 ) {
if ( Math.abs(offset + (ITEM_COUNT * SLOT_HEIGHT)) < (SLOT_SPEED * 1.5)) {
return... | [
"function _check_slot( offset, result ) {\n \tconsole.log(\"RSLTD: \"+result);\n\t\tif ( now - that.lastUpdate > SPINTIME ) {\n\t\t var c = parseInt(Math.abs( offset / SLOT_HEIGHT)) % ITEM_COUNT;\n\t\t if ( c == result ) {\n\t\t\t\tif ( result == 0 ) {\n\t\t\t\t if ( Math.abs(offset + (ITEM_COUNT * SLOT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds a lily pad to a linked list | function addLilyPad() {
const r = rnd(10, 10);
const c = {
p: vec(rnd(20, 80), -r),
r,
a: rnd(PI * 2),
v: rnds(0.03, 0.08),
l: 2,
next: undefined,
};
if (lastLilyPad != null) {
lastLilyPad.next = c;
}
if (playersLilyPad == null) {
playersLilyPad = c;
}
// makes the color ... | [
"addtoLL(val, loc) {\n var node = {value: val};\n // if node is inserted at first location\n if (loc == 0) {\n node.next = this.list.head;\n this.list.head = node;\n } else {\n let i = 0;\n var tmpnode = this.list.head;\n while (i !=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if we invited users, handle additional postresponse processing | async postProcessInvitedUsers () {
if (this.userInviter) {
return this.userInviter.postProcess();
}
} | [
"async confirmUser () {\n\t\t// in the case of a user accepting an invite, they might have signed up with an email different\n\t\t// from the email they were originally invited with, here we detect that scenario and make sure\n\t\t// the invited user record has the correct email\n\t\tif (this.user.get('email') !== ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for user is logged in. And creates a Switch button. | function checkForLoggedIn() {
const loginBtn = document.querySelector('form[action^="login.php"] input.button');
if (loginBtn) { // Have login button
const swAccount = Object.assign(document.createElement('a'), {href: '#', textContent: 'Switch', id: 'multiacc'});
loginBtn.parentNode.appendChild(swAccount);... | [
"function signIn (){\n\tif (userName.value === 'mirko' && userPassword.value === 'bit') {\n\tsignInOutSwitch = true;\n\talert('Welcome');\n divMovie.classList.toggle('disabled-div');\n divProgram.classList.toggle('disabled-div');\n\t}\n\telse {\n\t\talert('Wrong User name or Password');\n\t} \n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stop the animation and clear the canvas. | function stop() {
if (timer) clearInterval(timer);
timer = null;
var brush = canvas.getContext("2d");
brush.clearRect(0, 0, canvas.width, canvas.height);
} | [
"stop() {\n clearInterval(this.animation);\n this.canvas.clear();\n }",
"function stopAnimation() {\n\tclearInterval(intervalRef);\n\t// erase the canvas with clearRect\n\tcontext.clearRect(0,0,600,400);\n\t}",
"stop() {\n if (this.animation) {\n this.animation.stop();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that sets details of the outcome in UI. It sets color and signs both of opponent and player. | function setOutcomeDetails(currentRoundUi, currentRound, opponentColor, playerColor){
currentRoundUi.statusBoxOpponent.style.background = opponentColor;
currentRoundUi.statusBoxPlayer.style.background = playerColor;
var opponentUrl = currentRound.getOpponentSign() !== null ? currentRound.getOpponentSig... | [
"setCurrentTurnUI() {\n let htmlTurnText = \"Player 1's turn\";\n let styleColor = \"red\";\n if (!this.isPlayer1Turn) {\n styleColor = \"darkcyan\";\n htmlTurnText = \"Player 2's turn\";\n }\n this.currentPlayerUI.innerHTML = htmlTurnText;\n this.curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper to echo strings in the terminal window | function spitt(msg) {
shell.echo(msg);
} | [
"echo(message){\n this.terminal.echo(message);\n }",
"function echo() { //dm\n\t//if ( getCookie(\"dev_mode\") )\n\t{\n\n\t\tfor (var i= 0, txt= \"\"; i<arguments.length; i++) {\n\t\t\tvar delimiter= (i===arguments.length-1)? \"\": \" | \";\n\t\t\ttxt+= arguments[i] + delimiter;\n\t\t}\n\t\tconsole.log(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets saved regrets from DB and renders on portfolio.ejs view | function getPortfolio(request, response) {
let SQL = 'SELECT * FROM portfolio;';
return client.query(SQL)
.then(result => {
response.render('pages/portfolio', { regret: result.rows })
})
.catch(error => {
request.error = error;
getError(request, response);
});
} | [
"function myPortfolio( req, res ) {\n\n\tvar auth = null;\n\n\tif( req.session.name ) {\n\n\t\tauth = true;\n\n\t}\n\n\tportfolio.find().sort( { date: -1 } ).exec(\n\n\t\tfunction(err, portfolioPost) {\n\n\t\tif (err) {\n\n\t\t\tconsole.log(\"Error \"+err);\n\t\t\tres.send(\"Error \"+err);\n\n\t\t}\n\n\t\tres.rende... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a team map where key is team id and values are team name and short id | function makeTeamMap(teams) {
var map = {};
for (var i = 0; i < teams.length; i++) {
map[teams[i]._id] = {name : teams[i].team_name, shortID : teams[i].shortID};
}
return map;
} | [
"function createTeamMap(arr) {\n var country = 1\n ,m = {}\n ,j = arr.length\n ,i = 0\n ,team\n ;\n while( i < j ) {\n team = arr[i];\n if (team === \"|\") {\n country += 1;\n } else {\n if ( team in m ) {\n m[team].push(country);\n } else {\n m[team] = [countr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get parent path from string ex)"a/b/c"=> "a/b" "a"=> null "a/b/c/"=> "a/b": if allow_empty is false "a/b/c/"=> "a/b/c": if allow_empty is true "a//b/c"=> "a//b" "a/b/c//"=> "a/b": if allow_empty is false "a/b/c//"=> "a/b/c/": if allow_empty is true "a/"=> null: if allow_empty is false "a/"=> "a": if allow_empty is true... | function rawGetParentPath(str, separator, allow_empty)
{
if(!rawIsSafeString(str)){
return '';
}
if(!rawIsSafeEntity(allow_empty)){
allow_empty = false;
}else if('boolean' !== typeof allow_empty){
return '';
}
if(!rawIsSafeString(separator)){
separator = '/';
}
var tmp;
var cnt;
// escape if allow em... | [
"static _normalizeDeepestParentFolderPath(folderPath) {\r\n folderPath = path.normalize(folderPath);\r\n const endsWithSlash = folderPath.charAt(folderPath.length - 1) === path.sep;\r\n const parsedPath = path.parse(folderPath);\r\n const pathRoot = parsedPath.root;\r\n const path... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class StockDataManager: manage stock data at runtime; data includes StockData, RecentQuotes, Alert... | function StockDataManager() {
this.items = {};
this.count = 0;
} | [
"function StockProvider(){\n /**\n * Maakt een nieuwe YahooAjaxHelper aan en zet dat in de variable yahoo.\n * @type {YahooAjaxHelper} : Geeft een YahooAjaxHelper \"class/object\".\n */\n yahoo = new YahooAjaxHelper();\n\n /**\n * Maakt een nieuwe LocalHelper aan en zet dat in de variable l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Here we setup all the options for the VisJs network diagram were we see what are the default values and configuration | setupOptions() {
this.options = {
nodes: {
shape: 'image',
image: '/images/terminal.png'
},
edges: {
arrows: 'to',
color: '#aaa',
smooth: {
type: 'continuous',
... | [
"function drawNetwork({nodes: nodesDataset, edges: edgesDataset}) {\n network = new vis.Network(container, {nodes: nodesDataset, edges: edgesDataset} , options);\n }",
"function initTutorialDefaults() {\n const graph = graphComponent.graph\n \n // configure defaults normal nodes and their labels\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create an arc between two markers | function linkArc(data){
var to = data.toMarker;
var from = data.fromMarker;
bend = data.bend || 1;
var srcXY = map.latLngToLayerPoint( from.getLatLng()),
trgXY = map.latLngToLayerPoint( to.getLatLng() );
var dx = trgXY.x - srcXY.x,
dy = trgXY.y - srcXY.y,
dr = Math.sqrt(dx * dx + dy * dy)*bend;... | [
"function getCircleArc(r, p1, p2) {\n return `M ${p1.x} ${p1.y} A ${r} ${r}, 0, 0, 1, ${p2.x} ${p2.y}`;\n}",
"function computeArcThroughTwoPoints(p1, p2) {\n var aDen = (p1.x * p2.y - p1.y * p2.x), bDen = aDen;\n var sq1 = p1.squaredNorm(), sq2 = p2.squaredNorm();\n // Fall back ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invokes the specified nonquery method on the server | invokeNonQuery(methodName, params = null, ...actions) {
// by definition we are not returning anything from these calls so we should not be caching the results
this._useCaching = false;
return this.invokeMethodImpl(methodName, params, actions, null, true);
} | [
"execute(req, res) {\n let msg = req.message\n let method = this[msg.type]\n\n if (method) {\n method.call(this, req, res)\n } else {\n console.error('Method', msg.type, 'not implemented for CollabServer')\n }\n }",
"function noneYaBusiness(){ // Prod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if at higher priority state | function isHigherPriorityState() {
var options = ISessionScript.getOptions();
var value = options.getOther(options.HighPriorityTransfersPercentageAvailableBandwidth);
var retval = (value == "90");
ISessionScript.debug("isHigherPriorityState()=" + retval);
return retval;
} | [
"isHigh() {\n return this.state === 'high' || this.state === 'pullup';\n }",
"function __checkLevel(currentPriority, stateLevel) {\n if (Array.isArray(stateLevel)) {\n return (//Check if current is whitelisted (state)\n stateLevel.length > 0 &&\n !__insideArray... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the state for the supplied ED and position. resets the thumbnails to an empty array and sends a request to the datasource for the relevent thumbnails. | setSelectedED(ed,position) {
this.setState( { ed : ed, position: position, thumbnails: [] }, () => { this.requestThumbnails() } );
} | [
"function _initThumbnailsState() {\n return {\n imgs: [],\n firstThumbnailImg: null,\n firstThumbnailBtn: null,\n lastThumbnailImg: null,\n lastTumbnailBtn: null,\n selectedThumbnailImg: null\n };\n }",
"function _initThumbnailsState () {\n return {\n imgs: [],\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
call service from a remote node | _call_remote_service(remote, name, fun, args, cb) {
this._find_remote(remote, (err, rn) => {
if (err) return cb(err);
rn.call(name, fun, args, (err, ret) => {
if (err) return cb(err);
return cb(null, ret);
});
});
} | [
"_call_local_service(name, fun, args, cb) {\n if (name in this.services) {\n const rq = {\n type: 'call',\n fun: fun,\n args: args,\n };\n\n return this._req(this.service_socks[name], rq, (rsp) => {\n if (rsp.status ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a color picker palette for each of the spotlights | function populateColorPickers() {
for (var i = 1; i < 10; i++) {
$( "#spotlight" + i).append("<i id='palette" + i +
"' class='material-icons palette' onClick='openSpotlightControl(" + i + ")'>palette</i>");
$( "#spotlight" + i).append("<span> Spotlight " + i + " <span id='intensity" +
i + "'></s... | [
"function init_colors() {\n\t$('.colorpicker').each(function () {\n\t\tvar id = $(this).attr('id');\n\t\t$(this).spectrum('set', urlObj[id]);\n\t});\n}",
"function createPalette() {\n for (let i = 0; i < colors.length; i++) {\n let color = document.createElement('div')\n palette.appendChild(color).classLis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the given dir has workspace config (new or legacy) | static async isExist(dirPath) {
const jsoncExist = await WorkspaceConfig.pathHasWorkspaceJsonc(dirPath);
if (jsoncExist) {
return true;
}
return _workspaceConfig().default._isExist(dirPath);
} | [
"checkProj(dir) {\n if (fs.existsSync(dir)) {\n if (fs.existsSync(path.join(dir, 'src'))) {\n atom.notifications.addError(`Your directory \"src\" cannot be replaced`);\n return false;\n } else if (fs.existsSync(path.join(dir, 'package.json'))) {\n atom.notifications.addError(`Your ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Values for max_lazy_match, good_match and max_chain_length, depending on the desired pack level (0..9). The values given below have been tuned to exclude worst case performance for pathological files. Better values may be found for specific files. | function DeflateConfiguration(a, b, c, d) {
this.good_length = a; // reduce lazy search above this match length
this.max_lazy = b; // do not perform lazy search above this match length
this.nice_length = c; // quit search above this match length
this.max_chain = d;
} | [
"function DeflateConfiguration(a, b, c, d) {\n\tthis.good_length = a; // reduce lazy search above this match length\n\tthis.max_lazy = b; // do not perform lazy search above this match length\n\tthis.nice_length = c; // quit search above this match length\n\tthis.max_chain = d;\n}",
"function calcMaxRecursionDept... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
eslintdisableline nounusedvars output information to the warning logging stream. | warn() {} | [
"function logWarning() {\n var _console3;\n\n if (!internalDebugValue && \"production\" === \"test\") {\n return;\n } // eslint-disable-next-line no-console\n\n\n (_console3 = console).warn.apply(_console3, arguments);\n}",
"LogWarning() {}",
"printWarnings() {\n let count = 0;\n\n // Emit ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: DAFTAR MENU JURUSAN 1. menampilkan menu Jurusan | function menuJurusan() {
console.log(`
===========================================================
Silahkan pilih opsi di bawah ini
[1] daftar Jurusan
[2] cari Jurusan
[3] tambah Jurusan
[4] hapus Jurusan
[5] kembali
===========================================================
`);
rl.question('masukan salah satu no... | [
"function Venus() {}",
"function printMenu() {\n console.log(\"\\n<====== PENDAFATARAN SISWA BARU ======>\");\n console.log(\"<====== SMKN 1 RPL ======>\");\n console.log(\"\\n<====== Menu ======>\");\n console.log(\"1. Registrasi\");\n console.log(\"2. Input Nilai\");\n console.log... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
intervals = insertInterval([[1, 3], [5, 7], [8, 12]], [4, 6]); result = ""; for(i=0; i < intervals.length; i++) result += "[" + intervals[i][0] + ", " + intervals[i][1] + "] "; console.log("Intervals after inserting the new interval: " + result); intervals = insertInterval([[1, 3], [5, 7], [8, 12]], [4, 10]); result = ... | mergeIntervals (intervals)
{
if( intervals.length < 2 )
{
return intervals
}
intervals.sort((a, b) => a.start - b.start);
const merged = [];
let start = intervals[0].start,
end = intervals[0].end;
for (let i = 1; i < intervals.length; i++)
{
const interval = int... | [
"insertInterval (intervals, new_interval)\n {\n const merged = [];\n\n let newStart = new_interval[0]\n let newEnd = new_interval[1]\n\n let i = 0\n while( i < intervals.length && intervals[i][1] <= newStart )\n {\n merged.push( intervals[i] )\n i++\n }\n\n if( intervals[i][1] ===... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function: parse description: performs parse by Esprima parser, calls recursive expand() on parsed string and codeArray parameters: none return: null | function parse(){
var syntax = esprima.parse(editor.getValue());
codeArray = [];
expand(syntax.body, codeArray, 0);
} | [
"function parser(ast){\n var isTextNode = ast.type === 3;\n\n var $var = '_$var_' + ( ast.tag || 'text' ) + `_${uuid++}_`;\n codes.push(`var ${$var} = [];`);\n\n var parentVar = stack[stack.length - 1] || $root;\n //var parentAST = stackAST[stackAST.length - 1];\n\n stack.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace repeater values in a field def with the concrete field name. | function replaceRepeaterInFieldDef(fieldDef, repeater) {
fieldDef = replaceRepeat(fieldDef, repeater);
if (fieldDef === undefined) {
// the field def should be ignored
return undefined;
}
if (fieldDef.sort && isSortField(fieldDef.sort)) {
var sort = replaceRepeat(fi... | [
"function replaceRepeaterInFieldDef(fieldDef, repeater) {\n var field = fieldDef.field;\n if (fielddef_1.isRepeatRef(field)) {\n if (field.repeat in repeater) {\n return tslib_1.__assign({}, fieldDef, { field: repeater[field.repeat] });\n } else {\n log.warn(log.message.noS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructor Initialize a new instance for `PdfGridStyle` class. | function PdfGridStyle(){var _this=_super.call(this)||this;_this.gridBorderOverlapStyle=exports.PdfBorderOverlapStyle.Overlap;_this.bAllowHorizontalOverflow=false;_this.gridHorizontalOverflowType=exports.PdfHorizontalOverflowType.LastPage;return _this;} | [
"function PdfGridStyle() {\n var _this = _super.call(this) || this;\n _this.gridBorderOverlapStyle = PdfBorderOverlapStyle.Overlap;\n _this.bAllowHorizontalOverflow = false;\n _this.gridHorizontalOverflowType = PdfHorizontalOverflowType.LastPage;\n return _this;\n }",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set speed of both wheels where 1 is the maximum speed and 1 is the maximum in reverse. | setSpeedCoeff(left, right) {
this.leftWheel = this.servoStop + (this.servoSpeedSpread * left) * this.leftServoCoeff;
this.rightWheel = this.servoStop + (this.servoSpeedSpread * right) * this.rightServoCoeff;
} | [
"setMotorSpeed () {\n var tickDelta = this.tickDelta()\n\n switch (true) {\n case (tickDelta <= 3):\n this.motor.speed = SPEEDS.SINGLE_KERNEL\n break\n case (tickDelta > 3 && tickDelta <= 8):\n //this.motor.speed = SPEEDS.VERY_SLOW\n this.motor.speed = SPEEDS.SLOW\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update informations about a previously saved Jenkins | function updateJenkins(jenkins_id,jenkins_name, jenkins_url){
var db = getDatabase();
var res = "";
db.transaction(function(tx) {
var rs = tx.executeSql('UPDATE jenkins_data SET jenkins_name=?, jenkins_url=? WHERE id=?;', [jenkins_name,jenkins_url,jenkins_id]);
if (rs.rowsAf... | [
"function saveJenkinsJobs(event) {\r\n\r\n var jenkinsJobsToSave = [];\r\n var selectedJenkinsJobs = document.getElementById(\"selectedJenkinsJobs\").getElementsByTagName(\"li\");\r\n\r\n var length = selectedJenkinsJobs.length;\r\n for (var i = 0; i < length; i++) {\r\n var jobId = selectedJenki... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the product data percent & names | function calculatePercentsAndNames() {
// Get local storage products
var products = JSON.parse(localStorage.getItem('products'));
var percents = [];
var names = [];
// Calculate the percents for each product
for (var i = 0; i < products.length; i++) {
var percent = Math.floor((products[i].clicks / prod... | [
"function calcPercentage(){\n for (var i = 0; i < allProducts.length; i++) {\n var percentage;\n if (allProducts[i].views === 0){\n percentage = 0;\n }\n else {\n percentage = parseInt(Math.floor((allProducts[i].clicks / allProducts[i].views) * 100));\n }\n return percentage;\n }\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create cost plus quote tool. Simplified to only Fuel and Wage Expense consideration. | function costPlusQuote() {
if (distanceInMiles >= 100) {
quote = (wageExpense + fuelExpense) * margins[3];
return quote
} else if (distanceInMiles >= 500) {
quote = (wageExpense + fuelExpense) * margins[2];
... | [
"function createComputedCost(grid) {\n const computed = document.createElement(\"span\");\n computed.classList.add(\"computed-cost\");\n const computedCost = document.createTextNode(\"\");\n computed.appendChild(computedCost);\n grid.appendChild(computed);\n}",
"function building(cost, exp) {\n\t\tcost *= 4 ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function to check number is Armstrong or not. Test Cases : ``` Input 1: 153 Output: The 153 is Armstrong. Input 2: 11 Output: The 11 is not Armstrong. ``` | function Armstrong(number){
let digit=0;
for(i=0;i<number.length;i++){
digit += Number(number[i]*number[i]*number[i]);
}
if(digit == number){
return "Armstrong";
}
else{
return "not Armstrong";
}
} | [
"isArmstrong() {\n\n\t\tvar num = prompt(\"Enter a number\");\n\t\tvar input_num = parseInt(num);\n\t\tvar numLength = num.length;\n\t\tvar sum = 0;\n\t\tfor(var i = 0; i < numLength; i++)\n\t\t{\n\t\t\tvar container = 1;\n\t\t\tvar int_num = parseInt(num.charAt(i));\n\t\t\tfor(var j = 0; j < numLength; j++)\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes the visibility of a insert form, using the table name. | function toggleInsertForm(table){
var obj = ge(table+"_insertDiv");
var display = obj.style.display;
if( display == 'none'){
obj.style.display = 'block';
}else{
obj.style.display = 'none';
}
} | [
"function setVisibility() {\r\n var table = document.getElementById('activitiesTable');\r\n table.style.visibility = 'visible';\r\n}",
"function showSettingTable(){\r\n document.getElementById(\"setting_table\").style.visibility = \"visible\";\r\n}",
"function showTable() {\n $addItem.show();\n $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle displaying given element. If element is invisible make it visible with given display type. If Element is visible make it invisible. If animate is true, will use expand/collapse animation when bringing element in/out of view. | function toggleDisplayWithDisplayType(idOfElement, displayType, animate){
var element = document.getElementById(idOfElement);
if(!element){
return;
}
if(!displayType){
displayType = "block";
}
if (!animate) {
element.style.display = element.style.display == 'none' ? displ... | [
"function toggle_display(elem) {\n if (elem.css('display') === 'none') {\n elem.css('display', 'block');\n } else {\n elem.css('display', 'none');\n }\n }",
"function toggle_display(elem) {\n if (elem.css('display') === 'none') {\n elem.css('display', 'block');\n } else {\n elem.css('d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Max sockets by default is 5, but we want more than that. Set os limits | function configureMaxSockets(http){
http.globalAgent.maxSockets = pound.userOptions.globalAgentMaxSockets;//Infinity;
} | [
"function connectionPoolSize() {\n // A factor that's based on the type of storage.\n const MEM_FACTOR = 1;\n\n return (os.cpus().length * 2) + MEM_FACTOR;\n}",
"constructor() {\n this.maxClients = 4;\n }",
"function get_pool_sockets(pool) {\n if (pool.getProductAttribute(\"sockets\")) {\n // t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List all locations the API key has access to. The API key belongs to a particular account and has access to all locations of the account. This function returns a list of locations that the API key has access to. Calls the following HTTP API: `GET /locations/` For example: ```javascript import as Qminder from 'qminderap... | static list() {
return api_base_1.default.request('locations/').then((locations) => {
return locations.data.map(each => new Location_1.default(each));
});
} | [
"function getLocations(){\n AuthActions.locations.getAll()\n .then(locations => setLocations(locations))\n }",
"async getLocations () {\n if (!API_URL || !API_KEY) {\n console.error('Missing API_URL or API_KEY');\n throw new BadGatewayError();\n }\n\n // We could do some proper request... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines the next available user ID. | function nextUserId() {
return ++userSeq;
} | [
"function nextID (callback) {\n \n users.findOne({}).sort({userID: -1}).exec(function(err, user) {\n if (err) {\n throw err;\n } else {\n if (user) {\n callback(user.userID + 1);\n } else {\n callback(0);\n }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the ID of the document associated with a given verification code, or null if no document matches the given code. | static lookupVerificationCode(session, code) {
if (!code) {
return null;
}
// >>>>> NOTICE <<<<<
// This should be implemented on your application as a SELECT on your
// "document table" by the verification code column, which should be an
// indexed column.
if (sessi... | [
"static lookupVerificationCode(session, code) {\n\t\tif (!code) {\n\t\t\treturn null;\n\t\t}\n\t\t// >>>>> NOTICE <<<<<\n\t\t// This should be implemented on your application as a SELECT on your\n\t\t// \"document table\" by the verification code column, which should be an\n\t\t// indexed column.\n\t\tif (session[`... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the renderer dimensions to the max dimension of the canvas. This assumes a 1:1 aspect ratio but improves the output resolution. | updateRenderDimensions(window) {
const maxDimension = Math.max(this.renderer.domElement.clientWidth, this.renderer.domElement.clientHeight);
// Set the pixel ratio to set the correct resolution for high PPI displays.
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.se... | [
"setActualSize() {\n this.renderer.setActualSize();\n }",
"setRendererSize(w, h) {\n this.drawableObject.activate()\n this.drawableObject.view.setViewSize(w,h);\n\n var ctx = this.drawableElement.getContext('2d');\n ctx.canvas.style.width = '';\n ctx.canvas.style.height = '';\n }",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a configuration of a taco, containing baseLayer, mixins, etc., save it to our state array and locally in our cookie | saveTaco (config, cameFromHistory = false) {
// Update saved tacos
const newTacos = this.state.tacos.concat([new Taco(config)])
this.setState({ tacos: newTacos })
// On github pages cookies don't work!!!
Cookies.set(COOKIE_KEY, newTacos)
this.props.onSave(newTacos)
... | [
"saveStateToCookie() {\n cookies = cookies || new Cookies();\n\n const stateToSave = {};\n STATE_KEYS_SAVE.forEach(key => {\n stateToSave[key] = this.state[key];\n });\n\n cookies.set(STORYTELLER_COOKIE, stateToSave, {\n path: '/',\n expires: new D... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check for delay in start of new year due to length of adjacent years | function hebrew_delay_2(year)
{
var last, present, next;
last = hebrew_delay_1(year - 1);
present = hebrew_delay_1(year);
next = hebrew_delay_1(year + 1);
return ((next - present) == 356) ? 2 :
(((present - last) == 382) ? 1 : 0);
} | [
"function hebrew_delay_2(year) {\n var last, present, next;\n last = hebrew_delay_1(year - 1);\n present = hebrew_delay_1(year);\n next = hebrew_delay_1(year + 1);\n return ((next - present) == 356) ? 2 : (((present - last) == 382) ? 1 : 0);\n}",
"function hebrew_delay_2(year)\n\t{\n\t var last, present, next;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |