query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
pointer at midpoint arr.length / 2 set min if pointer is smaller than value at arr[pointer] high = pointer larger low = pointer if match set min if low > high return 1 | function indexEqualsValueSearch(arr) {
let min = undefined
let hi = arr.length-1
let lo = 0
while (hi >= lo) {
let mid = lo + Math.floor((hi - lo)/2)
if (arr[mid] === mid) {
min = mid
if (mid > 0 && arr[mid-1] !== (mid-1)) return min
hi = mid - 1
}
else if (mid < arr[mid]) hi ... | [
"static search (arr, goal) {\n let low = 0\n let high = arr.length - 1\n\n while (low != high) {\n let mid = Math.round((low + high) / 2)\n\n if (goal <= arr[mid]) {\n high = mid - 1\n } else {\n low = mid\n }\n }\n\n return low\n }",
"function findInsertionPoint(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
request for hostBlankingOrdered service, calls 'callback' function | function requestGetBlanking_Ordered(query, callback) {
// var url = hostBlanking + format.queryToURLForm(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date, slotValue_solution);
// var url = hostBlanking_Ordered + format.queryToURLForm(slotValue_name, slotValue_country, sl... | [
"function requestGetBlanking_CompletedOrdered(query, callback) {\n\n\t// var url = hostBlanking + format.queryToURLForm(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date, slotValue_solution); \n\n\t// var url = hostBlanking_Ordered + format.queryToURLForm(slotValue_name, slotVal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is used to print a category for debugging | function printCategory(cat){
var i;
//check that |cat| is not null
if(areReqdArgsNull(cat)){
return;
}
document.write("Category: name = " + cat.name + "; Options: [" +cat.options[0]);
for(i=1; i<cat.options.length; i++){
document.write(", " + cat.options[i]);
}
document.write("]; Type... | [
"showCategories() {\n for (var i = 0; i < this.categories.length; i++) {\n this.log.debug(this.categories[i].topic + ' - ' + this.categories[i].pattern.text_pattern);\n }\n }",
"get categoryString() {\r\n return this.category;\r\n }",
"function Category() {\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filters the given data to only include songs by the given artist | function filterData(data, artist) {
return data.filter(function(a) { return a.artist === (artist); });
} | [
"function filterData(data, artist) {\n return data.filter(function (a) { return a.artist === (artist); });\n }",
"function filterDataArtist(startYear, endYear, artist) {\n return data.filter(function(a) {\n return splitArtist(a.artist).includes(artist) &&\n validYear(startYear, endY... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`lerna version` pushes a tag per each new package version. However we need a single unique tag to trigger the `lerna publish fromgit` on circleCI This is why we delete and push the `RELEASE` as part of our release process. | async function triggerNPMPublish() {
const allTags = (await git.tags()).all;
if (includes(allTags, "RELEASE")) {
console.log("deleting old local<RELEASE> Tag");
await git.tag(["-d", "RELEASE"]);
}
console.log("creating new local <RELEASE> Tag");
await git.tag(["RELEASE"]);
try {
console.log("tr... | [
"async function triggerGHReleasesPublish() {\n const log = await git.log();\n const latestCommit = log.latest;\n const vscodeExtResult = /xml-toolkit@\\d+(?:\\.\\d+)*/.exec(latestCommit.body);\n if (vscodeExtResult !== null) {\n const vscodeExtTag = vscodeExtResult[0];\n console.log(`deleting remote tag $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fadeBands() Fades the similarity bands on the page | function fadeBands(){
d3.selectAll('path.band')
.each(function(d){
// Bring the non-faded bands to the front
if(d.a.faded() || d.b.faded()){ d3.select(this).moveToBack(); }
// if(!d.a.faded() && !d.b.faded()){ d3.select(this).moveToFron... | [
"function updateBands(d){\n var dirty = d == undefined ? [] : d;\n _similarityBands = createBands(dirty);\n drawBands();\n setMasks();\n }",
"function drawBands(){\n var path = d3.svg.diagonal()\n .source(function(d){\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Waits for the delete view to appear | function waitForCategoryDeleteView() {
browser.wait(categoryDeleteView.isPresent.bind(categoryDeleteView), 3000, "Timeout waiting for view to render");
} | [
"confirmDeleteSubstance () {\n const removeBtn = browser.element(`#removeBtn`);\n waitForNav(function () {\n removeBtn.click();\n });\n }",
"processDeleteList() {\n window.todo.view.showDialog();\n }",
"delete(id) {\n return __awaiter(this, void 0, void 0, fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starting with the first interactive element, initialize the load sequence | function initializeLoadSequence(){
$.logEvent('[dataVisualization.core.initializeLoadSequence]');
// Initialize the first component within the configuration
var toInitializeObj = dataVisualization.configuration.loadSequence[0];
// Initialize the required functionality for the desired mod... | [
"function createLoadSequence(){ \r\n // Once all of the DOM injection is complete, create the required load sequence\r\n var loadSequence = [];\r\n \r\n $('.interactive').each(function(index){ \r\n loadSequence.push({id: $(this).attr('id')});\r\n });\r\n \r\n // Set the global load ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds all positions in a configured mask, where the given fieldname is rendered | findFieldPaths(fieldname) {
return this.registers
.flatMap((register, regIdx) =>
register.get('fields')
// map before filter to preserve original index values
.map((field, fieldIdx) => [field.get('attribute'), fieldIdx])
.fi... | [
"function MaskField() {\n this.literal = false;\n this.input = false;\n \n //Returns the index up to where the texts matches this input\n this.upTo = function(text, fromIndex) {\n return -1;\n }\n}",
"function importPartialToMask(field, data)\r\n{\r\n\tvar temp = field.value.substring(0, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ method call the service to fetch all BPUs / / list of all BPUs | function GetAllBPU() {
userService.getAllBPU().success(function (data) {
$scope.bpuList = data;
//to disable "All" option from DDL
angular.forEach($scope.bpuList, function (value, key) {
if (value.BPUId == 0) {
valu... | [
"static fetchAll(cb) {\n getProductsFromFile(cb);\n }",
"function loadBets() {\n $scope.users = null;\n betService\n .getBets($scope.pageInfo)\n .$promise.then(function (result) {\n $scope.bets = result.data;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function newTechspecEvent() It will be called when clicking 'New' process in event tab on techspec screen. | function newTechspecEvent()
{
var url = "new";
var htmlAreaObj = _getWorkAreaDefaultObj();
var objAjax = htmlAreaObj.getHTMLAjax();
var objHTMLData = htmlAreaObj.getHTMLDataObj();
sectionName = objAjax.getDivSectionId();
//alert("sectionName " + sectionName);
if(objAjax && objHTMLData)
{
if(!i... | [
"function dltTechspecEvent()\r\n{\r\n\tvar url = \"delete\";\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n\r\n\tsectionName = objAjax.getDivSectionId();\r\n\t//alert(\"sectionName \" + sectionName);\r\n\tif(ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remover un item a un listbox elementId: ID del control que representa al ListBox Nota: solo removera el item si esta seleccionado | function listboxRemoveItem(elementId) {
var lbox = document.getElementById(elementId);
if (lbox==null) {
alert("ERROR (listboxRemoveItem): no existe un elemento con ID: " + elementId);
return;
}
if (lbox.selectedIndex>=0)
lbox.remove(lbox.selectedIndex);
} | [
"function listboxClear(elementId) {\n\n\tvar lbox = document.getElementById(elementId);\n\tif (lbox==null) {\n\t\talert(\"ERROR (listboxClear): no existe un elemento con ID: \" + elementId);\n\t\treturn;\n\t}\n\t\n\twhile (lbox.length>0) {\n\t\tlbox.remove(0);\n\t}\n\t\n}",
"function removeId(listId) {\n if( $(l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update marker by unique ID | static updateMarker(markerId) {
} | [
"handleMarkerClick(marker) {\n this.props.updateId(marker.id);\n }",
"function update_marker(id, lat, lng) {\n\tconsole.log(\"update marker!\");\n\n\tif (id in drone_dict && drone_dict[id] != null) {\n\t\tvar marker = drone_dict[id];\n\t\tmarker.setPosition({lat: lat, lng: lng});\n\t} \n\telse {\n\t\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The purpose of this method is to get relation count linked with particular role | function getRelationCount(roleName,boxName,accessor){
var mainBoxValue = getUiProps().MSG0039;
var key = null;
var relationCount =0;
var baseUrl = getClientStore().baseURL;
var objJdcContext = new _pc.PersoniumContext(baseUrl, cellName, "", "");
var objLinkMgr = new _pc.LinkManager(accessor,objJdcContext );
key ... | [
"static getRelationshipCount(relation) {\n if (isArray(relation)) {\n return relation.length;\n }\n return relation ? 1 : 0;\n }",
"function getRelationCount(ruleName,boxName,accessor){\n\tvar mainBoxValue = getUiProps().MSG0039;\n\tvar key = null;\n\tvar relationCount =0;\n\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
END PHASE 2 / waSignupTabHandler() Manages page name, s.events and mbox calls for Signup tab of login page | function waSignupTabHandler(){
wa.pageState="signup";
s.events="event2";
try {
mboxDefine('offermatica-div','mint_signupform_metrics');
mboxUpdate('mint_signupform_metrics');
wa.createMbox=true; //if true, call mboxDefine on first click of 'login' tab
}
catch(err){
/* ignore error */
}
} | [
"function waLoginTabHandler(){\n\twa.pageState=\"login\";\n\tif (curl.indexOf(\"messageid\") >-1) {wa.isMsgId=\"true\";}\t//capture msg id\n\ttry {\n\t\tmboxDefine('offermatica-div','mint_loginform_metrics');\n\t\tmboxUpdate('mint_loginform_metrics');\n\t\twa.createMbox=true;//if true, call mboxDefine on first clic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
True when the token after the mapped position was deleted. | get deletedAfter() {
return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;
} | [
"removeToken (token, tokenKey) {\n tokenKey = this.getTokenKey(token, tokenKey)\n if (this.references[tokenKey] != null) {\n ({ token } = this.references[tokenKey])\n this.updateRefCount(tokenKey, token, -1)\n return true\n } else {\n return false\n }\n }",
"function deleteToken(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(finalScore(inning(), 9)); / Task 4: Create a function called `scoreboard` that accepts the following parameters: (1) Callback function `inning` that you wrote above inningScore??? (2) A number of innings // inningNo and returns the score at each pont in the game, like so: 1st inning: 0 2 2nd inning: 1 3 3rd... | function scoreBoard(inning, inningNo) {
let homeScore = 0;
let awayScore = 0;
for (let i = 1; i <= inningNo; i++) {
homeScore = inning() + inningNo;
awayScore = inning() + inningNo;
console.log(`${i} inning: ${homeScore} - ${awayScore}`)
}
let finalScore = `Final Score: ${homeScore} - ${awaySc... | [
"function scoreboard(callback, numInnings) {\r\n /* CODE HERE */\r\n inningRound = 0;\r\n teamHome = 0;\r\n teamAway = 0;\r\n\r\n for (let i = 0; i < numInnings; i++) {\r\n teamHome = teamHome + callback();\r\n teamAway = teamAway + callback();\r\n ++inningRound;\r\n if (i == 0) {\r\n console.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the Footer JSX view Only if a selected Viewsite exists | render() {
if (this.props.viewsite) {
return (FooterJSX.call(this));
} else {
return null;
}
} | [
"function footerView() {\n const footer = document.querySelector('div.footer');\n if(elementInViewport(footer)) {\n seg.tracker('FOOTER_VIEW', {}, {\n entity_id: null,\n source_title: null,\n audience: null,\n topic: null\n }, {}, {});\n }\n }",
"renderFooter() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::KafkaConnect::Connector.CustomPlugin` resource | function cfnConnectorCustomPluginPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnConnector_CustomPluginPropertyValidator(properties).assertSuccess();
return {
CustomPluginArn: cdk.stringToCloudFormation(properties.customPluginArn),
... | [
"function cfnConnectorPluginPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnConnector_PluginPropertyValidator(properties).assertSuccess();\n return {\n CustomPlugin: cfnConnectorCustomPluginPropertyToCloudFormation(properties.custom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accept zone records or zone ids and print a list of all such records | function main(stdin){
return lines().then(function(zoneIds){
return listRecords(zoneIds)
})
} | [
"function print_zone_list(data)\n{\n if (program.verbose) {\n console.log(util.inspect(data, {showHidden: false, depth: null}))\n } else {\n data.forEach(function(zone) {\n print_zone(zone);\n });\n }\n}",
"function print_zone(zone)\n{\n var id = shortZoneId(zone.Id);\n console.log(id + \"\\t\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the list of variables first declared in this scope. | declaredVariables() {
var v;
return ((function() {
var i, len, ref, results;
ref = this.variables;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
v = ref[i];
if (v.type === 'var') {
results.push(v.name);
}
}
... | [
"declaredVariables() {\r\n\t\t\t\tvar v;\r\n\t\t\t\treturn ((function() {\r\n\t\t\t\t\tvar i, len, ref, results;\r\n\t\t\t\t\tref = this.variables;\r\n\t\t\t\t\tresults = [];\r\n\t\t\t\t\tfor (i = 0, len = ref.length; i < len; i++) {\r\n\t\t\t\t\t\tv = ref[i];\r\n\t\t\t\t\t\tif (v.type === 'var') {\r\n\t\t\t\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
' Name : callGuestOrAccCreationOrLogged ' Return type : none ' Input Parameter(s) : none ' Purpose : This method is used to check Guest/Registered user and call appropriate API method. It is being called from PAY button click. ' History Header : Version Date Developer Name ' Added By : 1.0 19 Feb 2014 UmamaheswaraRao ' | function callGuestOrAccCreationOrLogged() {
if(intervalForServiceFee){
clearIntervalApp(intervalForServiceFee);
}
deActivateCheckoutPayButton();
var registerUser = parseBoolean(localStorage.getItem("registerUser"));
if (!registerUser) {
if (!isGrtr) {
updateUserProfileCheckout();
... | [
"function GuestLogin() { }",
"function registerAsGuest(name) {\n\n console.log('Register as guest');\n\n // Use defined apiKey\n var apiKey = document.getElementById('apiKey').value;\n console.log('apiKey :', apiKey);\n\n // Create user agent\n ua = new apiRTC.UserAgent({... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Searches inside a collection of items by certains string properties, using the given pattern, sorting the results by number of matches, first index and number of recourrences. | searchByStringProperties(options) {
var defaults = {
order: "asc",
limit: null,
keepSearchDetails: false,
getResults: function (a) {
if (this.decorate) {
// add information about which property
for (var i = 0, l = a.length; i < l; i++) {
var item = a[... | [
"search(a) {\n if (!a || !a.length) return a;\n var l = arguments.length;\n if (l < 2) return a;\n var args = _.toArray(arguments).slice(1, l);\n var props = [], x, item, isString = _.isString;\n for (var i = 0, l = a.length; i < l; i++) {\n item = a[i];\n for (x in item) {\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the size of the span's contents. Use the log so that the words don't get ridiculously big. | function setSize(textSpan, textVal){
textSpan.style.color = "rgb(0," + (16 + (2*frequencyMap.get(textVal))) + ", "
+ (30 * frequencyMap.get(textVal)) + ")";
textSpan.style.fontSize = (constantMultiplier* (1+Math.log(frequencyMap.get(textVal)))) + "%";
} | [
"_updateTextSize(size) {\n this['textSize'] = parseInt(size, 10);\n this._targetEl.style.fontSize = this['textSize'] + 'px';\n this._layoutWords();\n }",
"updateSize() {\n const size = this.font.measureText(this.text);\n this.resizeTo(size.width, size.height);\n }",
"function change_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether this question should be processed as a Form Table question or not | function hasTableContext( qId ) {
if ( !qId ) return false;
// if the question is not associated with any form data, then return false
if ( !isFormTableQuestion( qId ) ) return false;
// else, if the question is associated with both form data and non-form data,
// return true if the appropriate field(s) in the... | [
"function isFormTableQuestion(qId){\n\tif ( !qId ) return false;\n\tvar formTableMetaData = getFormTableMetaData( qId );\n\tvar stringified = '' + formTableMetaData[ FORMTABLE_MAPPING_VIEW_TABLEID_INDEX ];\n\treturn !arrayContains( ['null','undefined',''], stringified );\n}",
"function isSimpleFormTableQuestion(q... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if need to remove instance please give the socketuuid name | function removeInstance(objName) {
var index = -1;
instances.forEach(function(obj, i) {
if(!!obj && !!obj.instance.getUUID_Socket && obj.instance.getUUID_Socket() == objName) {
index = i;
}
});
if(index !== -1) {
delete instances[index];
instances.remove(index)
}
} | [
"remove(socket){\n if (this.sockets.hasOwnProperty(socket.id)) {\n var nsp = this.sockets[socket.id].nsp.name;\n delete this.sockets[socket.id];\n delete this.nsps[nsp];\n } else {\n debug('ignoring remove for %s', socket.id);\n }\n }",
"removeWs(uuid){\n this.data.webSockets.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compares the two arrays when the length matches the current round. if player passes test +1 is added to round length and playback starts again. | function compareArrays() {
const theSame = userSequence.length === programSequence.length && userSequence.every((v,i) => v === programSequence[i].audio);
count += 1;
if ((count === currentRound) && (losses === 0) && (playing)) {
console.log(theSame);
if (theSame) {
currentRound += 1;
... | [
"function compareArray() {\n var pAnswersLength = playerAnswers.length;\n for (var i = 0; i < pAnswersLength; i++) \n\t\t{\n\t\t\tif (correctAnswers[i] === playerAnswers[i]) {\n\t\t\t\twin++;\n\t\t\t} else if (playerAnswers[i] === undefined) {\n\t\t\t\tunanswered++;\n\t\t\t} else {\n\t\t\t\tloss++;\n\t\t\t}\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a single bill | async getSpecificBill(bill_id) {
var url = this.baseURL + `116/bills/${bill_id}.json`
var response = await this.call(url)
console.log(response)
return response.data.results[0]
} | [
"function getOneBill(billId) {\n fetch(`api/bills/${billId}`,\n {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${state.token}`\n },\n method: \"GET\"\n })\n .then(response => {\n return response.json()\n })\n .then(res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Override the execute function; if we already have a redirect result, then just return it. | async execute() {
let readyOutcome = redirectOutcomeMap.get(this.auth._key());
if (!readyOutcome) {
try {
const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth);
const result = hasPendingRedirect ? await super.execute... | [
"async execute() {\n let readyOutcome = redirectOutcomeMap.get(this.auth._key());\n\n if (!readyOutcome) {\n try {\n const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth);\n const result = hasPendingRedirect ? await super.execute() : null;\n\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function userTurn() will get the input from the user and check if the user input is not a character, while looping thru the array it will replace the the number with 'x' if the number is a match | function userTurn(){
correctInput = false;
while(correctInput == false){
userChoice = prompt("Pick Number: " + movesArr);
for(var i =0; i < board.length; i ++){
for(var j =0; j < board[i].length;j++){
if (userChoice == board[i][j]){
board[i][j] = "x";
correctInput = true;
... | [
"function turns() {\n if (symbol === \"X\") {\n symbol = \"O\";\n } else {\n symbol = \"X\";\n }\n}",
"function getUserInput() {\n var row = prompt(\"enter a row\");\n var column = prompt(\"enter a column\");\n\n // We had originally set this up because we were\n // prompting th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a new `Counter`. | function Counter() {
this.el = domify('<div class="counter"></div>');
this._digits = [];
this.n = 0;
this.digits(2);
} | [
"function Counter() {\n\t\tutil.assert(this && (this instanceof Counter), \"Counter ctor ::\"\n\t\t\t+ \" error - constructor not called properly\");\n\n\t\t/** See .init() for properties **/\n\t}",
"function mkCounter() {\n return object({\n counter: 0\n }, {\n inc: function(state) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creation an id for each book | function createId() {
var id = $localStorage.booksId;
$localStorage.booksId = $localStorage.booksId + 1;
return id;
} | [
"generateNewLibraryBookId() {\n libraryBookId = libraryBookId + 1;\n return libraryBookId;\n }",
"function makeId() {\n let id = 0;\n if (bookArr.length === 0) {\n id = 1;\n } else {\n id = bookArr.pop().id + 1;\n }\n return id;\n}",
"function createBook(name, style, pages, authorId, id) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The main function makes sure the alarm buzzer and LCD are turned off, then starts checking the ambient temperature using the connected hardware. The custom event `startalarm` is fired, if a possible fire emergency exists, which calls the `alarm()` function. | function main() {
board.reset();
board.bootSounds();
//board.motorCheck();
board.openDamper();
monitorTemperature();
events.on("start-alarm", alarm);
} | [
"function monitorTemperature() {\n var prev = 0;\n \n setInterval(function() {\n var currentTemp = board.getTemperature();\n var currentLight = board.getLight();\n board.message(\"Temperature: \" + currentTemp);\n board.message(\"Light Level: \" + currentLight, 1);\n\n // check if fire alarm shoul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an instance of a pop function for the component represented by the given key. | generatePopFunction(key) {
return () => {
const { disclosureComponentKeys } = this.state;
if (disclosureComponentKeys[disclosureComponentKeys.length - 1] !== key) {
/**
* If the top component key in the disclosure stack does not match
* the key used to generate this function, ... | [
"function popMethod(/*DOM*/ elem, /*string*/ key) {\r\n\t\t// IE doesn't like colon in property names\r\n\t\tkey = key.split(':').join('$');\r\n\r\n\t\tvar method = elem[key];\r\n\t\tif (method) {\r\n\t\t\ttry {\r\n\t\t\t\tdelete elem[key];\r\n\t\t\t} catch (ex) {\r\n\t\t\t\t// sometimes IE doesn't like deleting fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all communes from Place ordered by zip code. | getAllCommunes(): Promise<Place[]> {
return axios.get(url + "/getCommunes");
} | [
"getAllCommunes (callback: mixed) {\n\t\tsuper.query(\n\t\t\t\"SELECT * FROM Place ORDER BY zipcode ASC\",\n\t\t\t[],\n\t\t\tcallback\n\t\t);\n\t}",
"function getPlaces(){\n // Get places : this function is useful to get the ID of a PLACE\n // Ajust filters, launch search and view results in the log\n // https... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
breakPointMatch The things which happen when the layout transitions from bigscreen to smallscreen mode | breakPointMatch() {
ResponsiveLayoutManager.switchSection("left");
ResponsiveLayoutManager.toggleToggleButton(true);
} | [
"function mobileBreakPointCheck() {\r\n\t\t\t\r\n\t\t\tvar $mobileBreakpoint = ($('body[data-header-breakpoint]').length > 0 && $body.attr('data-header-breakpoint') != '1000') ? parseInt($body.attr('data-header-breakpoint')) : 1000;\r\n\t\t\tvar $withinCustomBreakpoint = false;\r\n\t\t\t\r\n\t\t\tif ($mobileB... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CORE FUNCTIONS INIT called when user initiates a block resize | function init(ev){
ev.preventDefault();
// Set min-height on block to make room for resize controls
$thisBlock.css('min-height', settings.resizeControlsHeight);
// Update screensize UI based on current window dimensions
updateScreenSizeUI();
// Show resize controls and hide content but maintain ... | [
"initBlock () {\n this.blockRect = this.block(this.getGuidingRect())\n }",
"function initResizeHandler(){\r\n lyteboxResizeHandler();\r\n}",
"resizeInitiate() {\n this.resizeEnd();\n // wrap a resize start event handler\n this.resizeStartHandler = (e) => {\n this.resizeStar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assertion of expected full conversion result with 'input' & 'target' strings, expected result number, numerical tolerance, OPTIONAL expected warn number there are six possible outcomes: we expectWarn or we don't, AND we get ok, warn or err normally only one test is logged. If we expectWarn and we get ok or warn, two te... | function fullTest(input, target, expectNum, tol, expectWarn) {
const label = `${input}${target ? ' > '+target : ''} ≅ ${String(expectNum)}`
res = convert.fullConversion(input, target);
(res.status === 0 || (expectWarn && res.status < 2)) ? eqApx(res.output.num, expectNum, tol, label) : log(false, res.messages[0]... | [
"function verify (expected, converter, input) {\n let argArr = Object.values(arguments)\n let actual, message = ''\n if (arguments.length >= 3) {\n actual = converter.apply(this, argArr.slice(2))\n message = 'Input: '\n argArr.slice(2).forEach(a =>\n message += shrinkText('' + a) + '\\n'\n )\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the character has the inventory available | function InventoryAvailable(C, InventoryName, InventoryGroup) {
for (var I = 0; I < C.Inventory.length; I++)
if ((C.Inventory[I].Name == InventoryName) && (C.Inventory[I].Group == InventoryGroup))
return true;
return false;
} | [
"function isInventoryFull() {\n let window = bot.inventory\n return window.emptySlotCount() === 0;\n\n}",
"function checkInventory() {\n console.log(`START checkInventory(): Checking player's inventory.`);\n if (getInventory().length > 0) {\n let items = getInventory().map((item) => item.name).join(', ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this is called only once to get the AudioContext started and to set up master volume meter. function will play a test note. | function playWarmUpNote() {
if (warmUpCalled) return;
else warmUpCalled = true;
// set up master gain
masterGain = audioContext.createGain();
sonicBeepGain = audioContext.createGain();
playPauseGain = audioContext.createGain();
// initial volume is 0.5
masterGain.gain.value = 0.5;
ma... | [
"initAudio() {\n this.ctx = new AudioContext();\n this.gain = this.ctx.createGain();\n this.source = this.ctx.createBufferSource();\n\n this.gain.gain.setValueAtTime(this.volume, this.ctx.currentTime);\n\n this.source.connect(this.gain);\n this.gain.connect(this.ctx.destination);\n }",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call `f` for every child node, passing the node, its offset into this parent node, and its index. | forEach(f) {
for (let i = 0, p = 0; i < this.content.length; i++) {
let child = this.content[i];
f(child, p, i);
p += child.nodeSize;
}
} | [
"forEach(f) {\n for (let i = 0, p = 0; i < this.content.length; i++) {\n let child = this.content[i]\n f(child, p, i)\n p += child.nodeSize\n }\n }",
"foreachChild(callback) {\n for (let i = 0; i < this.children.length; i++) {\n callback(this.getChildAt(i), i);\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
read css and js | function readCss(request, response, suffix) {
var data = fs.readFileSync(".." + request.url, "utf-8");
response.writeHead(200, {"Content-Type": {
".css":"text/css",
".js":"application/javascript",
}[suffix]
});
response.write(data);
response.end();
} | [
"function loadCss() {\n $.post('/get-css', function (data) {\n var style = document.createElement('style');\n style.innerHTML = data;\n document.head.appendChild(style);\n });\n}",
"function load_css(document) {\n // taken from https://stackoverflow.com/questions/574944/how-to-lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform this action when user clicks 'Add Supplies' Toggle state of editing and inputs being visible every time 'Add Supplies' is clicked | onAddSuppliesClick() {
const edit = this.state.editing;
const visible = this.state.inputsVisible;
this.setState({
editing: !edit,
inputsVisible: !visible
});
} | [
"function showAddItemForm() {\n if (__DEVONLY__) $log.debug('ListController showAddItemForm');\n vm.addItemVisible = !vm.addItemVisible;\n }",
"function toggleAddForm() {\n\n setAdding(!adding);\n }",
"function toggleDisplayAddForm() {\n setDisplayAddForm(!displayAddForm);\n }",
"showAddI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete all conference attendee schedule of user with id | async deleteConferenceAttendee() {
const conferenceAttendee = await ConferenceAttendee.query().where(
'user_id',
this.id,
);
if (conferenceAttendee) {
await ConferenceAttendee.query()
.delete()
.where('user_id', this.id);
}
return conferenceAttendee;
} | [
"delete(req, res) {\n User.findById(req.params.userId).populate('reminders').exec((userErr, user) => {\n if (userErr) return res.status(500).send(err);\n\n Reminder.findByIdAndRemove(req.params.reminderId, (reminderErr, deletedReminder) => {\n if (reminderErr) return res.status(500).send(err);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the entityObj's unqKey is present in the entity. If not, attach and use tempIds. (This is only useful currently in the case of interactions where an id from the database may be included). | function findUnqField() {
unqFieldAry.some(function(unqKey){ return ifKeyInRcrds(unqKey); });
if (unqField === undefined) {
recrdsAry = attachTempIds(recrdsAry);
unqField = "tempId";
}
} | [
"_syncTempAssociations(tempAssociate) {\n Object.keys(this._tempAssociations).forEach(key => {\n if (this._tempAssociations[key] && this._tempAssociations[key].toString() === tempAssociate.toString()) {\n this._tempAssociations[key] = tempAssociate;\n }\n });\n }",
"function _addEntityIden... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generateSentence returns a sentence built around a word that is present in ngrams table. | function generateSentence(ngrams, stemWord) {
var sent = generateChain(ngrams, stemWord, 'backw', 20).reverse()
sent = sent.concat( generateChain(ngrams, stemWord, 'forw', 20).slice(1) )
sent = alignPunctuation( sent.join(' ')+'.' )
return cleanSentence(sent)
} | [
"function createSentence() {\n /*NN represents starting with a singular noun*/\n let currentState = 'NN';\n let sentence = '';\n while (true) {\n sentence = sentence + ' ' + getNextWord(currentState);\n currentState = getNextState(currentState);\n if (currentState == 'END_OF_LYRIC')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a radius and angle get the x, y point on the circle | function getCirclePoint( r, angle ) {
const rAngle = degreesToRadians( angle ),
x = multiply( r, Math.sin( rAngle ) ),
y = multiply( r, Math.cos( rAngle ) );
return {
x: Math.round( x ),
y: Math.round( y )
};
} | [
"function getPointOnCircle(_angle, _radius) {\n\tvar _angle = radians(_angle);\n\tvar x = cos(_angle) * _radius;\n\tvar y = sin(_angle) * _radius;\n\n\treturn { x, y };\n}",
"static _calcPointOnArc(radius, angle) {\n var x = Math.cos(angle) * radius;\n var y = Math.sin(angle) * radius;\n return { x: x, y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set trash state recursively on a bookmark item and its possible content BN: BookmarkNode folder to mark / unmark is_inTrash: Boolean | function BN_markTrash (BN, is_inTrash) {
if (is_inTrash) {
BN.inBSP2Trash = true;
BN.trashDate = (new Date ()).getTime();
}
else {
BN.inBSP2Trash = false;
}
if (BN.type == "folder") {
let children = BN.children;
let len;
if ((children != undefined) && ((len = children.length) > 0)) {
for ... | [
"function trashFolder (event) {\n list.deleteFolder(list.getFolder(helper.getActiveFolderId()));\n helper.updateFoldersInStorage();\n helper.deactivateActiveTaskElement();\n helper.deactivateActiveFolderElement();\n updateFolders();\n}",
"function saveTrashState(){\n localStorage.setItem('tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add Stroke Line & Remove Fill from Shape Group | function addStrokeDeleteFill (shapeLayer, grpName, lineColor, lineWt) {
// GET SHAPE GROUP
var shapeGroup = shapeLayer.property("ADBE Root Vectors Group")
.property(grpName);
// DELETE FILL
var shapeFill = shapeGroup.property("ADBE Vectors Group")
.property("ADBE Vector Graphic - Fill").remove();
//... | [
"function addStrokeDeleteFill (shapeLayer, grpName, lineColor, lineWt) {\n\n\t\t// GET SHAPE GROUP\n\tvar shapeGroup = shapeLayer.property(\"ADBE Root Vectors Group\")\n\t.property(grpName);\n\n\t\t// DELETE FILL\n\tvar shapeFill = shapeGroup.property(\"ADBE Vectors Group\")\n\t.property(\"ADBE Vector Graphic - Fil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Naive forEach implementation works with Objects or Arrays | function _forEach(obj, cb, _this) {
if (predicates_1.isArray(obj))
return obj.forEach(cb, _this);
Object.keys(obj).forEach(function (key) { return cb(obj[key], key); });
} | [
"function forEach(obj, iterator, context) {\n if (obj === null) {\n return;\n }\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i += 1) {\n iterator.call(context, obj[i], i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
START/STOP/PAUSE Bind start/stop/pause events from the clock and emit them. | _bindClockEvents() {
this._clock.on("start", (time, offset) => {
offset = new TicksClass(this.context, offset).toSeconds();
this.emit("start", time, offset);
});
this._clock.on("stop", (time) => {
this.emit("stop", time);
});
this._clock.on("pa... | [
"_bindClockEvents() {\n this._clock.on(\"start\", (time, offset) => {\n offset = new _type_Ticks__WEBPACK_IMPORTED_MODULE_5__[\"TicksClass\"](this.context, offset).toSeconds();\n this.emit(\"start\", time, offset);\n });\n\n this._clock.on(\"stop\", time => {\n this.emit(\"stop\", time);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when bird uses the makeSound() method, this gets used | makeSound() {
console.log('overriding sound');
} | [
"makeSound() {\n\t\t// explicitly call a method from the parent class\n\t\tsuper.makeSound()\n\t\tconsole.log('this is the cats own sound')\n\t}",
"_addSound() {\n this.sound = new Howl({ src: magicSound, loop: true, autoplay: true });\n }",
"function outOfBreathSound(){\n playSound(outOfBreath_Sound);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create gradients for the edges | function calculateEdgeGradient(edges) {
edges.forEach(function (d) {
var alpha; //Gradient for the hover state
//Needed in such a roundabout way for a gradient+transparency bug in Safari, sigh...
alpha = d.opacity === edge_primary_opacity ? 0.6 : 0.3;
createGradient(d, 'gradient_hover', alp... | [
"function calculateEdgeGradient(edges) {\r\n edges.forEach(d => {\r\n let alpha\r\n\r\n //Gradient for the hover state\r\n //Needed in such a roundabout way for a gradient+transparency bug in Safari, sigh...\r\n alpha = d.opacity === edge_primary_opacity ? 0.6 : 0.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create brush input a Raphael paper, return a brush object. | function brush(paper) {
var resizes = x && y ? ["n", "e", "s", "w", "nw", "ne", "se", "sw"]
: x ? ["e", "w"]
: y ? ["n", "s"]
: [];
if (x) {
e = d3_scaleRange(x);
left = e[0];
width = e[1] - e[0];
}
if (y) {
e = d3_scaleRange(y);
top = e[0];
height... | [
"function brush(paper) {\n var resizes = x && y ? [\"n\", \"e\", \"s\", \"w\", \"nw\", \"ne\", \"se\", \"sw\"]\n : x ? [\"e\", \"w\"]\n : y ? [\"n\", \"s\"]\n : [];\n\n if (x) {\n e = d3_scaleRange(x);\n left = e[0];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clearing the timeout when this component unmounts, then it's riderected to the homepage where is the list of users | async componentWillUnmount() {
clearTimeout(this.timeStatus);
// this.props.history.push('/'); // Keeping the home page link (so it goes to App.js)
} | [
"componentWillUnmount () {\n clearTimeout(this.timeout);\n }",
"componentWillUnmount() {\n this.unmounted = true;\n this.state.timeouts.forEach(clearTimeout);\n }",
"componentWillUnmount() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n }",
"componentWillUnmoun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function gives a random 1 9 dice if unaveraged, and a dice of 5 if averaged | function getDice() {
if (dice_averaged) {
return 5;
} else {
return Math.floor(Math.random() * 10);
}
} | [
"function diceRoll() {\n return RandomPositiveInteger(20);\n}",
"function rollD6(){\r\n return getRandomInteger(1, 6);\r\n}",
"function dice() {\n Math.floor(Math.random() * 7)\n}",
"function dice(){\n return Math.floor(Math.random()*6)+1\n}",
"function generateDiceRoll(){\r\n return Math.floor(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Multipart parser for request | function parseMultipart(req) {
var parser = multipart.parser();
// using the parsed request headers
parser.headers = req.headers;
// Add listeners to request, transfering data to parser to write the chunks
req.addListener("data", function(chunk) {
parser.write(chunk);
});
req.addListene... | [
"function parse_multipart(req) {\n var parser = multipart.parser();\n\n // Make parser use parsed request headers\n parser.headers = req.headers;\n\n // Add listeners to request, transfering data to parser\n\n req.addListener(\"data\", function(chunk) {\n parser.write(chunk);\n });\n\n req.addListener(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dynamically set the width of the search field | function fnPluginTaskSearch_SetWidth() {
try {
// Calculate the width of the search box
$width = window.innerWidth - $(".main-sidebar").width();
$width = $width - 500; // $('.navbar-custom-menu').width();
// Get place for other DOM elements
$width = $width - 100;
// Not too big...
if (parseInt($width) ... | [
"function searchResize() {\n var width = $('.nDescriptionContent').width() - $('.nSearchButton').width() - 15;\n $('.nSearchSearchBox').width(width);\n }",
"function updateWidth() {\n scope.inputStyle.width = scope.containerSize.width - scope.tagsSize.width - 30;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an annotated insert text edit. | function insert(position, newText, annotation) {
return {
range: {
start: position,
end: position
},
newText: newText,
annotationId: annotation
};
} | [
"function clickedInsert(aNode) {\n\tvar insertText=\"\";\n\tvar dom = dw.getDocumentDOM();\n\tif (dom) {\n\t\tif (aNode && aNode.isCodeViewDraggable && (dw.getFocus() == 'textView')) {\n\t\t\tinsertText = getCodeViewDropCode(aNode);\n\t\t\tvar selection = dom.source.getSelection();\n\t\t\tdom.source.replaceRange(se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
On init get data from Type service and synchronize updates | $onInit() {
this.TypeService.getTypes()
.then(response => {
this.typesAsyncData = response;
this.socket.syncUpdates('type', this.typesAsyncData);
})
.catch(this.handleFormErrors.bind(this));
} | [
"loadTypes() {\n this.transactionService.getTypes().subscribe((data) => {\n this.types = data;\n });\n }",
"init() {\r\n\r\n // Initialize the data object.\r\n data.init();\r\n }",
"function getTypeData() {\n return typeData;\n}",
"function initTypeCounters() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Algorithm 1. Let j = column m/2 2. Find the global max value, (i, j) in column j. 3. If (i, j 1) > (i, j), take the left columns and repeat. 4. Else if (i, j + 1) > (i, j), take the right columns and repeat. 5. Otherwise, you've found a peak. | function find2dPeak(m, j) {
let maxValue = 0;
let i = 0;
m.forEach((row, index) => {
if (row[j] > maxValue) {
maxValue = row[j];
i = index;
}
});
// TODO: Practice mathematics of splitting arrays.
if (m[i][j - 1] && m[i][j - 1] > maxValue) {
const leftColumnMid = Math.floor(j / 2) - 1 >= 0 ? Math.flo... | [
"max() {\r\n let m = 0;\r\n let i = this.elements.length;\r\n const nj = this.elements[0].length;\r\n let j;\r\n while (i--) {\r\n j = nj;\r\n while (j--) {\r\n if (Math.abs(this.elements[i][j]) > Math.abs(m)) {\r\n m = this.elements[i][j];\r\n }\r\n }\r\n }\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of the default Hippocamp models. | static async getDefaultModels () {
return new WorkflowManager({}).getDefaultModels();
} | [
"async function getDefaultModels () {\n\treturn Object.values(await this.getDefaultModelsByKey());\n}",
"describeModels () {\n\t\treturn this.modules.reduce((models, module) => {\n\t\t\treturn [...models, ...module.describeModels()];\n\t\t}, []);\n\t}",
"getDefaultCriteriaModels(){\n var criteriaModels = [];... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function checks if the plane is currently visible in the canvas and sets _shouldDraw property according to this test This is our real frustum culling check | _shouldDrawCheck() {
// get plane bounding rect
const actualPlaneBounds = this._getWebGLDrawRect();
// if we decide to draw the plane only when visible inside the canvas
// we got to check if its actually inside the canvas
if(
Math.round(actualPlaneBounds.right) <= t... | [
"insideFrustum(min, max) {\n let corners = getAABBFromExtent(min, max);\n\n // Record the largest dot product of all corners with all planes\n let maxDotProducts = [-1, -1, -1, -1, -1, -1];\n for (let i = 0; i < 8; i++) {\n maxDotProducts[0] = Math.max(maxDotProducts[0], m4.dot([this.left[0], this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROTECTED Writes the HTML code for this network element. A network element is created in five steps: the main span writing, the background writing, the background image writing, the name writing and the overglass writing. The overglass is an invisible layer set over all the previous layers. | function writeNE() {
this.writeMainSpan();
this.writeBg();
if (this.image != null) {
this.writeImage();
}
this.writeName();
this.writeOverglass();
this.allocate();
} | [
"function writeImageNE() {\n\t\tvar elem = document.getElementById(this.id).appendChild(document.createElement(\"span\"));\n\t\telem.style.position = \"absolute\";\n\t\telem.style.left = 0;\n\t\telem.style.width = this.width;\n\t\telem.style.backgroundImage = \"url(\" + this.image + \")\";\n\t\tvar pos = NAME_CENTE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scan Gmail account for message archive requests | function ScanGmail() {
// log sender and the attachment name
var ss = SpreadsheetApp.getActiveSheet();
// Get the label
var label = GmailApp.getUserLabelByName("Archive to Drive");
var threadsArr = getThreadsForLabel(label);
for(var j=0; j<threadsArr.length; j++) {
var messages... | [
"function Archive(search) {\n console.info(\"Archiving messages matching this query: \" + search)\n var age = new Date();\n age.setDate(age.getDate() - DAYS);\n var total = 0;\n\n try {\n // Search for mail, but limit to 40 at a time\n var threads = GmailApp.search(search, 0, 40);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function to make a contour plot from two univariate distributions | function makeContourData (xdat, ydat, nlev, thresh)
{
// calculate the values at the grid
var xx = xdat.xx, yy = ydat.xx;
var sur = jStat.seq(0, xx.length - 1, xx.length).map(function (jj)
{
return jStat.seq(0, yy.length - 1, yy.length).map(function (ii)
{
re... | [
"function makeBivarNormContourData (muX,muY,sigmaX,sigmaY,rho,resolution,nlev, thresh)\n { \t\n \t// calculate ranges \n \tvar xRange = [muX-3*sigmaX, muX+3*sigmaX];\n \tvar yRange = [muY-3*sigmaY, muY+3*sigmaY];\n \t \n // create xx and yy arrays (which give support of density)\n var xx = jStat.seq... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Problem 2 Create a function that adds only the ODD numbers inside the NESTED arrays. Return the total We create a function (proper) with a paramater (gentlePerson) | function proper (gentlePerson){
// Create a create a variable (work) to use as a placeholder that the numbers passed through the loop will be added to
let work = 0
// Create a 'for' loop that will start at index 0 of the first array, and end with the last index of the first array, it will loop through each elem... | [
"function famTotalAge(person){\n const familyAge = person.map(function(ageCalc){\n return ageCalc.age;\n });\n const totalAge = familyAge.reduce(function(prev, curr){\n return prev + curr;\n });\n return totalAge;\n}",
"function sumHeights(persons){\r\n\r\n}",
"function findSum(arr) {}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unary ::= Primary | '' Unary | function parseUnary() {
var token, expr;
token = lexer.peek();
if (matchOp(token, '-') || matchOp(token, '+')) {
token = lexer.next();
expr = parseUnary();
return {
'Unary': {
operator: token.value,
expr... | [
"function parseUnary() {\n let token, expr;\n\n token = lexer.peek();\n if (matchOp(token, '-') || matchOp(token, '+')) {\n token = lexer.next();\n expr = parseUnary();\n return {\n 'Unary': {\n operator: token.value,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the brython interpreter | function initBrython() {
if (!initialized) {
brython(1);
initialized = true;
}
} | [
"initInterpreter() {\n this.interpreter = new Interpreter(this.compiled, this.battle_.initInterpreter);\n }",
"function runBrython(console, argdict) {\n console.clear();\n __EXECUTE__BRYTHON__();\n }",
"function Interpreter () {}",
"function runBrython(cb) {\n exec(BRYTHON_CLI_CMD, {cw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate scale filename suffix for a variant | function scaleSuffix(scale) {
return scale === 1 ? '' : '.x' + String(scale);
} | [
"function suffix(variant) {\n return '_h' + variant.h + 'p-b' + variant.b + 'k';\n }",
"function getSuffix(fileName) {\n var suffix = fileName.substring(fileName.lastIndexOf(\".\"),fileName.length);\n switch(suffix){\n case \".ppt\":\n suffix = \"ppt\";\n break;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stop the feed. It will no longer poll. | stop() {
if (this.timeout) {
clearTimeout(this.timeout);
this.feedStartTime = null;
}
} | [
"function stop () {\n /*jshint validthis:true*/\n\n clearInterval(this.control.retryReadIntervalObj);\n clearInterval(this.control.feedReaderIntervalObj);\n clearTimeout(this.control.resuscitatorTimeoutIntervalObject);\n\n //https://nodejs.org/api/http.html#http_class_http_agent\n //https://nodejs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pageTracker wrapper Allows to use asynchronous or synchronous GA method calls. The class initializes methods according to the status of the gaConf.useSynchronousAPI configuration property. By default, asynchronous API will be used. | function gtw(){
// Async API initialization.
if(!gaConf.useSynchronousAPI) {
// random var name for the account alias used in calls
var pfx = this.accountPrefix = "haf" + Math.floor(Math.random()*100) + ".";
// Utility function for prefixing function calls with the account alias.
function p(fnName) {
... | [
"function callGA(){\t\n\tvar pageTracker = _gat._getTracker(\"UA-4969726-3\");\n\tpageTracker._initData();\n\tpageTracker._trackPageview();\n}",
"function GA(options) {\n // Debug boolean if we want to produce console output\n options = options || {};\n var debug = options.debug || false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete selected order item | function deleteItem() {
var item = itensGrid.selection.getSelected()[0];
if (item) {
itensStore.deleteItem(item);
} else {
okDialog.set("title", "Atenção");
okDialogMsg.innerHTML = "Selecione o item antes de excluir.";
okDialog.show();
}
} | [
"function DeleteOrderItem(e) {\n\n\t var evt = window.event || e;\n\t var oSrc = evt.srcElement || e.target;\n\t var sType = evt.type || e.type;\n \t\n\t var oDataRow = oSrc.parentNode;\n\t var sStatus = oDataRow.getAttribute(\"UpdateStatus\").toLowerCase();\n \t\n\t //Make sure the user rea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initialize by an array with arraylength / init_key is the array for initializing keys / key_length is its length / slight change for C++, 2004/2/26 c//void init_by_array(unsigned long init_key[], int key_length) | function init_by_array(init_key, key_length) {
//c//int i, j, k;
var i, j, k;
init_genrand(19650218);
i=1; j=0;
k = (N>key_length ? N : key_length);
for (; k; k--) {
//c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525))
//c// + init_key[j] + j; /* non linear */
... | [
"function init_by_array(init_key, key_length) {\n var i, j, k;\n init_seed(19650218);\n i = 1;\n j = 0;\n k = N > key_length ? N : key_length;\n for (; k; k--) {\n var s = mt[i - 1] ^ (mt[i - 1] >>> 30);\n mt[i] =\n (mt[i] ^\n (((((s & 0xffff0000) >>> 16) * 1664525) << 16... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
rangesapply Take an array of string index ranges, delete/replace the string according to them Version: 5.0.6 Author: Roy Revelt, Codsen Ltd License: MIT Homepage: | function rApply(str, originalRangesArr, _progressFn) {
var percentageDone = 0;
var lastPercentageDone = 0;
if (arguments.length === 0) {
throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");
}
if (typeof str !== "string") {
throw new TypeError("ranges-apply: [THROW_ID_02] first input argum... | [
"function replaceBulk(args) {\n\t\tvar solution = args.string;\n\t\tvar replaceArray = args.replacements;\n\t\tvar findArray = Object.keys(replaceArray);\n\t\t\n\t\tvar regex = [], map = {}; \n\t\tfor(var i = 0; i < findArray.length; i++) {\n\t\t\tvar orig = findArray[i];\n\t\t\tregex.push( findArray[i].replace(/([... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
format includes %% for numbers and strings to be extracted, inbetween other literal text returns array of extracted values, or null if literal delimiters don't match | function sscanf( string, format )
{
var rc = [];
for(;;)
{
var nextParam = format.indexOf("%%");
if( nextParam<0 ) return rc; // done
if( string.substr(0,nextParam)!=format.substr(0,nextParam) )
{
return null;
}
string = string.substr(nextParam); /... | [
"matchFormatters() {\n let start = this.start;\n if (this.str[start++] !== '|') {\n return null;\n }\n\n // Bail if we see a 2nd pipe. This is a sniff for inline minified\n // JavaScript which can create false positives. For example: {a||b?1:0};\n if (this.str[start] === '|') {\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a confirmation box using "bootbox" plugin with custom message corresponding to the entry being deleted. | function addConfirmationBox() {
var predicationDate = $(this).closest('tr.predictionTable').find('.predictionDate').text();
var predictionValue = $(this).closest('tr.predictionTable').find('.predictionValue').text();
var predictionRegion = $(this).data("region");
var $button = $(this);
var message... | [
"function deletePinpoint(sender) {\n // Show a confirmation box for deleting an pinpoint\n bootbox.dialog({\n message: \"Wilt u deze pinpoint zeker weten verwijderen? Hiermee worden tevens alle bijbehorende pagina's verwijderd.\",\n title: \"Pinpoint verwijderen\",\n buttons: {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the sbIMediaListView that this page is displaying | get mediaListView() {
return this._mediaListView;
} | [
"set mediaListView(value) {\n if (!this._mediaListView) {\n this._mediaListView = value;\n } else {\n throw new Error(\"mediaListView may only be set once. Please reload the page\");\n }\n }",
"set mediaListView(value) {\n \n if (!this._mediaListView) {\n this._mediaListView = va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given array, and indices start and end, remove vals in that index range, working inplace (hence shortening the array). For example, removeVals([20,30,40,50,60,70],2,4) should return [20,30,70]. | function removeVals(arr, start, end){
for(var i = 0; i < (arr.length - end +1); i++){
arr[start] = arr[end +1];
}
for(var i = 0; i < (end - start +1); i++){
arr.pop();
}
} | [
"function removeVals (arr, start, end) {\n var range = (end - start) + 1;\n arr.splice(start, range);\n return arr;\n}",
"function removeVals(arr, start, end) {\n arr.splice(start, end-1 )\n return arr;\n }",
"function removeVals(array, start, end) {\n\t// let itemsTobeRemoved = [];\n\tlet newAr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Basic sorting by numbers | function numberSortFunction(a, b) {
return a - b;
} | [
"function Numsort(a,b) { return a - b; }",
"function sortByNum(a, b) {\n return (a.peoplenum + a.recognized) < (b.peoplenum + b.recognized);\n }",
"function sortNumeric(val1, val2)\n{\n return val1 - val2;\n}",
"function sortNumbers(arr){\n return arr.sort(function(a, b){ return a - b; });\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Step 2 Replace ////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// I: an array, string, object O: a string of animals name C: Do not use replace E: for Loop | function replace(animals,name,replacement){//create a function called replace, parameters are animals, name and replacement
//an array of animals, a string of animals name, object representing the replacement animal for search
for (var i = 0; i<=animals.length -1; i++){// Using a for loop to loop over our entire array... | [
"function replace(animals, name, replacement) {// write a func. dec. 'Replace' that has 3 parameters: array \"animals\",string \"name\", and a replacemnt object \"replacement\"\n for (var i = 0; i <= animals.length - 1; i++) {// use for loop to go look through animals array \n if (animals[i].name === name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function validates user profile phone | function validateProfilePhone()
{
var x = document.forms["profile"]["phone"].value;
if(isNaN(x)|| x.indexOf(" ")!=-1)
{
alert("Please enter a numeric value for the phone number. Ex: 0777123456");
return false;
}
if (x.length != 10)
{
... | [
"function helperValidatePhone() {\r\n //sends the error state to change the background\r\n sendState(on, \"phone\");\r\n //adds the error to the array\r\n addDataAllErrors(allErrorMess[3]);\r\n }",
"processPhone() {\n let input = this.phone\n resetError(input)\n\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pipes the command to the VLC remote control interface | function rcVLC(command) {
var toWrite = command + "\n";
vlc.stdin.write(toWrite);
} | [
"function sendSimpleAVControlCommand() {\n console.log('===', 'Send AV control command');\n client.emit('simpleAVcontrol', {\n mac: '18CC230027DC', // MAC address registered in Hub. You may bind it into Hub first.\n uid: 300, // Device ID\n cid: 0, // Channel ID\n val: 0 // For more detail about value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
read 2 toggle read/unread button on cards/bookmarks (remove/add .read class) | function toggleReadClass(buttonToToggleClass){
buttonToToggleClass.classList.toggle('read');
} | [
"function toggleRead() {\n window.addEventListener(\"click\", (e) => {\n if (e.target.dataset.type == \"toggle-read\") {\n const toggleReadBtn = e.target;\n const currentBook = e.target.parentNode;\n for (let book of library) {\n if (book.id == currentBook.getAttribute(\"data-id\")) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if any of clientManifest, serverBundle and template changed, refresh them and create new renderer | refreshFiles() {
var _this5 = this;
return (0, _asyncToGenerator3.default)(function* () {
_logger2.default.info('build', 'refresh ssr bundle & manifest');
let changed = false;
let templateChanged = false;
let clientManifestPath = (0, _path2.distLavasPat... | [
"function update() {\n if (bundle && clientManifest) {\n resolveDevServerPromise();\n cb(bundle, {\n template,\n clientManifest\n });\n }\n }",
"function _createRenderer({template,bundle,manifest}={}){\n const viewTemplate = template || fs.readFileSync(TEMPLATE_PATH,'utf-8')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE THE PUBLICATION SERVICE | function deletePublication(req, res, next,proxyMensagem) {
let pub = new Publication();
var reqMensagem = req.body.Publication;
pub.deletePublication(reqMensagem).then((msgCreated) => {
return res.json(msgCreated);
}).catch((err) => {
return res.send("Publication delete failed" + err);
});
return next();
} | [
"async function delete_pub(cb){\n deletedPaths = await del('pub'); \n console.log('deleted pub-catalog');\n cb();\n}",
"function publicdel(){\n\t\t\tvar publicid = this.getAttribute('data-publicdel');\n\t\t\tlistefi.confirm('Desea eliminar esta publicación de forma permanente?', function(respuesta){\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a single survey | static getASurvey(surveyId) {
return (axios.get(LOCAL_URL + SURVEY + SURVEY + surveyId));
} | [
"function getsurvey(sid) {\n var url = BASEURL + '/surveys/' + sid;\n request.get({url: url}, function(error, response, body) {\n if (handleError(error, response, body)) return;\n\n var survey = JSON.parse(body).survey;\n console.log('Got a survey with ID ' + survey.id + ':');\n console.log(JSONpretty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loop thorugh all sockets and update them | function updateSockets() {
for(var id in context.sockets) {
updateSocket(context.sockets[id]);
}
} | [
"updateSocketChannel() {\n for (let key in this.channels) {\n if (this.channels.hasOwnProperty(key)) {\n let channel = this.channels[key];\n channel.setSocket(this.ws);\n }\n }\n }",
"function serverNotifyLoop(){ \n if(!Socket)\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Permite ejecutar una transaccion desde otra. ============================================================================== | function ejecutarComo(nombre)
{
var f=document.forms[0];
f.Transaccion.value=nombre;
f.submit();
return true;
} | [
"function ejecutarSegundoPunto(){\n leerDatos();\n recibirDatos();\n llenarTodosLosCampos();\n}",
"function executeUsecase() {\n\n var usecaseName;\n var usecase; // the Usecase object\n var view; // the UsecaseView object that belongs to our usecase.\n var state; // the state of the usecase ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all talents for username from db | function getTalents(username) {
return $http.get('/talent/get', { params: {username: username}});
} | [
"async function getTreasurers(level) {\n return db_conn.promise().execute(\n \"SELECT A.username, A.role, (SELECT CONCAT(U.first, ' ', U.last) FROM Users U WHERE U.username = A.username) name FROM approval A WHERE privilege_level = ? GROUP BY A.username, A.role\",\n [level]\n );\n}",
"static a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform an array into a regexp. | function arrayToRegexp(paths, keys, options) {
var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });
return new RegExp("(?:" + parts.join("|") + ")", flags(options));
} | [
"function toRegex(arr) {\n\t\tvar nextReg = '';\n\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\tnextReg += '('+arr[i].trim()+')|';\n\t\t}\n\n\t\treturn new RegExp(nextReg.slice(0,-1),'ig');\n\t}",
"function transformPathsFromArrayToRegexp(paths) {\n const regexp = paths.join(\"|\");\n return new RegExp(regex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the value using the slider position | _updateValue () {
let sliderWidth = this._sliderElement.offsetWidth;
// Calculate the new value
let { minValue, maxValue } = this._options;
let percentage = this._xPosition / sliderWidth;
let value = minValue + (maxValue - minValue) * percentage;
this.emit("update", value);
} | [
"function update_slider() {\r $slider.slider('values', 0, current_input_from());\r $slider.slider('values', 1, current_input_to());\r }",
"function updateSliderValue() {\n output = document.getElementById($(this).attr(\"id\").replace(\"slider\", \"value\"));\n output.value = parseInt(this.val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tree: substructure for the Local predictive Model | function Tree(tree, fields, objectiveField, rootDistribution) {
/**
* A tree-like predictive model.
*
* @param {object} tree Tree-like substructure of the resource object
* @param {object} fields Model's fields
* @param {string} objectiveField Objective field for the Model
*/
this.fields = fields... | [
"function Tree(tree, fields, objectiveField, rootDistribution) {\n /**\n * A tree-like predictive model.\n *\n * @param {object} tree Tree-like substructure of the resource object\n * @param {object} fields Model's fields\n * @param {string} objectiveField Objective field for the Model\n */\n\n this.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a match function for an inline scoped or simple element from a regex | function inlineRegex(regex) {
return function match(source, state) {
if (state.inline) {
return regex.exec(source);
} else {
return null;
}
};
} | [
"function inlineRegex(regex) {\n return function match(source, state) {\n if (state.inline) {\n return regex.exec(source);\n } else {\n return null;\n }\n };\n}",
"function regexMatchFN(match, field) {\n field = ((typeof field === 'undefined') ? 'name' : field);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert 5 projectattributes and check if they're inserted by counting the number of rows before and after the insertion of projectattributes. | async insertProjectAttributes() {
try {
var rowsCount;
await this.connection.query('SELECT * FROM projectary_tests.projectattribute;', await function (error, results, fields) {
rowsCount = results.length;
});
// mysqltest
try {
await utils.execPromise(`mysqltest --def... | [
"function inserts(callback) {\n var a = 30;\n var totalCount = 5;\n\n for (var i = 0; i < 5; i++) {\n collection.insert({ a: a }, { w: 2, wtimeout: 10000 }, function (err) {\n test.equal(null, err);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region Caching Adds a record to relation cache, optionally removing it if already there. | cacheRelatedRecord(record, id, name, uncacheId = null) {
const me = this,
cache = me.relationCache[name] || (me.relationCache[name] = {});
if (uncacheId !== null) {
me.uncacheRelatedRecord(record, name, uncacheId);
}
if (id) {
// Only include of not already in relation ... | [
"cacheRelatedRecord(record, id, name, uncacheId = null) {\n const me = this,\n cache = me.relationCache[name] || (me.relationCache[name] = {});\n\n if (uncacheId !== null) {\n me.uncacheRelatedRecord(record, name, uncacheId);\n }\n\n if (id != null) {\n // Only include of not already ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints FunctionExpression, prints id and body, handles async and generator. | function FunctionExpression(node, print) {
if (node.async) this.push("async ");
this.push("function");
if (node.generator) this.push("*");
if (node.id) {
this.push(" ");
print.plain(node.id);
} else {
this.space();
}
this._params(node, print);
this.space();
print.plain(node.b... | [
"function FunctionExpression(node, print) {\n if (node.async) this.push(\"async \");\n this.push(\"function\");\n if (node.generator) this.push(\"*\");\n\n if (node.id) {\n this.push(\" \");\n print.plain(node.id);\n } else {\n this.space();\n }\n\n this._params(node, print);\n this.space();\n pri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get index of current room from socket | function getRoomInfo(socket, game) {
if(socket && game) {
const room = Array.from(socket.rooms)[1];
const existingGame = game.map(game => game.roomId).indexOf(room);
return existingGame;
}
else {
return -1;
}
} | [
"function getRoom(socket){\r\n return Object.keys(socket.rooms)[0];\r\n}",
"function getRoom(socket) {\n return Object.keys(socket.rooms)[0];\n }",
"function getJoueurIndex(socket) {\n var id = socket.id;\n var index = -1;\n joueurs.forEach(function(joueur) {\n if (joueur.id === id) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clone nodes and apply styles directly to each node | function cloneNodes(sourceNode, targetNode) {
var newNode = sourceNode.cloneNode(false);
targetNode.appendChild(newNode);
if (!sourceNode.tagName) return; // skip inner text
// compare computed styles at this node and apply the differences directly
applyStyl... | [
"function cloneTreeWithStyle(node, func) {\n // Clode the node\n var cloneNode = node.cloneNode(false);\n\n // Run custom logic\n wrapCall(func)(cloneNode);\n\n // Clone the computed style info\n if (isEl(node)) {\n // Get the effective style for the element\n var styleInfo = window.getComputedStyle(nod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
attaches to pgpromise initialization options object: options the options object; events optional, list of events to attach to; override optional, overrides the existing event handlers; | attach(options, events, override) {
if (options && options.options && typeof options.options === 'object') {
events = options.events;
override = options.override;
options = options.options;
}
if ($state.options) {
throw new Error('Repeated attach... | [
"_setOptions(options) {\n options = options || {};\n if (options.webhookIdentifier) {\n this.initById(options.webhookIdentifier);\n }\n return Promise.resolve();\n }",
"function override(ev) {\n if (options && options.events && typeof options.events[ev] === 'function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |