query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Send bookmark message for the given state used by Ming.le | function publishBookmark(stateName) {
var state = $state.get(stateName);
var tabTitle = state.data ? state.data.tabTitle : '';
var stateParts = stateName.split('.');
var baseState = stateParts[0];
var part2 = stateParts[1];
var pageTitle;
// Don't publish if not yet logged in
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async handleUpdateBookmark(bookmarkToUpdate){\n this.setState({\n bookmark: bookmarkToUpdate\n })\n }",
"function gotoBookmark(){\n\n}",
"onSelectBookmarkAndExit() {\n const playbackPositionMs = Utility.getMilliSeconds(Math.round(this.objPlayerService.plugin.currentTime));\n const pro... | [
"0.60080624",
"0.5693632",
"0.5630426",
"0.5610529",
"0.5609212",
"0.55191624",
"0.54978865",
"0.54949325",
"0.5419969",
"0.5374135",
"0.5372866",
"0.5353325",
"0.5348856",
"0.5335614",
"0.53324765",
"0.5302468",
"0.53015506",
"0.52930456",
"0.5278525",
"0.5264017",
"0.525905... | 0.68859637 | 0 |
Get final entity list to publish 1. Include context of all ancestor states 2. Filter out duplicate values before publishing entity list Note: two fields on the screen may have same entity type and same key values, but don't want to publish that record twice | function getEntityListToPublish(stateName) {
var entityId, entity, entities = {}, finalList = [];
var state = $state.get(stateName);
// Include the context of this state and all ancestor states
// Note: need to check state.name here because ui router has a blank root state object
while (s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function publishContext(stateName) {\n var sxeEntities = [];\n var customEntities = [];\n var businessEntities = [];\n var state = $state.get(stateName);\n var stateContext = getStateContextObject(stateName);\n var screenId = self.getScreenId(state, stateContext.screenIdSuffix);\n\n ... | [
"0.6225612",
"0.5858035",
"0.5632686",
"0.5604156",
"0.55493057",
"0.53319085",
"0.5208173",
"0.51872313",
"0.5152677",
"0.5140461",
"0.5057219",
"0.50522316",
"0.50511086",
"0.50326395",
"0.5026953",
"0.5024324",
"0.5019054",
"0.49579623",
"0.4955245",
"0.4950787",
"0.494346... | 0.74160415 | 0 |
Check if the entities list already has entityToCheck (exact match of entity type and data/key values) | function isDuplicateEntity(entities, entityToCheck) {
var entity;
for (var i = 0; i < entities.length; i++) {
entity = entities[i];
// If entityKey matches and data matches, then we know it's a duplicate
// Note: We are still doing loose type equality checking since user-entered... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isEntityAlreadyTraversed(entity) {\n let {\n architectureDetails,\n questionDetails,\n questionEntityMapping\n } = this.props;\n\n let entityQuestions = architectureDetails[this.activeGroup].entities[entity].questions;\n for(l... | [
"0.61251825",
"0.6018278",
"0.58793074",
"0.5795872",
"0.5617822",
"0.55803543",
"0.54152524",
"0.53720486",
"0.5346388",
"0.52884185",
"0.51767004",
"0.51581216",
"0.5118023",
"0.5114549",
"0.51034766",
"0.50889957",
"0.50746655",
"0.507118",
"0.5053284",
"0.5044708",
"0.503... | 0.7112184 | 0 |
Compare entities for sorting list of entities | function compareEntities(obj1, obj2) {
if (obj1.entityKey < obj2.entityKey) {
return -1;
}
if (obj1.entityKey > obj2.entityKey) {
return 1;
}
return 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function compareEntities (a, b) {\n if (a.params && b.params && a.params[0] < b.params[0]) {\n return -1\n } else if (a.params && b.params && a.params[0] > b.params[0]) {\n return 1\n } else {\n return 0\n }\n}",
"function sortAggregateMethodEntities(entities) {\n entities.sort(functi... | [
"0.6598243",
"0.6572037",
"0.6233598",
"0.62130594",
"0.62027967",
"0.61671114",
"0.6154271",
"0.6136216",
"0.61128646",
"0.6005641",
"0.5973463",
"0.5958161",
"0.5948154",
"0.5944692",
"0.59223485",
"0.5918282",
"0.5903853",
"0.5879336",
"0.5875864",
"0.58670473",
"0.5848342... | 0.7103396 | 0 |
Log each entity's data | function logEntities(entityDataList, label) {
if (entityDataList && entityDataList.length) {
console.log(' ' + label + ':');
entityDataList.forEach(function (entityData) {
console.log(' ' + JSON.stringify(entityData));
});
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function logData(data){\n for (let a = 0; a < data.article.length; a++) {\n console.log(files.article[a].ID);\n console.log(files.article[a].header);\n console.log(files.article[a].link);\n }\n }",
"function logData() {\n console.log(\"Name: \" + datasetName);\n console.log(\"num Attr... | [
"0.6706558",
"0.664481",
"0.6322442",
"0.60323715",
"0.60142213",
"0.58780724",
"0.5868398",
"0.582567",
"0.5824983",
"0.5786566",
"0.57309425",
"0.570887",
"0.56587595",
"0.56062603",
"0.55891824",
"0.55632836",
"0.55614537",
"0.5560862",
"0.5551974",
"0.5522613",
"0.5511529... | 0.7476133 | 0 |
method to destroy and rerender chart with new values | updateChart(data) {
this.chart.destroy();
this.chartData = Object.values(data);
this.barChart();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function redrawChart() {\n usageBarChart.data = usageBarChartData;\n usageBarChart.update();\n}",
"function update() {\n // Reload and process the data\n chart.reloadData(currentData)\n\n // Get an object representing all the circles in the chart\n let circles = chart.bind(\"circle\... | [
"0.70381963",
"0.700058",
"0.70002216",
"0.6941961",
"0.6940238",
"0.6911408",
"0.6853438",
"0.68467194",
"0.68431336",
"0.6823986",
"0.681307",
"0.67903364",
"0.67178464",
"0.66915244",
"0.66377175",
"0.66140944",
"0.6595117",
"0.6579795",
"0.65600884",
"0.653106",
"0.651323... | 0.7435993 | 0 |
Coords > BlackBox > Everything about that tile's generation | function blackBox(x,y) {
//List of features
var tile = {hash:0,rock:false,color:"",lake:false,sandpebble:false,test:false,tree:false,empty:true};
//Simplex noise
tile.clayhash = simplex.noise2D(x/20+1000, y/20+1000);
tile.lakehash = simplex.noise2D(x/20, y/20);
tile.rockhash = simplex.noise2D(x/1, y/1);
tile.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function determineInsideUnfilledTiles(boxIndex){/*...*/}",
"generateBlankMap() {\n for (var lay = 0; lay < this.data.height; lay++) {\n for (var col = 0; col < this.data.width; col++) {\n this.tiles.push(false);\n }\n }\n }",
"drawTile(x, y, r, g, b) {\n const bmp = this.game.add.bit... | [
"0.713332",
"0.6790567",
"0.6595528",
"0.64718944",
"0.6420028",
"0.63896346",
"0.63824993",
"0.63809294",
"0.6369121",
"0.6359519",
"0.6353406",
"0.6352653",
"0.6278286",
"0.62127805",
"0.6211306",
"0.6208124",
"0.62062156",
"0.6204399",
"0.620203",
"0.6177943",
"0.6172044",... | 0.6857589 | 1 |
create a async function for all vectors to be drawn simultaneously | async function vec_draw_promises_func() {
vecs.forEach((item) => {
vec_conf = vec_conf_list[i] || dflt_vec_conf;
i += 1;
vec_draw_promises.push((_single_vec_creation_animation(item, xScale, yScale, vecGroup, vec_conf))())
})
await Promise.all(vec_draw_promises)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"processAllVerticies(){\n while(!this.isFinished()){\n this.processNextVertex()\n }\n }",
"async function ready(){\n boxes = makeBoxes(10, 10)\n WIDTH = window.innerWidth\n HEIGHT = window.innerHeight\n\n const container = document.querySelector(\"#container\")\n //container.setAttribute(\"style\... | [
"0.6285683",
"0.5956698",
"0.5852937",
"0.57811385",
"0.57696754",
"0.5752012",
"0.5721999",
"0.57034624",
"0.56290716",
"0.56155604",
"0.5568273",
"0.55315334",
"0.54473966",
"0.542203",
"0.54141766",
"0.5398188",
"0.5398032",
"0.5395319",
"0.5365447",
"0.5359645",
"0.534100... | 0.77929336 | 0 |
this function create reference of image to product. | function addreferencetoimages(product, res, next) {
var formattedparent = client.productPath(projectId, location, product.productid);
var referenceTasks = product.images.map(
(image) => new Promise((resolve, reject) => {
var bucketfile = 'product-images/' + image.filename;
var ref... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function renderProductImage (productArray) {\n var img = document.createElement('img');\n img.setAttribute('src', 'img/' + productArray.fileName);\n img.setAttribute('id', productArray.fileName);\n productsParent.append(img);\n}",
"function open_reference_image(evt) {\n //chart.js api call\n var item = cha... | [
"0.64717436",
"0.63741654",
"0.6347484",
"0.63083154",
"0.6251826",
"0.6219463",
"0.61617833",
"0.61433697",
"0.6059379",
"0.6046694",
"0.60000366",
"0.59790546",
"0.59706944",
"0.5962809",
"0.5953411",
"0.5917925",
"0.5888323",
"0.58805746",
"0.5878666",
"0.5878022",
"0.5861... | 0.65048313 | 0 |
this function associate the created product with productset | function associateproductset(product, next) {
var productPath = client.productPath(projectId, location, product.productid);
var productSetPath = client.productSetPath(
projectId,
location,
config.defaultproductsetid
);
var request = {
name: productSetPath,
product: productPath,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"addProduct(product) {\n\n this._products.push(product);\n }",
"function InsertProduct(call, response) {\n let product = call.request\n\n product.id = uuidv4()\n products.push(product)\n\n response(null, { status: true })\n}",
"async setProduct(req, res) {\n const product = await Products.c... | [
"0.7044393",
"0.70176524",
"0.6974841",
"0.6772029",
"0.670381",
"0.66888523",
"0.6612983",
"0.6591348",
"0.65903014",
"0.658651",
"0.6530692",
"0.6483271",
"0.6470166",
"0.64581406",
"0.6456156",
"0.6425495",
"0.6403767",
"0.6374547",
"0.6344066",
"0.63440233",
"0.6304547",
... | 0.75922275 | 0 |
Calculate statistics from the array of hax elements | calcStats(elements) {
if (elements && HAXStore.activeHaxBody.innerText) {
let counts = {
c: HAXStore.activeHaxBody.innerText.length,
w: parseInt(HAXStore.activeHaxBody.innerText.split(/\s+/g).length - 1),
h: 0,
p: 0,
e: 0,
};
elements.forEach((el) => {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handledataRate (hindex){\n return _(arr.slice(0,hindex+1)).unzip().map((d,i)=>{return {axis: serviceFullList[i].text, value: ss.mean(d),minval: ss.min(d),maxval: ss.max(d), q1: ss.quantile(d,0.25),q3: ss.quantile(d, 0.75)}});\n // return _(arr).unzip().map((d,i)=>{return {axis: axes[i], valu... | [
"0.6046037",
"0.59309256",
"0.58416784",
"0.58327883",
"0.57951754",
"0.5781302",
"0.5524627",
"0.5507005",
"0.54869974",
"0.541784",
"0.53350323",
"0.53219837",
"0.5305035",
"0.5290008",
"0.52469236",
"0.5237625",
"0.5207223",
"0.51963454",
"0.51906854",
"0.5188345",
"0.5156... | 0.62290657 | 0 |
build array of Legend divs | function getArrayOfLegendDivs(currentLegend) {
currentLegend = currentLegend.replace(' class=\" out-of-scale\"','');
var arrayCurrentLegend = currentLegend.split("<div id=");
for ( var i = 0; i < arrayCurrentLegend.length; i++ ) {
if ( i > 0 ) {
arrayCurrentLegend[i-1] = "<div id=" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"renderLegend_Div(i){\r\n // Construct the id of the row of the legend based on the input index \"i\"\r\n var id_full = \"legend_row_\"+i.toString();\r\n // Render a Legend_Div component \r\n return <Legend_Div \r\n id_ind={id_full} \r\n // The map_c... | [
"0.6890546",
"0.6791771",
"0.6790778",
"0.67754704",
"0.6774127",
"0.67359555",
"0.6702662",
"0.66457844",
"0.6615063",
"0.6613083",
"0.66112864",
"0.66010916",
"0.65936744",
"0.6566834",
"0.65278816",
"0.6496957",
"0.648503",
"0.6444456",
"0.64396214",
"0.63798296",
"0.63763... | 0.6821922 | 1 |
build array of Info divs | function getArrayOfInfoDivs( currentInfo ) {
var arrayCurrentInfo = currentInfo.split( "<div id=" );
for ( var i = 0; i < arrayCurrentInfo.length; i++ ) {
if ( i > 0 ) {
arrayCurrentInfo[i-1] = "<div id =" + arrayCurrentInfo[i];
}
}
if ( i > 0) {
arrayCurrentInfo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createDivs(){\n for(var i = 0; i < divElements.length;i++){\n divElements[i].id = 'info-'+i\n }\n}",
"buildFilterInfo() {\n\n this.filterinfo = document.createElement('div');\n this.filterinfo.classList.add('grid-filterinfo');\n\n let label = document.createElement('label');\n ... | [
"0.692393",
"0.6344459",
"0.62749517",
"0.6124605",
"0.61141926",
"0.60641617",
"0.60561836",
"0.6013742",
"0.60016197",
"0.5999755",
"0.5980504",
"0.5961772",
"0.5916622",
"0.58969265",
"0.58852637",
"0.5865963",
"0.5865914",
"0.5848974",
"0.58372164",
"0.58330625",
"0.58312... | 0.7103905 | 0 |
Input: key // User key hash (Uint8Array) salt // Salt (email or username) (Uint8Array) logN = 17 // CPU/memory cost parameter (Integer 1 to 31) r = 8 // Block size parameter dkLen = 64 // Length of derived key in Bytes interruptStep = 1000 // Steps to split calculation with timeouts callback function Result: Returns 64... | function getScryptKey (key, salt, logN, r, dkLen, interruptStep, callback) {
'use strict'
scrypt(key, salt, logN, r, dkLen, interruptStep, function (keyBytes) {
return callback(keyBytes)
}, null)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function scrypt (key, salt, N, r, p, dkLen, progressCallback) {\n\t if (N === 0 || (N & (N - 1)) !== 0) throw Error('N must be > 0 and a power of 2')\n\n\t if (N > MAX_VALUE / 128 / r) throw Error('Parameter N is too large')\n\t if (r > MAX_VALUE / 128 / p) throw Error('Parameter r is too large')\n\n\t var XY ... | [
"0.7399515",
"0.7384747",
"0.7384747",
"0.7384747",
"0.7384747",
"0.7384747",
"0.7384747",
"0.7382255",
"0.7334156",
"0.7334156",
"0.72251827",
"0.72251827",
"0.72251827",
"0.71965075",
"0.71965075",
"0.71965075",
"0.7194196",
"0.71778435",
"0.71778435",
"0.7165138",
"0.71651... | 0.8079264 | 0 |
Assume all nonempty lines are statement lines. (no comments yet...) | function isStatementLine( line ) {
// TODO: Should probably add comments at some point.
if( isEmptyLine( line ) ) {
return false;
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static _analyzeLines(type, insertSpace, model, lines, startLineNumber, ignoreEmptyLines, ignoreFirstLine) {\n let onlyWhitespaceLines = true;\n let shouldRemoveComments;\n if (type === 0 /* Toggle */) {\n shouldRemoveComments = true;\n }\n else ... | [
"0.59990185",
"0.58959264",
"0.58386815",
"0.5736988",
"0.57250315",
"0.56979424",
"0.5682986",
"0.56756175",
"0.56481206",
"0.55235285",
"0.5508281",
"0.5501762",
"0.5476707",
"0.5404564",
"0.5402541",
"0.53225285",
"0.53225285",
"0.5293321",
"0.5293321",
"0.5293321",
"0.529... | 0.6710777 | 0 |
Given a property identifier, return the type from its definition | fieldType(identifier) {
var def = this.fieldDefinition(identifier);
return (def ? def['@type'] : null)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static getPropertyType(targetObj, propName) {\n let property = Reflect.get(targetObj, propName);\n if (util_1.isNullOrUndefined(property))\n return PropertyType.Unknown;\n if (typeof property === \"string\")\n return PropertyType.String;\n if (typeof property === \... | [
"0.63681084",
"0.6223946",
"0.61915326",
"0.61915326",
"0.5837413",
"0.5695445",
"0.56575966",
"0.56444657",
"0.564133",
"0.5639396",
"0.55139136",
"0.5496487",
"0.5485792",
"0.5473654",
"0.54414445",
"0.54276",
"0.5421988",
"0.5393616",
"0.5364677",
"0.53626865",
"0.53626865... | 0.6237257 | 1 |
Given a Graph, and a prototype, compute the perid state deltas. | computeDeltas(graph, prototypeObject) {
throw (new Error('GraphEnvironment.computeDeltas must be implemented'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getStateGraph() {\n var nodes = new StateReprSet();\n var edges = [];\n var actions = this.actions;\n var prev_node = null;\n var next_edge_detail = null;\n\n // Recursive rule creator:\n let createRule = (name, args) => {\n ... | [
"0.5193624",
"0.4851605",
"0.47052413",
"0.46214843",
"0.45777062",
"0.45720398",
"0.4555764",
"0.45485628",
"0.45008063",
"0.45008063",
"0.44859245",
"0.44696024",
"0.44665757",
"0.44378924",
"0.44271472",
"0.44084913",
"0.43791682",
"0.43615562",
"0.43267724",
"0.43260664",
... | 0.59223145 | 0 |
Sets a marker on a given map at a given location and adds a click listener to open an infowindow | function setMarker(marker, map, location, infowindow) {
//Check if the location is an address or an array of latitude, longitude
if (typeof location === "string") {
marker.setPosition(codeAddress(geocoder, location));
marker.setMap(map);
} else {
marker.setPosition(location);
marker.setMap(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setupMarker() {\n locator = new google.maps.Marker({\n map: map,\n animation: google.maps.Animation.DROP\n\n });\n locator.addListener('click', function() {\n infowindow.open(map, locator);\n });\n}",
"function bindInfoClick(marker, content){\n //adding info \n var... | [
"0.76586974",
"0.7445598",
"0.74454874",
"0.7423137",
"0.73279154",
"0.7296668",
"0.7282854",
"0.7279396",
"0.7269066",
"0.72658587",
"0.72632",
"0.72580665",
"0.72375715",
"0.7213105",
"0.71678805",
"0.71618456",
"0.71420914",
"0.71311384",
"0.7125242",
"0.7121508",
"0.71119... | 0.80717 | 0 |
Creates a marker on with a given marker paramenters | function createMarker(params) {
var marker = new google.maps.Marker({
anchorPoint: params.point,
animation: params.animation,
clickable: params.clickable,
crossOnDrag: params.crossOnDrag,
cursor: params.cursor,
draggable: params.draggable,
icon: params.icon,
label: params.labe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createMarkers() {\n\n}",
"function makeMarkers(){\n\n }",
"marker(marker, width, height, block) {\n let attr = [\"marker\"]; // Build attribute name\n\n if (marker !== \"all\") attr.push(marker);\n attr = attr.join(\"-\"); // Set marker attribute\n\n marker =\n arguments[... | [
"0.75743234",
"0.73745406",
"0.7287382",
"0.724449",
"0.7175201",
"0.7087285",
"0.70172995",
"0.6936759",
"0.6911351",
"0.685557",
"0.6840003",
"0.6790486",
"0.67873526",
"0.67850006",
"0.67762995",
"0.6755854",
"0.67514765",
"0.6737066",
"0.67326194",
"0.6727508",
"0.6726949... | 0.76486707 | 0 |
Creates an infowindow on with a given marker paramenters | function createInfoWindow(params) {
var infowindow = new google.maps.InfoWindow({
content: params.content,
disableAutoPan: params.disableAutoPan,
maxWidth: params.maxWidth,
pixelOffset: params.pixelOffset,
position: params.position,
zIndex: params.zIndex
});
return infowindow;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createInfowindow() {\n\tmarker = this;\n\tinfowindow = largeInfowindow;\n\t// Bounce when show infowindow\n\tmarker.setAnimation(google.maps.Animation.BOUNCE);\n\t// Set BOUNCE animation timeout\n\tsetTimeout(function() {\n\t\tself.marker.setAnimation(null);\n\t}, 1200);\n\t// Fill the fetched info from F... | [
"0.7529496",
"0.7444013",
"0.7397816",
"0.73961",
"0.7386762",
"0.73674434",
"0.7363443",
"0.73588645",
"0.7306715",
"0.7287901",
"0.72549427",
"0.72421336",
"0.72312534",
"0.72223425",
"0.7214603",
"0.7212789",
"0.719485",
"0.7194438",
"0.7182339",
"0.71791476",
"0.71780163"... | 0.7460532 | 1 |
Gets the state of a board or a square in a board (don't define square if only want board) | getState(board, square) {
if(square === undefined) return this.states[board];
else return this.boards[board][square];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getBoardState() {\r\n\tfor (var i = 0; i < boardHeight/tileHeight; i++) {\r\n\t\tfor (var j = 0; j < boardWidth/tileWidth; j++) {\r\n\t\t\tvar tileAlive = $(\"#\" + i + \"_\" + j).hasClass(\"alive\");\r\n\t\t\tif (tileAlive) {\r\n\t\t\t\tboardState[i][j] = 1;\r\n\t\t\t} else {\r\n\t\t\t\tboardState[i][j] ... | [
"0.71640456",
"0.71455616",
"0.7123623",
"0.68384063",
"0.65834594",
"0.65665907",
"0.64343065",
"0.6416861",
"0.638113",
"0.6350007",
"0.6349027",
"0.6346121",
"0.6341549",
"0.63156974",
"0.62668633",
"0.62051415",
"0.62014246",
"0.6145679",
"0.61153257",
"0.6082855",
"0.605... | 0.83922195 | 0 |
Whether a board or a square in a board is "marked" (don't define square if only want board) | isMarked(board, square) {
return this.getState(board, square) == X
|| this.getState(board, square) == O
|| this.getState(board) == C;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isBorder(row,col) {\n const squares = this.state.squares;\n for(let i = row - 1; i <= row + 1; i++) {\n for(let j = col - 1; j <= col + 1; j++) {\n if(i >= 0 && i < this.state.height &&\n j >= 0 && j < this.state.width &&\n !(i === row && j === col)){\n\n if(!squares[i... | [
"0.7262617",
"0.72335064",
"0.69788927",
"0.68958896",
"0.68585855",
"0.6788036",
"0.6784929",
"0.6752879",
"0.6748377",
"0.6741504",
"0.6684539",
"0.660994",
"0.6609562",
"0.66066146",
"0.6599677",
"0.65992945",
"0.6558385",
"0.65548164",
"0.6548786",
"0.6542935",
"0.6509068... | 0.84177643 | 0 |
Sets the state of a board or square in a board (don't define square if only want to set board) | setState(state, board, square) {
if(square === undefined) this.states[board] = state;
else this.boards[board][square] = state;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeBoardState() {\n const class_name = this.className;\n switch (rgbToHex(this.style.backgroundColor)) {\n case \"#FF00A7\":\n BOARD.boxes[class_name].x + 1 < BOARD.length_board ? BOARD.boxes[class_name].x ++ : null;\n break;\n case \"#0... | [
"0.7110944",
"0.70620275",
"0.69434184",
"0.6920933",
"0.6610858",
"0.6555272",
"0.6453857",
"0.6403424",
"0.6375853",
"0.63711876",
"0.6358634",
"0.6348239",
"0.62994206",
"0.62877053",
"0.62837774",
"0.62330496",
"0.62163657",
"0.61878693",
"0.6185745",
"0.61744285",
"0.614... | 0.84546566 | 0 |
Whether a board or square in a board is selectable by the player in the current round (don't define square if only want board) | isSelectable(board, square) {
if(square == undefined) return !this.isMarked(board) && (board == this.currentBoard || this.currentBoard == -1);
else return !this.isMarked(board, square);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isWin(board) {}",
"validPieceToMove(select) {\n var [r, c] = select;\n return this.matrix[r][c].player == this.player;\n }",
"whoseTurn(x, y, targetColor, blue, green){\n //which square was clicked\n let squarePosition = this.grid[x][y];\n\n let gridPo... | [
"0.7069165",
"0.6860125",
"0.6801341",
"0.6738881",
"0.6718675",
"0.66534555",
"0.6608131",
"0.65748614",
"0.65599877",
"0.65471935",
"0.6520162",
"0.65046966",
"0.65010595",
"0.6499138",
"0.6497506",
"0.6496604",
"0.6495552",
"0.64929384",
"0.64895165",
"0.6481026",
"0.64760... | 0.7602438 | 0 |
Attempts to select a board, on failure will allow the next player to select the next board | select(board) {
if(this.isMarked(board)) this.currentBoard = -1;
else this.currentBoard = board;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"selectCell(event) {\n // Get the cell id and check if the game has finished\n const cellNo = event.target.id\n if (this.props.board[cellNo] === '0' && this.props.winner === 0) {\n const board = \n this.props.board.map(\n (item,index) => {\n return index === cellNo ? '-1' : ... | [
"0.6387788",
"0.6289892",
"0.62371147",
"0.6217724",
"0.60894865",
"0.60283655",
"0.60240036",
"0.60101587",
"0.59713644",
"0.5933468",
"0.5931263",
"0.58675295",
"0.58567053",
"0.5844625",
"0.58416176",
"0.5835789",
"0.5830287",
"0.5815156",
"0.5811624",
"0.57973665",
"0.578... | 0.65509343 | 0 |
Checks if there are any win states, first in the current board then in the global board | checkWinStates() {
// in current board
let state = '';
for(let i=0;i<9;i++) state += this.getState(data.currentBoard, i);
this.winStates.forEach(winState => { if(winState.state.test(state)) this.setState(winState.token, data.currentBoard); });
if(!this.empt.test(state)) this.setS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isWin(board) {}",
"function checkForOverallWin(){\n console.log('I am checking for overall win')\n winningCombos.forEach(combo => {\n if(combo.every(number => boardGrid[number] === 'X')) {\n winLargeBoard.play()\n currentGame = null\n // overAllWinner = 'X!'\n cons... | [
"0.7564783",
"0.74857444",
"0.7417264",
"0.73602206",
"0.7354161",
"0.7349453",
"0.7344073",
"0.7327958",
"0.73000985",
"0.7242473",
"0.7230292",
"0.7212665",
"0.71834874",
"0.7175703",
"0.7167523",
"0.7164713",
"0.7164025",
"0.716329",
"0.71630764",
"0.7152458",
"0.71363634"... | 0.80711967 | 0 |
Generates the win state regexes and related info used to determine if there are any win states | generateWinStates() {
this.winStates = [];
// X Win States
this.winStates.push({state:/XXX....../, token:X, row:[0, 2]}); // x top row
this.winStates.push({state:/...XXX.../, token:X, row:[3, 5]}); // x middle row
this.winStates.push({state:/......XXX/, token:X, row:[6, 8]}); //... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"checkWinStates() {\n // in current board\n let state = '';\n for(let i=0;i<9;i++) state += this.getState(data.currentBoard, i);\n this.winStates.forEach(winState => { if(winState.state.test(state)) this.setState(winState.token, data.currentBoard); });\n if(!this.empt.test(state))... | [
"0.6477686",
"0.6382628",
"0.6044572",
"0.59105706",
"0.5900093",
"0.57881665",
"0.57369715",
"0.57223725",
"0.5666642",
"0.565044",
"0.5480998",
"0.5470575",
"0.54391783",
"0.5438072",
"0.5412677",
"0.5387815",
"0.5378576",
"0.5371872",
"0.53545785",
"0.53538287",
"0.5337645... | 0.7026907 | 0 |
Get result of operation Processing stack 3 by 3 (operand, operator, operand) Recursive calls when operand is an operation | getResult() {
while(this.stack.length > 1) { // when stack.length == 1, it's the final answer.
let currentResult = 0;
let currentElement = this.stack.shift(); // first operand
if (currentElement instanceof Operation) {
currentResult = currentElement.getResult(); // recursive call
} else if (typeof cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function processOperation() {\n var operation = opStack.pop();\n if (unaryOpx.indexOf(operation) > -1) {\n valueStack.push(applyOperation(operation, valueStack.pop(), undefined));\n } else if (ternaryOpx.indexOf(operation) > -1) {\n ... | [
"0.75837386",
"0.67470396",
"0.6737698",
"0.6729773",
"0.66113317",
"0.65701264",
"0.6569747",
"0.65365213",
"0.6494419",
"0.6477887",
"0.62898964",
"0.62898964",
"0.6283449",
"0.62740403",
"0.62285274",
"0.6220088",
"0.6213081",
"0.620943",
"0.6191165",
"0.61662453",
"0.6149... | 0.80483216 | 0 |
Add operand to stack | addOperand(operand) {
if (operand instanceof Operation) {
operand.setParent(this);
}
this.stack.push(operand);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addOperatorToCalcStack() {\n\t\t\t\tif (!isNaN(_self._model.popCalculate())) {\n\t\t\t\t\t_self._model.pushCalculate(operator);\n\t\t\t\t} else {\n\t\t\t\t\t// If the calculate stack is not empty, then push the operator on to the stack\n\t\t\t\t\tif (!_self._model.isCalculateEmpty()) {\n\t\t\t\t\t\t_self.... | [
"0.7162527",
"0.66961914",
"0.65790206",
"0.6563152",
"0.6358221",
"0.63577235",
"0.6314219",
"0.63020325",
"0.6244365",
"0.6146278",
"0.6138161",
"0.6136598",
"0.6082773",
"0.6072144",
"0.60703236",
"0.6012188",
"0.5956865",
"0.5956456",
"0.5951899",
"0.5938239",
"0.5863903"... | 0.71199155 | 1 |
list all functions and their versions | async listFunctions() {
const funcs = await this.getFunctions();
const funcsVersions = await this.getFunctionVersions(funcs);
this.displayFunctions(funcsVersions);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"callableFunctionsInfo(){\n let availableFunctions = [];\n \n const listFilesSchema = {\n \"name\": \"listFiles\",\n \"description\": \"Returns a list of available files for a URL.\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"path\": {\n ... | [
"0.59919035",
"0.5956575",
"0.5926768",
"0.5922697",
"0.5892408",
"0.5891916",
"0.5852155",
"0.58145535",
"0.5783355",
"0.576783",
"0.5763118",
"0.5731486",
"0.5627223",
"0.56263465",
"0.5621374",
"0.56093836",
"0.55941725",
"0.5542318",
"0.55135375",
"0.5484874",
"0.5466703"... | 0.81429833 | 0 |
BEGIN QUICK THEME COLOR PICKER TAB BODY CONTENT when the user clicks a color block in the quick theme color picker tab body content, the css variables themeprimarycolor & themesecondarycolor change according to the selected color block and the variables localStorage.themePrimaryColor & localStorage.themeSecondaryColor ... | function changeThemeColors(themePrimaryColor, themeSecondaryColor) {
localStorage.themePrimaryColor = themePrimaryColor;
localStorage.themeSecondaryColor = themeSecondaryColor;
document.documentElement.style.setProperty('--theme-primary-color', localStorage.themePrimaryColor);
do... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeThemeColor() {\n storageGet('color', function(storage) {\n var classesNames = [\n '_2t-a _26aw _5rmj _50ti _2s1y',\n '_2n_9',\n '_59fb _tmz',\n '_5lxt'\n ];\n\n var colors = {\n '1': 'rgb(19, 207, 19)',\n '2': ... | [
"0.67940277",
"0.66768456",
"0.65546113",
"0.65202504",
"0.64392483",
"0.63961893",
"0.63672245",
"0.63582385",
"0.6333349",
"0.63092273",
"0.6277399",
"0.62522614",
"0.6231405",
"0.6219089",
"0.61386937",
"0.61083406",
"0.6069607",
"0.6051649",
"0.60376024",
"0.6031375",
"0.... | 0.66943425 | 1 |
Fetch a single product by ID | function fetchProduct(id){
productId = id.toString();
client.product.fetch(productId).then((product) => {
// Do something with the product
console.log(product);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getProductById(id) {\n\n }",
"function get_product_by_id (args, done) {\n const product = seneca.make(\"products\");\n product.load$(args.id, done);\n }",
"getById(id) {\n return productModel.findByPk(id);\n }",
"one(id) {\n return fetch(`${BASE_URL}/products/${id}`, {\n cr... | [
"0.8209052",
"0.7990531",
"0.79602224",
"0.7799095",
"0.77223897",
"0.7711977",
"0.7670216",
"0.76350874",
"0.75782573",
"0.74883115",
"0.74588805",
"0.74338293",
"0.7398008",
"0.73749745",
"0.73591036",
"0.7345343",
"0.7323724",
"0.73163956",
"0.72116864",
"0.7114881",
"0.71... | 0.8125889 | 1 |
Fetching Collection Fetch all collections, including their products | function fetchAllCollections(){
var deferred = $.Deferred();
client.collection.fetchAllWithProducts().then((collections) => {
// Do something with the collections
deferred.resolve(collections);
});
return deferred.promise();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static fetchAll() {\n const db = getDb()\n return db.collection(\"products\").find().toArray()\n .then(products => {\n console.log(products);\n return products\n }).catch(err => {\n console.log(err)\n }); // find is a method to find Data on M0ngoDb, which returns a cur... | [
"0.73920023",
"0.7178347",
"0.717531",
"0.70851576",
"0.699369",
"0.6951353",
"0.6941646",
"0.69364566",
"0.6835743",
"0.6714265",
"0.6621338",
"0.6621338",
"0.64772505",
"0.6459178",
"0.6452315",
"0.6449124",
"0.64198047",
"0.6393642",
"0.63888747",
"0.63694304",
"0.63586897... | 0.76130825 | 0 |
Fetch a single collection by ID, including its products | function fetchCollection(id){
collectionId = id.toString();
client.collection.fetchWithProducts(collectionId).then((collection) => {
// Do something with the collection
console.log(collection);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get(collection, id) {\r\n return this.find(collection, 'id', id);\r\n }",
"function get_product_by_id (args, done) {\n const product = seneca.make(\"products\");\n product.load$(args.id, done);\n }",
"one(id) {\n return fetch(`${BASE_URL}/products/${id}`, {\n credentials: \"include\"\n... | [
"0.74927366",
"0.6985821",
"0.69721854",
"0.68464315",
"0.6842404",
"0.6736477",
"0.668789",
"0.66551816",
"0.6653574",
"0.66255105",
"0.65899557",
"0.6579384",
"0.65274894",
"0.6522921",
"0.6487336",
"0.64533794",
"0.6421962",
"0.641401",
"0.6409362",
"0.6408522",
"0.6395555... | 0.7935243 | 0 |
Checkout Create an empty checkout | function createCheckout(){
client.checkout.create().then((checkout) => {
// Do something with the checkout
console.log(checkout);
return checkout.id
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"initializeCheckout() {\n const checkoutView = new CheckoutView();\n // $('#recipt-info').attr(\"hidden\", false);\n }",
"checkout(cart) {\n let request = this.buildPaymentRequest(cart);\n let response;\n // Show UI then continue with user payment info\n\n // TODO PAY-6 - display the Paym... | [
"0.60146344",
"0.5644916",
"0.5581514",
"0.5580143",
"0.5498255",
"0.5456941",
"0.54528934",
"0.5431191",
"0.53930455",
"0.5377927",
"0.53694904",
"0.5308302",
"0.52386606",
"0.5221558",
"0.521964",
"0.5176323",
"0.515595",
"0.50966275",
"0.5095861",
"0.50867486",
"0.507809",... | 0.6987395 | 0 |
Add Item To Checkout | function addItemCheckout(checkoutId, itemID, quantity){
lineItemsToAdd = [
{variantId: itemID, quantity: quantity}
];
// Add an item to the checkout
client.checkout.addLineItems(checkoutId, lineItemsToAdd).then((checkout) => {
// Do something with the updated checkout
console.log(chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addItemToPurchase() {}",
"function addItemToShoppingList(itemName) {\n STORE['item'].push({name: itemName, checked: false})\n}",
"function addItemToShoppingList(itemName) {\n STORE.items.push({name: itemName, checked: false});\n}",
"function addItem() {}",
"add_item(item){}",
"function addItem... | [
"0.81526256",
"0.72145855",
"0.7142373",
"0.7126983",
"0.7055604",
"0.7007527",
"0.69704515",
"0.6968615",
"0.6958687",
"0.69478124",
"0.68681335",
"0.6809697",
"0.6808272",
"0.676545",
"0.67611486",
"0.6739274",
"0.672963",
"0.67283964",
"0.6714399",
"0.67106736",
"0.6696473... | 0.7319107 | 1 |
Remove Item from Checkout | function removeItemCheckout(checkoutId, itemID){
lineItemIdsToRemove = [
itemID
];
// Remove an item from the checkout
client.checkout.removeLineItems(checkoutId, lineItemIdsToRemove).then((checkout) => {
// Do something with the updated checkout
console.log(checkout.lineItems); // Ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"remove(outfitId) {\n let item = this.getItem(outfitId);\n\n let itemIndex = this.items.indexOf(item);\n\n if (item) {\n this.items.splice(itemIndex, 1);\n this.update();\n }\n }",
"removeFromCart(state, item) {\n let index = state.cart.items.indexOf(item);\n\n if (ind... | [
"0.73420596",
"0.7240169",
"0.7209976",
"0.7130842",
"0.70538205",
"0.6988429",
"0.69676346",
"0.6966296",
"0.69290376",
"0.6905671",
"0.6880277",
"0.68298304",
"0.6775846",
"0.6775846",
"0.6770204",
"0.67692506",
"0.6759484",
"0.67568576",
"0.6746661",
"0.67164123",
"0.66944... | 0.73513305 | 0 |
function to loop through directions and create line | function createLine(arr,lineOutput){
//we start at (0,0)
var x = 0;
var y = 0;
//we loop through the directions
for (var i = 0; i < arr.length; i++){
//split the direction into 2 parts, the letter and the number
var dir = arr[i].substring(0,1);
var val = arr[i].substring(1);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addOneLine(i) {\n let twoPointForLine = [\n { lat: cycleCoordinates[i].lat, lng: cycleCoordinates[i].lng },\n { lat: cycleCoordinates[i + 1].lat, lng: cycleCoordinates[i + 1].lng },\n ];\n let cyclePath = new google.maps.Polyline({\n path: twoPointForLine,\n geodesic: true,\n ... | [
"0.67649156",
"0.6715814",
"0.6530643",
"0.64512193",
"0.64408535",
"0.6429129",
"0.6410016",
"0.6375845",
"0.6251947",
"0.6242048",
"0.6234116",
"0.621821",
"0.6194165",
"0.6189944",
"0.61870533",
"0.6173193",
"0.6168853",
"0.6158056",
"0.61555797",
"0.6095792",
"0.6094955",... | 0.7560172 | 0 |
load execution plan names to form | function loadExecutionPlanNames(elementId) {
Simulator.retrieveExecutionPlanNames(
function (data) {
createExecutionPlanMap(data);
refreshExecutionPlanList(elementId, Object.keys(executionPlanDetailsMap));
$('#' + elementId).prop("selectedIndex", -1);
},
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function refreshExecutionPlanList(elementId, executionPlanNames) {\n var newExecutionPlans = generateOptions(executionPlanNames);\n $('#' + elementId).html(newExecutionPlans);\n}",
"function refreshExecutionPlanList(elementId, executionPlanNames) {\n var newExecutionPlans = generateOptions(executionPlan... | [
"0.58223",
"0.58223",
"0.58079284",
"0.4972552",
"0.49718753",
"0.49622223",
"0.48844492",
"0.4822777",
"0.46961042",
"0.45057318",
"0.4487287",
"0.4454433",
"0.44312775",
"0.44231606",
"0.44215333",
"0.4415194",
"0.43940312",
"0.43783388",
"0.43625918",
"0.43618026",
"0.4335... | 0.70001024 | 0 |
create a map containing execution plan name | function createExecutionPlanMap(data) {
for (var i = 0; i < data.length; i++) {
executionPlanDetailsMap[data[i]['executionPlaName']] = data[i]['mode'];
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createExecution(endpointName, executionName) {\n let obj = {};\n obj.executionName = executionName;\n obj.endpointName = endpointName;\n obj.executionId = guid();\n return obj;\n}",
"function loadExecutionPlanNames(elementId) {\n Simulator.retrieveExecutionPlanNames(\n function (data) {\n... | [
"0.5480125",
"0.53838366",
"0.52028644",
"0.50628424",
"0.49699968",
"0.4938718",
"0.4896661",
"0.48666543",
"0.4828486",
"0.47579023",
"0.46973926",
"0.4650899",
"0.46260786",
"0.46260786",
"0.46260786",
"0.46075055",
"0.45797583",
"0.45066756",
"0.44919395",
"0.4485588",
"0... | 0.7634857 | 0 |
field names: id, userId, eventTime, writeTime, type, category, amount | async getItem(filter) {
let query = JSON.parse(JSON.stringify(filter));
return new Promise((resolve, reject) => {
const sql = `select id, user_id as userId, event_time as eventTime, write_time as writeTime, type, category, amount
from ledger`
if (query.id) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function type(d) {\n\td.UserID = +d.UserID;\n\td.Year = +d.Year;\n\treturn d;\n}",
"formatData(\n event, objectType, objectId, detail, parentType, parentId, userId\n ) {\n return {\n objectType: objectType,\n objectId: objectId,\n userId: userId,\n event: event,\n detail: detail,\... | [
"0.5114795",
"0.5083997",
"0.5081243",
"0.5073074",
"0.5072651",
"0.5013911",
"0.5004232",
"0.49428996",
"0.4930115",
"0.49278885",
"0.49273565",
"0.48743194",
"0.48332486",
"0.4826375",
"0.48127064",
"0.47944877",
"0.47896957",
"0.47840217",
"0.47684187",
"0.47580934",
"0.47... | 0.5850357 | 0 |
function returns trimmed crank case (cc) label. cc will be trimmed to a length mentioned in the environment variable CCLENGTH If no CCLENGTH is set, the function will return cc as it is. | function trimCrankCase(cc) {
return cc;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ccc(val) {\n return(val.substring(0, 2).toUpperCase());\n}",
"function ChannelTrim(formContext) {\n var phrase = GetAllChannelsValue(formContext);\n if (phrase != null) {\n var rephrase = \"\";\n if (phrase != null && phrase.length > 1) {\n rephrase = phrase.substring(0, ... | [
"0.65558344",
"0.57215834",
"0.5594406",
"0.5437795",
"0.54147905",
"0.5362849",
"0.5322854",
"0.53221434",
"0.53221434",
"0.52988034",
"0.52988034",
"0.52859515",
"0.52774966",
"0.52631754",
"0.52631754",
"0.5239129",
"0.5219472",
"0.52148783",
"0.5195932",
"0.5184449",
"0.5... | 0.7691997 | 0 |
CUSTOM METHODS Create the SFX | createSFX() {
this.SFX.dead = this.sound.add('dead-sfx');
this.SFX.shoot = this.sound.add('shoot-sfx');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function create() {\n\n}",
"_generateSPFxOptions() {\n\n if (this.options['component-description'] !== undefined) {\n this.options.SpfxOptions['componentDescription'] = this.options['component-description'];\n // for testing only\n this.options.SpfxOptions['component-descr... | [
"0.60768235",
"0.59148026",
"0.5809958",
"0.5736149",
"0.559302",
"0.5567569",
"0.5566095",
"0.55091935",
"0.55015135",
"0.55015135",
"0.55009866",
"0.5372201",
"0.5372201",
"0.53435194",
"0.5336125",
"0.5316347",
"0.5299666",
"0.52794635",
"0.52375776",
"0.5223384",
"0.52183... | 0.6486538 | 0 |
Configure the viewport to follow the player's character | setupCamera() {
let offsetX = -(this.game.scale.width / 2) + GAMESETTINGS.player.initialX * GAMESETTINGS.scaleFactor;
let offsetY = -(this.game.scale.height / 2) + GAMESETTINGS.player.initialY * GAMESETTINGS.scaleFactor;
this.viewport = this.cameras.main;
this.viewport.startFollow(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setPlayerPos() {\n player.x = HUD_WIDTH + (WIDTH - HUD_WIDTH)/2;\n player.y = 600;\n}",
"constructor() {\n this._viewport = { offset: { x: 0, y: 0 } };\n }",
"constrain() {\n this.pos.x = constrain(user.pos.x, 0 - this.r, 6000 - this.r);\n this.pos.y = constrain(user.pos.y, 0 + t... | [
"0.61209947",
"0.61164963",
"0.6115759",
"0.60498315",
"0.6020804",
"0.6016176",
"0.6014085",
"0.5989305",
"0.5941503",
"0.5874684",
"0.58431107",
"0.5813729",
"0.57950354",
"0.57907414",
"0.57857084",
"0.5785408",
"0.57665324",
"0.5758097",
"0.5741457",
"0.5736346",
"0.57326... | 0.7045719 | 0 |
Update the health UI | updateHealth() {
let healthTextValue = '';
for (let i = 0; i < this.health; i++) {
healthTextValue += '*';
}
if (this.healthText !== undefined) {
try {
this.healthText.text = healthTextValue;
} catch (TypeError) {}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function update() {\n healthBar.value = health;\n choosePick();\n lowhealth();\n}",
"update() {\n this.updateHealthBar();\n this.pauseMusic();\n this.checkWinCondition();\n \n }",
"function update(health) {\n if (target.health <= 0) {\n health = 0;\n }\n\n ... | [
"0.7449929",
"0.7225793",
"0.6934028",
"0.66630715",
"0.6629645",
"0.65646034",
"0.65162843",
"0.6508187",
"0.6497734",
"0.6479572",
"0.6474712",
"0.64475346",
"0.64359635",
"0.6420309",
"0.6380326",
"0.6346929",
"0.6334536",
"0.63342965",
"0.62929016",
"0.62841105",
"0.62814... | 0.7782417 | 0 |
Update the world bounds collision boxes for indefinite scrolling (from left to right) | updateWorldBounds() {
let targetX = this.viewport.scrollX - this.game.scale.width / 2;
for (let i = 0; i < this.worldBounds.length; i++) {
if (targetX > this.worldBounds[i].x + this.bufferZone) {
this.worldBounds[i].setPosition(
targetX,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"onBodyUpdate() {\n this.updateBounds();\n }",
"OnRebuildBounds()\n {\n box3.empty(this._boundingBox);\n sph3.empty(this._boundingSphere);\n\n if (!this._visibleItems.length)\n {\n this._boundsDirty = false;\n return;\n }\n\n const { box... | [
"0.708606",
"0.6693441",
"0.6615801",
"0.6571847",
"0.65296",
"0.6487695",
"0.6418994",
"0.6368584",
"0.63454455",
"0.6345176",
"0.6327494",
"0.62836915",
"0.62669504",
"0.6265112",
"0.62407815",
"0.62163234",
"0.61085933",
"0.60697174",
"0.6055856",
"0.60511196",
"0.6046656"... | 0.74219525 | 0 |
Update the player character's properties according to player input | updatePlayer() {
// -------------------------------- Categorize inputs -------------------------------- //
const control = {
left:
this.cursor.left.isDown ||
(this.pointer.isDown && this.pointer.x < this.scale.width / 2) ||
(this.touch.isDown &... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateCharacter()\n {\n player.displayRender();\n\n if (inputDown) deathWasBeforeUserInput = false;\n\n if(inputDown && player.contact)\n {\n player.displayStandingAnim();\n player.stopMoving();\n }\n else if (player.contact)\n {\n ... | [
"0.70436007",
"0.6705032",
"0.66512936",
"0.64582473",
"0.6457143",
"0.63363266",
"0.63254195",
"0.6217784",
"0.61757046",
"0.6142929",
"0.61318976",
"0.61145824",
"0.6105419",
"0.6019376",
"0.6013049",
"0.6010452",
"0.5970258",
"0.5937913",
"0.5928463",
"0.5926833",
"0.59199... | 0.6948707 | 1 |
a function that generates a random number every second and posts it to the main JavaScript | function generateNumbers(){
setInterval(function(){
// post a message to the main JavaScript
self.postMessage(Math.random());
}, 1000);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function startInterval()\r\n{\r\n rnTimer = window.setInterval(\"getRandom()\", 1500);\r\n}",
"function randomTime() {\n return Math.random() * 10000\n}",
"function getRandTime() {\n return Math.random() * 1000 + 200;\n}",
"function setTiming() {\r\n return Math.random() * (3000 - 1000) + 1000;\r... | [
"0.7456006",
"0.73451066",
"0.706059",
"0.69796115",
"0.697606",
"0.6902064",
"0.68456703",
"0.6769429",
"0.6761476",
"0.6755341",
"0.67438835",
"0.67132866",
"0.6710006",
"0.66644126",
"0.66526794",
"0.66056",
"0.6589956",
"0.6563742",
"0.65095526",
"0.65081775",
"0.6478604"... | 0.761478 | 0 |
Start running all tests. | function startTests() {
describe('All Tests', function() {
describe('START', function() {
runTests([new Test(
'Enable test mode', '~`RUN UNIT TESTS`~',
['~`UNIT TEST MODE ENABLED`~'])]);
});
describe('SpikeyBot', function() {
describe('Main Module', function() {
run... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function start() {\n // We need to set the reporter when the tests actually run to ensure no conflicts with\n // other test driver packages that may be added to the app but are not actually being\n // used on this run.\n mochaInstance.reporter(reporter);\n\n mochaInstance.run();\n}",
"function runTests() {\... | [
"0.77844757",
"0.74128336",
"0.7254175",
"0.71421087",
"0.67844164",
"0.6701678",
"0.6658743",
"0.6649832",
"0.66483474",
"0.6589397",
"0.6572458",
"0.65202314",
"0.6506199",
"0.6490271",
"0.6482085",
"0.64724475",
"0.6402927",
"0.637319",
"0.63587",
"0.63061726",
"0.6234097"... | 0.8417795 | 0 |
return the sum of the first n even numbers recursively. Assume n > 0 | function firstEvenNumbersSum(n) {
if (n === 0) return 0;
return 2 * n + firstEvenNumbersSum(n - 1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function firstEvenNumbersSum(n) {\n if (n === 1) return 2;\n return 2 * n + firstEvenNumbersSum(n - 1);\n}",
"function firstEvenNumbersSum(n) {\n if (n <= 1) {\n return 2;\n }\n let previous = (firstEvenNumbersSum(n - 1));\n let sum = ((n * 2) + previous);\n return sum;\n}",
"function s... | [
"0.8620322",
"0.8344846",
"0.7754228",
"0.7671206",
"0.7608992",
"0.7556744",
"0.7497116",
"0.7392172",
"0.7346442",
"0.73436695",
"0.7334832",
"0.7331556",
"0.7307887",
"0.73018193",
"0.72985345",
"0.7205039",
"0.71896493",
"0.7162457",
"0.7148408",
"0.71370566",
"0.71364963... | 0.8632483 | 0 |
takes an image using the pi cam and calls the given callback on success callback arguments are (imagefilename) | function takeImage(data, callback) {
/*callback(imageFolderName + "/test.jpg");
return; */
console.log("Debug: " + data.photoOptions.width + " " + data.photoOptions.height);
var options = {
mode: "photo",
output: imageFolderName + "/%d.jpg",
timeout: 1,
nopreview: true,
width: data.photoO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getImageFromCamera(callback) {\n cameraInput.onchange = function (onchangeEvent) {\n var files = onchangeEvent.target.files;\n if (files && files.length > 0) {\n camera.getOrientation(files[0], function (orientation) {\n var fileReader = new FileReader();\n fileRea... | [
"0.67821544",
"0.67272466",
"0.6667944",
"0.6567235",
"0.6511849",
"0.65057814",
"0.64978284",
"0.6487552",
"0.64699847",
"0.6466259",
"0.6390695",
"0.62616783",
"0.6177914",
"0.6168492",
"0.6149466",
"0.6145785",
"0.6102362",
"0.60903704",
"0.609029",
"0.60891163",
"0.608616... | 0.71186626 | 0 |
Mark Attendance in Bulk | mark_attend_inBulk(req, res) {
let timestamp = req.body.timestamp;
let dayDate = req.body.dayDate;
let month = req.body.month;
let attend_year = req.body.attend_year;
let year = req.body.year;
let count = 0;
let bulk_attend_array = req.body.bulk_attendance;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function MarkActive() \n\t{\n\t\tvar conn = $.db.getConnection();\n\tvar twelvehours_datetime = calculateDate(43200000);\n//var twelvehours_datetime = calculateDate(60000);// Date 12 hours prior to current date\n\tvar status = 'APPROVED';\n\n\tvar str = \"\"; // TO store all the permit numbers for \"in\" condition... | [
"0.570335",
"0.55644006",
"0.53332454",
"0.5299359",
"0.52249634",
"0.52222615",
"0.5193582",
"0.5163317",
"0.51607287",
"0.5147462",
"0.512772",
"0.5084202",
"0.505916",
"0.505916",
"0.5037049",
"0.4996159",
"0.4969848",
"0.4944358",
"0.493304",
"0.49269873",
"0.48883435",
... | 0.6298576 | 0 |
Search By NIC / Phone Num | searchByNicPhoneNum(req, res) {
let tbl = req.body.type;
let keyword = req.body.keyword;
let Searchkeyword = "%" + keyword + "%";
let query_paramas = [1, Searchkeyword, Searchkeyword];
let sql_prepare_statement;
if (tbl == "tbl_teachers") {
sql_prepare_state... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findSpecificContactByNameAndPhone(){\n\ttry{\n\t\t\n\t\tfindOptions = new blackberry.pim.contacts.ContactFindOptions();\n\t\tfindOptions.filter = [\n {fieldName: \n\t\tblackberry.pim.contacts.ContactFindOptions.SEARCH_FIELD_FAMILY_NAME, \n\t\tfieldValue: contactDetails.fname},\n\t\t{fieldName: \n\t... | [
"0.62305504",
"0.59775394",
"0.5861349",
"0.5722926",
"0.5616097",
"0.5601088",
"0.5595274",
"0.5469896",
"0.54595",
"0.54094994",
"0.53255856",
"0.53133386",
"0.527954",
"0.5276057",
"0.5258218",
"0.5249756",
"0.52403665",
"0.5151416",
"0.5138279",
"0.5135332",
"0.5135262",
... | 0.6047803 | 1 |
Simulate until 500 donuts | function fivehb() {
while (numdonut < 500) {
onceb();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fivehsk() {\r\n while (numdonutsk < 500) {\r\n oncesk();\r\n }\r\n}",
"async function sleepM() {\n for (var i = 0; i < speedOfDelivery; i += 10) {\n await sleep(10);\n if (i % 50 == 0) {\n postMessage(i / speedOfDelivery);\n }\n }\n ... | [
"0.70931435",
"0.64388263",
"0.63969195",
"0.63167006",
"0.6227397",
"0.621367",
"0.61776364",
"0.6140653",
"0.6090887",
"0.6056703",
"0.6043225",
"0.60293806",
"0.60018396",
"0.5956364",
"0.59478986",
"0.5922726",
"0.59201473",
"0.59012806",
"0.58823967",
"0.5872064",
"0.586... | 0.74069065 | 0 |
Simulate until 500 donuts | function fivehsk() {
while (numdonutsk < 500) {
oncesk();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fivehb() {\r\n while (numdonut < 500) {\r\n onceb();\r\n }\r\n}",
"async function sleepM() {\n for (var i = 0; i < speedOfDelivery; i += 10) {\n await sleep(10);\n if (i % 50 == 0) {\n postMessage(i / speedOfDelivery);\n }\n }\n r... | [
"0.74069065",
"0.64388263",
"0.63969195",
"0.63167006",
"0.6227397",
"0.621367",
"0.61776364",
"0.6140653",
"0.6090887",
"0.6056703",
"0.6043225",
"0.60293806",
"0.60018396",
"0.5956364",
"0.59478986",
"0.5922726",
"0.59201473",
"0.59012806",
"0.58823967",
"0.5872064",
"0.586... | 0.70931435 | 1 |
Creates a new client options : Object Options associated with the client. Allowed options: timeout (number): Seconds to wait for a response before it is considered timed out (default 30s) heartbeatInterval (number): The heartbeat interval in ms. (default 5000ms) | function Client(options) {
options = options || {};
var heartbeat = options.heartbeatInterval || DEFAULT_HEARTBEAT
this._timeout = options.timeout || DEFAULT_TIMEOUT;
this._socket = socket.client(heartbeat);
util.eventProxy(this._socket, this, "error");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createClient (options = {}) {\n\tObject.keys(defaults).forEach(function (key) {\n\t\tif (!options[key]) {\n\t\t\toptions[key] = defaults[key];\n\t\t}\n\t});\n\n\t// backwards compatibility helper... remaps 'index' to '_index'\n\tif (options.index) {\n\t\toptions._index = options.index;\n\t\tdelete options... | [
"0.61052454",
"0.59366083",
"0.5743951",
"0.55843496",
"0.5575288",
"0.5500951",
"0.54720336",
"0.5441007",
"0.5402797",
"0.535025",
"0.53313",
"0.5311749",
"0.5302233",
"0.52963203",
"0.52939445",
"0.5284363",
"0.5264601",
"0.5264601",
"0.5264601",
"0.5264601",
"0.5264601",
... | 0.70615685 | 0 |
Change Form's validation enforcement based on service status (active/inactive) | toggleServiceState(serviceActive) {
this.toggleSubmitBtnLabel(serviceActive);
if (serviceActive) {
this.$form.removeAttr('novalidate');
} else if (!this.$form.attr('novalidate')) {
this.$form.attr('novalidate', 'novalidate');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onchangeStatus(){\n\tvar state = $(\"activity_log.status\").value;\n\tvar activity = $(\"activity_log.activity_type\").value;\n\tvar form = View.panels.get('servicePanel');\n\t\n\tif(activity == 'SERVICE DESK - MAINTENANCE'){\n\t\tif(state == 'APPROVED'){\n\t\t\tform.enableField(\"activity_log.dispatcher\... | [
"0.6450209",
"0.62641245",
"0.61248857",
"0.6105184",
"0.60125434",
"0.58763933",
"0.5863156",
"0.579171",
"0.577829",
"0.57702786",
"0.5739693",
"0.5739693",
"0.57348615",
"0.5734186",
"0.57229877",
"0.57214224",
"0.57155067",
"0.57054913",
"0.5687147",
"0.56714314",
"0.5667... | 0.70253384 | 0 |
Toggle Submit button label based on Integration status and ability to test service | toggleSubmitBtnLabel(serviceActive) {
let btnLabel = 'Save changes';
if (serviceActive && this.canTestService) {
btnLabel = 'Test settings and save changes';
}
this.$submitBtnLabel.text(btnLabel);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"toggleSubmitBtnState(saveTestActive) {\n if (saveTestActive) {\n this.$submitBtn.disable();\n this.$submitBtnLoader.removeClass('hidden');\n } else {\n this.$submitBtn.enable();\n this.$submitBtnLoader.addClass('hidden');\n }\n }",
"function updateButton() {\n //disabled when we're... | [
"0.68255126",
"0.65045905",
"0.64269704",
"0.63852495",
"0.6379157",
"0.6379157",
"0.6378803",
"0.6366655",
"0.63267565",
"0.61737657",
"0.6169254",
"0.6151302",
"0.6135622",
"0.6125908",
"0.61096704",
"0.6105762",
"0.61051553",
"0.6104744",
"0.6088672",
"0.60826296",
"0.6007... | 0.8254702 | 0 |
Toggle Submit button state based on provided boolean value of `saveTestActive` When enabled, it does two things, and reverts back when disabled 1. It shows load spinner on submit button 2. Makes submit button disabled | toggleSubmitBtnState(saveTestActive) {
if (saveTestActive) {
this.$submitBtn.disable();
this.$submitBtnLoader.removeClass('hidden');
} else {
this.$submitBtn.enable();
this.$submitBtnLoader.addClass('hidden');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function EnableDisableSubmitButton() {\n var totalQuestions = getTotalQuestionCount();\n var noOfQuestionAttempted = NoOfQuestionAttempted();\n if (totalQuestions == noOfQuestionAttempted) {\n fnEnableSubmitTest(true);\n }\n else {\n fnEnableSubmitTest(false);\n }\n}",
"function toggleSubmit () {\n ... | [
"0.71818775",
"0.69656044",
"0.69656044",
"0.69247663",
"0.6819607",
"0.67651474",
"0.67611647",
"0.67292964",
"0.6722681",
"0.6716911",
"0.6709042",
"0.65798694",
"0.6556321",
"0.65447676",
"0.6529603",
"0.652935",
"0.6457788",
"0.6451999",
"0.64161056",
"0.6401812",
"0.6387... | 0.8732569 | 0 |
a TodoItem model with just two properties: text (string): The description done (boolean): Done or not? | function TodoItem(text) {
this.text = text;
this.done = false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addTodo( text, done = false ) {\n return {\n type: 'ADD_TODO',\n todo: { text: text, done: done }\n }\n }",
"createTodo(text) {\n\t\treturn {\n\t\t\ttext,\n\t\t\tcompleted: false,\n\t\t};\n\t}",
"function Todo(title, completed) {\n\t\tthis.title = wx.property(title);\n\t\tthis.complet... | [
"0.73587346",
"0.7048764",
"0.6979877",
"0.694573",
"0.69275874",
"0.68092483",
"0.6793511",
"0.66378754",
"0.66152316",
"0.6599347",
"0.65981394",
"0.6588627",
"0.6566637",
"0.652156",
"0.6496394",
"0.64893067",
"0.6488232",
"0.648322",
"0.6465397",
"0.6454186",
"0.64373666"... | 0.830082 | 0 |
Mimic same logic inside context handler wrapper to return the menuId from selector & target | function _deriveMenuId(selector, $target){
return ((typeof selector === 'string') ? selector : uniqueId($target));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_getContextMenuId()\n{\n return this.extractedData.guid;\n}",
"function pvmMenuSetId( triggerMenu ){\r\n var $origMenu = pvm.find( '.PVM-menu' );\r\n\r\n $origMenu.map( function( index ){\r\n $( this ).attr( 'id', 'PVM_Menu_0' + index );\r\n });\r\n\r\n return $origMenu;\r... | [
"0.66100115",
"0.6076031",
"0.60325134",
"0.60022515",
"0.5849527",
"0.5829643",
"0.57675964",
"0.5755127",
"0.5725203",
"0.5714228",
"0.5690227",
"0.56747407",
"0.5670917",
"0.5658799",
"0.56551933",
"0.5584917",
"0.5561766",
"0.5544537",
"0.5451613",
"0.5444457",
"0.5429841... | 0.7196131 | 0 |
Returns true if the given bezier is a line or a line in diguise, i.e. if all control points are collinear. Robust: Robust for any bitlength of the given coordinates. | function isLine(ps) {
if (ps.length === 2) {
// Line
return true;
}
if (ps.length === 3) {
// Quadratic bezier
return flo_numerical_1.orient2d(ps[0], ps[1], ps[2]) === 0;
}
if (ps.length === 4) {
// Cubic bezier
return (flo_numerical_1.orient2d(ps[0], ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function canCompleteAnyLine(piece) {\n for (var i = 0; i < 3; i++) {\n if (canCompleteLine(new coord(i, 0), new coord(i, 1), new coord(i, 2), piece)) return true;\n if (canCompleteLine(new coord(0, i), new coord(1, i), new coord(2, i), piece)) return true;\n }\n ... | [
"0.6427418",
"0.63907886",
"0.6101454",
"0.60519207",
"0.59403",
"0.5922673",
"0.5773762",
"0.576562",
"0.5675987",
"0.5566295",
"0.55528575",
"0.55355084",
"0.553377",
"0.553377",
"0.5529604",
"0.55228156",
"0.5514659",
"0.5508964",
"0.5504576",
"0.5496291",
"0.54946834",
... | 0.7100065 | 0 |
Returns true if the given bezier degenerates to a horizontal line (possibly selfoverlapping) | function isHorizontalLine(ps) {
let y = ps[0][1];
for (let i = 1; i < ps.length; i++) {
if (ps[i][1] !== y) {
return false;
}
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isLine(ps) {\n if (ps.length === 2) {\n // Line\n return true;\n }\n if (ps.length === 3) {\n // Quadratic bezier\n return flo_numerical_1.orient2d(ps[0], ps[1], ps[2]) === 0;\n }\n if (ps.length === 4) {\n // Cubic bezier\n return (flo_numerical_1.... | [
"0.6982503",
"0.6327121",
"0.62729347",
"0.61165524",
"0.6095975",
"0.60890853",
"0.60853314",
"0.6061439",
"0.60449064",
"0.60248405",
"0.60137063",
"0.5999013",
"0.5934863",
"0.59243333",
"0.58932555",
"0.58923054",
"0.58847344",
"0.5854079",
"0.5697535",
"0.56831884",
"0.5... | 0.6976348 | 1 |
Returns true if the given bezier degenerates to a vertical line (possibly selfoverlapping) | function isVerticalLine(ps) {
let x = ps[0][0];
for (let i = 1; i < ps.length; i++) {
if (ps[i][0] !== x) {
return false;
}
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isLine(ps) {\n if (ps.length === 2) {\n // Line\n return true;\n }\n if (ps.length === 3) {\n // Quadratic bezier\n return flo_numerical_1.orient2d(ps[0], ps[1], ps[2]) === 0;\n }\n if (ps.length === 4) {\n // Cubic bezier\n return (flo_numerical_1.... | [
"0.6532689",
"0.6473941",
"0.63963854",
"0.59859395",
"0.59492433",
"0.59034014",
"0.5878862",
"0.58737737",
"0.58345735",
"0.5820508",
"0.58089197",
"0.5805024",
"0.5782759",
"0.57359815",
"0.57224035",
"0.5717722",
"0.56915617",
"0.56782985",
"0.56444883",
"0.5614329",
"0.5... | 0.7218981 | 0 |
Controller METHOD defintions process form does two things, it calculates sum, then based on the sum it calculates severity | function processForm (form) {
this.sum(form);
this.severityProcess(form);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function severity(total) {\n const severityField = document.querySelector('#severitydep');\n\n\n if (total === 0){\n severity.innerText = \"All zero\"\n } else if (total > 0 && total < 5) {\n severityField.innerText = \"Minimal Depression\";\n } else if (total > 4 && total < 10) {\n ... | [
"0.5852403",
"0.5719216",
"0.5603928",
"0.5589672",
"0.55694884",
"0.5427126",
"0.53815925",
"0.5374212",
"0.5342717",
"0.53411645",
"0.53065926",
"0.52773",
"0.52605265",
"0.5251955",
"0.52348936",
"0.52134097",
"0.5210889",
"0.5206903",
"0.52056444",
"0.51899916",
"0.518243... | 0.68940836 | 0 |
gets the range list | function getRangeList(start, end){
var tmp = new Array();
for(var i = 0; i < jsonTable.length; i++){
var tmpId = jsonTable[i]["id"];
if(tmpId >= start && tmpId <= end)
tmp.push(jsonTable[i]);
}
return tmp;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"ranges () {\n var range = this._list.at(0)\n const ranges = []\n while (range) {\n ranges.push([range.data.a, range.data.b])\n range = range.prev\n }\n return ranges\n }",
"function getRange(start, stop) {\n\tlet output = []\n\twhile (start != stop) {\n\t\toutput.push(start)\n\t\tstart ... | [
"0.8084409",
"0.727986",
"0.72401035",
"0.7211594",
"0.7208795",
"0.7106484",
"0.7087794",
"0.70597327",
"0.6991739",
"0.6987202",
"0.6981802",
"0.6972645",
"0.69528747",
"0.69445056",
"0.6937963",
"0.6935281",
"0.69248754",
"0.6921216",
"0.69049805",
"0.6902993",
"0.6902993"... | 0.75146854 | 1 |
Deletes an item with the given id. returns the item wich was deleted, otherwise null if no element with the given id exists. | function deleteItemWithId(id){
for(var i = 0; i < jsonTable.length; i++){
if(id == jsonTable[i]["id"]){
var val = jsonTable[i];
jsonTable.splice(i, 1);
return val;
}
}
return null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"deleteById(id) {\n const item = this.find(id);\n if (!item) {\n return null;\n }\n return this.deleteByCondition((model) => model.$id === item.$id)[0];\n }",
"deleteItem(id) {\n const oz = this._appContext.oz, url = oz.getItemURI(this.name, id);\n return oz... | [
"0.7453901",
"0.7134417",
"0.68176925",
"0.6594892",
"0.6553828",
"0.64843065",
"0.6453593",
"0.64179856",
"0.64171827",
"0.64045125",
"0.6393107",
"0.63374233",
"0.6255882",
"0.6242323",
"0.6218953",
"0.6148466",
"0.61472774",
"0.6137736",
"0.61290556",
"0.61021394",
"0.6083... | 0.73853374 | 1 |
Fetches data for specific session | function fetchSessionData(config, session) {
return function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(dispatch) {
var sessionData, width, height, url;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSessionData(uuid, cb) {\n const { url } = generateJob('session', {\n id: uuid,\n });\n getData(redis, url, (err, body) => {\n if (err) {\n return cb(err, null);\n }\n const { session } = body;\n const obj = session === null\n ? null\n : {\n game: typeToStandardNa... | [
"0.6936313",
"0.66946054",
"0.6668254",
"0.6463214",
"0.63555",
"0.6309201",
"0.6284462",
"0.62624025",
"0.6230911",
"0.6206682",
"0.61666036",
"0.6120289",
"0.6074026",
"0.60596037",
"0.6032554",
"0.58866215",
"0.58644104",
"0.5854424",
"0.5838601",
"0.5805962",
"0.58023775"... | 0.67976797 | 1 |
Fetches all possible sessions for the selected project | function fetchSessions(project) {
return function () {
var _ref2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(dispatch) {
var projectContents;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async getProjectSessions (projectId) {\n this.notImplemented()\n }",
"async getSessions(code) {\n\n const sessions = await this.querySessions ({ s: { date: 1 }, q: makeMeetingConferenceQuery (code) });\n const interventions = await this.queryInterventions({ s: { datetime: 1 }, q: { ses... | [
"0.66952705",
"0.6281777",
"0.613486",
"0.6075025",
"0.59939027",
"0.5985511",
"0.5910978",
"0.58830035",
"0.58514863",
"0.5828484",
"0.5801544",
"0.57819253",
"0.5763677",
"0.57486504",
"0.57428616",
"0.5690292",
"0.5663542",
"0.56539667",
"0.5589031",
"0.55769694",
"0.55325... | 0.71837234 | 0 |
Class: Buffer ============= The Buffer constructor returns instances of `Uint8Array` that are augmented with function properties for all the node `Buffer` API functions. We use `Uint8Array` so that square bracket notation works as expected it returns a single octet. By augmenting the instances, we can avoid modifying t... | function Buffer (arg) {
if (!(this instanceof Buffer)) {
// Avoid going through an ArgumentsAdaptorTrampoline in the common case.
if (arguments.length > 1) return new Buffer(arg, arguments[1])
return new Buffer(arg)
}
if (!Buffer.TYPED_ARRAY_SUPPORT) {
this.length = 0
this.parent = u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Buffer (arg) {\n\t if (!(this instanceof Buffer)) {\n\t // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n\t if (arguments.length > 1) return new Buffer(arg, arguments[1])\n\t return new Buffer(arg)\n\t }\n\n\t if (!Buffer.TYPED_ARRAY_SUPPORT) {\n\t this.length = 0\n... | [
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73859423",
"0.73468745",
"0.7322732",
"0.7322732",
"0.7322732",
"0.7322732",
"0.73088866",
"0.7282678",
"0.7246557",
"0.7246557",
"0.... | 0.73896766 | 1 |
Function addNewRow Fungsi untuk menambah row baru ke dalam table I : id dari tbody tabel P : Persiapan row dalam bentuk HTML O : Tambahan row pada akhir tabel (append) | function addNewRow(body,onDetail) {
//alert(body);
var tabBody = document.getElementById(body);
if(onDetail) {
var detail = onDetail;
} else {
var detail = false;
}
// Search Available numRow
var numRow = 0;
if(!detail) {
while(document.getElementById('tr_'+numRow)) {
numRow+... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addNewRow(body,primary,field) {\n var tabBody = document.getElementById(body);\n \n // Search Available numRow\n var numRow = 0;\n while(document.getElementById('detail_tr_'+numRow)) {\n\tnumRow++;\n }\n \n // Add New Row\n var newRow = document.createElement(\"tr\");\n tabBo... | [
"0.79436326",
"0.79062355",
"0.7897695",
"0.75337356",
"0.7516854",
"0.73084974",
"0.7304964",
"0.7291857",
"0.7288992",
"0.7283182",
"0.72595114",
"0.724566",
"0.71978146",
"0.7179985",
"0.71793693",
"0.7164527",
"0.7148358",
"0.71430826",
"0.71366054",
"0.71318203",
"0.7128... | 0.7966945 | 0 |
luaslingkaran= pi x r x r | function luasLingkaran(r){
let pi=3.14;
hasil=pi*r*r;
console.log("luas lingkaran="+hasil)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function luasLingkaran( i=3, t=4){\n return 0.5 *i*t;\n}",
"function LuasLingkaran(jari) {\n let luas = 3.14 * jari ** 2;\n return luas;\n}",
"function luasPersegi(tinggi, lebar) {\n return tinggi * lebar;\n}",
"menghitungLuas() {\n return Math.PI * Math.pow(this.radius, 2)\n }",
"function kotak(... | [
"0.74800646",
"0.6977973",
"0.6833263",
"0.6724569",
"0.64687836",
"0.6377753",
"0.6265935",
"0.61689126",
"0.6081486",
"0.59966576",
"0.5971572",
"0.5970336",
"0.59404767",
"0.59360474",
"0.5932157",
"0.5906498",
"0.5905958",
"0.5886218",
"0.5849346",
"0.58123314",
"0.579889... | 0.7775486 | 0 |
user is "finished typing," do something | function doneTyping() {
//do something
GMaps.geocode({
address: $(self).val().trim(),
callback: function(results, status) {
if (status == 'OK') {
var latlng = results[0].geometry.location;
map.setCenter(latlng.lat(), latlng.lng());
map.addMarker({
lat: latlng.lat(),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doneTyping() {\n tour.next()\n }",
"function doneTyping () {\n return searchSIRENE(e, optforce);\n }",
"function doneTyping () {\n set_content_to_local_storage();\n }",
"function TypingEnd(name){\n this.broadcast.emit('typing_end',name);\n... | [
"0.79195154",
"0.74555653",
"0.7454757",
"0.72784567",
"0.7222919",
"0.71984494",
"0.7160598",
"0.7147756",
"0.71254116",
"0.7094889",
"0.7066889",
"0.702605",
"0.69581753",
"0.69061047",
"0.68910944",
"0.6866464",
"0.6830128",
"0.68130887",
"0.67860633",
"0.6771002",
"0.6768... | 0.7641562 | 1 |
tests values against established percent difference | function getValForPercentDifference(val1, percent) {
let value = val1;
let val2;
let finalPercent;
let counter = 0;
while (Math.floor(finalPercent) != percent && counter < 500) {
val2 = value + .001;
finalPercent = (Math.abs(val2 - val1)/((val1 + val2)/2)) * 100;
value = val2;
counter += 1;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function percentDiff(num1, num2) {\n return parseFloat(Math.abs(((num1-num2)/((num1+num2)/2)*100).toFixed(1)));\n}",
"percentAchieved(value, target) {\n return (100 * value) / target\n }",
"function percentOf(num1, num2) {\r // TODO: your code here\r var tmp = num2/num1;\r var ans = 100/t... | [
"0.68814963",
"0.66369814",
"0.6607679",
"0.65050966",
"0.6496661",
"0.6471614",
"0.6437386",
"0.6437386",
"0.6412772",
"0.6407331",
"0.640413",
"0.6381353",
"0.6364083",
"0.6358985",
"0.63568836",
"0.6352107",
"0.63324535",
"0.63178116",
"0.63178116",
"0.6310479",
"0.6300136... | 0.69813067 | 0 |
Load Related Items based on Item No. from the header of Item Master Data Parameter: oInst (the object exposed by Web Client UI API framework) | async function loadItem(oInst) {
// get Item No. from the header of Item Master Data
sItemCode = await oInst
.ActiveView(VIEW_OITM_DETAIL)
.TextInput(HEADER_ItemCode)
.getValue();
// check if Item Code is valid
if (sItemCode !== undefined && sItemCode !== null && sItemCode.length > 0) {
// /... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"item(item) {\n if (Object.keys(this.load).length > 0) {\n Loader.eagerLoadRelations(this, [item]);\n }\n return item;\n }",
"function showItemsRelated(){\r\n\t\t\r\n\t\tg_objWrapperItems.show();\r\n\t\tjQuery(\".uc-items-related\").show();\r\n\t\t\r\n\t}",
"itemCrumb () {\n ... | [
"0.6041775",
"0.58558476",
"0.5518259",
"0.54298246",
"0.5426491",
"0.5402382",
"0.5402382",
"0.5357407",
"0.53543335",
"0.5322821",
"0.52709514",
"0.52250487",
"0.520666",
"0.5205967",
"0.5198427",
"0.5188822",
"0.5175569",
"0.5149141",
"0.5129484",
"0.5124625",
"0.51129836"... | 0.7146627 | 0 |
use the returned new numfriendreqs to update the notifications of the added user Realtime using socket.io | function AddAsFriendCB(err, result, friendid, userid){
if (err){
console.error(err);
}else{
//Pass the new numfriendreqs to the socket
//Send this message in the "NotificationSocket" namespace to everyone
//But because of the friendid, only the person who got added will be listening to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function UpdateNotificationsCB(err, result,friendid, userid){ \n if (err){\n console.error(err);\n }else{\n //increase their friendreq number\n //Return the numfriendreqs\n var sql = \"UPDATE UnreadNotifications SET numfriendreqs = (numfriendreqs+1) where userid = $1 RETURNING numfriendreqs;\";\n... | [
"0.7482203",
"0.6276156",
"0.6247129",
"0.6200538",
"0.6186398",
"0.61410296",
"0.60944325",
"0.60679895",
"0.6062681",
"0.60346484",
"0.603447",
"0.602628",
"0.6023688",
"0.5950601",
"0.5930983",
"0.5924043",
"0.59198594",
"0.59136754",
"0.5906506",
"0.5876226",
"0.58422387"... | 0.73588735 | 1 |
SendGroupMessage Broadcast the chat group message to all other users in the event | function SendGroupMessageCB(err, result, socket, msg)
{
if (err)
{
console.error(err);
}
else
{
//Broadcast the message to all other users in the socket room/event [Except to the sender]
socket.broadcast.to(msg.Chat_EventID).emit('ReceiveEventMessages', {eventID: ms... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function broadcastToGroup(groupId, json) {\n\t\t// Find the group\n\t\tvar groupIndex = findGroup(groupId);\n\t\tif (groupIndex == -1)\n\t\t\treturn;\n\t\t\t\n\t\t// For each user in the group\n\t\tvar usersInGroup = sharedActivities[groupIndex].users;\n\t\tfor (var j = 0 ; j < usersInGroup.length ; j++) {\n\t\t\t... | [
"0.7530086",
"0.6717052",
"0.6362015",
"0.63127404",
"0.6243064",
"0.6201091",
"0.61432093",
"0.59568894",
"0.5907766",
"0.5827656",
"0.5823739",
"0.5800155",
"0.5794937",
"0.57672817",
"0.5760936",
"0.57429147",
"0.57384926",
"0.57357436",
"0.572674",
"0.57183844",
"0.569294... | 0.7114131 | 1 |
select distink from array of object jsonData | function selectDist(distinct, jsonData) {
var flags = [], dataDistinct = [], l = jsonData.length, i;
for (i=0; i<l; i++) {
if (flags[jsonData[i][distinct]]) continue;
flags[jsonData[i][distinct]] = true;
dataDistinct.push(jsonData[i][distinct]);
}
return dataDistinct;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function selectArray(json) {\n $scope.json = json;\n $scope.structure = [];\n expand(json);\n }",
"select(fields) {\n let selectedJson = [];\n if (fields.length === 0) {\n for (let i = 0; i < this.json.length; i++) {\n let data = this.json[i];\n ... | [
"0.5735091",
"0.5548081",
"0.54321766",
"0.52984834",
"0.528524",
"0.52794135",
"0.52576447",
"0.5257319",
"0.51834863",
"0.51548505",
"0.51364803",
"0.51331145",
"0.5116315",
"0.5108133",
"0.51010793",
"0.5079016",
"0.50484914",
"0.5024733",
"0.5021557",
"0.5021554",
"0.5007... | 0.59009564 | 0 |
find best match for address in an array of OSM names | function bestMatch(address, names) {
const prefixDirection = address['PREFIX_DIR'] && normalize(address['PREFIX_DIR']);
const prefixType = address['PRE_TYPE'] && normalize(address['PRE_TYPE']);
const streetName = address['STREET_NAM'] && normalize(address['STREET_NAM']);
const streetType = address['STREET_TYP']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function matchesNeighborhoodName(name) {\n const score = stringSimilarity.findBestMatch(name, neighborhoodDescriptions.map(n => n.name));\n return neighborhoodDescriptions.find(({name}) => name === score.bestMatch.target);\n}",
"function fuzzyMatch(drivers, names){\n return drivers.filter(match => match[0] ===... | [
"0.63448733",
"0.6138842",
"0.609531",
"0.6055636",
"0.5891625",
"0.5871971",
"0.5865661",
"0.57760656",
"0.5769337",
"0.5660591",
"0.56420714",
"0.5640916",
"0.56348705",
"0.5632656",
"0.5622851",
"0.55939794",
"0.55824655",
"0.553894",
"0.55252033",
"0.5519217",
"0.5496039"... | 0.79642403 | 0 |
function that prints out what the max weather is | function maxWeather(results){
return Math.max.apply(null, results);
// or Math.max(...results);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_max(){\r\n for(var i=0 ; i<tempdata.length;i++){\r\n if(tempdata[i].tem > max){\r\n max = tempdata[i].tem;\r\n }\r\n }\r\n console.log( 'max_temperature > ' + max);\r\n}",
"function get_max()\n {\n var max,swap;\n max=temperature[0];\n for(let i=... | [
"0.7197606",
"0.6639806",
"0.66393244",
"0.66218233",
"0.65165263",
"0.63521254",
"0.62304586",
"0.62220573",
"0.6209121",
"0.6203466",
"0.6185772",
"0.6151218",
"0.6141972",
"0.6138323",
"0.6082941",
"0.6079726",
"0.6040495",
"0.60027134",
"0.5994564",
"0.59903157",
"0.59853... | 0.6936868 | 1 |
A getter for tags to grab signals of module from Cerebral | signalsGetter(modulePath) {
return this.controller.getSignals(modulePath)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get tag() {}",
"get signal() {\n return getSignal(this);\n }",
"get signal() {\n return getSignal(this);\n }",
"get signal () {\n webidl.brandCheck(this, Request)\n\n // The signal getter steps are to return this’s signal.\n return this[kSignal]\n }",
"get signal () {\n web... | [
"0.6510843",
"0.62676215",
"0.62676215",
"0.61721325",
"0.61721325",
"0.59780735",
"0.59546316",
"0.5944515",
"0.5944515",
"0.59175795",
"0.59175795",
"0.5856626",
"0.58313173",
"0.5821691",
"0.58172977",
"0.57834136",
"0.57834136",
"0.5675796",
"0.5671742",
"0.56466335",
"0.... | 0.7066993 | 0 |
A method to ensure objects and arrays from state tree are not passed as props | verifyProps(props) {
const key = getStateTreeProp(props)
if (key && !this._verifyPropsWarned) {
console.warn(
`You are passing an ${Array.isArray(props[key])
? 'array'
: 'object'} to the component "${this
._displayName}" on prop "${key}" which is from the Cerebral st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"UNSAFE_componentWillReceiveProps(nextProps) {\n let { state } = this;\n\n if (nextProps.uast !== this.props.uast) {\n state = this.stateFromProps(nextProps);\n } else if (\n !isEqualArray(nextProps.rootIds, this.props.rootIds) ||\n nextProps.levelsToExpand !== this.props.levelsT... | [
"0.6012322",
"0.59330356",
"0.5923912",
"0.57341075",
"0.57339865",
"0.5690341",
"0.56491905",
"0.55862",
"0.5578778",
"0.55410767",
"0.5480811",
"0.5476162",
"0.54441464",
"0.5419644",
"0.54115695",
"0.540863",
"0.5393194",
"0.5383837",
"0.5359762",
"0.5349287",
"0.53387433"... | 0.6842003 | 0 |
Called by component when props are passed from parent and they have changed. In this situation both tags and depndency trackers might be affected. Tags are just updated and dependency trackers are matched on props changed | updateFromProps(propsChanges, props) {
this.update(props, this.updateDependencyTrackers({}, propsChanges, props))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"update(props, hasChangedDependencyTrackers) {\n const prevDependencyTrackersDependencyMaps = this\n .dependencyTrackersDependencyMaps\n const previousTagsDependencyMap = this.tagsDependencyMap\n\n this.tagsDependencyMap = this.getTagsDependencyMap(props)\n this.dependencyTrackersDependencyMaps = h... | [
"0.6452177",
"0.60613674",
"0.6016773",
"0.5997728",
"0.59785277",
"0.591842",
"0.584486",
"0.5844256",
"0.58168846",
"0.5782741",
"0.5768708",
"0.5758726",
"0.5750965",
"0.57077074",
"0.56974703",
"0.56843275",
"0.5657717",
"0.565167",
"0.5626534",
"0.56075066",
"0.5564328",... | 0.6440998 | 1 |
Udpates the dependency trackers by checking state changes and props changes | updateDependencyTrackers(stateChanges, propsChanges, props) {
const hasChanged = Object.keys(
this.dependencyTrackers
).reduce((hasChanged, key) => {
if (this.dependencyTrackers[key].match(stateChanges, propsChanges)) {
this.dependencyTrackers[key].run(this.stateGetter, props)
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"forceUpdateDependencyTrackers() {\n Object.keys(this.dependencyTrackers).forEach(key => {\n this.dependencyTrackers[key].run(this.stateGetter, this.props)\n })\n\n return true\n }",
"_depend(changers, _allow_unordered) {\n if (Tracker.active) {\n const dependency = ... | [
"0.7248047",
"0.6781277",
"0.67639613",
"0.6736714",
"0.6266416",
"0.6025064",
"0.5944683",
"0.59047675",
"0.585566",
"0.57783866",
"0.57230544",
"0.56992716",
"0.56923586",
"0.56552684",
"0.564875",
"0.5634053",
"0.55826116",
"0.55624604",
"0.5555948",
"0.55479324",
"0.55351... | 0.75224495 | 0 |
Go through dependencies and identify state trackers and merge in their state dependencies | getDependencyTrackersDependencyMaps(props) {
return Object.keys(this.dependencies).reduce(
(currentDepsMaps, propKey) => {
if (this.dependencyTrackers[propKey]) {
currentDepsMaps.state = Object.assign(
currentDepsMaps.state,
this.dependencyTrackers[propKey].stateTrack... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"forceUpdateDependencyTrackers() {\n Object.keys(this.dependencyTrackers).forEach(key => {\n this.dependencyTrackers[key].run(this.stateGetter, this.props)\n })\n\n return true\n }",
"updateDependencyTrackers(stateChanges, propsChanges, props) {\n const hasChanged = Object.keys(\n this.depe... | [
"0.63006544",
"0.6186844",
"0.59951735",
"0.59939754",
"0.58939224",
"0.5855734",
"0.5855734",
"0.5855734",
"0.5855734",
"0.5855734",
"0.5849489",
"0.5687212",
"0.563257",
"0.5626738",
"0.5575109",
"0.55338305",
"0.5499337",
"0.5484416",
"0.54065084",
"0.5402047",
"0.53937596... | 0.6687953 | 0 |
Go through dependencies and extract tags related to state dependencies | getTagsDependencyMap(props) {
return Object.keys(this.dependencies).reduce((currentDepsMap, propKey) => {
if (this.dependencyTrackers[propKey]) {
return currentDepsMap
}
if (!this.dependencies[propKey].getTags) {
throwError(`Prop '${propKey}' should be a tag or a Compute.`)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get dependencies() {\n const found = new Map(); // Deduplication map\n const ret = new Array();\n for (const source of this.findAll()) {\n for (const dependable of Node.of(source)._dependencies) {\n for (const target of dependency_1.DependableTrait.get(dependable).dep... | [
"0.6055538",
"0.5902273",
"0.5818618",
"0.5780258",
"0.5741986",
"0.57085806",
"0.5574865",
"0.5556006",
"0.55556893",
"0.55149",
"0.5492383",
"0.5486923",
"0.5480468",
"0.5475422",
"0.5430802",
"0.54294217",
"0.5399849",
"0.538302",
"0.538302",
"0.53604525",
"0.5356213",
"... | 0.71382743 | 0 |
Creates getters passed into tags | createTagGetters(props) {
return {
state: this.stateGetter,
props: props,
signal: this.signalGetter,
signals: this.signalsGetter,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createGetters(getters, { evaluate }) {\n return mapValues(getters, getter => (transform = identity) => transform(evaluate(getter)))\n}",
"function genGetter(v) {\n var t = \"public \" + typename(v) + \" \" + \"get\" + (options.forceCamelCaseMethods ? makeCamelCase(v.name) : v.name) + \"() {\";\n... | [
"0.65988475",
"0.6325569",
"0.6183156",
"0.61257714",
"0.606316",
"0.6032429",
"0.59867436",
"0.59867436",
"0.59149265",
"0.567389",
"0.56620365",
"0.56002617",
"0.5591576",
"0.5519971",
"0.55107284",
"0.5405263",
"0.5405033",
"0.54026943",
"0.5364135",
"0.5362747",
"0.536180... | 0.73927134 | 0 |
Walk the directory tree and look for .mp3 files | function walkTree(path, callback) {
var files = [];
var mp3Files = [];
var walker = walk.walk(path, {followLinks: false});
walker.on('file', function (root, stat, next) {
files.push(root + '/' + stat.name);
next();
});
walker.on('end', function () {
for (var i = 0; i <... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onDirectoryRead(entries) {\n //console.log(\"The dir has \"+entries.length+\" entries.\");\n // Scan for audio src\n for (var i=0; i<entries.length; i++) {\n //console.log(entries[i].name+' dir? '+entries[i].isDirectory);\n if(entries[i].name == src) {\n console.log(\"fil... | [
"0.67363924",
"0.54990363",
"0.5437627",
"0.53762263",
"0.5375704",
"0.52919585",
"0.5245265",
"0.52368236",
"0.52246046",
"0.52234817",
"0.5190961",
"0.5183004",
"0.5156425",
"0.5155959",
"0.51508766",
"0.5148346",
"0.51385385",
"0.5123626",
"0.5108597",
"0.5105004",
"0.5104... | 0.7148879 | 0 |
Validations for userdefined options in gridsome.config.js | validateOptions(options) {
if (options === undefined) throw `Options not defined for ${pluginName}`
if (!options.typeName) throw `${pluginName}: You need to define options.collection in your options you want to create recommendations for`;
if (!options.field) throw `${pluginName}: You need to de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateOptions(options){\n\n }",
"function validateConfig() {\n if (config.minLength < 0 || config.maxLength < 0) {\n throw \"Configuration error. minLength and maxLength cannot be less than 0\";\n }\n if (config.minLength > config.maxLength) {\n throw \"Co... | [
"0.7126559",
"0.6536733",
"0.65359277",
"0.65169996",
"0.65169996",
"0.6398093",
"0.6185837",
"0.6048761",
"0.5999022",
"0.5965254",
"0.5954578",
"0.5954578",
"0.59224707",
"0.5917556",
"0.59105504",
"0.5904016",
"0.5882113",
"0.5873964",
"0.5866199",
"0.5862449",
"0.5852077"... | 0.6634398 | 1 |
Trains model based on given collection | train(collection) {
let convertedDocuments = collection.data().map(node => {
return this.convertDocument(node, this.options.field);
});
this.log("training " + convertedDocuments.length);
this.recommender.train(convertedDocuments);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"collect(collection) {\n if (collection.length < 1) {\n return [];\n }\n if (Object.keys(this.load).length > 0) {\n collection = collection.map((item) => {\n const model = this.model.getModelFromRecord(item);\n return new model(item);\n ... | [
"0.6126087",
"0.5400787",
"0.5334142",
"0.5274781",
"0.515487",
"0.51370317",
"0.51310265",
"0.5097856",
"0.5031208",
"0.5009748",
"0.50009245",
"0.4939144",
"0.49272305",
"0.49060404",
"0.48947173",
"0.488985",
"0.4888296",
"0.48728523",
"0.48728523",
"0.48726082",
"0.484751... | 0.59923655 | 1 |
Create node relations for one node in collection / GraphQl | createNodeRelations(collection, store, node, documentRelations, reverse) {
let options = {...node};
options[!reverse ? this.options.relatedFieldName : this.options.referenceRelatedFieldName] = documentRelations
.map(relation => {
/*
*Decide if we reference A-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async addRelations(){\n var driver = neo4j.driver(\n 'bolt://localhost:7687',\n neo4j.auth.basic('neo4j', 'bookmarks') \n )\n var session = driver.session()\n try { \n const result = await session.writeTransaction(tx =>\n tx.run('match (n)... | [
"0.62982917",
"0.6039418",
"0.60310477",
"0.58327425",
"0.58327425",
"0.57442456",
"0.5675098",
"0.5570719",
"0.5551315",
"0.5536174",
"0.5534228",
"0.5534104",
"0.55294764",
"0.5462127",
"0.54584384",
"0.5452272",
"0.5439707",
"0.5423996",
"0.5423517",
"0.5421442",
"0.541262... | 0.71905875 | 0 |
Seer to Mon conversion | function seerToMon(seer) {
const mon = seer / 40;
//for string inputs
if (typeof seer != "number") {
return 'Invalid input';
}
//for negative or 0 inputs
else if (mon <= 0) {
return "Please enter a number greater than 0.";
}
//valid input calculation
else {
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function seerToMon(seer) {\n if(seer < 0) {\n return(\"Please provide a positive number\");\n }\n let mon = seer / 40; //we know that 1 mon = 40 seer\n return mon;\n}",
"function seerToMon(seer) {\n //if enter string or other key then throw this error line\n if (typeof seer != 'number') ... | [
"0.6672083",
"0.57715243",
"0.55770105",
"0.5507854",
"0.54105574",
"0.53959274",
"0.53959274",
"0.5256725",
"0.52370715",
"0.5221825",
"0.52004445",
"0.5198919",
"0.51814544",
"0.5163044",
"0.5152522",
"0.51433027",
"0.5139283",
"0.51372",
"0.5135508",
"0.5135508",
"0.513550... | 0.57996327 | 1 |
find the class object for a given plugin name | function queryPlugin(name) {
var retval = Modul_widget; // fallback if no such plugin exists
$.each(plugins.modules, function (index, module) {
if (module.widgetname == name) { retval = module; return false; }
});
return retval;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findClass() {}",
"plugin(name) {\n return this.pluginsMap.get(name) || null;\n }",
"function findClass() {\n\tvar cls = generateClass();\n\treturn cls;\n}",
"get_instance(name){\n for (instance in this.arr){\n if (instance[1] == name) {\n return instance[0]... | [
"0.6506367",
"0.62758356",
"0.6259587",
"0.59719276",
"0.58723885",
"0.58671296",
"0.5804665",
"0.57764876",
"0.57380027",
"0.57132673",
"0.5712079",
"0.569449",
"0.5616881",
"0.55932873",
"0.55712163",
"0.55559105",
"0.55559105",
"0.55559105",
"0.55559105",
"0.55140984",
"0.... | 0.6285788 | 1 |
note that the callback function will be called when the svg is available side note: chrome will repaint with the unaltered svg and emit another 'load' event thus calling the callback once more so ideally, all elements of the svg are updated by the callback function param w,h: height and width cobstrainst, one of which ... | function setupSVG(elem,src,w,h,callback) {
// We need an object that loads the svg so that the svgs do not
// share the same DOM, hence messing up non-unique ids (e.g. with "use").
// The class we need for finding the container object w/ getSvgDoc()
var objElement = $('<object class="ftu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function update_svg(elem,svgElem,svgDoc) {\n return false;\n }",
"function onSvgLoaded(svg, error) \n{ \n customLog('loaded');\n \n removeLoader();\n \n var obj = {audio: true};\n \n getUserMedia(obj, gotStream);\n \n $(\"#spectrumView\").click(function()\n {\n toggleS... | [
"0.6701858",
"0.66904444",
"0.645047",
"0.6442779",
"0.6294397",
"0.6232575",
"0.61288106",
"0.6101295",
"0.60664105",
"0.60642344",
"0.59933174",
"0.59306824",
"0.58963084",
"0.58905727",
"0.5855532",
"0.5848003",
"0.5837888",
"0.58105373",
"0.57996345",
"0.57932806",
"0.577... | 0.71115506 | 0 |
update_elem() is the function called by update() or init_ui() when one of the svg_ widget divs need updating | function update_elem(elem) {
var me = this;
var svgId = elem.data('object');
if (!svgId) return me.log(false,1,me.widgetname+": missing data-object");
var svgDoc = getSvgDoc(elem);
if (!svgDoc) return me.log(false,3,me.widgetname+": svg not ready");
var svgElem = $(svgDoc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"update(){this.element.parentElement.querySelector('.widget').remove();this._init();}",
"update() {\n\t /**\n\t * It is somewhat complex to properly update, especially when the widget is currently\n\t * showing a list of geotrace/geoshape points. Hence we use the inefficient but robust\n\t ... | [
"0.70688957",
"0.69529146",
"0.68913615",
"0.68634593",
"0.68056446",
"0.6785695",
"0.6679104",
"0.65948874",
"0.65872985",
"0.64036834",
"0.6344446",
"0.63288546",
"0.6312239",
"0.6280786",
"0.62522054",
"0.6190813",
"0.61786103",
"0.6163143",
"0.6153658",
"0.6153658",
"0.61... | 0.76290435 | 0 |
update_svg() is the function called by update() when one of the svg_ widget elements need updating overload this function in each svg_ widget to do the heavy lifting (change svg element) param elem: jQuery object of divelement resource param svgElem: jQuery object of referenced svg element param svgDoc: DOM element of ... | function update_svg(elem,svgElem,svgDoc) {
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function update_elem(elem) {\n var me = this;\n var svgId = elem.data('object');\n if (!svgId) return me.log(false,1,me.widgetname+\": missing data-object\");\n var svgDoc = getSvgDoc(elem);\n if (!svgDoc) return me.log(false,3,me.widgetname+\": svg not ready\");\n var svg... | [
"0.79851854",
"0.72192",
"0.6825325",
"0.6765049",
"0.6549363",
"0.6109391",
"0.61037314",
"0.6052973",
"0.597349",
"0.59707355",
"0.5914538",
"0.5862106",
"0.58535147",
"0.58535147",
"0.5843706",
"0.5802478",
"0.57784176",
"0.5754184",
"0.57355076",
"0.5724804",
"0.56939536"... | 0.8571583 | 0 |
Generate and return a form state object, based on fields available in validation rules, that represent the pristine state of the form | pristineState(){
var fields = Immutable.Map().withMutations( (f) => {
for (let field of this.validationRules.keySeq()) {
f.set(field,{
valid: false,
dirty: false
});
}
});
var state = Immutable.Map({
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getFormState() {\n return {\n ...this.state,\n pristine: this.pristine(),\n dirty: this.dirty(),\n invalid: this.invalid()\n };\n }",
"function getInitialFormState() {\n\t\tconst formFields = getFormFields();\n\n\t\tconst formFieldNames = formFields.reduce((obj, field) => {\n\t\t\tobj[... | [
"0.7703709",
"0.6622051",
"0.64639103",
"0.62383646",
"0.6119621",
"0.6003366",
"0.5977996",
"0.5904531",
"0.5784773",
"0.57800955",
"0.5755797",
"0.5732128",
"0.56771445",
"0.5673915",
"0.5653657",
"0.5640327",
"0.56141376",
"0.5607592",
"0.55890554",
"0.5576369",
"0.5560552... | 0.749695 | 1 |
return an updated version of a previous form object by applying validation rules on each field with supplied values | validate(previousState, values, currentField = void 0) {
var isFormValid = true;
var fields = previousState.get("fields").withMutations((f) => {
for(let field of f.keySeq()) {
let isFieldValid = this.validationRules.get(field)(Utils.getIn(values, field));
isFo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_validate(values) {\n const updated = Object.assign({}, this.state.editing, values)\n\n const { FORM_CONSTRAINT } = this.constructor\n const singleConstraint = _.pickBy(FORM_CONSTRAINT, v => !v.array)\n const arrayConstraint =\n _(FORM_CONSTRAINT)\n .pickBy(v => v.array)\n .mapValues(v =... | [
"0.6844801",
"0.6155718",
"0.6031184",
"0.59954387",
"0.585109",
"0.58372724",
"0.58142996",
"0.580308",
"0.5795773",
"0.57829696",
"0.5779461",
"0.5736005",
"0.57348496",
"0.57194275",
"0.57191885",
"0.57128596",
"0.57122844",
"0.56641424",
"0.56514347",
"0.56463873",
"0.564... | 0.6980251 | 0 |
Returns the trimmed postcode, or '.' if the postcode is either null or '' after trimming | _handlePostcode (postcode) {
return postcode?.trim() ? postcode.trim() : '.'
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function formatTrim(s){out:for(var n=s.length,i=1,i0=-1,i1;i<n;++i){switch(s[i]){case\".\":i0=i1=i;break;case\"0\":if(i0===0)i0=i;i1=i;break;default:if(i0>0){if(!+s[i])break out;i0=0;}break;}}return i0>0?s.slice(0,i0)+s.slice(i1+1):s;}",
"function formatTrim(s) {\n out: for (var n = s.length, i = 1, i0 = -1, ... | [
"0.60067",
"0.5991799",
"0.5991799",
"0.59836185",
"0.59836185",
"0.59836185",
"0.59836185",
"0.597156",
"0.597156",
"0.597156",
"0.597156",
"0.5970471",
"0.5951443",
"0.59356296",
"0.59255564",
"0.5907526",
"0.5904702",
"0.58793336",
"0.58793336",
"0.58793336",
"0.58793336",... | 0.8320245 | 0 |
This function is provided to the constructor of `Localization` object and is used to create new `MessageContext` objects for a given `lang` with selected builtin functions. | function createContext(lang) {
return new MessageContext(lang, { functions });
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(lang) {\n this.lang = lang;\n this.transMap = new Map();\n }",
"function Language(lang) {\n \n var __construct = function () {\n if (eval('typeof ' + \"'\" + lang + \"'\") == _undefined) {\n lang = _defaultLanguage;\n }\n\n return;\n }()\n\n ... | [
"0.5847062",
"0.57683104",
"0.56426734",
"0.56426734",
"0.56362814",
"0.55510724",
"0.553466",
"0.5469909",
"0.54571974",
"0.5444322",
"0.5444322",
"0.5408361",
"0.53941774",
"0.5388974",
"0.5361908",
"0.5359344",
"0.5356752",
"0.53185695",
"0.53185695",
"0.53185695",
"0.5318... | 0.808621 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.