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 |
|---|---|---|---|---|---|---|
=========================== lively config =========================== | applyLivelyConfig (livelyConfig) {
// configures System object from lively config JSON object.
// - adds System.package entry for package
// - installs hook from {hooks: [{name, source}]}
// - merges livelyConfig.packageMap into System.package[pkg.url].map
// entries in packageMap are specifically... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"configure() { }",
"configure() {\n\n }",
"function configuration(){}",
"static _config() {\n\n }",
"function ProxyConfig() {}",
"function Config() {}",
"function Config() {}",
"function Config() {}",
"constructor( config ){ super(config) }",
"yorc() {\n this.config.defaults(yorc.defaul... | [
"0.67315084",
"0.66242445",
"0.64861864",
"0.6424607",
"0.63342917",
"0.630633",
"0.630633",
"0.630633",
"0.6210812",
"0.6111922",
"0.6088237",
"0.6088237",
"0.6083551",
"0.6083551",
"0.602012",
"0.6015874",
"0.5973452",
"0.59613985",
"0.5932198",
"0.590629",
"0.59025055",
... | 0.66407186 | 1 |
util func to reorder array | function reorderArray(newPos, oldPos, arr){
var temp = arr[oldPos];
arr.splice(newPos, 0, temp);
arr.splice((oldPos < newPos ? oldPos : (Number(oldPos) + 1)), 1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function rearrange(array){\n var arr=array.sort(function(a,b){\n return a-b;\n })\n return arr;\n}",
"function rearrangeArray(arr) {\n\tvar temp = [];\n\n\tarr.forEach((e, i) => {\n\t\ttemp[i] = arr[e];\n\t});\n\n\treturn temp;\n}",
"function reorderArray(tabArray, id) {\n let splicedArray =... | [
"0.696626",
"0.67591643",
"0.67457247",
"0.6554648",
"0.65320987",
"0.64932406",
"0.64645267",
"0.6421887",
"0.63379383",
"0.6314525",
"0.6300854",
"0.6274523",
"0.6265285",
"0.6265032",
"0.6258217",
"0.6247934",
"0.623702",
"0.62281764",
"0.62281764",
"0.618684",
"0.617311",... | 0.72836614 | 0 |
a general utility function to change form values can be used for any text value attr is passed in using .bind(this, "attr") and event is implictly passed in as a result of an event (such as onChange and onClick) | handleFormChange(attr, event){
console.log(attr, event.target.value)
this.setState({
[attr]: event.target.value
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeFunction(event) {\n event.preventDefault();\n event.stopPropagation();\n\n event.target.parentNode.setAttribute('value', event.target.value);\n handleChange(event.target.parentNode);\n }",
"onChange(e){\n\t\tthis.setState({ textValue: e.target.value });\n\t}",
"han... | [
"0.6593396",
"0.64952266",
"0.6390402",
"0.63304174",
"0.6326179",
"0.63253",
"0.62265825",
"0.6217917",
"0.61578965",
"0.6132175",
"0.612236",
"0.61104584",
"0.61104584",
"0.61035824",
"0.60889447",
"0.60877395",
"0.60869664",
"0.60795784",
"0.60617113",
"0.60501754",
"0.604... | 0.6962165 | 0 |
render an error or success message based on the React state conditional statements used throughout this React component determine whether a message will show | renderMessage(){
if(this.state.errorMessage){
return (
<div className="alert alert-danger alert-dismissible" style={comStyles().message}>
<strong>Error!</strong> {this.state.errorMessage}
<b onClick={()=>this.setState({errorMessage: ""})} style={comStyles().messageClose}>×</b>
</div>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"renderErrorMessage(){\n \tif(this.state.showError === true){\n\t return <ReactBootstrap.Alert bsStyle=\"danger\">Erro ao cadastrar cliente</ReactBootstrap.Alert>;\n\t }\n\t return null;\n\t}",
"renderError() {\n //Default error message if one isn't in state\n const message = this.prop... | [
"0.7410131",
"0.73582464",
"0.7335699",
"0.7187547",
"0.70482624",
"0.7046218",
"0.6948991",
"0.69285667",
"0.69116706",
"0.69042116",
"0.68650067",
"0.68298477",
"0.6803881",
"0.6764811",
"0.675787",
"0.674279",
"0.67363703",
"0.6727367",
"0.67206377",
"0.6698844",
"0.668821... | 0.7723801 | 0 |
Function that takes in 3 arrays for streets cities counties loops through them and returns a single array of address objects | function createAddresses(streets,cities,counties){
var newAddresses=[];
for (var i = 0; i <= streets.length; i++) {
var newAddress=new Address(streets[i],cities[i],counties[i]);
newAddresses.push(newAddress);
}
return newAddresses;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getLatLngAddress(){\n var o = [];\n var db = this.getDbs();\n var dbA = Object.values(db);\n dbA.map(function(_db){\n var dbfields = [];\n var empresas = _db.empresas;\n if(!empresas){\n empresas = {};\n }\n empresas = Object.values(empresas);\n if(empresas){\n ... | [
"0.60638785",
"0.5975026",
"0.59480053",
"0.5873261",
"0.5869605",
"0.5779532",
"0.575867",
"0.5738653",
"0.5720928",
"0.5712097",
"0.56989706",
"0.5685815",
"0.5683153",
"0.56811965",
"0.5664279",
"0.566188",
"0.56558156",
"0.5654436",
"0.5644546",
"0.5644197",
"0.5643968",
... | 0.7679649 | 0 |
Step 1: GET Request to fetch login token | function getLoginToken() {
var params_1 = {
action: "query",
meta: "tokens",
type: "login",
format: "json"
};
request.get({ url: url, qs: params_1 }, function(error, res, body) {
if (error) {
return;
}
var data = JSON.parse(body);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getLoginToken() {\n var params_0 = {\n action: \"query\",\n meta: \"tokens\",\n type: \"login\",\n format: \"json\"\n };\n request.get({ url: url, qs: params_0 }, function (error, res, body) {\n if (error) {\n return;\n }\n var data = JS... | [
"0.8019301",
"0.711479",
"0.6999579",
"0.69806457",
"0.6813589",
"0.6766313",
"0.6751293",
"0.6632754",
"0.66327333",
"0.6627275",
"0.66051364",
"0.65323144",
"0.6531621",
"0.6496783",
"0.6484378",
"0.64671206",
"0.6459565",
"0.64009947",
"0.6395408",
"0.6391058",
"0.63819975... | 0.811598 | 0 |
Step 3: Request the account's own watchlist feed | function getWatchlistFeed() {
var params_3 = {
action: "feedwatchlist"
};
request.get({ url: url, qs: params_3 }, function(error, res, body) {
if (error) {
return;
}
console.log(body);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadWatchlist() {\n API.getWatchlist(user.email)\n .then((res) => setWatchlist(res.data))\n .catch((err) => console.log(err));\n }",
"function pullFeed () {\n worker.postMessage({url: `${api.getUrl()}/user/feed`, newest: newest, token: getToken(), user: myself.username... | [
"0.6333755",
"0.6141587",
"0.61353797",
"0.58622515",
"0.5765681",
"0.56531006",
"0.5616906",
"0.5566956",
"0.5561424",
"0.5525998",
"0.5492125",
"0.5435558",
"0.54201907",
"0.53975517",
"0.5322997",
"0.5290299",
"0.5288652",
"0.5277186",
"0.5247886",
"0.52468854",
"0.5230047... | 0.70662206 | 0 |
type, timestamp, deadline, senderPublicKey, recipientId, amount, fee, referencedTransactionFullHash, signature, blockId, height, id, senderId, blockTimestamp, fullHash | function Transaction(data) {
if (typeof data !== "object") {
data = {}
}
if (data.senderPublicKey == null || typeof data.senderPublicKey != 'object' || typeof data.senderPublicKey.length == 'undefined')
throw new Error('Transaction: data.senderPublicKey mast be array');
this.deadline = data.deadline || null;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(timestamp, transactions, previousHash = '') {\n this.previousHash = previousHash;\n this.timestamp = timestamp;\n this.transactions = transactions;\n\n // completely random number to ensure hash can change and can be mined\n this.nonce = 0;\n\n // When we creat... | [
"0.61725813",
"0.61033446",
"0.6081382",
"0.603224",
"0.5906576",
"0.59063196",
"0.590053",
"0.58880883",
"0.58880883",
"0.58092403",
"0.5795012",
"0.57787216",
"0.5775578",
"0.57635176",
"0.5758008",
"0.5740086",
"0.5706095",
"0.5677899",
"0.5639652",
"0.5628491",
"0.5608805... | 0.6967079 | 0 |
Adds the Achievement CSS class to every milestone trade by checking their index in the HTML table and giving them a specific tooltip description! | function highlight_achievement(item) {
achievement = item[0];
trade_id = item[1];
row = find_row(trade_id, method)
row.addClass('achievement')
desc = `🏆 Achievement! 🎇 The ${achievement}th Currency Thing! 🥳🎉` // the description displayed on the achievement tooltip
row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"displayAchievements(achievements) {\n this.elementList.achievementDisplay.innerHTML = '<hr><h5 class=\"center-align\">Achievements</h5>';\n achievements.forEach((achievement) => {\n const opaqueness = achievement.unlocked ? '' : 'opaque';\n const tooltip = achievement.unlocked ? achievement.descrip... | [
"0.6290036",
"0.57942593",
"0.5785655",
"0.57731473",
"0.57060254",
"0.5670744",
"0.5569725",
"0.5562334",
"0.5487698",
"0.5438095",
"0.542926",
"0.5426263",
"0.5421216",
"0.5409968",
"0.54088527",
"0.5399799",
"0.53826666",
"0.5374953",
"0.53605086",
"0.53212285",
"0.5301178... | 0.6476161 | 0 |
Finding the wanted row | function find_row(trade_id, search_type) {
// FLAWLESS method - finds table row by table ID
if (search_type == "flawless") {
index = row_count - trade_id; // since the table is in reverse, we must reverse the index too
row = table.find('tr').eq(index... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkRow(row){\n if(row[0][1] === row[1][1] && row[1][1] === row[2][1]){\n return row[0][1];\n }\n }",
"function findRow(datatable, source) {\n for (var i = 0; i < datatable.getNumberOfRows(); i++) {\n if (datatable.getValue(i, 0) == source) {\n return i;\n }\n }\n ... | [
"0.68121684",
"0.6518307",
"0.6479059",
"0.641433",
"0.6397065",
"0.63916093",
"0.63796914",
"0.6370225",
"0.6337629",
"0.63149345",
"0.629104",
"0.62804604",
"0.6257476",
"0.62496936",
"0.6248985",
"0.6233263",
"0.6225191",
"0.6211244",
"0.6188722",
"0.6175621",
"0.6150507",... | 0.65380794 | 1 |
setGaussParam() allows to change gaussian parameters and number of points to generate | setGaussParam(mu, sigma, nPoints) {
this.mu = mu;
this.sigma = sigma;
this.nPoints = nPoints;
this.clear()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function gauss(x, s) {\n return exp(-(x * x) / (2.0 * s * s));\n }",
"function gauss( x, sigma ) {\n\n return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) );\n\n }",
"function gauss( x, sigma ) {\n\t\n\t\t\t\t\treturn Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) );\n\t\n\t\t\t\t}",
"fun... | [
"0.65011126",
"0.64637834",
"0.6438872",
"0.6427436",
"0.63923895",
"0.63231564",
"0.63231564",
"0.619017",
"0.61861426",
"0.58436567",
"0.56558365",
"0.56283605",
"0.5571796",
"0.5565269",
"0.55626214",
"0.5540118",
"0.54296684",
"0.54262155",
"0.538319",
"0.5351103",
"0.534... | 0.83046865 | 0 |
setDistributionPixels() takes a properties of canvas and for each pixel (x) creates a value (y) for Df assign Hf | setDistributionPixels() {
let maxY = 0;
let minX = 0;
let maxX = 0;
let isMinX = false;
let isMaxX = false;
for(let i = 0; i<this.rangeX; i++) {
let x = i+this.minX
let yValue = Math.floor(yOfGauss(x, this.mu, this.sigma, this.GAME_HEIGHT-20))
if(!isMinX && yValue > 0) { // fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setfg(x, y, v) {\n let i = y * this.width + x;\n if (i < this.nentries) {\n this.fg[i] = v;\n this.fgsketches[i] = this.genSketch(v);\n }\n }",
"function createGrid(value){\n var pixel = 24;\n drawb.style.width = value * pixel+\"px\";\n drawb.style.height = value ... | [
"0.5635964",
"0.5418639",
"0.5391087",
"0.53593105",
"0.53169626",
"0.5310578",
"0.5263841",
"0.5236655",
"0.52332944",
"0.521313",
"0.5188435",
"0.51768464",
"0.51726705",
"0.51465863",
"0.51431096",
"0.5119314",
"0.51156443",
"0.5112743",
"0.5105406",
"0.5101862",
"0.509966... | 0.65819234 | 0 |
drawDistroLine() takes Hf values of all Df (y of x) and draw all of these points | drawDistroLine() {
this.ctx.fillStyle = this.color
for(let i=0; i<this.rangeX; i++) {
this.ctx.fillRect(i + this.minX, this.GAME_HEIGHT-50-this.drawDistroPoints[i], 3, 3);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"drawLineBetweenPoints() {\n return d3.line()\n .x(d => { return this.xyInfo.x(d.get(this.xyInfo.xColumnName)); })\n .y(d => { return this.xyInfo.y(d.get(this.xyInfo.yColumnName)); });\n }",
"function drawDivLine(dl) {\n console.log(dl)\n ctx.lineWidth = 4;\n ctx.beginPath();\n ... | [
"0.62929547",
"0.62335175",
"0.6053862",
"0.6005369",
"0.5988189",
"0.59585416",
"0.5940104",
"0.5931455",
"0.59169304",
"0.59156156",
"0.5912028",
"0.58808976",
"0.58594215",
"0.5857685",
"0.58353984",
"0.58302665",
"0.57951206",
"0.57942355",
"0.57874006",
"0.5786803",
"0.5... | 0.7342424 | 0 |
getNewPoint() generate new point and if it fits Gaussian distribution it add it to set | getNewPoint(drawPoints, drawLines) {
let x = Math.floor(Math.random()*this.rangeX);
let y = Math.floor(Math.random()*this.maxY);
if( y < this.drawDistroPoints[x] ) { // belongs to gaussian distribution
if(drawPoints){
this.drawPoint(x+this.minX, this.GAME_HEIGHT-y-50, false)
}
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setNewPoint() {\n do {\n var newPoint = Point.random(this.handlePointClick, this.handlePointHove);\n } while (\n this.state.points.some((point) => point.distanceTo(newPoint) < 20) ||\n (newPoint.pos.x <= 350 && newPoint.pos.y <= 46)\n );... | [
"0.66382056",
"0.64366823",
"0.6339642",
"0.6201971",
"0.61634034",
"0.6061828",
"0.6015926",
"0.59081006",
"0.5846884",
"0.5814662",
"0.57902545",
"0.5759382",
"0.5726973",
"0.5724338",
"0.5717756",
"0.5649799",
"0.55732596",
"0.55680656",
"0.5551398",
"0.5535219",
"0.549764... | 0.7237152 | 0 |
Index page: Hide category if all posts are drafts | function hideEmptyCategoryWrapper() {
const pageIndex = document.getElementsByClassName("page-index")[0];
if (pageIndex) {
let listHiddenClass = [];
if (!toggleDraftBtn.checked) listHiddenClass.push("post-not-full");
if (!togglePrivateBtn.checked) listHiddenClass.push("post-private");
if (!toggleOut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayDrafts(){\n\tfor(var m = 0; m < posts.length; m++){\n\t\tif(posts[m].draftView == false){\n\t\t\tif(posts[m].draft == true){\n\t\t\t\t$(\"#drafts-pane ul\").prepend(\"<li class='display-draft'>\" + posts[m].content + \"</li>\");\n\t\t\t\tposts[m].draftView = true;\n\t\t\t} else {\n\n\t\t\t}\n\t\t} ... | [
"0.68394935",
"0.6138959",
"0.60311556",
"0.5870541",
"0.577379",
"0.5694903",
"0.56660205",
"0.5489494",
"0.54868156",
"0.54397964",
"0.54290676",
"0.54006785",
"0.5377897",
"0.5364926",
"0.53591305",
"0.5338375",
"0.5324433",
"0.52988344",
"0.5293037",
"0.52694005",
"0.5212... | 0.69659215 | 0 |
home topics click handler | function homeTopicsClickHandler(id, topic) {
$("#" + id).off("click").on("click",
function () {
window.localStorage.setItem("cardSubject", topic);
$("body").pagecontainer("change", "#topicPage");
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onTopicClick() {\n var label;\n\n // Add/remove CSS classes for coloring the selection\n if ($activeTopic) {\n $activeTopic.removeClass(\"active\");\n }\n $activeTopic = $(this);\n $activeTopic.addClass(\"active\");\n\n // Clear the results list ... | [
"0.68351823",
"0.64851624",
"0.6379881",
"0.63150215",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
"0.6197291",
... | 0.7321402 | 0 |
Function to validate an ISO Date String | function isValidDate(string) {
return luxon.DateTime.fromISO(string).get('isValid');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateISODateString(date)\n{\n var date = new Date(date);\n return !isNaN(date.getTime());\n}",
"function isValidDate(dateString)\n{\n var regEx = /^\\d{4}-\\d{2}-\\d{2}$/;\n \n //invalid date format\n if(!dateString.match(regEx))\n {\n return false; \n }//end if\n\n ... | [
"0.81577396",
"0.76069987",
"0.7544134",
"0.7454447",
"0.745121",
"0.738698",
"0.7382446",
"0.7337548",
"0.7327782",
"0.7239716",
"0.71727645",
"0.71505857",
"0.70491374",
"0.70211667",
"0.7019125",
"0.7006197",
"0.69251204",
"0.6909739",
"0.6907359",
"0.6907359",
"0.6907359"... | 0.7930953 | 1 |
set the key, and queue periodic dehydration to the server in the background | async setKeyAndQueueDehydration(key, keyInfo = {}, deviceDisplayName = undefined) {
const matches = await this.setKey(key, keyInfo, deviceDisplayName);
if (!matches) {
// start dehydration in the background
this.dehydrateDevice();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async scheduleKeyCheck() {\n try {\n let jobName = \"key-check-\" + new Date().getTime();\n this.bree.add({\n name: jobName,\n interval: \"at 05:30am also at 05:30pm\",\n path: path.join(__dirname, \"jobs\", APIKEY_MONITORING),\n worker: {\n workerData: {\n ... | [
"0.56940717",
"0.5642004",
"0.5630666",
"0.5506172",
"0.5478331",
"0.5447848",
"0.53867644",
"0.53396255",
"0.5329306",
"0.5308543",
"0.5302375",
"0.5296105",
"0.52461994",
"0.5220813",
"0.5185501",
"0.51812273",
"0.51809204",
"0.5174902",
"0.5160997",
"0.5160792",
"0.5098455... | 0.65039116 | 0 |
If the emit was skipped. | getEmitSkipped() {
return this.compilerObject.emitSkipped;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"onSkipFailed() {\n this._emitter.emit('skip-failed');\n }",
"function skip() {\n\t\tnext();\n\t}",
"skip(count){const name=this._constructChainName(\"Skip\");const transformedObservable=new Observable(name);let emitsSoFar=0;this._wireTransformedObservableWithOperation(transformedObservable,value=>{emitsSoF... | [
"0.7066682",
"0.6549134",
"0.61816865",
"0.61133236",
"0.61084706",
"0.6024038",
"0.5979271",
"0.5963849",
"0.59423494",
"0.58970976",
"0.5895655",
"0.5861402",
"0.58041453",
"0.5788209",
"0.5788209",
"0.5747579",
"0.57022685",
"0.5686888",
"0.5669428",
"0.56603247",
"0.56586... | 0.68741953 | 1 |
Find out a pair of numbers(we called them number a and number b) from the array numbers, let ab=c, result format is an array [a,b] The array numbers is a sorted array, value range: 100...100 The result will be the first pair of numbers, for example,findAB([1,2,3,4,5,6],6) should return [1,6], instead of [2,3] Please se... | function findAB(array, number) {
let result = [];
for(let index = 0; index < array.length; index++){
for (let index2 = index +1; index2 < array.length; index2++) {
if (array[index] * array[index2] === number) {
result.push(array[index], array[index2]);
return result;
}
}
}
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findpairs(n) {\n const arr = n.replace(/\\D/g, '0').split('').map(Number);\n const pairs_arr = arr.map( (val,index,arr) => {\n if (index == arr.length - 1) {\n return [val,arr[0]];\n } else {\n return [val,arr[index + 1]];\n }\n });\n return pairs_arr.reduce((acc,val) => {\n if (... | [
"0.6170588",
"0.6068681",
"0.59596556",
"0.59466434",
"0.5939289",
"0.587709",
"0.58766377",
"0.58702093",
"0.58185345",
"0.5816584",
"0.57998174",
"0.5777026",
"0.5760602",
"0.57587165",
"0.5726642",
"0.5709184",
"0.5695913",
"0.56672394",
"0.5636292",
"0.56179106",
"0.56138... | 0.72725976 | 0 |
Resets the level, dependent coordination classes, resources and Set "fullReset" to return to first level and reset score to zero, and false to proceed to next level | reset(fullReset) {
this.state = this.states.initialising;
if (fullReset) {
this.score = 0;
this.level = this.levels.reset();
} else {
this.level = this.levels.next();
}
this.entities = new Entities(this.level);
this.inputHandler = new I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function reset () {\n isPaused = true;\n isLevelUp = false;\n isGameOver = false;\n isGameStart = true;\n scores = 0;\n life = 3;\n level = 1;\n }",
"function reset() {\n score = 0;\n lifes = 3;\n gameIteration = 0;\n level = 0;\n ... | [
"0.72611475",
"0.7190206",
"0.7166769",
"0.71461594",
"0.70949",
"0.7082747",
"0.7069854",
"0.6995675",
"0.69258136",
"0.69247717",
"0.69231796",
"0.6891443",
"0.68593794",
"0.68583024",
"0.68429303",
"0.6835039",
"0.6813345",
"0.67823523",
"0.6678156",
"0.66748387",
"0.66593... | 0.79687583 | 0 |
Starts running the main loop. This involves some initialisations and then calling the first iteration of the loop (which will then call additional iteration by callbacks) | run() {
this.initialiseLevel();
this.runLoopIteration();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"run() {\n\n // Start the main loop\n this.loop(0);\n }",
"function main(){\r\n console.log('Main loop started.');\r\n controlLoop();\r\n\tcontrolLoopFast();\r\n}",
"start() {\n this.loop();\n }",
"startMainLoop() {\n\t\tthis.workerSystem.start();\n\t}",
"start () {\n loo... | [
"0.7640164",
"0.7368347",
"0.72346544",
"0.69232",
"0.68846256",
"0.68454343",
"0.68082666",
"0.68082666",
"0.68082666",
"0.66877306",
"0.66795295",
"0.66612613",
"0.66556424",
"0.6649477",
"0.6601675",
"0.65752965",
"0.65608877",
"0.65013087",
"0.6498251",
"0.6475716",
"0.64... | 0.7557283 | 1 |
Makes sure this information is consistent everywhere it's used. Player input is disabled for the first few seconds to allow enemies to enter the screen | playerInputAllowed() {
return this.timeSinceReset > 2;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleInput(e) {\n e.preventDefault();\n const { keyCode, type } = e;\n const { player } = this;\n this.keyMap[keyCode] = type === 'keydown';\n // Ignore the Shift key, which is just a key modifier\n if (type === 'keydown' && Input_1.keyCodeToChar[keyCode] !== 'Shift') {\n... | [
"0.6423159",
"0.6285299",
"0.6257224",
"0.61997366",
"0.618299",
"0.61348486",
"0.6103333",
"0.61019504",
"0.6096564",
"0.6081485",
"0.60814476",
"0.6014249",
"0.6011991",
"0.5991758",
"0.5974185",
"0.59563637",
"0.59505314",
"0.59377927",
"0.59248793",
"0.5921727",
"0.592130... | 0.6486823 | 0 |
Determines visibility of the player entity. If player input is disabled then the player entity will "blink" and is periodically not visible | playerVisible() {
// Player entity blinks at 2 cycles per second
const blinkState = Math.floor(this.timeSinceReset * 4 % 2) == 0;
return this.state != this.states.running || blinkState || this.playerInputAllowed();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_onVisibilityChange() {\n if (document.hidden === true && this.currentState === exports.PlayerState.Playing) {\n this.freeze();\n } else if (this.currentState === exports.PlayerState.Frozen) {\n this.play();\n }\n }",
"static _updateWhenInvisible() {\r\n Graphics.showScreen... | [
"0.6924026",
"0.65872616",
"0.6542833",
"0.6511086",
"0.64799994",
"0.64799994",
"0.64799994",
"0.64579374",
"0.6335372",
"0.6334578",
"0.6275631",
"0.62127876",
"0.60987204",
"0.6088336",
"0.6080108",
"0.6065037",
"0.5982881",
"0.59615856",
"0.59280246",
"0.58933204",
"0.587... | 0.74794626 | 0 |
Renders messages that appear when the player reaches the next level or hits an enemy If there were more UI elements in game it would be good to create separate classes for them but since it's just one box with similar messages just code it here for now | renderMessages() {
if (this.state == this.states.running) return;
if (this.state == this.states.levelWin || this.state == this.states.gameOver) {
// border
ctx.fillStyle = '#777';
ctx.fillRect(this.MESSAGE_PADDING, this.MESSAGE_PADDING + this.CANVAS_Y_OFFSET,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayMessage(){\n\tif (level < 11 && lives > 0) {\n\t\tvar title = new Element('h2', {\n\t\t\tid: 'message_title',\n\t\t\ttext: 'Level ' + level,\n\t\t});\n\n\t\tvar subtitle = new Element ('p', {\n\t\t\tid: 'message_subtitle',\n\t\t\ttext: 'Press Enter to start',\n\t\t});\n\t} else if(level > 10) {\n\t... | [
"0.70342517",
"0.6594587",
"0.6481963",
"0.6434504",
"0.6411757",
"0.63709337",
"0.6347473",
"0.6325062",
"0.6324759",
"0.629946",
"0.6283502",
"0.62445205",
"0.623251",
"0.6189731",
"0.61565715",
"0.6146055",
"0.61416715",
"0.613969",
"0.6123414",
"0.6075598",
"0.6075287",
... | 0.6904504 | 1 |
Handler for mouse move events that may highlight the message box's button | handleMouseMove(event) {
const x = event.offsetX;
const y = event.offsetY;
if (x >= this.buttonLeft() && x < this.buttonRight() && y >= this.buttonTop() && y < this.buttonBottom()) {
this.buttonHighlight = true;
} else {
this.buttonHighlight = false;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mouseMoveEventHandler(e)\n\t\t\t {\n\t\t\t switch(command)\n\t\t\t {\n\t\t\t \tcase 1\t:\t{\tdrawPencil(e);break; }\n\t\t\t \tcase 2\t:\t{\tdrawPencil(e);break; }\n\t\t\t \tcase 4\t:\t{ fakeLineInput(e);\tbreak;\t }\n\t\t\t \tcase 5\t:\t{ fa... | [
"0.6301382",
"0.63007927",
"0.62414443",
"0.624077",
"0.6195426",
"0.6175373",
"0.61445993",
"0.60869193",
"0.60647213",
"0.60590315",
"0.6013802",
"0.5991758",
"0.5938508",
"0.5927023",
"0.5916965",
"0.59114045",
"0.58925927",
"0.58858323",
"0.58834153",
"0.5877505",
"0.5868... | 0.6932409 | 0 |
Check if a screens exists in the stack. | function appScreenStackExists(screenName) {
var arrLength = appScreenStack[currAppName].length;
for ( var counter=0; counter<arrLength; counter++ ) {
currScr = appScreenStack[currAppName][counter].name;
if ( currScr == screenName) {
return(true);
}
}
return(false);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function existsComponentsStack(){\n\tif (Components && Components.stack)\n\t\treturn true;\n\telse \n\t\treturn false;\n}",
"function checkTestAndScreenID(teamInfo, args) {\r\n\t\treturn teamInfo.CurrentTest == args.testID && teamInfo.CurrentScreen == args.screen;\r\n\t}",
"function is(screen_label)\n{\n\tretu... | [
"0.6531219",
"0.6132011",
"0.593567",
"0.59182817",
"0.5869135",
"0.5789332",
"0.5786336",
"0.5709082",
"0.5609519",
"0.5573264",
"0.5470688",
"0.5434827",
"0.5343488",
"0.53364336",
"0.5332537",
"0.5331221",
"0.5314208",
"0.52982783",
"0.5280641",
"0.52758825",
"0.52667564",... | 0.7912606 | 0 |
Pop the stack until the passed screen is popped. | function appScreenStackPop(screenName) {
var arrLength = appScreenStack[currAppName].length;
while (arrLength != 0 ) {
var currRec=appScreenStack[currAppName].pop();
if ( currRec.name == screenName ) {
return;
}
arrLength = appScreenStack[currAppName].length;
}
return;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static pop(){\n\t\tif( listStack.length > 0 )\n\t\t\tEventQueue.restore(listStack.pop().key);\n\t}",
"pop() {\n\t\tthis.stack.pop();\n\t}",
"popUntil(rt) {\n while (this._execStack.length > 0 && this._execStack[this._execStack.length - 1] !== rt) {\n this.pop();\n }\n }",
"functio... | [
"0.6914445",
"0.69015133",
"0.66190624",
"0.6561663",
"0.65539956",
"0.6503147",
"0.6447259",
"0.6432053",
"0.6381673",
"0.63587373",
"0.63264763",
"0.62832165",
"0.6281282",
"0.6275241",
"0.62457556",
"0.62421715",
"0.6226606",
"0.6223932",
"0.617595",
"0.61435723",
"0.60397... | 0.71809095 | 0 |
Check that conversion worked for the given source. | function checkConversion(source, target) {
for (let sourceContent of source.directoryEntries) {
let sourceContentName = sourceContent.leafName;
let ext = sourceContentName.substr(-4);
let targetFile = FileUtils.File(
PathUtils.join(target.path, sourceContentName)
);
log.debug("Checking path:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sourceValid(source){\n if( Config.SOURCES.find( function(sourceName){ return (sourceName === source); }) !== undefined ){\n return true;\n }\n return false;\n }",
"function isSource(source) {\n return instanceOf(source, Source);\n }",
"async function validateSourceNameExistenceA... | [
"0.6069799",
"0.60611045",
"0.5556132",
"0.5550712",
"0.54399526",
"0.5331019",
"0.53236187",
"0.5216312",
"0.5216312",
"0.5189821",
"0.51638794",
"0.5141675",
"0.5135533",
"0.5129672",
"0.5112065",
"0.50393",
"0.50227225",
"0.49940774",
"0.49778056",
"0.4969059",
"0.49481335... | 0.61002713 | 0 |
Returns the string representation of a given BlockResponse. | function blockResponseToString(blockResponse) {
var stringBuilder = "";
if (blockResponse.Block.IonText) {
stringBuilder = stringBuilder + "Block: " + blockResponse.Block.IonText + ", ";
}
if (blockResponse.Proof.IonText) {
stringBuilder = stringBuilder + "Proof: " + blockResponse.Proof.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"toString(){\n return `Block-\n Timestamp : ${this.timestamp}\n Last hash : ${this.lastHash.substring(0,10)}\n current hash : ${this.cur_hash.substring(0,10)}\n Nonce : ${this.nonce}\n Difficulty : ${this.difficulty}\n data : ${this.data}`;\n }",
"toStrin... | [
"0.65230656",
"0.63609356",
"0.63148105",
"0.62326264",
"0.6213064",
"0.5625228",
"0.55603427",
"0.5270781",
"0.5208163",
"0.5160695",
"0.5142884",
"0.50762784",
"0.50671947",
"0.506191",
"0.50457966",
"0.49865848",
"0.49865848",
"0.49865848",
"0.4956087",
"0.49190465",
"0.48... | 0.8437686 | 0 |
Returns the string representation of a given GetDigestResponse. | function digestResponseToString(digestResponse) {
var stringBuilder = "";
if (digestResponse.Digest) {
stringBuilder += "Digest: " + JSON.stringify(ion_js_1.toBase64(digestResponse.Digest)) + ", ";
}
if (digestResponse.DigestTipAddress.IonText) {
stringBuilder += "DigestTipAddress: " + d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"toString () {\n return `${this.responseHeaderToString()}\\n\\n${this.getPrettyfiedBody()}`\n }",
"function getDigest(data){\n\treturn convertHex(calcDigest(convertUtf8(data))).toLowerCase();\n}",
"function blockResponseToString(blockResponse) {\n var stringBuilder = \"\";\n if (blockResponse.Block.Io... | [
"0.5084452",
"0.4916623",
"0.48913622",
"0.48854384",
"0.4843031",
"0.47937945",
"0.4765292",
"0.4660714",
"0.46328035",
"0.45968357",
"0.45898047",
"0.45898047",
"0.45709077",
"0.4564774",
"0.45392895",
"0.45326984",
"0.45326984",
"0.45286748",
"0.4497444",
"0.44596124",
"0.... | 0.80588645 | 0 |
Function which, given a reader and a path, traverses through the reader using the path to find the value. | function getFieldValue(ionReader, path) {
ionReader.next();
ionReader.stepIn();
return recursivePathLookup(ionReader, path);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function recursivePathLookup(ionReader, path) {\n if (path.length === 0) {\n // If the path's length is 0, the current ionReader node is the value which should be returned.\n if (ionReader.type() === ion_js_1.IonTypes.LIST) {\n var list = [];\n ionReader.stepIn(); // Step int... | [
"0.7037091",
"0.5807006",
"0.5690772",
"0.56613714",
"0.56613714",
"0.55289",
"0.5243877",
"0.5188411",
"0.5188411",
"0.5188411",
"0.5188411",
"0.5188411",
"0.5188411",
"0.5188411",
"0.5188411",
"0.5188411",
"0.51812375",
"0.51555824",
"0.5137476",
"0.5121832",
"0.5118822",
... | 0.7306993 | 0 |
Helper method that traverses through the reader using the path to find the value. | function recursivePathLookup(ionReader, path) {
if (path.length === 0) {
// If the path's length is 0, the current ionReader node is the value which should be returned.
if (ionReader.type() === ion_js_1.IonTypes.LIST) {
var list = [];
ionReader.stepIn(); // Step into the list... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFieldValue(ionReader, path) {\n ionReader.next();\n ionReader.stepIn();\n return recursivePathLookup(ionReader, path);\n}",
"get(path) {\n return _find(this, path, '.');\n }",
"get(path) {\n return _find(this, path, '.');\n }",
"get(path) {\n return _find(this,... | [
"0.7516306",
"0.58104724",
"0.58104724",
"0.58104724",
"0.58104724",
"0.58104724",
"0.58104724",
"0.58104724",
"0.58104724",
"0.58104724",
"0.5804229",
"0.5512768",
"0.5512768",
"0.5462015",
"0.54284227",
"0.5398325",
"0.5391757",
"0.53665066",
"0.53543663",
"0.53241026",
"0.... | 0.66514444 | 1 |
Returns the string representation of a given ValueHolder. | function valueHolderToString(valueHolder) {
var stringBuilder = "{ IonText: " + valueHolder.IonText + "}";
var writer = ion_js_1.makePrettyWriter();
var reader = ion_js_1.makeReader(stringBuilder);
writer.writeValues(reader);
return ion_js_1.decodeUtf8(writer.getBytes());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toString(val) {\n return val == null ?\n '' :\n typeof val === 'object' ?\n JSON.stringify(val, null, 2) :\n String(val)\n }",
"function toString(val) {\n return val == null\n ? ''\n : typeof val === 'object'\n ? JSON.stringify(va... | [
"0.6720869",
"0.67178965",
"0.6695333",
"0.6695333",
"0.66743135",
"0.6618818",
"0.66138184",
"0.6584583",
"0.6584583",
"0.6580909",
"0.6580909",
"0.6580909",
"0.6580909",
"0.655613",
"0.655613",
"0.653566",
"0.653566",
"0.653566",
"0.653566",
"0.653566",
"0.653566",
"0.653... | 0.777257 | 0 |
generate all of the values in table across every decade | function decade_generate_values(min, max, table) {
var val = min;
var interp = decade_interp_forward(val, table);
var index = interp[0];
var decade = interp[1];
var val = table[index] * Math.pow(10, decade);
var out = []
while (val < max) {
out.push(val);
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"makeTable(length) {\n var table = new Array(length)\n var denom = length - 1\n for (var i = 0; i < table.length; ++i) {\n table[i] = this.decay(i / denom)\n }\n return table\n }",
"function generateColumns() {\n var table = $(\".data-table thead tr\");\n for (var i = 1972; i < ... | [
"0.63106346",
"0.58392155",
"0.57611",
"0.57543975",
"0.5489627",
"0.5483261",
"0.54583263",
"0.54426813",
"0.54358405",
"0.53908145",
"0.5385273",
"0.537945",
"0.53775424",
"0.53550595",
"0.5345926",
"0.53332716",
"0.5297263",
"0.5296268",
"0.5285938",
"0.5285764",
"0.528210... | 0.7812691 | 0 |
get the values at the location in the argument space | function get_values_at_loc(loc, args) {
var out = [];
for (i=0; i<args.length; i++) {
out.push(args.values[loc[i]]);
}
return out;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get args() {\n return [this._x, this._y]\n }",
"function getArgumentValues(){\n\t\tvar a=new Array();\n\t\tvar b=this.query.split('&');\n\t\tvar c='';\n\t\tif(b.length<1) return a;\n\t\tfor(var i=0;i<b.length;i++){\n\t\t\tc=b[i].split('=');\n\t\t\ta[i]=new Array(c[0],((c.length==1)?c[0]:c[1]));\n\t\t}\n\... | [
"0.6626609",
"0.6379799",
"0.6276119",
"0.6264796",
"0.6253912",
"0.6143827",
"0.6114087",
"0.60070056",
"0.59612817",
"0.59388345",
"0.5882293",
"0.58531195",
"0.58531195",
"0.58196324",
"0.5818347",
"0.5815066",
"0.5797716",
"0.5793884",
"0.5790553",
"0.5790553",
"0.5790553... | 0.7253986 | 0 |
evaluates a particular coordinate in the argument space | function eval_at_loc(eq_in, loc, args) {
with (Math) {
return eval(generate_equation_at_loc(eq_in, loc, args))
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"containsCoordinates(x,y) {\n }",
"fireAt(coords) {\n let self = this;\n \n let r = self.gameCoordsToXY(coords);\n if (!r) {\n log.info(\"that's not a valid coordinate\");\n return;\n }\n \n switch (self._grid[r.y][r.x]) {\n case OCEAN:\n case MISS: \n self._grid[r.y... | [
"0.59868634",
"0.5927683",
"0.585257",
"0.58510536",
"0.5705496",
"0.5652477",
"0.56507635",
"0.5644437",
"0.5644168",
"0.5534999",
"0.5498738",
"0.54825985",
"0.5447844",
"0.5447484",
"0.54423153",
"0.54363096",
"0.5431401",
"0.54216397",
"0.5393834",
"0.537264",
"0.53594124... | 0.6164087 | 0 |
format work data append work data work forin loop | function displayWork(){
for(job in work.jobs) {
$("#workExperience").append(HTMLworkStart);
var formattedWorkEmployer = HTMLworkEmployer.replace("%data%", work.jobs[job].employer);
var formattedWorkTitle = HTMLworkTitle.replace("%data%", work.jobs[job].title);
var formattedWorkDates... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayWork(){\n for(var job=0; job<work.workplaces.length; job++){\n //console.log(work.workplaces[job])\n $(\"#workExperience\").append([HTMLworkStart]);\n if (work.workplaces[job].hasOwnProperty(\"employer\")){\n var formattedJob = HTMLworkEmployer.replace(\"%data%\",work.workplaces[job]... | [
"0.6475034",
"0.6384882",
"0.59436476",
"0.5859382",
"0.57830435",
"0.56957656",
"0.5666062",
"0.56365055",
"0.55735433",
"0.5555548",
"0.55331326",
"0.5506335",
"0.5483806",
"0.5448588",
"0.53914946",
"0.53907585",
"0.53625655",
"0.5282015",
"0.5262452",
"0.52561724",
"0.523... | 0.6504416 | 0 |
obtener nombre del mes | function mes_nombre(numero)
{
var meses = [
"Marzo",
"Abril",
"Mayo",
"Junio",
"Julio",
"Agosto",
"Septiembre",
"Octubre",
"Noviembre",
"Deciembre"
]
return meses[numero-1];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMesNome(retirarMes) {\n var date = new Date();\n date.setMonth(date.getMonth() - retirarMes);\n monthName = [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"];\n return monthName[date.getMonth... | [
"0.69110113",
"0.61615735",
"0.6136769",
"0.5994273",
"0.597785",
"0.59648573",
"0.5959153",
"0.5910303",
"0.5889919",
"0.58824366",
"0.5756362",
"0.57135206",
"0.57103944",
"0.5703086",
"0.5693482",
"0.56886184",
"0.568627",
"0.5686168",
"0.5665861",
"0.5665696",
"0.56612086... | 0.7834536 | 0 |
Start and stop the transfer process | function startStop() {
if (isTransferring) {
select('#startStop').html('Start');
} else {
select('#startStop').html('Stop');
// Make a transfer using the video
style.transfer(gotResult);
}
isTransferring = !isTransferring;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function startStop() {\n if (isTransferring) {\n select('#startStop').html('Start');\n } else {\n select('#startStop').html('Stop');\n // Make a transfer using the video\n style.transfer(gotResult);\n }\n isTransferring = !isTransferring;\n}",
"async function stopTransfer() {\n const sf = new ... | [
"0.6537672",
"0.5812922",
"0.57939005",
"0.57939005",
"0.56452304",
"0.5645147",
"0.56334937",
"0.56334937",
"0.56334937",
"0.56334937",
"0.560982",
"0.56009567",
"0.5594488",
"0.55430263",
"0.5525211",
"0.55215496",
"0.55127597",
"0.54303026",
"0.5411315",
"0.5365853",
"0.53... | 0.6537486 | 1 |
When we get the results, update the result image src | function gotResult(err, img) {
resultImg.attribute('src', img.src);
if (isTransferring) {
style.transfer(gotResult);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function gotResult(err, img) {\n resultImg.attribute('src', img.src);\n}",
"function gotResult(err, img) {\n resultImg.attribute('src', img.src);\n if (isTransferring) {\n style.transfer(gotResult);\n }\n}",
"function callback_getResult(response){\n console.log(response);\n result_image = new Image();... | [
"0.7947719",
"0.6909283",
"0.6727064",
"0.6551061",
"0.64432627",
"0.6341259",
"0.6319105",
"0.6285902",
"0.61635387",
"0.61611307",
"0.6135018",
"0.61216396",
"0.6120604",
"0.611659",
"0.61110526",
"0.6075439",
"0.6064778",
"0.6063424",
"0.60518634",
"0.6038449",
"0.60237646... | 0.69518113 | 1 |
Algorithm: Initalize n1 to 1 and n2 to 1 initialize index to 1 while length of n2 is < length argument: set temp variable to n2, n2 to n1 + n2 and n1 to temp return index Recursive Solution: Break condition: n2 length is fibLength; call function with n2 and n1 + n2 as arguments default values for n1 and n2 are 1 | function findFibonacciIndexByLength(fibLength) {
let n1 = 1;
let n2 = 1;
let index = 2;
while (String(n2).length < fibLength) {
let temp = n2;
n2 = n2 + n1;
n1 = temp;
index += 1;
}
return index;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fib2 (n,ac1=1,ac2=1) {\n\tif(n<=1) return ac2;\n\treturn fib2(n-1,ac2,ac2+ac1);\n}",
"function fib(index){\n if(index < 2) return 1\n return fib(index-1) + fib(index-2)\n}",
"function fibo1(N) {\n if (N < 2) {\n return N;\n }\n return fibo(N - 1) + fibo(N - 2);\n}",
"function fib2(n, mem... | [
"0.72585297",
"0.7089617",
"0.70715535",
"0.70367616",
"0.7035005",
"0.7016132",
"0.70086974",
"0.6944011",
"0.68883544",
"0.6883696",
"0.6836544",
"0.6833883",
"0.68332493",
"0.68241763",
"0.6810896",
"0.68087894",
"0.6795483",
"0.67837566",
"0.6775008",
"0.6774989",
"0.6765... | 0.7629916 | 0 |
NOTE this function addHouse, creates the house by using post() | async addHouse(houseData) {
// NOTE the async and await makes it so that nothing else can happen until this is complete.
const res = await api.post('api/houses', houseData)
console.log('houseServices response', res)
// NOTE this next line then adds the information from the api into our houses proxystate.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async addHouse({ commit, dispatch }, newHouse) {\n await api.post('/house', newHouse)\n .then(res => {\n dispatch('getHousesByMember', newHouse.superAdmin)\n })\n }",
"function newHousehold() {\n var id = odkCommon.genUUID();\n odkCommon.setSessionVariable('household_id', id)... | [
"0.71445644",
"0.6418197",
"0.6033537",
"0.5932002",
"0.5825587",
"0.57664657",
"0.57664657",
"0.56139284",
"0.5530325",
"0.5493103",
"0.5469454",
"0.5463616",
"0.54568046",
"0.54557973",
"0.544816",
"0.5435733",
"0.5396881",
"0.53685856",
"0.53650886",
"0.5354594",
"0.535433... | 0.76814693 | 0 |
NOTE getHouse function is accessing the houses from the api using get() | async getHouse() {
const res = await api.get('api/houses')
console.log('getHouse response', res)
// line below this takes the raw data that we accessed from api using get... and turning it into our Model data.
ProxyState.houses = res.data.map(h => new House(h))
console.log('getHouse response', res)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAndDisplayHouses() {\n\tgetListOfHouses(displayHouses);\n}",
"function House(bedrooms) {\n this.bedrooms = bedrooms;\n this.color = \"White\";\n this.bathrooms = 2;\n\n this.getDetails = function() {\n return (\n this.bedrooms +\n \" bedroom, \" +\n this.bathrooms +\n \" ba... | [
"0.7421049",
"0.65631187",
"0.65097815",
"0.64733243",
"0.64195794",
"0.6380627",
"0.6349689",
"0.6255485",
"0.61967814",
"0.6183553",
"0.61404264",
"0.6133109",
"0.6116547",
"0.6101445",
"0.60876465",
"0.6081438",
"0.6065325",
"0.6035198",
"0.6009534",
"0.5964868",
"0.594828... | 0.7600228 | 0 |
NOTE this function deletes the house from the page & also the api using the house ID. | async deleteHouse(houseId) {
await api.delete(`api/houses/${houseId}`)
// this next line iterates through the houses in the proxystate to filter through the id's so that the page ONLY shows the id's that DO NOT match the one that was deleted.
ProxyState.houses = ProxyState.houses.filter(h => h.id !== houseI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function releasePokemon(event) {\n const pokeId = event.target.dataset.pokemonId\n fetch(POKEMONS_URL + `/${pokeId}`, {\n method: 'DELETE',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n })\n .then(res => {\n if ... | [
"0.6732131",
"0.6566725",
"0.6435483",
"0.6414526",
"0.6326146",
"0.6321969",
"0.63088596",
"0.629919",
"0.62851185",
"0.62402266",
"0.6193374",
"0.6183241",
"0.616303",
"0.6156208",
"0.6133424",
"0.6050876",
"0.6026452",
"0.60262716",
"0.6008538",
"0.5998441",
"0.5998164",
... | 0.75271755 | 0 |
handler = function (error, index, alreadyExistingFileHashes, newlyCachedPaths) | function createCacheFiles (paths, index, handler) {
let fileCount = 0
const alreadyExistingFileHashes = []
const newlyCachedPaths = []
paths.forEach(path => {
path = resolve(process.cwd(), path)
const pathHash = md5(path)
const cachePath = join(getCurrentStorageDir(index), `${pathHash}.${storageFor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeFreshCacheDir (index, handler) {\n const currentStorageDirPath = getCurrentStorageDir(index)\n mkdir(currentStorageDirPath, { recursive: true }, err => {\n if (err) throw err\n\n if (index.files && Object.keys(index.files).length > 0) {\n const filePaths = Object.keys(index.files).map(key... | [
"0.6309471",
"0.61400217",
"0.5987512",
"0.5711921",
"0.5597277",
"0.54792005",
"0.53631645",
"0.5331851",
"0.53027713",
"0.52957773",
"0.52782416",
"0.52185196",
"0.5170318",
"0.5158643",
"0.51585716",
"0.5156317",
"0.5136326",
"0.5133229",
"0.51313436",
"0.5128398",
"0.5116... | 0.65288025 | 0 |
Checks installed NodeJS version | function checkNodeVersion() {
const currentNodeVersion = process.versions.node;
const minNodeVersion = engines.node;
if (!semver.satisfies(currentNodeVersion, minNodeVersion)) {
const errorMsg =
`You are running Node ${currentNodeVersion}.\n` +
`Amplify CLI requires Node ${minNodeVersion}. \n` +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"verifyNodeJsVersion(pkgFile) {\n var _a;\n const nodeEngine = (_a = pkgFile === null || pkgFile === void 0 ? void 0 : pkgFile.engines) === null || _a === void 0 ? void 0 : _a.node;\n if (!nodeEngine) {\n return;\n }\n if (!semver_1.default.satisfies(process.version, no... | [
"0.72260135",
"0.7181998",
"0.7152426",
"0.7117981",
"0.67127544",
"0.66168696",
"0.65758324",
"0.6369359",
"0.6290945",
"0.62352854",
"0.61989605",
"0.6150374",
"0.60251033",
"0.5922626",
"0.588317",
"0.5864025",
"0.58289194",
"0.58289194",
"0.58188975",
"0.58188975",
"0.581... | 0.74811417 | 0 |
Reads a VTK file and creates the respective JSON(s) file(s). | function vxlVTKReader(scene){
this.scene = scene; //the scene that will be updated
this.ARRAY_SIZE = 65536*3;
this.vertices = [];
this.indices = [];
this.normals = [];
this.scalars = [];
this.colors = [];
this.mode = "SOLID";
this.tags = {
NOWHERE ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDataFromVTK(data) {\r\n var loader = new THREE.VTKLoader();\r\n var geometry = loader.parse(data);\r\n\r\n\r\n var pointAtt = geometry.getAttribute(\"position\");\r\n\r\n for (var i = 0; i < pointAtt.count; i++) {\r\n NODES[i] = {\r\n position: {\r\n x: poin... | [
"0.611401",
"0.58526856",
"0.5527568",
"0.5522776",
"0.5519317",
"0.54915386",
"0.5453974",
"0.5420017",
"0.53058535",
"0.5298921",
"0.527107",
"0.51730525",
"0.51134855",
"0.5109035",
"0.51089656",
"0.5095698",
"0.5092078",
"0.508381",
"0.5057159",
"0.5044865",
"0.50014883",... | 0.60534996 | 1 |
Set the responsive height and add a watch around the change in width of the browser Could be accomplished in CSS but this increases browser compatibility. | function setResponsiveHeights() {
$scope.options.ResponsiveHeight = $scope.options.height;
$scope.$watch(function(){
return $window.innerWidth;
}, function(value) {
if (value < 480)
$scope.options.ResponsiveHeight = $scope.options.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function responsive(){\n $(\"#wrapper\").height(getHeight());\n window.addEventListener(\"resize\", e => responsive())//When window resize, this execute this function\n}",
"function handleResize() {\n // 1. update height of step elements\n // var stepHeight = Math.floor($(window).innerHeight() * ... | [
"0.7312103",
"0.6840564",
"0.68373483",
"0.6828538",
"0.6828538",
"0.6828538",
"0.6740501",
"0.670516",
"0.66840345",
"0.66750455",
"0.6663833",
"0.6661745",
"0.6661745",
"0.6661745",
"0.6661745",
"0.6630864",
"0.662049",
"0.66167355",
"0.6610946",
"0.660809",
"0.6597053",
... | 0.79178506 | 0 |
Sets the active title of the slide. | function setActiveTitle(titleName) {
$scope.activeTitle = $scope.slideShowData[$scope.activeIndex][titleName];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set title(newtitle) {\n this.setAttribute('title',newtitle);\n }",
"setTitle(title) {\n this._parent.setTitle(title);\n }",
"set title(newTitle) {this._title = newTitle;}",
"setTitle(newTitle) {\r\n\t\tdocument.title = newTitle;\r\n\t}",
"setTitle(newTitle) {\n this._doc.title = ... | [
"0.6977561",
"0.6933867",
"0.6850182",
"0.68167794",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6755096",
"0.6729171",
"0.67173105",
"0.67026925",
"0.6684483",
"0.66710913",
"0.6647737",
"0.66287166"... | 0.794161 | 0 |
Handles the click of the header. When at or below the `lte600` breakpoint, the click toggles the filters `open` class to hide show the filters menu. | handleResponsiveHeaderClick() {
if(document.documentElement.classList.contains('lte-600')) {
this.filters.current.classList.toggle('open');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleResponsiveFilterNavClick() {\n if(document.documentElement.classList.contains('lte-600')) {\n this.filters.current.classList.toggle('open');\n }\n }",
"function filterToggle() {\n if (window.innerWidth < 600 || document.body.clientWidth < 600) {\n // S... | [
"0.7688643",
"0.6936883",
"0.6832214",
"0.66424114",
"0.6363972",
"0.61887",
"0.61420363",
"0.61193323",
"0.6090117",
"0.603532",
"0.59909004",
"0.59615165",
"0.59575695",
"0.5909169",
"0.5907664",
"0.5873985",
"0.5820895",
"0.57705253",
"0.5745605",
"0.57362425",
"0.5735768"... | 0.8494966 | 0 |
When at or below the `lte600` and the nav is open, any click on it, including the filter options will close the menu again. Whilst this is "kinda ok" user experience, in a proper user facing app more attention would be paid to the responsive menu including swiping events etc. | handleResponsiveFilterNavClick() {
if(document.documentElement.classList.contains('lte-600')) {
this.filters.current.classList.toggle('open');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleResponsiveScrollerClick() {\n if(document.documentElement.classList.contains('lte-600')) {\n this.filters.current.classList.remove('open');\n }\n }",
"handleResponsiveHeaderClick() {\n if(document.documentElement.classList.contains('lte-600')) {\n this.filter... | [
"0.7423073",
"0.7420206",
"0.71115345",
"0.69590276",
"0.6827115",
"0.6803849",
"0.6798732",
"0.67154205",
"0.6710602",
"0.6700241",
"0.66899943",
"0.66759175",
"0.6644218",
"0.65375715",
"0.6506726",
"0.649952",
"0.64980024",
"0.64645046",
"0.63969946",
"0.6392421",
"0.63600... | 0.81304663 | 0 |
When clicking anywhere in the scroller, and at the `lte600` breakpoint any open menu is closed. | handleResponsiveScrollerClick() {
if(document.documentElement.classList.contains('lte-600')) {
this.filters.current.classList.remove('open');
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function closeMenu(e) {\r\n if (window.innerWidth < 800) {\r\n const ect = e.currentTarget;\r\n e.preventDefault();\r\n nav.classList.remove('menu-opened');\r\n document.body.classList.remove('no-scroll');\r\n document.body.style.marginRight = `0`;\r\n setTimeout(() => {\r\n const id = ... | [
"0.71055967",
"0.70741194",
"0.66476923",
"0.6596972",
"0.6584164",
"0.6526425",
"0.6522415",
"0.6513852",
"0.6422034",
"0.6384416",
"0.6362066",
"0.63414985",
"0.6329677",
"0.631585",
"0.6308382",
"0.6301389",
"0.6297787",
"0.62891",
"0.6226684",
"0.62243634",
"0.62196404",
... | 0.7220457 | 0 |
Handles the click of the "Perform Checks..." primary action. | handleButtonPerformChecks() {
this.openPerformChecksModalEditor();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onClick()\n\t{\n\t\tupdateLabel();\n\t\t\n\t\t\n\t\tif (settings.onChange!=undefined)\n\t\t{\n\t\t\tif (mCheckbox.is(\":checked\"))\n\t\t\t{\n\t\t\t\tsettings.onChange(settings.isclicked);\n\t\t\t}else\n\t\t\t{\n\t\t\t\tsettings.onChange(settings.notclicked);\n\t\t\t}\n\t\t}\t\t\n\t}",
"performClickFunc... | [
"0.63757235",
"0.61929363",
"0.616644",
"0.60579115",
"0.59010243",
"0.58934146",
"0.5839734",
"0.5809359",
"0.57545996",
"0.5730019",
"0.5720898",
"0.56474966",
"0.5637406",
"0.5637394",
"0.56370556",
"0.5625775",
"0.55968505",
"0.55942696",
"0.55722564",
"0.5559774",
"0.555... | 0.7505259 | 0 |
Closes the create item modal by setting state. | closeCreateItemModalEditor() {
this.setState({
createModalIsOpen: false
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"close(){\n this.setState({\n show_modal: false,\n editid: null,\n name: \"\",\n description: \"\"\n });\n document.getElementById(\"create-item-form\").reset(); \n }",
"handleCloseCreate() {\n this.setState({ showCreate: false });\n }... | [
"0.73291457",
"0.6750246",
"0.65755874",
"0.655982",
"0.64428383",
"0.6299327",
"0.626396",
"0.6244218",
"0.6223849",
"0.6190918",
"0.61776984",
"0.6168551",
"0.6166996",
"0.61534566",
"0.61534566",
"0.6144328",
"0.6132234",
"0.61154157",
"0.6111729",
"0.610519",
"0.6096414",... | 0.7592602 | 0 |
Closes the edit item modal by setting state. | closeEditItemModalEditor() {
this.setState({
editModalIsOpen: false
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"close(){\n this.setState({\n show_modal: false,\n editid: null,\n name: \"\",\n description: \"\"\n });\n document.getElementById(\"create-item-form\").reset(); \n }",
"closeEditEstModal() {\n this.setState({\n showEditEst: false,... | [
"0.72068506",
"0.7048736",
"0.6961232",
"0.6911589",
"0.6711707",
"0.6650571",
"0.6631202",
"0.6574831",
"0.6565778",
"0.65050644",
"0.64310724",
"0.6423907",
"0.6405724",
"0.64003044",
"0.63651896",
"0.6365085",
"0.62963307",
"0.6283112",
"0.6281158",
"0.6281158",
"0.6279405... | 0.76962024 | 0 |
Closes the perform checks modal by setting state. | closePerformChecksModalEditor() {
this.setState({
performChecksModalIsOpen: false
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function closeModalWrapper(){\r\n modal.style.display = \"none\";\r\n uncheckAll();\r\n removeForm();\r\n removeUSERChoice();\r\n}",
"handleButtonPerformChecks() {\n this.openPerformChecksModalEditor();\n }",
"modalCancel() {\n if (this.closable) {\n this.checkAndCancel(... | [
"0.6574889",
"0.6381073",
"0.63748956",
"0.6333728",
"0.6328714",
"0.63116276",
"0.6269181",
"0.6269181",
"0.62638116",
"0.6261385",
"0.6230945",
"0.62308055",
"0.6224657",
"0.6174356",
"0.6149687",
"0.6144217",
"0.61216867",
"0.6108055",
"0.6085258",
"0.6085258",
"0.6050193"... | 0.7783647 | 0 |
UTILITIES split raw data into header and body. | function split(rawData) {
var entry = {headObj: null, bodyData: rawData};
var headStart = rawData.indexOf('---');
if (headStart >= 0) {
var headEnd = rawData.indexOf('---\n', headStart + 3);
if (headEnd >= 0) {
headStr = rawData.substring(headStart, headEnd);
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function parseHeader(buffer) {\n var data = {};\n var offset = 0;\n ustarStructure.forEach(function (value) {\n var arr = buffer.subarray(offset, offset + value.length);\n data[value.field] = arr;\n offset += value.length;\n });\n return data;\n}",
"function parseMultipartData... | [
"0.61075765",
"0.6004895",
"0.5954333",
"0.59368205",
"0.5873231",
"0.57909083",
"0.57884955",
"0.5774212",
"0.5654331",
"0.5608106",
"0.5598212",
"0.5575073",
"0.5560179",
"0.5532687",
"0.5529288",
"0.5527643",
"0.5513411",
"0.5489895",
"0.54015267",
"0.53967845",
"0.535278"... | 0.6230654 | 0 |
Coffees are $3.50 each, but if you order more than 10, you get a 15% discount. Write a program that asks for the quantity and correctly calculates the total after discount. | function getTotalAfterDiscount(coffeePrice, quantity){
let total = coffeePrice * quantity;
if(quantity > 10){
total = total * 0.85;
}
return total.toFixed(2);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculatePrice(a) {\n a.preventDefault();\n let customerName = document.getElementById(\"customer\").value;\n let itemName = document.getElementById(\"productname\").value;\n let itemPrice = document.getElementById(\"productprice\").value;\n let itemCount = document.getElementById(\"quantit... | [
"0.72629714",
"0.7235815",
"0.7090009",
"0.7070679",
"0.6894791",
"0.6877395",
"0.68749535",
"0.685511",
"0.67949283",
"0.6781346",
"0.67700946",
"0.675881",
"0.6756025",
"0.67484415",
"0.6741346",
"0.6738285",
"0.6703263",
"0.6690232",
"0.6660346",
"0.66396344",
"0.66396344"... | 0.8037882 | 0 |
add new number phone to exisiting one | function addPhone() {
var addNumberPhone = prompt("Type a number phone: ");
//check if string or number
addNumberPhone1 = Number(addNumberPhone);
if (addNumberPhone !== null) {
if (addNumberPhone !== "") {
if (Number.isInteger(addNumberPhone1) !== false) {
var newCon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addPhone() {\n var addNumberPhone = prompt(\"Type a number phone: \", \"034 232 323\");\n //check if string or number\n addNumberPhone = Number(addNumberPhone);\n var addNewNumber = addNumberPhone.toString();\n if (Number.isInteger(addNumberPhone) === false) {\n alert(\"It's not a nu... | [
"0.6804049",
"0.6757744",
"0.6657682",
"0.64501774",
"0.64204705",
"0.6368989",
"0.6319249",
"0.6295913",
"0.62441885",
"0.6241207",
"0.62401885",
"0.61818117",
"0.61332405",
"0.6044652",
"0.6044389",
"0.60283977",
"0.60219246",
"0.60034716",
"0.60034716",
"0.59773934",
"0.58... | 0.6933659 | 0 |
assign_ipv6_address_on_creation computed: true, optional: false, required: false | get assignIpv6AddressOnCreation() {
return this.getBooleanAttribute('assign_ipv6_address_on_creation');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setIPV6Addr() {\n this.vscpHead &= 0x8FFF;\n this.vscpHead |= 0x1000;\n }",
"function cfnLaunchTemplateIpv6AddPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnLaunchTemplate_Ipv6AddPropertyValidator(properties).assertSuccess();\n ... | [
"0.685599",
"0.6526922",
"0.64760816",
"0.6309313",
"0.61508554",
"0.59833556",
"0.5956332",
"0.593065",
"0.59211826",
"0.59048486",
"0.59048486",
"0.578413",
"0.5782527",
"0.5779134",
"0.5728257",
"0.5714952",
"0.5582823",
"0.55820894",
"0.55762523",
"0.55096257",
"0.5486830... | 0.8279956 | 0 |
availability_zone_id computed: true, optional: false, required: false | get availabilityZoneId() {
return this.getStringAttribute('availability_zone_id');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get availabilityZone() {\n return this.getStringAttribute('availability_zone');\n }",
"get availabilityZone() {\n return this.getStringAttribute('availability_zone');\n }",
"get availabilityZone() {\n return this.getStringAttribute('availability_zone');\n }",
"get availabilityZo... | [
"0.66572386",
"0.66572386",
"0.66572386",
"0.6573185",
"0.6573185",
"0.6573185",
"0.58197355",
"0.572533",
"0.5599598",
"0.5599598",
"0.5533781",
"0.5495026",
"0.54342276",
"0.528294",
"0.5175221",
"0.50854427",
"0.50854427",
"0.50854427",
"0.50854427",
"0.50854427",
"0.50854... | 0.76314145 | 0 |
ipv6_cidr_block_association_id computed: true, optional: false, required: false | get ipv6CidrBlockAssociationId() {
return this.getStringAttribute('ipv6_cidr_block_association_id');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get ipv6AssociationId() {\n return this.getStringAttribute('ipv6_association_id');\n }",
"get ipv6CidrBlock() {\n return this.getStringAttribute('ipv6_cidr_block');\n }",
"get ipv6CidrBlock() {\n return this.getStringAttribute('ipv6_cidr_block');\n }",
"get ipv6CidrBlockInput() ... | [
"0.7119874",
"0.6708573",
"0.6708573",
"0.66999274",
"0.60637933",
"0.5496926",
"0.54576457",
"0.54012966",
"0.54012966",
"0.53720844",
"0.53296775",
"0.5308047",
"0.5280399",
"0.5280399",
"0.5280399",
"0.5277452",
"0.5277452",
"0.5277452",
"0.52291363",
"0.5207191",
"0.51667... | 0.8147583 | 0 |
Anitmated filling vitamin with color. | function fillVitamin ({ctx, x, line, vertices, newBg, callback = () => {}, oldBg = 255}) {
const deltaBg = Math.abs(oldBg - newBg)
if (deltaBg < 3) return callback()
setup(ctx, x, line)
ctx.beginPath()
ctx.moveTo(vertices[0].x, vertices[0].y)
vertices.forEach((point, i) => {
ctx.lineT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fill(x, y, ctx){\n var i = ((y * (imgData.width * 4)) + (x * 4));\n imgData.data[i] = fillingColor[0];\n imgData.data[i+1] = fillingColor[1];\n imgData.data[i+2] = fillingColor[2];\n imgData.data[i+3] = 255;\n ctx.putImageData(imgData, 0, 0);\n \n var iN... | [
"0.6474295",
"0.63431835",
"0.6337967",
"0.628357",
"0.624995",
"0.6238178",
"0.62361777",
"0.6220479",
"0.61319864",
"0.61220074",
"0.60549307",
"0.60520965",
"0.6025559",
"0.60064256",
"0.59950703",
"0.59684736",
"0.5966721",
"0.59594524",
"0.59592927",
"0.59590334",
"0.595... | 0.6835129 | 0 |
Constructs a comma separated list of image IDs, from the currently visible images within the preview area. Also updates the hidden input with the list. Useful for when the user removes or rearranges images. | function olsen_light_featgal_UpdateIDs( preview_element ) {
var ids = [];
$( preview_element ).children( '.thumb' ).children( 'img' ).each( function() {
ids.push( $( this ).data( 'img-id' ) );
} );
preview_element.siblings( '.ci-upload-to-gallery-ids' ).val( ids.join( ',' ) );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayImages(){\n assignIndices();\n // console.log('the display function worked');\n one.src = allImages[currentIndices[0]].location;\n one.alt = allImages[currentIndices[0]].name;\n allImages[currentIndices[0]].displayed += 1;\n\n two.src = allImages[currentIndices[1]].location;\n two.alt = allI... | [
"0.59990215",
"0.59348327",
"0.58622885",
"0.58280784",
"0.58203775",
"0.5810906",
"0.5785927",
"0.57740945",
"0.575776",
"0.5719871",
"0.5689507",
"0.5620583",
"0.5614938",
"0.56097466",
"0.5601513",
"0.55712277",
"0.5569398",
"0.5563391",
"0.554582",
"0.5537072",
"0.5511953... | 0.64169943 | 0 |
Retrieves a JSON list of IDs and URLs via AJAX, and updates the preview area of the passed gallery container element. | function olsen_light_featgal_AJAXUpdate( gallery_container ) {
var target_ids = gallery_container.children( '.ci-upload-to-gallery-ids' );
var target_preview = gallery_container.children( '.ci-upload-to-gallery-preview' );
$.ajax( {
type: 'post',
url: olsen_light_PostMeta.ajaxurl,
data: {
action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getPictures(id) {\n const element = document.querySelector('#product_' + id);\n event.preventDefault();\n let req = new XMLHttpRequest();\n const gallery = document.querySelector('.product-form-main__left__gallery');\n const galleryPreview = document.querySelector(\n '.product-form-main__left-img ... | [
"0.6817659",
"0.67798114",
"0.67025083",
"0.6398374",
"0.6375936",
"0.6352726",
"0.62126493",
"0.6171819",
"0.61679196",
"0.61512685",
"0.6135878",
"0.61244315",
"0.6101614",
"0.60958534",
"0.6079704",
"0.60604215",
"0.60485065",
"0.60075015",
"0.5930548",
"0.5925257",
"0.590... | 0.77191806 | 0 |
Show only active todos | function showActiveTodoItems() {
// reset
showAllTodoItems();
// hide completed todos
[...document.querySelectorAll(".completed")].forEach(
(todoItem) => (todoItem.style.display = "none")
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"visibleTodos () {\n switch (this.state.visibilityFilter) {\n case \"ALL_TODOS\":\n return this.state.todos;\n break;\n case \"ACTIVE_TODOS\":\n return this.state.todos.filter(todo => !todo.completed);\n break;\n cas... | [
"0.7608857",
"0.73786116",
"0.7262258",
"0.7209862",
"0.70955884",
"0.6813609",
"0.66980416",
"0.6662069",
"0.66060054",
"0.6594977",
"0.65941465",
"0.65539044",
"0.6536522",
"0.6535851",
"0.6531095",
"0.65301275",
"0.6515926",
"0.6512243",
"0.64796615",
"0.64796615",
"0.6475... | 0.7714619 | 0 |
Show only completed todos | function showCompletedTodoItems() {
// reset
showAllTodoItems();
// hide active todos
[...document.querySelectorAll(".active")].forEach(
(todoItem) => (todoItem.style.display = "none")
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function todosCompleted(){\n return vm.todos.filter(x => x.done === true);\n }",
"function showActiveTodoItems() {\n // reset\n showAllTodoItems();\n\n // hide completed todos\n [...document.querySelectorAll(\".completed\")].forEach(\n (todoItem) => (todoItem.style.display = \"none\")\n );\n}",
"ge... | [
"0.77672267",
"0.7481583",
"0.74595165",
"0.7314712",
"0.7312608",
"0.72577274",
"0.71917474",
"0.712398",
"0.70650053",
"0.7052743",
"0.70407456",
"0.7021612",
"0.69994396",
"0.6961369",
"0.68673915",
"0.68367064",
"0.68141145",
"0.67656523",
"0.6684684",
"0.66801643",
"0.66... | 0.78465205 | 0 |
Sets hasVotedFor property to entry in the state object. | function vote(state, entry) {
const currentVotePair = state.getIn(['vote', 'pair']);
if (currentVotePair && currentVotePair.includes(entry)) {
return state.set('hasVotedFor', entry);
}
return state;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetVote(state) {\n const hasVotedFor = state.get('hasVotedFor');\n const currentVotePair = state.getIn(['vote', 'pair'], List());\n\n if (hasVotedFor && !currentVotePair.includes(hasVotedFor)) {\n return state.remove('hasVotedFor');\n }\n return state;\n}",
"function resetVote(st... | [
"0.5929761",
"0.5763236",
"0.5666795",
"0.56165344",
"0.55939686",
"0.54904425",
"0.54822475",
"0.5447255",
"0.53672683",
"0.5220374",
"0.49665636",
"0.49455258",
"0.4944763",
"0.49318004",
"0.49192026",
"0.49036708",
"0.48591962",
"0.47958565",
"0.47856605",
"0.4780587",
"0.... | 0.6012133 | 0 |
Unsets hasVotedFor property in the state object. | function resetVote(state) {
const hasVotedFor = state.get('hasVotedFor');
const currentVotePair = state.getIn(['vote', 'pair'], List());
if (hasVotedFor && !currentVotePair.includes(hasVotedFor)) {
return state.remove('hasVotedFor');
}
return state;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetVote(state) {\n const hasVoted = state.get('hasVoted');\n const currentPair = state.getIn(['vote', 'pair'], List());\n if (hasVoted && !currentPair.includes(hasVoted)) {\n return state.remove('hasVoted');\n } else {\n return state;\n }\n}",
"downVote() {\n this.castVote_(false);\n }"... | [
"0.74205625",
"0.5763803",
"0.5657095",
"0.55046827",
"0.5404749",
"0.53971165",
"0.53278726",
"0.5258139",
"0.52140695",
"0.5164789",
"0.51385266",
"0.50840807",
"0.5072932",
"0.5044776",
"0.4983215",
"0.4957176",
"0.49480802",
"0.4910402",
"0.48929617",
"0.48697945",
"0.486... | 0.7612984 | 0 |
Only called once in the initial app loading If the user isn't null, then we call componentDidUpdate() to fetch our data Maybe refactor data fetching logic out of componentDidUpdate into a function | componentDidMount() {
if (this.props.user.userId != null) {
this.componentDidUpdate(null, this.state);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"componentDidUpdate(prevProps) {\n if (!prevProps.user.id && this.props.user.id) {\n this.props.fetchUsers()\n }\n }",
"componentDidUpdate(prevProps) {\n if (this.props.userId && prevProps.userId !== this.props.userId) {\n this.languageInfoLoad();\n } else {\n //console.log(\"SHOULD LO... | [
"0.75835073",
"0.7189345",
"0.71627057",
"0.7158639",
"0.7111697",
"0.7110117",
"0.7079365",
"0.70370865",
"0.6952428",
"0.69070727",
"0.68988067",
"0.6894526",
"0.68884164",
"0.6887881",
"0.6882205",
"0.6871006",
"0.6860106",
"0.683958",
"0.6826175",
"0.6814608",
"0.67641795... | 0.73169625 | 1 |
Developed By: Azeem Hassan Date: 7319 action: only number and dots allow | function onlyNumbersWithDot(e) {
var charCode;
if (e.keyCode > 0) {
charCode = e.which || e.keyCode;
}
else if (typeof (e.charCode) != "undefined") {
charCode = e.which || e.keyCode;
}
var ctrlDown = e.ctrlKey || e.metaKey // Mac support
/***** Copy past ctrl+C c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function CPOnlyAlphaNumeric(t) { \nt.value = t.value.toString().replace(/[^0-9,\\.-]*$/g,'');\n}",
"function isNumbericAndSymbol(field){\r\n\t\tvar re = /^[0-9-'.'-',']*$/;\r\n\t\tif (!re.test(field.value))\r\n\t\t{\r\n\t\t field.value = field.value.replace(/[^0-9-'.'-',']/g,\"\");\r\n\t\t}\r\n}",
"validateMo... | [
"0.702865",
"0.6848506",
"0.6826304",
"0.68017155",
"0.67636776",
"0.67636776",
"0.67434275",
"0.6713149",
"0.6672188",
"0.66669947",
"0.65774876",
"0.65373904",
"0.6460617",
"0.64212173",
"0.63975036",
"0.6351598",
"0.63295835",
"0.63289917",
"0.6326717",
"0.6306851",
"0.627... | 0.720991 | 0 |
Developed By: Azeem Hassan Date: 7319 action: aler for confirmation yes or no .give heading description and return callback | function confirmationBox(area,heading,description,callback) {
var html = '<div style="z-index: 9999;width: 30%;left: 0;position: absolute;right: 0;margin: 0 auto;top: 10%;" role="alert" class="alert alert-success confirmationBox">' +
'<h4 class="alert-heading">' + heading + '</h4>' +
'<p>' + descrip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function xConfirm(msg, callback, header) {\n\n var buttons = {};\n buttons[lbl_no] = function() {\n $(this).dialog('destroy').remove();\n }\n buttons[lbl_yes] = function() {\n if (undefined !== callback && callback != '') {\n eval(callback);\n }\n $(this).dialog('destroy').remove();\n }\n\n ... | [
"0.6992558",
"0.6742001",
"0.6742001",
"0.6666357",
"0.6662729",
"0.66536474",
"0.66409034",
"0.6628689",
"0.6604815",
"0.6600098",
"0.6558586",
"0.6542016",
"0.6534976",
"0.6509489",
"0.6498622",
"0.6491522",
"0.6475234",
"0.64529705",
"0.6444417",
"0.6420883",
"0.64180064",... | 0.7190417 | 0 |
Used to decorate model class to equip same functionalities as extending class `Translatable`. | function translatable() {
return function (TargetClass) {
copyStatic(Translatable, TargetClass, ['getTranslator', '$createTranslator', 'getValidator', '$createValidator', 'from', 'fromMany']);
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Transformer() {\n this.standardizer = new Standardizer();\n this.canonical = new Canonical();\n\n return this;\n}",
"function Attribute$decorate() {\n this.set(this.render());\n}",
"function SimplePlugin(){\n return Model({\n publicProperties: [\"message\"]\n });\n}",
"function AddTransfo... | [
"0.5667609",
"0.5238001",
"0.49615854",
"0.4949925",
"0.49402604",
"0.49211082",
"0.49211082",
"0.49211082",
"0.49211082",
"0.48906928",
"0.48819515",
"0.48747748",
"0.4871834",
"0.4861769",
"0.478494",
"0.47511065",
"0.4746162",
"0.474401",
"0.47082686",
"0.4694735",
"0.4681... | 0.6757306 | 0 |
TODO: Does it make sense to have classes on "/" or make "/" redirect to signin or classes? TODO: Update routes for creating / viewing a class | render() {
return (
<div>
<Route exact path="/" component={ClassOverview} />
<Route path="/sign-in" component={SignIn} />
<Route path="/sign-up" component={SignUp} />
<Route path="/class/:classId" component={ClassPage} />
<Route path="/classes" component={ClassOverview}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function postClass(req, res){\n console.log(\"Adding a new class\");\n \n // parsed by 'app.use(urlextended)' to get variables from url\n var classname = req.body.classname;\n console.log(\"Creating new class with name: \" + classname);\n \n //create variable to store r... | [
"0.6185925",
"0.6081213",
"0.5685727",
"0.5636731",
"0.5591553",
"0.55744386",
"0.5556695",
"0.55455035",
"0.54903877",
"0.54883766",
"0.5440844",
"0.5438169",
"0.53842837",
"0.5313455",
"0.5270754",
"0.52413076",
"0.5207752",
"0.52034235",
"0.5188021",
"0.51814497",
"0.51262... | 0.6709606 | 0 |
get a article by id | function getById(id) {
return new Promise(async(resolve, reject) => {
try {
const article = await Article.findById(id).populate('author', { username: 1, name: 1, _id: 0 });
resolve(article)
} catch (error) {
reject('id is not true')
}
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getArticle(articleId){\n if(this.articles.hasOwnProperty(articleId)){\n return this.articles[articleId];\n }\n\n return null;\n }",
"function getArticle() {\n // First we fetch the URL params so we can get the article ID \n // from the URL.\n var params = new URLSearchParams(window.locati... | [
"0.7792445",
"0.7118272",
"0.69938385",
"0.69259304",
"0.6852902",
"0.67839366",
"0.6769061",
"0.6661581",
"0.66601163",
"0.66466033",
"0.66449344",
"0.6641862",
"0.6636947",
"0.6592762",
"0.6590088",
"0.6571822",
"0.6564185",
"0.6541514",
"0.65006864",
"0.6478826",
"0.646730... | 0.72693956 | 1 |
Output action message to DOM | function outputActionMessage(message) {
const div = document.createElement('div');
div.classList.add('message');
const p = document.createElement('p');
p.classList.add('meta');
p.innerText = message.username;
if(message.username == username){
p.style.color = "blue";
}
//p.innerHT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function logaction() {\n var outputText = \"\\n\";\n for (var i in listOfActions)\n outputText = outputText + listOfActions[i] + \"\\n\";\n var session = document.getElementById('sessionElements');\n session.innerText = outputText;\n }",
"function message(msg){\r\n ... | [
"0.66160756",
"0.6224934",
"0.61718035",
"0.6170269",
"0.61239856",
"0.6104975",
"0.60327953",
"0.5965468",
"0.59594905",
"0.59529066",
"0.59446275",
"0.59028786",
"0.58796483",
"0.5858384",
"0.58243644",
"0.5823065",
"0.58142227",
"0.5813776",
"0.57852805",
"0.5781765",
"0.5... | 0.7147019 | 0 |
checks if letter to guess input is not a number and length is 1 valid | function checkLetterInputValid(str) {
if ( (isNaN(Number(str))) && (str.length === 1) ){
return true;
} else {
return false;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function verifyinput(digits) {\n\n var nospacescode = guessedcode.trim(); //removing spaces from the begining and the end of the secret code\n guessedcode = nospacescode;\n var isnumber = true;\n\n for (i = 0; i < nospacescode.length && isnumber; i++) {\n var c = nospacescode... | [
"0.7115586",
"0.6908706",
"0.6803981",
"0.6717265",
"0.6717083",
"0.67096597",
"0.6690304",
"0.66827166",
"0.66577816",
"0.66315144",
"0.6618136",
"0.6597673",
"0.6593408",
"0.65894705",
"0.65886766",
"0.65869737",
"0.6578103",
"0.65724343",
"0.65515846",
"0.6497681",
"0.6492... | 0.74606615 | 0 |
function to chk if num is present already in the array | function check(array, num) {
for (i = 0; i < array.length; i++)
if (array[i] == num){
return false;
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isContain(num, array) {\r\n for (var i = 0; i < array.length; i++) {\r\n if (array[i] == num) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}",
"function numberInArray(arr, x) {\n if (arr.length == 0)\n arr.push(Math.floor(Math.random() * 4 + 1));\n\n for (i = 0; i < arr... | [
"0.7486949",
"0.7258589",
"0.7226655",
"0.7184233",
"0.69754326",
"0.696782",
"0.69438946",
"0.6925052",
"0.6888274",
"0.67452514",
"0.6738009",
"0.6736442",
"0.6688593",
"0.6622384",
"0.6613415",
"0.660512",
"0.6597448",
"0.6570769",
"0.6535711",
"0.6523888",
"0.64508754",
... | 0.7507433 | 0 |
Throw error in case the decorator used incorrectly. | function throwUsageError() {
throw new Error(exports.uniqueId + " must be applied to the class or method");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function api$1() {\n if (undefined !== 'production') {\n assert.fail(`@api decorator can only be used as a decorator function.`);\n }\n\n throw new Error();\n}",
"function guardExtend(name, validator) {\n if (isCallable(validator)) {\n return;\n }\n if (isCallable(validator.validate... | [
"0.60741687",
"0.5724982",
"0.5697686",
"0.56855756",
"0.56341404",
"0.5630642",
"0.5630642",
"0.5622093",
"0.5611971",
"0.5611971",
"0.5611971",
"0.5611971",
"0.5611971",
"0.55725133",
"0.55694216",
"0.5551429",
"0.5528362",
"0.5522159",
"0.5512116",
"0.5512116",
"0.5512116"... | 0.6019685 | 1 |
input = dataNode (person) output = various data needed for graph (array of treatments) | function getTreatment(dataNode){
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function processGraph(data) {\n\n var dataset = {};\n dataset['@default'] = [];\n\n var subjects = data.subjects;\n for (var subject in subjects) {\n var predicates = subjects[subject].predicates;\n\n for (var predicate in predicates) {\n // iterate over objects\n var objects = predicates[predi... | [
"0.58632606",
"0.5798439",
"0.5793184",
"0.57507026",
"0.5665967",
"0.5627908",
"0.55491",
"0.5531208",
"0.5504934",
"0.550435",
"0.5495019",
"0.54598975",
"0.5386622",
"0.5374148",
"0.5374104",
"0.53558725",
"0.5348243",
"0.53386104",
"0.53257143",
"0.53233546",
"0.53166944"... | 0.6416909 | 0 |
Convert months since epoch into a moment.js date object | function sliderDate(m) {
return moment({
year: 1970 + m / 12,
month: m % 12
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toDate() {\n return function(date) {\n return moment(new Date(date*1000)).format('ll');\n }\n }",
"function parseDate(date){\n return moment([1970, 0, 1]).add(date, 'days').toDate();\n}",
"M(date) {\n return date.month()\n }",
"function dateConverter(d) {\n let dateString = (d.YY... | [
"0.58613604",
"0.5834789",
"0.57181466",
"0.57102287",
"0.5673181",
"0.560634",
"0.54488724",
"0.5440322",
"0.5404146",
"0.5307516",
"0.53052306",
"0.5304057",
"0.5291",
"0.5272728",
"0.5169019",
"0.5162001",
"0.5140357",
"0.50834525",
"0.50714105",
"0.5050758",
"0.5028893",
... | 0.63614196 | 0 |
pieChart Purpose: Builds svg cluster DivIcons inputs: clusters passed from Leaflet.markercluster output: L.DivIcon donut chart where the number of points in a cluster are represented by a proportional donut chart arc of the same color as the underlying marker | function pieChart(cluster) {
var children = cluster.getAllChildMarkers();
// Count the number of points of each kind in the cluster using underscore.js
var data = _.chain(children)
.countBy(function(i) {
return i.options.icon.options.pieColor
})
.map(function(count, pieColor) {
return {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function bakeThePie(options) {\n /*data and valueFunc are required*/\n if (!options.data || !options.valueFunc) {\n return '';\n }\n var data = options.data,\n valueFunc = options.valueFunc,\n r = options.outerRadius ? options.outerRadius : 28, //Default outer radius = 28px\n ... | [
"0.677588",
"0.65804416",
"0.65730745",
"0.6282544",
"0.62564766",
"0.6202912",
"0.6199739",
"0.61803883",
"0.61270666",
"0.6058291",
"0.6036346",
"0.60124934",
"0.59953976",
"0.5991753",
"0.5958604",
"0.5958388",
"0.59377384",
"0.5908355",
"0.5904053",
"0.5885089",
"0.587796... | 0.75532293 | 0 |
URLs use incident types in plural form, checkboxes use singular. Convert between for convenience | function convertPluralToSingular(pluralIncidentType) {
if (pluralIncidentType === "nearmisses") return "nearmiss";
else return pluralIncidentType.slice(0, -1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSearchTypeURLsuffix() {\n if ($(\"#rdo_elements\").prop(\"checked\")) {\n return \"/elements\"\n }\n if ($(\"#rdo_sif\").prop(\"checked\")) {\n return \"/sif\"\n }\n if ($(\"#rdo_collections\").prop(\"checked\")) {\n return \"/collecti... | [
"0.58302736",
"0.5420813",
"0.5299802",
"0.50217295",
"0.50180954",
"0.4980821",
"0.49648252",
"0.48387727",
"0.47516865",
"0.47187954",
"0.47127718",
"0.46924958",
"0.46458134",
"0.46209407",
"0.46176228",
"0.46124136",
"0.45959163",
"0.4576791",
"0.4569085",
"0.45601583",
"... | 0.54685146 | 1 |
Function to load new data if current loaded data bounds are empty or current bounds exceed them | function loadDataIfBoundsExceed(currentMapBounds) {
if (!boundsOfLoadedData.isValid() || !boundsOfLoadedData.contains(currentMapBounds)) {
loadAllIncidentData(currentMapBounds);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkSelectionsAfterNewData() {\n\t\t// $log.log(preDebugMsg + \"checkSelectionsAfterNewData\");\n\t\tvar newSelections = [];\n\n\t\tfor(var sel = 0; sel < selections.length; sel++) {\n\t\t\tvar newSel = selections[sel];\n\t\t\tvar val1 = newSel[0];\n\t\t\tvar val2 = newSel[1];\n\n\t\t\tif(val1 <= limits.... | [
"0.59931195",
"0.5926636",
"0.567686",
"0.5643168",
"0.564065",
"0.5568311",
"0.5527673",
"0.5521793",
"0.5514213",
"0.5511863",
"0.5495541",
"0.5493133",
"0.5462998",
"0.5424399",
"0.5424399",
"0.5406074",
"0.5406074",
"0.5343836",
"0.5343836",
"0.5274746",
"0.52657074",
"... | 0.77071226 | 0 |
Function used to display number of markers loaded to map helpful for debugging or watching data load. Uncomment calls to updateCounter in indexhelpers.js as well as pointCounterContainer in overlays.html to enable. | function updateCounter() {
let loaded = incidentReferenceLayers.get('collisions').length +
incidentReferenceLayers.get('nearmisses').length +
incidentReferenceLayers.get('hazards').length +
incidentReferenceLayers.get('thefts').length +
incidentReferenceLayers.get('newInfrastructures').length;
let a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateStats() {\n // Start with count of location list rows ...\n let countShown = gLocationsListEntries.length;\n\n if (!gMap) {\n return;\n }\n\n const mapBounds = gMap.getBounds();\n if (!mapBounds) {\n return;\n }\n\n // ... but defer to count of markers in map bounds, when applicable.\n... | [
"0.71645045",
"0.69976604",
"0.69542915",
"0.6657962",
"0.66041714",
"0.63323015",
"0.62986165",
"0.62073934",
"0.6135275",
"0.60307086",
"0.60243326",
"0.6011675",
"0.5988617",
"0.5973172",
"0.59579444",
"0.5951493",
"0.5935218",
"0.59337276",
"0.58640116",
"0.581302",
"0.58... | 0.79820126 | 0 |
removes medium level cards from play | function removeMedCards() {
let medCards = document.getElementsByClassName("medium-level");
while (medCards.length > 0) {
medCards[0].parentNode.removeChild(medCards[0]);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeHardCards() {\n let hardCards = document.getElementsByClassName(\"hard-level\");\n while (hardCards.length > 0) {\n hardCards[0].parentNode.removeChild(hardCards[0]);\n }\n}",
"function removeOpenCards() {\n openCards = [];\n}",
"function resetCards(){\n $('#cards li'... | [
"0.7493277",
"0.7355338",
"0.7270018",
"0.72589636",
"0.7035791",
"0.69104826",
"0.6907198",
"0.68354",
"0.6800875",
"0.67960083",
"0.67951095",
"0.67840284",
"0.67713666",
"0.67268753",
"0.67025083",
"0.6701551",
"0.6689626",
"0.66675895",
"0.66611296",
"0.6659711",
"0.66583... | 0.7818424 | 0 |
removes hard level cards from play | function removeHardCards() {
let hardCards = document.getElementsByClassName("hard-level");
while (hardCards.length > 0) {
hardCards[0].parentNode.removeChild(hardCards[0]);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeOpenCards() {\n openCards = [];\n}",
"function resetCards(){\n $('#cards li').remove();\n $('#analysis li').remove();\n }",
"function discardcard() {\n unbr.discard.unshift((unbr.hand[unbr.selected[0]]));\n unbr.hand.splice(unbr.selected[0], 1);\n $(\".card\"... | [
"0.7355894",
"0.7251042",
"0.71848726",
"0.7095457",
"0.7031008",
"0.6921226",
"0.69138986",
"0.6894811",
"0.6809054",
"0.6806988",
"0.67513573",
"0.6737641",
"0.66780496",
"0.6668611",
"0.6668389",
"0.6635325",
"0.6632598",
"0.663118",
"0.6630613",
"0.6625766",
"0.66155744",... | 0.7683197 | 0 |
return the first component with a given name | getComponent(name) {
return (this._nextDict[name] || [undefined])[0];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getComponent(name){\n\t\tfor(let component of this.components){\n\t\t\tif(component.constructor.name == name)\n\t\t\t\treturn component;\n\t\t}\n\t\t//If we didn't find it, search any children we have\n\t\tfor(let child of this.children){\n\t\t\tlet component = child.getComponent(name);\n\t\t\tif(component) return... | [
"0.7803369",
"0.745358",
"0.6981238",
"0.68531024",
"0.68521863",
"0.6564723",
"0.6471733",
"0.63325626",
"0.6201763",
"0.6182478",
"0.61580753",
"0.61496615",
"0.61051226",
"0.59888566",
"0.59707993",
"0.59451836",
"0.5913929",
"0.5898533",
"0.5855274",
"0.5833789",
"0.58236... | 0.7984051 | 0 |
getCompanyContact Fetches the company contact info. Correlates to getCompaniesContact in queries | async function getCompanyContact() {
const spot = document.getElementById("companyContact");
fetch_db("company/contact", function (res) {
let table = generate_table(res);
spot.replaceChild(table, spot.firstElementChild);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async getCompany () {\n\t\tif (this.company) {\n\t\t\treturn;\n\t\t}\n\t\tthis.company = await this.request.data.companies.getById(\n\t\t\tthis.team.get('companyId')\n\t\t);\n\t}",
"function fetchCompany(c) {\n return APICaller({\n method: \"GET\",\n url: `${BASE_URL}company/`\n });\n}",
"static async ... | [
"0.7006125",
"0.6523344",
"0.633289",
"0.63151425",
"0.6284145",
"0.61871123",
"0.61846346",
"0.6142143",
"0.6115437",
"0.6115437",
"0.6106661",
"0.61011255",
"0.60950744",
"0.603824",
"0.6032808",
"0.6029571",
"0.600796",
"0.6007746",
"0.5959707",
"0.5958383",
"0.5928052",
... | 0.71927947 | 0 |
createCompany Creates a company given the information in the insertCompany form. Correlates to insertCompany in queries | async function createCompany() {
let fields = document.forms["insertForm"].getElementsByTagName("input");
// Extract all of the fields
let values = {};
for (let i = 0; i !== fields.length; ++i) {
let key = fields[i].id;
let val = fields[i].value;
// Save the value
values[key] = val;
}
// Post the resul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createCompany() {\n var data = {};\n return db.Category.create(testData.category())\n .then(function (category) {\n data.category = category;\n return db.Company.create(testData.company(category.id))\n })\n .then(function (company) {\n data.company = company;\n return data;\... | [
"0.72730863",
"0.70620525",
"0.6847368",
"0.6636132",
"0.6448376",
"0.63501316",
"0.63439345",
"0.6333003",
"0.63247937",
"0.63192844",
"0.6292942",
"0.62414765",
"0.6224152",
"0.61786073",
"0.6120822",
"0.6100576",
"0.6065135",
"0.5977745",
"0.5965746",
"0.59090984",
"0.5852... | 0.7868654 | 0 |
searchCompany Searches for matching companies to the field search text. Correlates to searchCompany in queries | async function searchCompany() {
let field = document.getElementById("fieldSelect").value;
let search = document.getElementById("searchText").value;
if (field === "INVALID") {
// TODO: Validation
return;
}
const spot = document.getElementById("searchResults");
fetch_db("company/search/" + field + "/" + searc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function searchCompanies(formData) {\n setSearchCompanyInput(formData);\n }",
"static async filterCompanies(search) {\n let res = await this.request('companies', { search });\n return res.companies\n }",
"static async getCompanies(search) {\n\t\t/** On the backend, our `Company` model has a query th... | [
"0.76983774",
"0.6973831",
"0.6739516",
"0.6484593",
"0.64193845",
"0.6061182",
"0.60293543",
"0.5927903",
"0.5913989",
"0.591287",
"0.58961284",
"0.5831181",
"0.5772515",
"0.5762224",
"0.5761846",
"0.57306683",
"0.57203597",
"0.5677691",
"0.5583868",
"0.558021",
"0.55600154"... | 0.71682906 | 1 |
Save current font settings | function saveFontSettings() {
gitbook.storage.set('fontState', fontState);
update();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function save_settings(){\n var settings = {\n font : numeral_fonts[numeral_fonts_index].getName(),\n color_scheme : color_schemes[color_scheme_index].name,\n };\n var file = SETTING_PREFIX + \".settings.json\";\n console.log(file + \": saving:\" + JSON.stringify(settings));\n require(\"Storage\").write... | [
"0.69058037",
"0.68983245",
"0.6890277",
"0.6340084",
"0.6273459",
"0.6237489",
"0.6202441",
"0.6116625",
"0.6105809",
"0.6081882",
"0.60786206",
"0.605337",
"0.6009806",
"0.5999468",
"0.59875375",
"0.59436774",
"0.59272",
"0.5897236",
"0.58570975",
"0.58401555",
"0.5811235",... | 0.8836493 | 0 |
Return the correct id for a fontfamily config key Default to first fontfamily | function getFontFamilyId(configName) {
// Search for plugin configured font family
var configFamily = $.grep(FAMILIES, function(family) {
return family.config == configName;
})[0];
// Fallback to default font family
return (!!configFamily)? configFamily.id : 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFontId(config) {\n var hash = crypto.createHash('md5');\n\n hash.update('fontello' + builderVersion);\n hash.update(JSON.stringify(config));\n\n return hash.digest('hex');\n}",
"function fontFamily() {\n\treturn (0 | Math.random() * 9e6).toString(36) // eslint-disable-line no-bitwise\n}",
"get ... | [
"0.7337508",
"0.69554365",
"0.6540916",
"0.6385186",
"0.63825566",
"0.62930065",
"0.62893456",
"0.61335295",
"0.6125157",
"0.6045183",
"0.60409486",
"0.5992815",
"0.5967325",
"0.5944206",
"0.59110326",
"0.59103966",
"0.5891686",
"0.58616143",
"0.5849128",
"0.5763512",
"0.5661... | 0.7899151 | 0 |
Return the correct id for a theme config key Default to first theme | function getThemeId(configName) {
// Search for plugin configured theme
var configTheme = $.grep(THEMES, function(theme) {
return theme.config == configName;
})[0];
// Fallback to default theme
return (!!configTheme)? configTheme.id : 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"SET_THEME_BY_ID(state, themeId = state.themes[0].id) {\n state.theme_by_id = state.themes.find(theme => theme.id === themeId);\n //console.info(\"SET_THEME_BY_ID\", state.theme_by_id);\n }",
"function getThemeColor()\n{\n\tvar colorId, themeName;\n\t\n\tfor(var i = 0; i < themeNameList.length; i++) {\n\t\... | [
"0.6650706",
"0.6462689",
"0.61019605",
"0.6087103",
"0.6087103",
"0.6087103",
"0.6087103",
"0.6087103",
"0.6072035",
"0.60623646",
"0.5944862",
"0.5851863",
"0.5832063",
"0.56532466",
"0.5644899",
"0.5587632",
"0.5571844",
"0.5566415",
"0.5502042",
"0.5475395",
"0.5452094",
... | 0.743488 | 0 |
consummer(producer(10)) / producer(10) .then(consummer) .then(data => data 2) .then(consummer) .then(producer) .then(consummer) .catch(err => console.log(err)) | async function run(){
const res = await producer(10)
consummer(res)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function baca(){\n readBooksPromise(10000,books[0])\n .then(function(sisa){\n readBooksPromise(sisa,books[1])\n .then(function(sisa){\n readBooksPromise(sisa,books[2]).catch(function(error){})\n })\n .catch(function(error){})\n })\n .catch(function(error){})\n}",
... | [
"0.6174121",
"0.6055032",
"0.5967262",
"0.5895621",
"0.58027726",
"0.5692541",
"0.5675951",
"0.5550559",
"0.55447686",
"0.5445468",
"0.5437004",
"0.53962404",
"0.53764397",
"0.53377557",
"0.5287911",
"0.52714986",
"0.526782",
"0.52645755",
"0.52556896",
"0.5246236",
"0.524562... | 0.71117383 | 0 |
Affichage des personnages de la map en cours | function afficherPersonnages() {
var leperso;
// Boucle d'affichage : séparation pour éviter qu'un personnage en efface un autre quand ils se croisent
for (var personnage in personnages[zone_map]) {
leperso = personnages[zone_map][personnage];
if (leperso["is_alive"]) {
// ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ageCal(person)\n{\n return person.died - person.born;\n}",
"function cal_2(){\n showAccidentPoints(accidents_array, map);\n }",
"calcAge() {\n console.log(2037 - this.personBirthYear);\n }",
"function observeStats() { \n\tOutput.maxAgeAtGeneration[ generation ] =... | [
"0.59607416",
"0.5841314",
"0.565187",
"0.5596424",
"0.5594762",
"0.55784404",
"0.55559564",
"0.55469906",
"0.5519126",
"0.5511694",
"0.54941225",
"0.5466924",
"0.5426762",
"0.5425445",
"0.54209596",
"0.5408715",
"0.54064304",
"0.53815883",
"0.5372833",
"0.5364922",
"0.535283... | 0.7194033 | 0 |
Deplacer mario dans le jeu | function deplacerMario () {
detecterRelachementTouche();
detecterAppuiSurTouche();
// on ne fait rien quand il ne se passe rien !
if (!isMarioSurLeSol || isOneToucheActive()) {
keyDeplacer();
setMarioLigneColonne();
afficherMario();
}
intera... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function faireSauterMario() {\r\n if (initialiser_saut_mario) {\r\n initialiser_saut_mario = false;\r\n top_depart_chute_mario = Date.now();\r\n mario_sg_y_initiale = mario_sg_y;\r\n }\r\n var temps = (Date.now() - top_depart_chute_mario) / 1000;\r\n \r\n if (isMarioSautParaboli... | [
"0.669574",
"0.65777135",
"0.63684285",
"0.6206158",
"0.6194513",
"0.6175852",
"0.61532605",
"0.61145496",
"0.60960174",
"0.60528576",
"0.6040223",
"0.6037708",
"0.6034706",
"0.6024968",
"0.6003499",
"0.60010827",
"0.6000216",
"0.59934646",
"0.59829056",
"0.59711605",
"0.5969... | 0.750997 | 0 |
Round 1 Write a function fizzbuzzer that accepts a single parameter as an argument, a number, and will return the following: The string "Fizz" if the number is evenly divisible by 3 The string "Buzz" if the number is evenly divisible by 5 The string "FizzBuzz" if the number is evenly divisible by 3 AND 5 The string "Mc... | function fizzbuzzer(num) {
if (num % 3 === 0 && num % 5 === 0) {
return 'FizzBuzz';
}
else if (num % 5 === 0) {
return 'Buzz';
}
else if (num % 3 === 0) {
return 'Fizz';
}
else {
return 'McClane';
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fizzbuzz(n){\r\n\t// If not a multiple of either then return the number\r\n\treturn n%3 && n%5? n:\r\n\t\t// otherwise return string appending fizz for multiple of 3\r\n\t\t(n%3?'':'fizz')+\r\n\t\t// and append buzz for multiple of 5\r\n\t\t(n%5?'':'buzz');\r\n}",
"function fizzBuzz(num) {\n if (((num ... | [
"0.87431383",
"0.8715069",
"0.8646217",
"0.84616065",
"0.83688074",
"0.83492",
"0.83470416",
"0.82738644",
"0.82326967",
"0.82058126",
"0.81422126",
"0.81338984",
"0.80780417",
"0.8063921",
"0.80631727",
"0.80583686",
"0.802317",
"0.7991105",
"0.79834604",
"0.7967426",
"0.786... | 0.87653834 | 0 |
getRow(puzzle, 8); > [ 3,2,8,1,9,6,5,4,7 ] getRow(puzzle, 0); > [ 8,9,5,7,4,2,1,3,6 ] | function getRow(puzzle, row) {
return puzzle[row];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getRow(puzzle, row){\nreturn puzzle[row];\n}",
"function getRow(position){\n return Math.floor(position/8)\n}",
"function getSection(puzzle, x, y) {\n var result = [];\n // iterate 3 times\n for (var row = y * 3; row < y * 3 + 3; row++) {\n for (var column = x * 3; column < x * 3 + 3; column++)... | [
"0.84214824",
"0.71570003",
"0.68289614",
"0.66649914",
"0.6572843",
"0.6555095",
"0.65346634",
"0.64327705",
"0.64270204",
"0.64088875",
"0.63373303",
"0.6309052",
"0.62944114",
"0.62237674",
"0.620165",
"0.61956006",
"0.6144052",
"0.6137966",
"0.6103996",
"0.6080145",
"0.60... | 0.8146396 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.