query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Returns the current default dispatcher instance | static getDefault() {
return Dispatcher._dispatchers['default'];
} | [
"static getDispatcher(dispatcher_name) {\n Dispatcher._dispatchers = Dispatcher._dispatchers || {};\n\n return Dispatcher._dispatchers[dispatcher_name];\n }",
"constructor(defaultInstance = false) {\n this._events = {};\n\n if (defaultInstance == true) {\n Dispatcher._dis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
opting for semicolons instead of commas due to commas in dollar figures this is a hacky way b/c of the newline | function makeSemicolonSeparated(text) {
return text.replace(/[\n]/g, ';');
} | [
"function Separator() { bind.Separator(); }",
"get seperator() { return this._seperator }",
"function getPoplistSepLine(x,y,s){\n\tvar result=\"M\"+(x-s/2)+\" \"+y+\",\";\n\tresult=result+\"L\"+(x+s/2)+\" \"+y;\n\t\n\treturn result;\n}",
"set surround_seperator(string){ \n this.seperator_prefix = string\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
guess extension by content: "json", "html" or "text" | function guess_extension(str) {
return tryThese(function () {
JSON.parse(str);
return 'json';
}, function () {
if (cheerio(str)('*').length) {
return 'html';
}
}, function () {
return 'txt';
})
} | [
"function extension(type) {\n const match = EXTRACT_TYPE_REGEXP.exec(type);\n if (!match) {\n return;\n }\n const exts = exports.extensions.get(match[1].toLowerCase());\n if (!exts || !exts.length) {\n return;\n }\n return exts[0];\n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resubscribe the patient data. pid pid for this patient config The configuration information to use for context callback The callback to call when it is done. | function resubscribePatientData(pid, config, callback) {
var vistaId = idUtil.extractSiteFromPid(pid);
var localId = idUtil.extractDfnFromPid(pid);
var rpcConfig = _createRpcConfigVprContext(config, vistaId);
var rpcLog = logUtil.get('rpc', log);
var params;
if (rpcConfig) {
params = {... | [
"async function registerRessource(config,data){\n\n //Get options from configuration parameter in real case.\n let ids_body = config.body\n console.log(\"data:\",data)\n ids_body.representations[0]['source']['url']=ids_body.representations[0]['source']['url'].replace('{uidIDS}',data.data)\n\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the tizen platform conf | function getPlatformInfos(tizenconf){
var content = fs.readFileSync(tizenconf);
if (!content) {
logger_qamanager.error("Invalid tizen platform config file : " + tizenconf);
process.exit(1);
}
try {
content = JSON.parse(content);
}
catch(e){
logger_qamanager.error("Unable to parse config file : " + tizenc... | [
"function getPlatformPreferences(platform) {\n //init common config.xml prefs if we haven't already\n if(!preferencesData) {\n preferencesData = {\n common: configXml.findall('preference')\n };\n }\n\n var prefs = preferencesData.common || [];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name: ToggleMode Purpose: Using get_uiMode and set_uiMode this function cycles through the UI modes of the player control when called. | function ToggleMode()
{
var Mode = get_uiMode();
if (Mode=="none") set_uiMode("mini");
if (Mode=="mini") set_uiMode("full");
if (Mode=="full") set_uiMode("none");
} | [
"changePlayerMode() {\n this._inPlayerMode = !this._inPlayerMode\n this.reset()\n }",
"function switchOff() {\n stopGame(); \n infoscreen.text('Game is switched off'); \n usedPattern = []; //usedPatt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the part of energy that is influenced by a BP (even if in mfemode only parts of the structures are analyzed, the energy difference refers to the whole structure) | function get_BP_Energy(pos_i, int_seq)
{
var energy = 0.0;
var pos_BP; //pos_i is the absolute pos. in the structure, pos_BP is the pos. of the BP in BP_Order (in pos_i is a BP)
var pos_j; //binding pos. of pos_i, if there is a BP in pos_i
var bp_i, bp_j; // assignment of the BP
var size; ... | [
"function get_BasePart_Energy(pos_i, int_seq)\n{\n var bp_i; // assignment of the base\n var size; // loop size\n var pos_BP_vor, pos_BP_nach; // pos. of the BPs that enclose the free base (in BP_Order)\n var i, j;\n var group_i, group_j; // left and right bord... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates subQueryFilter a select nested in the where clause of the subQuery. For a given include a query is generated that contains all the way from the subQuery table to the include table plus everything that's in required transitive closure of the given include. | _generateSubQueryFilter(include, includeAs, topLevelInfo) {
if (!topLevelInfo.subQuery || !include.subQueryFilter) {
return;
}
if (!topLevelInfo.options.where) {
topLevelInfo.options.where = {};
}
let parent = include;
let child = include;
let nestedIncludes = this._getRequiredC... | [
"visitSubquery_restriction_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function _postSubQuery( opt ){\r\n//console.log(\"_postSubQuery()\", arguments, \"caller: \", _postSubQuery.caller );\r\n//console.log(\"_postSubQuery()\", opt );\r\n//console.log(options);\r\n\r\n\t\t\tvar num_condition = opt[\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end generateRandomVerseNumber generateVerseOfTheDay function Consume generateRandomVerseNumber function then use its return value as today's verse number, "verseNumberToday". We'll then use verseNumberToday to grab an actual verse from the Proverbs data set. Return the verse. It shall be rendered at the front end | function generateVerseOfTheDay() {
let chapterToday = GMT_dayOfMonth;
let verseNumberToday = generateRandomVerseNumber();
// generate verse of the day dynamically
let verseToday = Proverbs[chapterToday][chapterToday.toString()][verseNumberToday][verseNumberToday.toString()];
verseToday = `${chapterToday}:${... | [
"function generateRandomVerseNumber() {\n\n let verseNumber = null;\n\n // find the day of the month that we are working \n // with within the suitableVersesPool object\n for (let key in suitableVersesPool) {\n if (key.endsWith(GMT_dayOfMonth)) {\n todaysChapterArray = suitableVersesPool[key];\n };\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getCategoryNameAtIndex params: index 0, 1, or 2 for the left, center, or right bar respectively; shouldUpvote true if an upvote action was executed successfully and the chart needs to be updated; newNScore the new N Score to update the chart with, if any Recalculates the category scores, n score, and number of upvotes/... | function reloadChart(index, shouldUpvote, newNScore) {
if(shouldUpvote) {
options.upvotes[index]++;
} else {
options.downvotes[index]++;
}
nScore = newNScore;
options.categoryScores[index+1] = options.upvotes[index] / options.downvotes[index];
c3Char... | [
"function voteClick(index, isUpvote) {\n var bar = getBarContainerAtIndex(index);\n var voteType = isUpvote ? \"upvote\" : \"downvote\";\n var updatedNScore = !_.contains(votingPermissions, false) ? nScore + 1 : nScore;\n\n votingPermissions[index] = false;\n toggleTooltips(\"top\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a "sentence node" and a grammar, expand the sentence's first realizable nonterminal and return the resulting list of sentence nodes (which may be empty). Each sentence node's "step" member is incremented and its "nonterminals" member adjusted. | function expandSentenceNode(node, grammar) {
var i, j;
var expanded = [];
var nonterminals = grammar.calculate("grammar.nonterminals");
var unrealizable = grammar.calculate("grammar.unrealizable");
var sentence, replacement, nonterminalCount;
// expand the first realizable nonterminal.... | [
"function describeAndReduceProductions(nonterminal, replacements) {\n if (isCompressable(replacements)) {\n if (replacements.length == 2) {\n // Use syntax A|B where B = A+1, meaning 'Number A or number B'\n return [`<span class=\"nonterminal\">${nonterminal}</span> ${ARROW} ${trimICs(replacements[0][... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by Java9ParserinferredFormalParameterList. | enterInferredFormalParameterList(ctx) {
} | [
"exitInferredFormalParameterList(ctx) {\n\t}",
"FormalParameterList() {\n const params = [];\n\n do {\n params.push(this.Identifier());\n } while (this._lookahead.type === \",\" && this._eat(\",\"));\n\n return params;\n }",
"enterVariableDeclaratorList(ctx) {\n\t}",
"enterMultiVariableDecla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The PostsDAO must be constructed with a connected database object | function PostsDAO(db) {
"use strict";
if (false === (this instanceof PostsDAO)) {
console.log('Warning: PostsDAO constructor called without "new" operator');
return new PostsDAO(db);
}
var posts = db.collection("posts");
this.insertEntry = function (title, body, author, channels, cre... | [
"static get db(){\n throw new Error(`Model.db getter is abstract and must be implemented by subclasses`)\n }",
"constructor(dbUrl) {\n\t\tthis.dbURL = dbUrl\n\t\tthis.client = null\n \tthis.db = null\n\n\t\tthis.Mongo_Collections = []\n\n\t\tthis.content_mongo = []\n\t\tthis.content = new Map()\n\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[MSOSHARED] 2.3.7.8 FileMoniker TODO: all fields | function parse_FileMoniker(blob) {
blob.l += 2; //var cAnti = blob.read_shift(2);
var ansiPath = blob.read_shift(0, 'lpstr-ansi');
blob.l += 2; //var endServer = blob.read_shift(2);
if(blob.read_shift(2) != 0xDEAD) throw new Error("Bad FileMoniker");
var sz = blob.read_shift(4);
if(sz === 0) return ansiPath.repla... | [
"function FileInfo() {\n}",
"function File() {\n \n /**\n The id of the file (if stored in the FC).\n * @name File#id\n * @type number\n * @readonly\n * @throws READ_ONLY_PROPERTY when setting the property is attempted\n */ \n this.prototype.id = undefined; \n /**\n The... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make an xhr request using settings. | function populateRequest(xhr, request, settings) {
if (request.contentType !== void 0) {
xhr.setRequestHeader('Content-Type', request.contentType);
}
xhr.timeout = settings.timeout;
if (settings.withCredentials) {
xhr.withCredentials = true;
}
// W... | [
"function xDomainAJAX (url, settings) {\n jQueryRequired();\n $.support.cors = true; // enable x-domain\n if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && XDomainRequest) {\n // use ms xdr\n var xdr = new XDomainRequest();\n xdr.open(settings.type, url + '?' + $.param(settings.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers an general handler for page visibility. | listenForPageVisibility_() {
this.client_.makeRequest(
MessageType_Enum.SEND_EMBED_STATE,
MessageType_Enum.EMBED_STATE,
(data) => {
this.hidden = data['pageHidden'];
this.dispatchVisibilityChangeEvent_();
}
);
} | [
"addVisibilityListeners() {\n document.addEventListener('visibilitychange', this.updateVisibility);\n this.updateVisibility();\n }",
"processPage() {\n this.logger.debug(`${this}start observing`)\n $('head').appendChild(this.stylesheet)\n this.insertIconInDom()\n this.observePag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
antennaCount: 15, rangeKm: 0.12, name: "Zyxel" | display() {
console.log(`ะญัะพ ัะพััะตั ${this.name}, ะดะฐะปัะฝะพััั(ะบะผ) ${this.rangeKm}, ัะธัะปะพ ะฐะฝัะตะฝะฝ ${this.antennaCount}`);
} | [
"function maxATA(mix)\n{\n if (!mix)\n return(1.6);\n else if (mix.shortName() == \"21/35\")\n return(1.42);\n else if (mix.shortName() == \"35/25\")\n return(1.63);\n else if (mix.Type == \"Oxygen\")\n return(1.61);\n else\n return(1.6);\n}",
"function mapBeaconRSSI(rssi)\n{\n\tif (rssi >= 0)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether the number of selected elements matches the total number of rows. | isAllSelected() {
var _a;
const numSelected = ((_a = this.selection) === null || _a === void 0 ? void 0 : _a.selected.length) || 0;
const numRows = this.data.length;
return numSelected === numRows;
} | [
"get numberOfResultsIsValid() {\n return this._isPositiveNumber(this.state.numberOfResults);\n }",
"getSelectedCount()\n {\n return Object.keys(this._selectedItems).length;\n }",
"function hasAllColumnsSelected() {\n var allSelected = true;\n for( var i = 0; i < vm.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse out the name / sector / checksum from a room description string | function parseRoom(room){
var parts = room.split("-").map( (part) => { return part.replace("]", "").split('[') } );
var name = parts.slice(0, parts.length-1);
name = name.reduce( (a, b) => { return a+b});
var sector = parts[parts.length-1][0];
var checksum = parts[parts.length-1][1];
retur... | [
"function parseLocationInfo(location) {\n for (const key in LOCATIONS) {\n const abbr = location.substring(0, key.length)\n if (key.toLowerCase() == abbr.toLowerCase()) {\n const room = location.substring(key.length).trim()\n const { name, num } = LOCATIONS[key]\n return `(${num}) ${location} ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(add100(100)) console.log(add100(102)) console.log(add100(200)) 2. write a function where it will divides the number by 5 | function divByFive(num){
return num/5
} | [
"function divisionBy5(num) {\n\treturn (num / 5);\n}",
"function multipleOfFive(num){\n return num%5 === 0 \n}",
"function five (num) {\n if (num>=5) {\n return \tparseInt(num/5)+five(parseInt(num/5));\n }\n else {\n return 0;\n }\n }",
"function divBy4(nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A reference to the appheader element. | get header() {
return (0, _polymerDom.dom)(this.$.headerSlot).getDistributedNodes()[0];
} | [
"function ELEMENT_HEADER$static_(){LinkListBEMEntities.ELEMENT_HEADER=( LinkListBEMEntities.BLOCK.createElement(\"header\"));}",
"function anchorHeader() {\n return tree => {\n visit(tree, 'element', node => {\n if (node.tagName.match(/h\\d/)) {\n node.properties.size = node.tagName;\n node... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Output a type's schema, including defaults. | function show(type) { console.log(type.schema({exportAttrs: true})); } | [
"function mapTypeToSchema(p) {\n\tvar output;\n\tswitch (p) {\n\tcase \"Place\":\n\t\toutput = \"http://schema.org/Place\";\n\tbreak;\n\tcase \"Organization\":\n\t\toutput = \"http://schema.org/Organization\";\n\tbreak;\n\tcase \"Person\":\n\t\toutput = \"http://schema.org/Person\";\n\tbreak;\t\n\tdefault:\n\t\tout... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
edit_textarea function gets the element of a keyboard array that corresponds to the virtual_keyboard_option from the index parameter and decodes the element and passes returned output to add_character_move_cursor. It also resizes the textarea as needed. index parameter: index of the keyboard arrays (arrays ending in ut... | function edit_textarea(index) {
if (virtual_keyboard_option == "lowercase_alphabet") {
add_character_move_cursor(String.fromCharCode(lowercase_letter_comma_period_utf_8_array[index]));
} else if (virtual_keyboard_option == "uppercase_alphabet") {
add_character_move_cursor(String.fromCharCode(uppercase_letter_... | [
"function input_character_keys(key_array_index, event_type, character_key_index, key_code) {\r\n\tkey_array[key_array_index].addEventListener(event_type, function(event) {\r\n\t\tif (event_type == \"keydown\" && document.getElementById(\"mirrored_textarea\") != document.activeElement) {\r\n\t\t\tif (event.key === ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send a mouse event: regular/utf8: ^[[M Cb Cx Cy urxvt: ^[[ Cb ; Cx ; Cy M sgr: ^[[ Cb ; Cx ; Cy M/m vt300: ^[[ 24(1/3/5)~ [ Cx , Cy ] \r locator: CSI P e ; P b ; P r ; P c ; P p & w | function sendEvent(button, pos) {
var term = ace.session.term;
// term.emit('mouse', {
// x: pos.x - 32,
// y: pos.x - 32,
// button: button
// });
if (term.vt300Mouse) {
// NOTE: Unstable.
// http... | [
"function sendMouse() {\n document.addEventListener(\"mousemove\", sendSomeData);\n document.addEventListener(\"click\", sendClick);\n document.addEventListener(\"keypress\", sendKey);\n}",
"function mousemove(e) {\n var ifrPos = eventXY(e) // mouse from iframe origin\n var xyOI = iframeXY(iframe) //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate answers count, there should be at least 2 answers selected | function isAnswersCountValidOnSubmit() {
var countValues = 0;
for( var i=0; i < $scope.form.masterAnswers.length; i++ ) {
if ($scope.form.masterAnswers[i].checked == true) {
countValues++;
}
}
if (countValues < 2) {
return false;
... | [
"function validateAnswer(){\n let userChoice = this.value\n let correctAnswer = questions[questionIndex].answer\n if (userChoice !== correctAnswer){\n timeRemaining -=10\n }\n questionIndex++\n generateQuestion();\n}",
"function validateInstructionChecks() {\n \n hideElements(); \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
////////////////////////////////////////////END: remove ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// /////////////////////////"randInt" returns a random integer between 0 and a (inclu... | function randInt (a) {
r = Math.random ()
for (var i = 0; a +1 ; i++) {
if (r < (i / (a + 1))) {
return i - 1
}
}
} | [
"function randomInteger(a, b) {\n let min, max;\n\n if (!arguments.length) {\n min = 0;\n max = 2;\n } else if (arguments.length === 1) {\n min = 0;\n max = a;\n } else {\n min = a;\n max = b - a;\n }\n min = Math.ceil(min);\n max = Math.floor(max);\n\n return Math.floor(Math.random() * ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserxml_passing_clause. | visitXml_passing_clause(ctx) {
return this.visitChildren(ctx);
} | [
"visitSupplemental_plsql_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitFrom_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitCompiler_parameters_clause(ctx) {\n\t return this.visitC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to modify a ability table with a value | function modifyAbilityTable(abilityTableName, rowName, value) {
getAbilityTable(abilityTableName).rows.namedItem(rowName).cells[1].innerHTML = value;
} | [
"function abilityModifier(ability){\n return Math.floor((ability - 10)/2)\n}",
"function setTablePolicy(table, name, options, _) {\n var setPolicySettings = createTablePolicySetting(options);\n setPolicySettings.resourceName = interaction.promptIfNotGiven($('Table name: '), table, _);\n setPolicySetti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use this to assert unreachable code. | function unreachable() {
throw new AssertionError("unreachable");
} | [
"function assertNever(theValue) {\n throw new Error(\"Unhandled case for value: '\".concat(theValue, \"'\"));\n }",
"function unreached_func(test, desc) {\n return test.step_func(function() {\n assert_unreached(desc);\n });\n}",
"function failedTestFn() {\n throw new Error('test failed... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update Var and Var_Value to File If var existed, then replace else create new one. Not modify | function Walley_Update_Var_And_Var_Value_To_Var(struct_var, var_name, var_value){
// printf("#### Walley_Update_Var_And_Var_Value_To_File ####\n");
//printf("var_name "++" var_value "++"\n",var_name,var_value);
var var_value_type = variableValueType(var_value);
var has_same_var_name = Var_Existed(stru... | [
"function replaceSave(oldFile, newFile, oldStr, newStr) {\r\n\tvar fr = File.OpenTextFile(oldFile, ForReading);\r\n\toldText = fr.ReadAll();\r\n\tfr.close();\r\n\t\r\n\tnewText = oldText.replace(new RegExp(oldStr, \"g\"), newStr);\r\n\t\r\n\tvar fw = File.OpenTextFile(newFile, ForWriting, true);\r\n\tfw.Write(newTe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a function that takes a string and an integer of i and creates a new array of length i where each value is equal to the string passed in myFunction('sunshine', 3) => ['sunshine', 'sunshine', 'sunshine']; Put your answer below | function buildArray(str, i) {
const newArray = [];
for (var j = 0; j <= i; j++) {
test.push(str);
}
return newArray;
} | [
"function addLetters(n) {\n for (i = 0; i <= 5; i++) {\n newArray.push(n);\n }\n}",
"function create(n){\n var n;\n var arr = [];\n for (i=1; i<=n; i++){\n if (i%2==0 && i%3==0 && i%5==0){\n arr.push(\"yu-gi-oh\");\n }else if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TRAIN FACE FUNCTION ///// trains a user's face | function trainFace(username_email, cb) {
var trained = false;
console.log('training started>>>>>');
// lighting
var a = 180;
var a2 = 0;
var l = setInterval(function() {
matrix.led([{
arc: Math.round(180 * Math.sin(a)),
color: 'blue',
start: a2
... | [
"train() {\n this.settings.classifier.clear();\n this.docs.forEach((doc) => {\n this.settings.classifier.addObservation(this.textToFeatures(doc.utterance), doc.intent);\n });\n if (this.settings.classifier.observationCount > 0) {\n this.settings.classifier.train();\n }\n }",
"async funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calcTarget finds the estimated number of people that should experience an attraction in one hour by looking at the attraction duration, the interval of how long it takes to load and dispatch, the vehicless on the track, and the vehicle capacity | function calcTarget(duration, interval, vehicles, capacity) {
var time = 60 * 60;
var runTime = duration + interval;
var full = capacity * vehicles;
var target = Math.floor(time / runTime * full);
return target;
} | [
"_calculateTargetedSpeed() {\n if (this.mcp.autopilotMode !== MCP_MODE.AUTOPILOT.ON) {\n return;\n }\n\n if (this.flightPhase === FLIGHT_PHASE.LANDING) {\n return this._calculateTargetedSpeedDuringLanding();\n }\n\n switch (this.mcp.speedMode) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a Promise for a Kernel object. Fulfilled when the Kernel is Starting, or rejected if Dead. | function createKernel(options, id) {
return new Promise(function (resolve, reject) {
var kernel = new Kernel(options, id);
var callback = function (sender, status) {
if (status === ikernel_1.KernelStatus.Starting || status === ikernel_1.KernelStatus.Idle) {
kernel.statusC... | [
"_ensure_future() {\n let ptrobj = _getPtr(this);\n let resolveHandle;\n let rejectHandle;\n let promise = new Promise((resolve, reject) => {\n resolveHandle = resolve;\n rejectHandle = reject;\n });\n let resolve_handle_id = Module.hiwire.new_value(resolveHandle);\n let reject_handle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Receives a function that will penalize the relay and tests that call for a penalization, including checking the emitted event and penalization reward transfer. Returns the transaction receipt. | async function expectPenalization (penalizeWithOpts) {
const reporterBalanceTracker = await balance.tracker(reporter)
const relayHubBalanceTracker = await balance.tracker(relayHub.address)
const stake = (await relayHub.getRelay(relay)).totalStake
const expectedReward = stake.divn(2)
// A ... | [
"async function expectPenalization (penalizeWithOpts) {\n const reporterBalanceTracker = await balance.tracker(reporter)\n const relayHubBalanceTracker = await balance.tracker(relayHub.address)\n\n // A gas price of zero makes checking the balance difference simpler\n const receipt = await penal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Notify all matchMedia subscribers of deactivations Note: we must force 'matches' updates for future matchMedia::activation lookups | deactivateAll() {
const list = this.currentActivations;
this.forceRegistryMatches(list, false);
this.simulateMediaChanges(list, false);
} | [
"async deactivate() {\n await super.deactivate();\n\n for (let observer of this.txObservers) {\n await observer.deactivate();\n }\n }",
"disposeSubscriptions() {\n const regex = new RegExp(this._subscribePrefixName);\n\n for (let key in this) {\n if (reg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function adds 1 to the data warehouse once the user creates a widget. | function addOne(widgetID) {
const key = firebase.database();
const update = key.ref("state");
if (widgetID === "wid1") {
update.update({
notes_value: 1
});
} else if (widgetID === "wid2") {
update.update({
news_value: 1
});
} else if (widgetID === "wid3") {
update.update({
... | [
"function setActiveWidget(type) {\n switch (type) {\n // if measure distance is clicked\n case \"distance\":\n activeWidget = new DistanceMeasurement2D({\n viewModel: {\n view: view,\n mode: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If state name is "Q0" then it returns 0 in integer as state number | getStateNumber(){
var temp = this.name.slice(1,this.name.length);
return(parseInt(temp));
} | [
"function getIndexQ() {\n for (let i = d.length - 1; i >= 0; i--) {\n if (d.substring(i, i + 1) === 'Q') {\n return i\n }\n }\n return 0\n }",
"function getStateLabel(){\n\t\t/*jshint validthis:true */\n\t\tif (! this.state){\n\t\t\treturn \"off\";\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
const data = genData(); | function genData(init) {
const tempData = init ? [] : data;
let i = 10;
while (i--) {
tempData.push({ a: `a${i}`, b: `b${i}่ฐๅ็้ฝๆฏ`, c: `c${i}`, d: `d${i}` })
}
return tempData;
} | [
"function generateData( filepath )\r\n\t\t{\r\n\t\t\tvar dataObj = new datauri( filepath );\r\n\r\n\t\t\treturn {\r\n\t\t\t\tdata: dataObj.content,\r\n\t\t\t\tpath: filepath\r\n\t\t\t};\r\n\t\t}",
"function getSeedData() {\n\n var data = {\n teamID: 'LAA',\n lgID: 'LA',\n yearID: '2014',\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We give this strategy a name, and store a history of interactions with bandits. | constructor(bandits) {
this.name = "Strategy";
this.history = bandits.map((bandit) => {
return {
bandit,
attempts: 0,
totalRewards: 0,
};
});
} | [
"function record(type, args){\n var insert_index = history_index;\n\n //when history_length is not zero, enforce ring history\n if(configs.history_length !== 0){\n insert_index = history_index % configs.history_length;\n }\n\n history[insert_index] = {\n typ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
slide component into screen from top on mount, using gsap | componentDidMount(){
let t1 = gsap.timeline({repeat: 0, delay: 0, repeatDelay: 1});
t1.from('#photoSlider', {
duration: 1,
y: -500,
ease: 'power1'
});
} | [
"transitionToDemoContainer() {\n this.hideElement(\n this.homeScreen[\"home-container\"],\n true,\n this.demoScreen[\"demo-container\"]\n )\n this.startDemo()\n }",
"setStickToCenterTop() {\n this.logger.debug('setStickToCenterTop');\n this.view.get$item().stickToCenterTop(this.cont... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is used if the binding provider doesn't include a getBindingAccessors function. It must be called with 'this' set to the provider instance. | function getBindingsAndMakeAccessors(node, context) {
return makeAccessorsFromFunction(this['getBindings'].bind(this, node, context));
} | [
"function addBindingProperty(e)\n {\n if(!e.binding)\n {\n e.binding = ko.dataFor(e.target);\n }\n\n return e;\n }",
"function checkBindings () {\n addLog('checkBindings() was Triggered');\n // if dataBoundNodes has elements in it, loop through each one a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
THREEJS AND GUI FUNCTIONS Initialisation of Scene, Camera, Renderer, Controls and Map | function init() {
camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10000);
camera.position.z = 700;
camera.up.set(0, 0, 1);
console.log("initialisation", camera)
scene = new THREE.Scene();
createMap();
renderer = new THREE.WebGLRenderer({
antialias: true,
... | [
"init() {\n\t\t'use strict';\n\t\tthis.createRenderer();\n\t\tthis.createScene();\n\n\t\tthis.clock = new THREE.Clock;\n this.clock.start();\n\n\n\t\twindow.addEventListener(\"keydown\", KeyDown);\n window.addEventListener(\"keyup\", KeyUp);\n\t}",
"function initScene() {\n gScene = new THREE.Sce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace number in the param's name like 'floor_plans[0][image]' | function trx_addons_options_clone_replace_index(name, idx_new) {
name = name.replace(/\[\d\]/, '['+idx_new+']');
return name;
} | [
"function ElemListView_setInfo(theInfo) {\n var currInfo, currName = '';\n with (this) {\n for (var i=0; i < theInfo.length; i++) {\n if (i % (imagesPerName+1) == 0) {\n currName = theInfo[i];\n currInfo = '';\n for (var j=0; j < imgInfo.length; j++)\n if (currName == imgInfo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function updates the card based on the shortnotes received. updates headers and icons and also moves to correct bucket | updateCardShortNotes (cardData) {
let _id = '#' + cardData.recordNumber;
let _shortNotes = cardData.shortNotes;
let waitArray = _shortNotes.waiting;
let withArray = _shortNotes.with;
let existingCard = $(_id);
let _currentDepartment = $('.department-modal .department-select').val();
let curr... | [
"function editCard({ signal }) {\n const newCard = {\n ...objToModify,\n front: formData.front,\n back: formData.back,\n };\n updateCard(newCard, signal).then(() => updateDecks(signal));\n }",
"_updateDomElementContent() {\n const {\n dataId, keyword, source, title, description, u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts description from contents of a readme file in markdown format | function extractDescription (d) {
if (!d) return;
if (d === "ERROR: No README data found!") return;
// the first block of text before the first heading
// that isn't the first line heading
d = d.trim().split('\n')
for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++);
var l = d.length
for (var e = ... | [
"function generateMarkdown(readmeData) {\n return `\n # ${readmeData.projectName}\n ${selectBadge(readmeData.license)}\n ## Description\n ${readmeData.description}\n ## Table of Contents\n * [Installation](#installation)\n * [Usage](#usage)\n * [License](#license)\n * [Contributing](#c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
invite users to a channel | async invite(channelId, users) {
try {
const res = await this.client.conversations.invite({
channel: channelId,
users,
});
} catch (err) {
console.error(err);
}
} | [
"async inviteUser () {\n\t\tthis.log('NOTE: Inviting user under one-user-per-org paradigm');\n\t\tconst inviterClass = UserInviter;\n\t\tthis.userInviter = new inviterClass({\n\t\t\trequest: this,\n\t\t\tteam: this.team,\n\t\t\tdelayEmail: this._delayEmail,\n\t\t\tinviteType: this.inviteType,\n\t\t\tuser: this.user... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `CorsConfigurationProperty` | function CfnBucket_CorsConfigurationPropertyValidator(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 object, but recei... | [
"function CfnBucket_CorsRulePropertyValidator(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 object, but rec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable the web audio listener and setup the stats page. | async enable (app, statsdiv = null) {
this.app = app
this.config = this.app.config
this.detector = await getPitchDetector(this.comparePitch)
if (statsdiv) {
this.stats = new AudioStatsDisplay(statsdiv)
this.stats.setup() // reveal stats page
}
// Get the audio context or resume if... | [
"function initAudio() {\n\n // Default values for the parameters\n AudBuffSiz = 4096;\n AudAmplify = 0.02;\n AudAmpScale = 0.8; // 1.3 is good to emphasise \"peakiness\", 0.5 good to \"smooth\" the sounds out a bit\n AudMinFreq = 30.0; // In Hz\n AudMaxFreq = 900.0;\n\n AudioCtx = new AudioContext();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add styling to logo Element incase its provided by the config | _setLogoStyle(element, configGroupIndex) {
Object.keys(this._config.configGroups[configGroupIndex].logoStyle).forEach((key) => {
element.style[key] = this._config.configGroups[configGroupIndex].logoStyle[key];
});
} | [
"_applyConfigStyling() {\n if (this.backgroundColor) {\n const darkerColor = new ColorManipulator().shade(-0.55, this.backgroundColor);\n this.headerEl.style['background-color'] = this.backgroundColor; /* For browsers that do not support gradients */\n this.headerEl.style['background-image'] = `li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create data sources and clear tile cache if necessary | createDataSources (config) {
// Save and compare previous sources
this.last_config_sources = this.config_sources || {};
this.config_sources = config.sources;
let last_sources = this.sources;
let changed = [];
// Parse new sources
this.sources = {}; // clear previ... | [
"finalize() {\n for (const tile of this._cache.values()) {\n if (tile.isLoading) {\n tile.abort();\n }\n }\n this._cache.clear();\n this._tiles = [];\n this._selectedTiles = null;\n }",
"function resetData() {\n specialNodesMap = {};\n pipelinedStageInfo = {};\n pipelineNodeInf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the Web3Handler's state given this is a legacy dapp browser (with window.web3 set but not window.ethereum). | async updateLegacy() {
// If the current provider isn't web3.currentProvider, set to that.
if (this.provider !== window.web3.currentProvider) {
console.log("Setting provider to web3.currentProvider [legacy].");
this.updateState("provider", window.web3.currentProvider);
this.updateState("l... | [
"_setOriginWeb3Instance() {\n const oThis = this,\n wsProvider = oThis.ic().configStrategy.originGeth.readOnly.wsProvider;\n\n oThis.web3Instance = web3Provider.getInstance(wsProvider).web3WsProvider;\n }",
"_setAuxWeb3Instance() {\n const oThis = this,\n wsProvider = oThis.ic().configStrategy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ISERROR returns true when the value is an error. | function ISERROR(value) {
return ISERR(value) || value === error$2.na;
} | [
"function ISERR(value) {\n return value !== error$2.na && value.constructor.name === 'Error' || typeof value === 'number' && (Number.isNaN(value) || !Number.isFinite(value));\n}",
"get isError() {\n return (this.flags & 4) /* NodeFlag.Error */ > 0\n }",
"function checkErrors(data) {\n\tif (data['er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
indcpaKeypair generates public and private keys for the CPAsecure publickey encryption scheme underlying Kyber. | function indcpaKeypair(paramsK) {
var skpv = polyvecNew(paramsK);
var pkpv = polyvecNew(paramsK);
var e = polyvecNew(paramsK);
// make a 64 byte buffer array
var buf = new Array(64);
// read 32 random values (0-255) into the 64 byte array
for (var i = 0; i < 32; i++) {
... | [
"function generateAndSetKeypair () {\n opts.log(`generating ${opts.bits}-bit RSA keypair...`, false)\n var keys = peerId.create({\n bits: opts.bits\n })\n config.Identity = {\n PeerID: keys.toB58String(),\n PrivKey: keys.privKey.bytes.toString('base64')\n }\n opts.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
just like a clivis, but the first note of the three also works like the second note of the clivis: episema below, unless the middle note also has an episema | positionTorculusMarkings(firstNote, secondNote, thirdNote) {
var hasTopEpisema = this.positionClivisMarkings(secondNote, thirdNote);
hasTopEpisema =
this.positionEpisemata(
firstNote,
hasTopEpisema ? MarkingPositionHint.Above : MarkingPositionHint.Below
) && hasTopEpisema;
return... | [
"notesNotation() {\r\n let actual = this.octaveGenerator();\r\n let notes = [];\r\n\r\n for (let i = 0; i < actual.length; i++) {\r\n if (actual[i].indexOf(\"#\") !== -1 || actual[i].indexOf(\"b\") !== -1) {\r\n notes.push(new VF.StaveNote({ clef: \"treble\", keys: [ac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get list of .ts files | async function getSrcFiles() {
const result = []
const files = await treeToList(SRC_DIR)
for (const f of files) {
if (!f.file) continue
const isTS = f.file.endsWith('.ts') && !f.file.endsWith('.d.ts')
const isVUE = f.file.endsWith('.vue')
if (!isTS && !isVUE) continue
const srcPath = path.joi... | [
"function _getSampleTestFiles () {\n return [{\n path: path.join(testSuitesRelativePath, 'test-txt.txt'),\n contents: Assets.getText(path.join('sample-tests', 'suites', 'test-txt.txt'))\n }, {\n path: path.join(testSuitesRelativePath, 'test-tsv.tsv'),\n contents: Assets.getText(path.join('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates notifications metadata for specific connection. Notifies server about it. | updateNotifications(connectionID, metadata) {
const connection = this.getConnectionByID(connectionID);
if (!connection) {
return;
}
this.startNotifications(connection, metadata);
} | [
"function onConnectionChange() {\n window.console.log('Connection changed. Attempting to syncโฆ');\n syncIfPossible();\n }",
"function update_badge(){\n\t//count unread notes\n\tvar count = 0;\n\tfor(var i in note_data){\n\t\tif(note_data[i].unread){ count++; }\n\t}\n\n\t//get the saved value from... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom Neon Text/Image (Input) Boxes | function NeonInputBoxGenerator() {
this.inputTitles = []
this.inputs = []
this.themeColors = ['#5D0D72','#72F2E5', '#0743C8', '#CB0A88', '#FA0990']
} | [
"function addLabelAndBox(name) {\n addLabel(name);\n addTextBox(name);\n}",
"function BinaryBox(x, y, size, isClickable) {\n this.size = size;\n this.isClickable = isClickable;\n\n\n if (size == BoxSize.LARGE) {\n LargeTextBox.call(this, x, y, size, size, \"0\", isClickable);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method to update the SafeTravel details in the database | static async updateSafeTravel(id, updateSafeTravel) {
try {
const SafeTravelToUpdate = await SafeTravel.findOne({
where: { id: Number(id) },
});
if (SafeTravelToUpdate) {
await SafeTravelToUpdate.update(updateSafeTravel);
return updateSafeTravel;
}
return null;... | [
"function handleUpdateTrip() {\n\t$('main').on('submit','.edit-trip-form', function(event) {\n\t\tevent.preventDefault();\n\t\tconst tripId = $(this).data('id');\n\t\tconst toUpdateData = {\n\t\t\tid: tripId,\n\t\t\tname: $('.trip-name').val(),\n\t\t\tstartDate: new Date($('.start-date').val()),\n\t\t\tendDate: new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function finds the leftmost unit. | function findMostLeft (units) {
if (units.length === 0) {
return null;
}
var mostLeft = units[0];
for (var i = 0; i < units.length; i++) {
var unit = units[i];
if (unit.pos.x < mostLeft.pos.x) {
mostLeft = unit;
}
}
return mostLeft;
} | [
"function getLeftmost( start ) {\n \n var p = start,\n leftmost = start;\n do {\n \n if ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n p = p.next;\n \n } while ( p !== start );\n \n return leftmost;\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a heartbeat packet. | sendHeartbeat() {
this.sendPacket({ op: VoiceOPCodes.HEARTBEAT, d: Math.floor(Math.random() * 10e10) }).catch(() => {
this.emit('warn', 'Tried to send heartbeat, but connection is not open');
this.clearHeartbeat();
});
} | [
"function heartbeat() {\n for (var key in this._nodes) {\n var node = this._nodes[key];\n\n // ensure more` than a second has elapsed since the last send. this works\n // because this use of hrtime returns a tuple of [seconds, nanoseconds] and\n // if the seconds field is non-zero it will evaluate to t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the writing direction of a specified locale | function getLocaleDirection(locale) {
const data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ษตfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ษตLocaleDataIndex"].Directionality];
} | [
"function getLocale () {\n return locale\n}",
"_isRtl() {\n return this._dir && this._dir.value === 'rtl';\n }",
"locale() {\n return d3.formatLocale(this.selectedLocale);\n }",
"textDirectionAt(pos) {\n let perLine = this.state.facet(perLineTextDirection)\n if (!perLine || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specref manages aliases, let's follow the chain to the final spec | function resolveAlias(name, counter) {
counter = counter || 0;
if (counter > 100) {
throw "Too many aliases returned by Respec";
}
if (chunkRes[name].aliasOf) {
return resolveAlias(chunkRes[name].aliasOf, counter + 1);
}
else {
return name;
}
} | [
"function expandAliases(unit) {\n\t\tfor (var key in unit) {\n\t\t\tvar alias = unit[key].alias, i = alias.length;\n\t\t\twhile (i--) {\n\t\t\t\tunit[alias[i]] = unit[key];\n\t\t\t}\n\t\t}\n\t}",
"AliasComponent(string, string, string, string, string) {\n\n }",
"function Alias(props) {\n return __... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ROUTE gets a list of route points, i.e. waypoint coordinates | function getRoutePoints() {
var allRoutePoints = [];
var numWaypoints = $('.waypoint').length - 1;
for (var i = 0; i < numWaypoints; i++) {
var element = $('#' + i).get(0);
element = element.querySelector('.address');
if (element) {
allRoutePoi... | [
"function getWaypoints() {\n var waypoints = [];\n for (var i = 0; i < $('.waypoint').length - 1; i++) {\n var address = $('#' + i).get(0);\n if (address.querySelector('.address')) {\n address = $(address).children(\".waypointResult\");\n address = $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loop black tuts until 20 give chord name in every tuts | function pianoClickBlack(ctx){
//to give chord name for each tuts
//make array and fill with black tuts chord name
var keyName2=["C#","D#","F#","G#","A#","C#'","D#'","F#'","G#'","A#'","C#''","D#''","F#''","G#''","A#''","C#'''","D#'''","F#'''","G#'''","A#'''"];
var keyNameNumber2 = 0;
var textPosition2 = 46;
... | [
"function pianoClickWhite(ctx){\r\n\t//to give chord name for each tuts\r\n\t//make array and fill with white tuts chord name\r\n\tvar keyName=[\"C\",\"D\",\"E\",\"F\",\"G\",\"A\",\"B\",\"C'\",\"D'\",\"E'\",\"F'\",\"G'\",\"A'\",\"B'\",\"C''\",\"D''\",\"E''\",\"F''\",\"G''\",\"A''\",\"B''\",\"C'''\",\"D'''\",\"E'''\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For example:: >>> print_recursively([1, 2, 3]) 1 2 3 | function printRecursively(lst) {
if (lst.length === 1) {
console.log(lst[0]);
} else if (lst.length === 0) {
return;
} else {
console.log(lst.slice(0, 1)[0]);
printRecursively(lst.slice(1));
}
} | [
"function recursiveFunction(someParam) {\n recursiveFunction(someParam)\n}",
"function Recurse(a) { // loop through an array\n\t\n\t\tif (a.constructor == Array) {\n\t\t\tfor (var i = 0; i < a.length; i++)\n\t\t\t\tRecurse(a[i]);\n\t\t}\n\t\telse element.innerHTML += a + \"<br />\";\n\t}",
"printDebug()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method retrieves the apps to be shown on the shelf, based on actual page and how many apps per page. | getAppsToShow(){
var itemsToShow = [];
var init = this.state.pagination.actualPage * this.state.pagination.itemPerPage;
var ending = init + this.state.pagination.itemPerPage;
ending = ending >= this.props.apps.length ? this.props.apps.length : ending;
for(var count = init; count < ending; count++... | [
"function processNextApp() {\n\t\t\tif (appIds.length > 0) {\n\t\t\t\tcurrentApp = appIds.shift();\n\t\t\t\tcurrentPage = firstPage;\n\t\t\t\tqueuePage();\n\t\t\t} else {\n\t\t\t\temit('done with apps');\n\t\t\t}\n\t\t}",
"function initApps(callback) {\n var appMgr = navigator.mozApps.mgmt;\n\n if (!appMgr)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stores the result of the addition of the current Color3 and given one rgb values into "result" | addToRef(otherColor, result) {
result.r = this.r + otherColor.r;
result.g = this.g + otherColor.g;
result.b = this.b + otherColor.b;
return this;
} | [
"add(otherColor) {\n return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);\n }",
"multiplyToRef(color, result) {\n result.r = this.r * color.r;\n result.g = this.g * color.g;\n result.b = this.b * color.b;\n result.a = this.a * co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set Const.prototype.__proto__ to Super.prototype | function inherit (Const, Super) {
function F () {}
F.prototype = Super.prototype;
Const.prototype = new F();
Const.prototype.constructor = Const;
} | [
"function extend(__proto__) {\n for (var key in __proto__) {\n if (hasOwnProperty.call(__proto__, key)) {\n this[key] = __proto__[key];\n }\n }\n return this;\n }",
"function inheritPrototype(subType, superType) {\n var proto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reveal Item on Scroll | function revealItem($container, $item) {
if ($container.length == 0)
return;
if($scrollTop > ($container.offset().top - $windowHeight/1.3 )) {
$item.each(function(i) {
setTimeout(function() {
$item.eq(i).addClass("is-showing");
}, 150 ... | [
"function showHideReadmore() {\r\n\r\n var scrollTop = $('body').scrollTop(); \r\n if (scrollTop >= 0 ) {\r\n if (scrollTop < 100) {\r\n $('.fixed-read-more').fadeIn();\r\n }\r\n else {\r\n $('.fixed-read-more').remove();\r\n }\r\n $('.fixed-read-more').css('bottom', - scr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show the help text in a `pre` element. | function displayHelp() {
const helpNode = document.createElement("pre");
helpNode.className = "help";
helpNode.textContent = helpString;
resultFeed.appendChild(helpNode);
} | [
"function displayHelp() {\n\tlet helpText = require('../html/help.html.js');\n\tcreateDialog('show-dialog', 'Help', helpText['helpDialog'], undefined, true);\n}",
"function helpPlugin() {\n return function(app) {\n\n // style to turn `[ ]` strings into\n // colored strings with backticks\n app.style('co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
normalize the config into a simple list of hex instances | static _flattenConfig(config) {
const items = [];
for (var item of config) {
// expand config specification of hexes in hexBag
// e.g. [new Forest(), [3, () => new Mountain()]]
if (Array.isArray(item)) {
var array = item;
var amount = a... | [
"static _flattenBag(bag) {\n const items = [];\n for (var item of config) {\n // expand config specification of hexes in hexBag\n // e.g. [new Forest(), [3, () => new Mountain()]]\n if (Array.isArray(item)) {\n var array = item;\n var amou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if date is valid for specific month (and year for February). Month: 0 = Jan, 1 = Feb, etc | function isValid(year, month, date) {
if (date < 1) {
return false;
}
if (month === 1 && date > 28) {
return date === 29 && (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0);
}
if (month === 3 || month === 5 || month === 8 || month === 10) {
return date < 31;
}
re... | [
"function isDateValid(day,month,year)\n{\n\tvar okay = true;\n\tvar leapYear = isLeapYear(year);\n\n\tif (day > numDays(month, year))\n\t{\n\t\tokay = false;\n\t}\n\n\treturn okay;\n}",
"function isValidYrMonth(dtStr, FromToCheck){\n\n re = new RegExp(\"/\",\"g\");\n var dtStr = dtStr.replace(re,\"\");\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : saveAutoDAddInfoQuery AUTHOR : Cathyrine C. Bobis DATE : March 15, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : sends query PARAMETERS : | function saveAutoDAddInfoQuery(args,idx){
if(globalDeviceType == "Mobile"){
loading('show');
// }else{
// ajaxLoader('show','Processing Information ...');
}
if(globalInfoType=="XML"){
var urlx = getURL("ConfigEditor2","XML");
}else{
var urlx = getURL("ConfigEditor2","JSON");
}
$.ajax({
url: urlx... | [
"function call_create_query() {\n\t// list every node with class saveQuery:\n\tvar values = '';\n\tvar nodes = dojo.query(\".saveQuery\");\n\n\tfor( var x = 0; x < nodes.length; x++ ) {\n\t\tvar k, v;\n\n\t\tk = nodes[x].id;\n\t\tv = nodes[x].value;\n\t\tif( k == 'name' ) {\n\t\t\tv = encodeURIComponent(v); // make... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Layer mask constant to select default raycast layers. | static set DefaultRaycastLayers(value) {} | [
"static set AllLayers(value) {}",
"function hasLayerMask() {\n var hasLayerMask = false;\n try {\n var ref = new ActionReference();\n var keyUserMaskEnabled = app.charIDToTypeID('UsrM');\n ref.putProperty(app.charIDToTypeID('Prpr'), keyUserMaskEnabled);\n ref.putEnumerated(app.charIDToTypeID('Lyr ')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create monthly conversations chart | function monthlyConversationsChart (result) {
// Get chart data
function getConversationsByChannel (data, channelFilter) {
const channels = {}
// Loops through the data to build the `channels` object
data.forEach(item => {
const channel = item.MessageChannel; const id = item.ConversationID
... | [
"function monthlyTimeChart (result) {\n // Get chart data\n function getMessagesByDay (data, channelFilter) {\n const channels = {}\n\n // Loops through the data to build the `channels` object\n data.forEach(item => {\n const channel = moment(item.MessageTime).format('YYYY-MM-DD'); const id = item.M... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Export Kibana saved objects with the find API | async function findObjects(argv) {
let body = {};
const url = new URL(argv.url);
url.pathname = '/api/saved_objects/_find';
url.search = '?per_page=1000';
for (const type of argv.types) url.search += `&type=${type}`;
url.search;
url.search += argv.search ? `&search=${argv.search}` : '';
logger.verbose(... | [
"async function exportObjects(argv) {\n const url = new URL(argv.url);\n url.pathname = '/api/saved_objects/_export';\n\n const options = {\n method: 'GET',\n headers: {\n 'kbn-xsrf': true,\n },\n };\n\n try {\n const res = await fetch(url, { ...options });\n const body = JSON.stringify(awa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
As lsget, but from localStorage instead of sessionStorage | function lsget(k) {
k = _tokey(k);
let v = JSON.parse(localStorage.getItem(k));
return v;
} | [
"function getLocalStorage() {\n return localStorage;\n}",
"function ssget(k) {\n k = _tokey(k);\n let v = JSON.parse(sessionStorage.getItem(k));\n return v;\n}",
"static getDataFromLS(){\r\n let products;\r\n if(localStorage.getItem('products') === null){\r\n products = []\r\n }else{\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update Compatibility in db when 'Submit' button in Compatibility section is clicked | async function updateCompatibilityInDb() {
// let zodiacType1 = document.querySelector("#compatibilities_zodiac_1").value;
// let zodiacType2 = document.querySelector("#compatibilities_zodiac_2").value;
let compatibilityValue = document.querySelector("#compatibility_value_input").value;
let textValue = ... | [
"function update() {\n console.log(\"UPDATE\");\n // Update ractive components\n updateRactives();\n\n // Upgrade all added MDL elements\n upgradeMDL();\n // Reset listeners on all dynamic content\n resetListeners();\n\n // Initiate save to localStorage on every data change\n saveLocal();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create getPlayers function that will initialize a firebaseObject to store the player icons. | function getPlayers() {
var ref = new Firebase("https://tictacstoe.firebaseio.com/players");
var players = $firebaseObject(ref);
players.tictacs = [];
players.tictacs.push({
type: "spearmint",
image: "images/green-tic.png",
alt: "green"
});
players.tictacs.push({
type: "... | [
"function getPieces() {\n var ref = new Firebase(\"https://tictacstoe.firebaseio.com/pieces\");\n var pieces = $firebaseObject(ref);\n\n pieces.spaces = [];\n\n for (var i = 1; i < 4; i++) {\n for (var j = 1; j < 4; j++) {\n pieces.spaces.push({\n row: i,\n column: j,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Easing function for linear animation. | function linearEase(currentTime, startValue, changeInValue, duration) {
return changeInValue * currentTime / duration + startValue;
} | [
"function ExponentialEase(/** Defines the exponent of the function */exponent){if(exponent===void 0){exponent=2;}var _this=_super.call(this)||this;_this.exponent=exponent;return _this;}",
"function FadeInTransition() {}",
"function Tween(start, end, ms, func) {\n this.start = start;\n this.end = end;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts an ArrayBuffer to a Node.js Buffer. | function toBuffer(arrayBuffer) {
return Buffer.from(arrayBuffer);
} | [
"function buffer2ArrayBuffer(buffer) {\n var buf = new ArrayBuffer(buffer.length);\n var bufView = new Uint8Array(buf);\n for (var i = 0; i < buffer.length; i++) {\n bufView[i] = buffer[i];\n }\n return buf;\n }",
"function toBuffer(data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test the given file has the same contents. It also considers the dependencies. That means it is treated as updated when one of the dependenies is changed even if the target file itself is not. | test(fileName, source) {
// If original source is updated, it should not be the same.
if (!this.cache.test(fileName, source)) {
return false
}
const deps = this.depResolver.getOutDeps(fileName)
// Loop through deps to compare its contents
let isUpdate = false
for (const fileName of d... | [
"function compareAllGeneratedFiles(test, folder) {\n var destPath = path.join(\"temp\", folder);\n utils.ensureDirectoryExists(\"temp\");\n utils.ensureDirectoryExists(destPath);\n\n var srcPath = path.join(srcPrefix, folder);\n var compPath = path.join(compPrefix, folder);\n\n site.build(srcPath, destPath, f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called when the mouse eject button is pressed | function AgarMouseEject(timesToLoop) {
console.log("Ejecting Mass");
if (timesToLoop > 0 && SETTINGS.mouseEject.use){
$("body").trigger(SETTINGS.mouseEject.dek.d);
$("body").trigger(SETTINGS.mouseEject.dek.u);
setTimeout(function(){AgarMouseEject(--timesToLoop)},100);... | [
"function mouseReleased() {\n helmet.released();\n}",
"function eject_OnClick()\n{\n\n try {\n\t\tDVD.Stop();\n\t DVD.Eject();\n\n DVD.ResetState();\n }\n\n catch(e) {\n e.description = L_ERROREject_TEXT;\n\t HandleError(e, true);\n\t return;\n }/* end of function eject_Onclick... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Language: HTTP Description: HTTP request and response headers with automatic body highlighting | function http(hljs) {
const VERSION = 'HTTP/(2|1\\.[01])';
const HEADER_NAME = /[A-Za-z][A-Za-z0-9-]*/;
const HEADER = {
className: 'attribute',
begin: concat('^', HEADER_NAME, '(?=\\:\\s)'),
starts: {
contains: [
{
className: "punctuation",
begin: /: /,
rel... | [
"function createResponse(status, body, contentType) {\n\n\t//remember that the response needs a whole empty line between the headers\n\t//and the body \n\treturn `HTTP/1.1 ${status} OK\\r\\nContent-Type: `+ contentType +`\\r\\n\\r\\n${body}`;\n\n}",
"_debugResponse(uri, status, body) {\n if (this.debugResponse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update component state when suite changes | _suiteChange() {
if (DEBUG) {
console.log('[*] ' + _name + ':_suiteChange ---');
}
this.setState({
suites: getSuitesState()
});
} | [
"function update() {\n console.log(\"UPDATE\");\n // Update ractive components\n updateRactives();\n\n // Upgrade all added MDL elements\n upgradeMDL();\n // Reset listeners on all dynamic content\n resetListeners();\n\n // Initiate save to localStorage on every data change\n saveLocal();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This sample demonstrates how to Update the track data. Call this API after any changes are made to the track data stored in the asset container. For example, you have modified the WebVTT captions file in the Azure blob storage container for the asset, viewers will not see the new version of the captions unless this API... | async function updateTheDataForATracks() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const assetName = "ClimbingMountRa... | [
"updateAudioTrack(state, track) {\n\t\tVue.set(state.self.tracks, 'audio', track)\n\t}",
"updateVideoTrack(state, track) {\n\t\tVue.set(state.self.tracks, 'audio', track)\n\t}",
"static update(id, captionParams){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.captionParams = captionParams;\n\t\tretur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function cretes an array of object pairs that will will be a clearer representation of whats in the cash register. This function will order the return array based on the order of the denom. | function newRegister(cid, denom){
let returnArr = []
denom.forEach(function(pair){
cid.forEach(function(subArray){
if (pair.name == subArray[0]){
let pairObj = {
name: subArray[0],
amount: 0,
value: pair.val
}
let cidAmt = subArray[1];
while (cidAmt > 0){
... | [
"static getCryptoValueArray() {\n var coinArray = [];\n for(var i = 0; i < CryptoExchanger.cryptoExchangerArray.length; i++) {\n coinArray.push({\n name: CryptoExchanger.cryptoExchangerArray[i].getCoinName(),\n population: CryptoExchanger.cryptoExchangerArray[i].getCurrentValue(),\n })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates Link if text is not selected the address inserted into link as text | function createLink() {
if (!validateMode()) return;
var isA = getEl("A",Composition.document.selection.createRange().parentElement());
if(isA==null){
var str=prompt("ะฃะบะฐะถะธัะต ะฐะดัะตั :","http:\/\/");
if ((str!=null) && (str!="http://")) {
var sel=Composition.document.selection.createRange();
i... | [
"function onCreateLink() {\n var selection = window.getSelection();\n var inLink = nodeIsInLink(selection.anchorNode);\n if (!isInNode(selection.anchorNode, \"popuptext\") || selection.isCollapsed && !inLink) {\n window.alert(\"To create a link to another page, first select a phrase in the text.\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions just like apply, but resets the content: the line and column are reversed, and the eaten value is readded. This is useful for nodes with a single type of content, such as lists and tables. See `apply` above for what parameters are expected. | function reset() {
var node = apply.apply(null, arguments)
line = current.line
column = current.column
value = subvalue + value
return node
} | [
"function undoLastMove(column, board) {\n let i = 0\n while(board[i][column] === 0) {\n i++\n }\n board[i][column] = 0\n return board\n}",
"restoreRowPosition() {\n\t\t\tthis.swoosh.restore();\n\t\t}",
"function advance(state, cols) {\n state.line[state.line.length - 1] += cols;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to get highscores from storage and update the dropdown | function getHighscores() {
var highScores = JSON.parse(localStorage.getItem(highScoresLS));
var hsMenu = $("#highscores-menu").children();
for (i=0; i<10; i++) {
var displayItem = hsMenu[i];
var scoredata = highScores[i+1];
displayItem.innerHTML = `#${scoredata.rank} - ${scoredata.us... | [
"function addHighScore(){\n var highScore = getHighScore();\n var score = currentScore;\n highScore.splice(0, 0, score);\n localStorage.setItem('highScore', JSON.stringify(highScore)); \n displayHighScore(); \n }",
"function setHighScore () {\n let highscore = window.localStorage.getItem('high... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Locate a resource by resource id | _findResource(id) {
return this.template.resources.find(res => {
// Simple match on substring is possible after
// fully resolving names & types
return res.fqn.toLowerCase().includes(id.toLowerCase());
});
} | [
"function startResourceGet(id) {\n return { type: START_RESOURCE_GET,\n id: id};\n}",
"lookupRegionByID(id) {\r\n let region = null;\r\n let i = 0;\r\n while (i < this.regions.length && region == null) {\r\n if (this.regions[i].ID === id) {\r\n region = th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Highlight a node by making it bigger and outlining it | function highlightNode(d) {
d3.select("#node_" + d.idx)
.transition().duration(100)
.attr("r",sizes[d.idx]*r*1.3)
.style("stroke",d3.rgb(0,0,0));
} | [
"function highlightNode(nodeId) {\n var node = myDiagram.findNodeForKey(nodeId++);\n // console.log(node);\n if (node !== null) {\n // make sure the selected node is in the viewport\n myDiagram.scrollToRect(node.actualBounds);\n // move the large yellow node behind the selected node to highlight it\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to populate Select(multiSelect) tag with optionset data | function populateSelect(optionSetCollection)
{
var functionName = "populateSelect";
try
{
// clear the multiselect options
$("#multiSelect").empty();
// Bind the multiselect options with the optionset data
for (var i in optionSetCollection)
{
$('#multiSe... | [
"function BindFranchiseeName(dept, customUrlIT) { \n $('.FranchiseeName option').remove();\n $.ajax({ \n type: \"POST\",\n url: customUrlIT,\n data: '{}',\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n success: function (r) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
doValidateSubscriptionForm() Validates the contents of the subscribe form field and returns true if OK, or raises an alert if the email address is missing or not valid. | function doValidateSubscriptionForm(formData) {
var reg = new RegExp(emailregex);
var $theEmailField = $(formData).find('[name=email]');
if ( reg.test($theEmailField.val()) ) {
return true;
} else if ( $theEmailField.val().length ) {
alert(jsStr.tcemailnotvalid.unescapeHTML());
} else {
alert(jsStr... | [
"function add_email_subscribe() {\n\n\tvar email_sub = document.forms[\"subscr\"][\"emails\"].value;\n\tvar checkEmailSub = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/;\n\n\t// It can not be registered if one of the fields is empty\n\tif (email_sub !== \"\") {\n\n\t\tif (!checkEmailSub.test(email_sub)) {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Mutates fp argument | getFieldPaths(fp, state) {
const fps = [];
for (const [index, field] of this.fields.entries()) {
fp.path[fp.last] = index;
fps.push(...field.getFieldPaths(fp, state));
}
return fps;
} | [
"addFile(fileName, value) {\n if (value) {\n const fo = SpigFiles.createFileObject(fileName, {virtual: true});\n fo.spig = this;\n fo.contents = Buffer.from(value);\n return fo;\n }\n const fo = SpigFiles.createFileObject(fileName);\n fo.spig = this;\n\n return fo;\n }",
"_hand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns true if the specified file is a js or json file | function isScriptFile(filename) {
var ext = path.extname(filename).toLowerCase();
return ext === '.js' || ext === '.json';
} | [
"isScriptFile(filePath) {\n return ['.js', '.json'].includes(path_1.extname(filePath));\n }",
"function isjs(x) {\n if (x.match(/readme/gi)) return false;\n var n = x.split('.'),\n ext = n[n.length - 1];\n if (n.length > 1 && ext !== 'js' && ext !== 'txt')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
rectange function to return a rectangle element HTML (div) | function rect( x,y,w,h, color){
var x = x;
var y = y;
var w = w;
var h = h;
var color = color;
//defaults
if(x == undefined) x = 0;
if(y == undefined) y = 0;
if(w == undefined) w = 100;
if(h == undefined) h = 100;
if(color == undefined) color = "lightgrey";
rectElem = do... | [
"createSvgRectElement(x,y,w,h){const el=document.createElementNS(BrowserCodeSvgWriter.SVG_NS,'rect');el.setAttributeNS(svgNs,'x',x.toString());el.setAttributeNS(svgNs,'y',y.toString());el.setAttributeNS(svgNs,'height',w.toString());el.setAttributeNS(svgNs,'width',h.toString());el.setAttributeNS(svgNs,'fill','#00000... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add a chat message to the chat log store | async addChatLog(action, user, message) {
this.calendar.addDate(Date.now());
return await this.stores.chat.insert({
type: 'chat',
created: Date.now(),
instanceId: await this.getInstanceId(),
action,
user,
...(message ? {message} : {}),
});
} | [
"async addChat(message){\n //format a chat object\n\n const now = new Date();\n const chat = {\n message : message,\n username:this.username,\n room: this.room,\n created_at : firebase.firestore.Timestamp.fromDate(now)\n }\n\n //save the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check where user in the scroll use getSnapshotBeforeUpdate() instead of using componentWillUpdate | getSnapshotBeforeUpdate(prevProps, prevState) {
const messageListNode = this.messageListRef.current;
// scrollTop height of scrolled part from top
// clientHeight height of appeared part
// scrollHeight height of <MessageList />
// scroll to bottom when we are near it
this.shouldScrollToBottom =... | [
"handleWindowScroll() {\n const sectionHTMLElement = this.sectionHTMLElement.current;\n const { top } = sectionHTMLElement.getBoundingClientRect();\n\n const shouldUpdateForScroll = Section.insideScrollRangeForUpdates.call(this, top);\n if ( shouldUpdateForScroll ) {\n\n this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |