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 |
|---|---|---|---|---|---|---|
Checks a block to see if it has matching colors with adjacent blocks Returns the list of indexes for matching color blocks only if there are at least "blocks_to_match" number of matching blocks. | function isBlockColorMatching(row, col) {
var block = blocks[row][col];
if(!block.properties.exists) return [];
if(isFloating(row,col)) return [];
var blocksList = [];
blocksList = blocksList.concat(getHorizontalBlockMatches(row, col),
getVerticalBlockMatches(row, co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getSameColourNeighbours(block) {\n const neighbours = this.getNeighbours(block);\n\n const sameColourNeighbours = neighbours.filter(\n neighbour => neighbour.colour === block.colour\n );\n\n sameColourNeighbours.map(neighbour => {\n const alreadyFlagged = this.blocksFlaggedForRemoval.find(\n ... | [
"0.62952495",
"0.5923497",
"0.5788922",
"0.5756823",
"0.56407243",
"0.5632884",
"0.55141425",
"0.5464717",
"0.54584956",
"0.53806555",
"0.5358773",
"0.5352486",
"0.53466094",
"0.53419834",
"0.5312134",
"0.53040236",
"0.5296284",
"0.5276311",
"0.5269644",
"0.5269356",
"0.52446... | 0.77302647 | 0 |
Swaps the properties value of two blocks. The inherent x and y coordinates of the blocks stay the same. Returns true if the blocks were successfully swapped, false otherwise | function swap(blockRow, blockCol, swapWithRow=blockRow, swapWithCol=blockCol+1){
Log("Swapping: "+blockRow+","+blockCol+" and "+swapWithRow+","+swapWithCol,priority.V);
var block = blocks[blockRow][blockCol];
var blockSwapWith = blocks[swapWithRow][swapWithCol];
if(!block.properties.exis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function swapBlocks(){\n var tmp = 0;\n tmp = startRow;\n startRow = endRow;\n endRow = tmp;\n\n tmp = startCol;\n startCol = endCol;\n endCol = tmp;\n}",
"function swap(x1, y1, x2, y2) {\n var typeswap = level.tiles[x1][y1].type;\n level.tiles[x1][y1].type = level.tiles[x2][y2].type;\n ... | [
"0.67414933",
"0.6358918",
"0.6106059",
"0.6060428",
"0.59199524",
"0.5914723",
"0.5907551",
"0.5862116",
"0.5821143",
"0.5818757",
"0.5818757",
"0.5812019",
"0.5812019",
"0.57098055",
"0.56582355",
"0.5598789",
"0.55542",
"0.5552412",
"0.5458691",
"0.54552186",
"0.540895",
... | 0.69528264 | 0 |
granularity of collabels Triggers transformingsteps to construct the model from scheduleDetails, timeSlots. Rows are created based on scheduled roleinstances. | function init(){
// create lines for shifts
_.chain(args.scheduleDetails).each(function(scheduleDetail) {
scope.lines.push(createLine({
shift : scheduleDetail,
extractId : function(scheduleDetail) {
return scheduleDetail.employeeName + '$' + scheduleDetail.startTime;
}
}));
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generatePlacementTable(vm){\n var requirements_str = vm.USER_TEMPLATE.SCHED_REQUIREMENTS ? vm.USER_TEMPLATE.SCHED_REQUIREMENTS : \"-\";\n var rank_str = vm.USER_TEMPLATE.SCHED_RANK ? vm.USER_TEMPLATE.SCHED_RANK : \"-\";\n var ds_requirements_str = vm.USER_TEMPLATE.SCHED_DS_REQUIREMENTS ? vm.USER_TEM... | [
"0.53183943",
"0.52871025",
"0.5217486",
"0.51736665",
"0.51550734",
"0.5095448",
"0.5046114",
"0.5044528",
"0.50341964",
"0.49354",
"0.491711",
"0.49015528",
"0.4892403",
"0.48910707",
"0.48433885",
"0.48359045",
"0.4832742",
"0.4830789",
"0.48024908",
"0.4785422",
"0.478044... | 0.53598595 | 0 |
Computes the cellstatus of lines by determining which shiftcells are resolving a forecastshift cell. In case, line's 'resolved' property is set to true for the corresponding columnidx. | function computeLineCellStatus(){
// all lines corresp. to shifts
var shiftLines = _.chain(scope.lines).filter(function(line) { return !line.forecast; }).value();
// iterate lines corresp. to forecast-shifts
_.chain(scope.lines).filter(function(line) { return line.forecast; })
.each(function(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function tryResolveForecast(forecast, colId){\r\n\t\t\t\t_.chain(shiftLines).filter(function(shift){ return forecast.role.name === shift.role.name; }) /* restrict on same role*/\r\n\t\t\t\t\t\t\t\t .each(function(line){\r\n\t\t\t\t\t\t\t\t\t var shiftHasSlot = _.chain(line.columns).findWhere({id: colId}).value... | [
"0.54005754",
"0.5315424",
"0.5220911",
"0.5126117",
"0.5061984",
"0.5020713",
"0.49885955",
"0.4923046",
"0.48727044",
"0.48126155",
"0.47393978",
"0.47380286",
"0.47279245",
"0.4714025",
"0.47127718",
"0.47118717",
"0.4670753",
"0.46611872",
"0.46594942",
"0.46528056",
"0.4... | 0.8754248 | 0 |
tries to find shift which resolves given forecastslot and sets 'resolved'prop | function tryResolveForecast(forecast, colId){
_.chain(shiftLines).filter(function(shift){ return forecast.role.name === shift.role.name; }) /* restrict on same role*/
.each(function(line){
var shiftHasSlot = _.chain(line.columns).findWhere({id: colId}).value();
if(shiftHasSlot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function computeLineCellStatus(){\r\n\t\t\t// all lines corresp. to shifts\r\n\t\t\tvar shiftLines = _.chain(scope.lines).filter(function(line) { return !line.forecast; }).value();\r\n\r\n\t\t\t// iterate lines corresp. to forecast-shifts\r\n\t\t\t_.chain(scope.lines).filter(function(line) { return line.forecast; ... | [
"0.5975944",
"0.49762434",
"0.49518648",
"0.48313",
"0.4788907",
"0.47365665",
"0.47103047",
"0.4649347",
"0.46485206",
"0.46385384",
"0.45547384",
"0.45430204",
"0.44941902",
"0.44758087",
"0.4469566",
"0.44471386",
"0.44471386",
"0.44450328",
"0.44441736",
"0.4427696",
"0.4... | 0.6603154 | 0 |
Extracts timeslots for given shift from timeSlotlist. | function findTimeSlots(shift){
return _.chain(scope.columns).filter(function(timeSlot){
return timeSlot.startTime >= shift.startTime && timeSlot.startTime < shift.endTime;
}).value();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateTimeSlots(shift) {\n // starting at 600, keep adding 15 to it, and everytime you do, add {num: 2} to your dict\n var timeSlots = {}\n\n for(var t = shift.start; t <= shift.end; t += shift.interval) {\n timeSlots[t] = shift.tables\n }\n\n return timeSlots\n }",
"async functio... | [
"0.59216124",
"0.54539186",
"0.5420853",
"0.53424096",
"0.5325422",
"0.5202628",
"0.5117298",
"0.5115724",
"0.5104596",
"0.5056804",
"0.50388044",
"0.49383205",
"0.49234888",
"0.49185428",
"0.49055085",
"0.48508272",
"0.48443198",
"0.48377758",
"0.4826492",
"0.4808833",
"0.48... | 0.6764421 | 0 |
Extracts role for given shift from rolelist based on name and roleInstance. If not exists add the role to 'rows' | function findOrCreateRole(shift){
var role = _.chain(scope.rows).find(function(role){
return (role.name === shift.role.name && role.instance === shift.roleInstance);
}).value();
if(!role){
// must create and add
role = createRoleInstance(shift);
addRow(role);
}
return role;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createRoleInstance(shift){\r\n\t\t\tvar instance = _.clone(shift.role);\r\n\t\t\t_.chain(instance).extend({id: instance.name + '$' + shift.roleInstance,\r\n\t\t\t\t\t\t\t\t label: instance.name + ' ' + shift.roleInstance,\r\n\t\t\t\t\t\t\t instance: shift.roleInstance});\r\n\t\t\treturn instance;\r\n... | [
"0.5859486",
"0.5679704",
"0.5321927",
"0.51174647",
"0.50979465",
"0.5091749",
"0.5035019",
"0.4993357",
"0.49880898",
"0.48940763",
"0.48914775",
"0.4868611",
"0.48491827",
"0.48445067",
"0.48081085",
"0.47836688",
"0.47392356",
"0.47203088",
"0.46774676",
"0.4655038",
"0.4... | 0.686228 | 0 |
Adds a roleinstance to the rows. | function addRow(roleInstance){
scope.rows.push(roleInstance);
scope.rows.sort(function(row1, row2){
if(row1.name === row2.name){
return row1.roleInstance - row2.roleInstance;
} else if(row1.name > row2.name){
return 1;
} else if (row1.name < row2.name){
return -1;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addRole(role) {\n roles.push(role);\n}",
"function addRole(obj) {\n console.log(\"Inserting a new role\");\n connection.query(\"INSERT INTO employee_role SET ?\", obj, function(err, res) {\n if (err) throw err;\n console.log(`${res.affectedRows} role inserted! \\n`);\n });\n connection.query(... | [
"0.6059525",
"0.58648485",
"0.5814726",
"0.5692077",
"0.56416464",
"0.55209446",
"0.5496167",
"0.5480053",
"0.5477061",
"0.5463834",
"0.5418116",
"0.54114175",
"0.5402462",
"0.53936857",
"0.52996963",
"0.5294448",
"0.5237526",
"0.5229721",
"0.52258825",
"0.520128",
"0.5186628... | 0.72176474 | 0 |
Correct rolelabels (instance from db not always desired as counter) Assumes the rows are sorted as intended to be displayed. | function correctRowsLabel(){
var groups = _.chain(scope.rows).groupBy('name').value();
for(var key in groups){
_.chain(groups[key]).each(function(row, idx){
row.label = row.name + ' ' + (idx + 1);
});
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateLabels(l) {\n\t var a = [],\n\t i;\n\t for (i = 0; i < l; i++) {\n\t a[i] = s.labels && s.labels[i] ? s.labels[i] : i;\n\t }\n\t return a;\n\t }",
"function rename_labels() {\n\t\t $('.price_rule').each(function() {... | [
"0.55284387",
"0.53243214",
"0.5130869",
"0.5044454",
"0.5004123",
"0.5002112",
"0.49830443",
"0.49822694",
"0.49702498",
"0.495826",
"0.49469206",
"0.49049643",
"0.49029878",
"0.4887133",
"0.48845428",
"0.48422894",
"0.4763049",
"0.47358283",
"0.47037202",
"0.4697478",
"0.46... | 0.6860652 | 0 |
Creates a row (roleinstance) based on the given shift's roleinstance. | function createRoleInstance(shift){
var instance = _.clone(shift.role);
_.chain(instance).extend({id: instance.name + '$' + shift.roleInstance,
label: instance.name + ' ' + shift.roleInstance,
instance: shift.roleInstance});
return instance;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findOrCreateRole(shift){\r\n\t\t\tvar role = _.chain(scope.rows).find(function(role){\r\n\t\t\t\treturn (role.name === shift.role.name && role.instance === shift.roleInstance);\r\n\t\t\t}).value();\r\n\t\t\tif(!role){\r\n\t\t\t\t// must create and add\r\n\t\t\t\trole = createRoleInstance(shift);\r\n\t\t\t... | [
"0.71709013",
"0.63158774",
"0.5653338",
"0.5474766",
"0.5431593",
"0.5221551",
"0.4867759",
"0.48616645",
"0.4823541",
"0.47935542",
"0.4788974",
"0.47723708",
"0.47516012",
"0.47490677",
"0.4733791",
"0.46999666",
"0.46752036",
"0.46697176",
"0.46686107",
"0.46584633",
"0.4... | 0.738543 | 0 |
Attempts to parse a JSON Web Token. Return null if parsing fails. | function parseJWT(token) {
let parts = token.split('.');
if (parts.length != 3) {
log(ERROR, 'Token is not a JWT.');
return null;
}
const [header, payload, signature] = parts;
try {
return JSON.parse(atob(payload));
} catch (e) {
log(ERROR, `Failed to parse JWT payload: ${e.message}`);
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function decodeJwtComplete(token) {\n var decodedToken = jsonwebtoken_1.decode(token, { complete: true });\n if (decodedToken === null || typeof decodedToken === 'string') {\n throw new Error('JwtError: The given jwt payload does not encode valid JSON.');\n }\n return decodedToken;\n}",
"funct... | [
"0.61166793",
"0.60954255",
"0.6036463",
"0.5951156",
"0.58737123",
"0.57879704",
"0.5761314",
"0.5751756",
"0.5714847",
"0.5670397",
"0.56538415",
"0.56464154",
"0.563263",
"0.56288725",
"0.56226915",
"0.55765915",
"0.5552956",
"0.55430865",
"0.54914594",
"0.54809797",
"0.54... | 0.6581156 | 0 |
Funcion que inicializa la variable del Monitor | function AbrirMonitor()
{
//Monitor de impresiones
if(ventana_monitor== null)
ventana_monitor="VentanaMonitor";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"monitor() {\n this.init();\n }",
"function initialize() {\n monitor();\n }",
"function initWatchVal() {}",
"function initWatchVal() {}",
"function initWatchVal() {}",
"function initWatchVal() {}",
"function initWatchVal() {}",
"function initWatchVal() {}",
"function initWatchVal() {}"... | [
"0.6558794",
"0.63195384",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",
"0.61948997",... | 0.696008 | 0 |
Make API request from Flickr for photoset | function requestPhotos(apiKey, photosetId) {
var apiUrl = "https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=" + apiKey + "&photoset_id=" + photosetId + "&extras=url_n" + "&format=json&nojsoncallback=1";
var xhr = new XMLHttpRequest();
xhr.open("GET", apiUrl, false... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function photo_search ( param ) {\n // my API key setting\n param.api_key = '4df3beb87450502f86941ac88ee33756';\n param.method = 'flickr.photos.search';\n //param.per_page = 10;\n param.sort = 'interestingness-desc';\n param.format = 'json';\n param.jsoncallback = 'jsonFlickrApi';\n ... | [
"0.7029979",
"0.6721678",
"0.6711904",
"0.66919756",
"0.6681369",
"0.6673442",
"0.6619693",
"0.6612286",
"0.6538876",
"0.65072185",
"0.6505088",
"0.6453293",
"0.6433867",
"0.64163023",
"0.63424176",
"0.63304585",
"0.63273925",
"0.63182086",
"0.6250136",
"0.6249408",
"0.623864... | 0.75633126 | 0 |
Apply contents to the template to evaluate it's output | apply(contents) {
this.templateData = contents || {};
return this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyTemplate() {\n return through.obj(function(file, enc, cb) {\n var data = {\n site: site,\n page: file.page,\n content: file.contents.toString()\n };\n\n var templateFile = path.join(\n __dirname, 'docs', '_templates', file.page.layout + '.html');\n var tpl = swig.co... | [
"0.6431276",
"0.64204794",
"0.625605",
"0.6205673",
"0.6045519",
"0.60352665",
"0.60020137",
"0.59576476",
"0.5919511",
"0.5875989",
"0.5875989",
"0.57703966",
"0.5769385",
"0.57559705",
"0.57514393",
"0.5730039",
"0.571497",
"0.5693165",
"0.5693165",
"0.56789297",
"0.5672245... | 0.65918535 | 0 |
Control whether or not to render whitespace. It is enabled by default | renderWhitespace(whitespaceFlag) {
this.whitespace = whitespaceFlag;
return this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get whitespace() {\n return this.spec.whitespace || (this.spec.code ? \"pre\" : \"normal\");\n }",
"space() {\n\t\t\tthis.append(' ');\n\t\t}",
"function testWhitespace() {\n RunTests([\n S('', [\n ]),\n S(' \\n\\r\\n\\r\\v\\f\\t\\x85\\xa0\\u2000\\u3000', [\n ]),\n ]);\n}",
"function hi... | [
"0.66137946",
"0.63086474",
"0.6132167",
"0.60252225",
"0.59870017",
"0.5859473",
"0.58551323",
"0.5777089",
"0.5724887",
"0.5688121",
"0.5656335",
"0.56229424",
"0.5575156",
"0.5575156",
"0.5550243",
"0.5550243",
"0.5550243",
"0.5550243",
"0.5550243",
"0.5550243",
"0.5550243... | 0.76232934 | 0 |
If the form input error object is empty (file input is valid) it will show a green checkmark. Otherwise hides the checkmark | function showUploadSuccess(formInputErrorObject, elementIdToAdjust) {
if (jQuery.isEmptyObject(formInputErrorObject)) {
$('#' + elementIdToAdjust).parent().children('md-icon').css('opacity', '1');
// $('#utility-bill-input').parent().children().first().css('opacity', '1');
} else {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function errorMark() {\r\n if (checkHex(hex.value)) {\r\n document.getElementById('hexError').classList.add('hidden');\r\n } else {\r\n document.getElementById('hexError').classList.remove('hidden');\r\n }\r\n if (checkRgb(rgb.value)) {\r\n document.getElementById('rgbError').classList.add('hidden');\... | [
"0.7022815",
"0.6697018",
"0.65197974",
"0.65163124",
"0.65163124",
"0.63149476",
"0.6284203",
"0.628285",
"0.6265055",
"0.6216489",
"0.61778367",
"0.6140445",
"0.61390764",
"0.61388946",
"0.6134242",
"0.612414",
"0.61238974",
"0.6080157",
"0.60600406",
"0.60590374",
"0.60285... | 0.6794452 | 1 |
the sum of the first and last elements of the array if there is an even number of elements the difference between the first and last elements of the array if there is an odd number of elements. You can assume the array contains at least one number. | function firstAndLast(array){
for(var i = 0; i < array.length; i++){
if(array.length % 2 === 0){
return array[0] + array[array.length - 1];
} else{
return array[0] - array[array.length - 1];
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcSum(array) {\n var sum = 0;\n for (var i = 0; i < array.length; i++) {\n if (array[i] % 2 != 0) {\n sum += array[i];\n }\n }\n return sum;\n}",
"function evenOddSums(array) {\n let evenSum = 0;\n let oddSum = 0;\n\n array.forEach(number =>\n number % 2 === 0 ? (evenSum += number... | [
"0.7230419",
"0.7076163",
"0.70237523",
"0.7015834",
"0.6998363",
"0.6980494",
"0.69803625",
"0.6934499",
"0.6924276",
"0.6915984",
"0.69089246",
"0.690713",
"0.6904072",
"0.6892211",
"0.6861213",
"0.6845954",
"0.6841541",
"0.6805987",
"0.67352676",
"0.67351925",
"0.6729297",... | 0.72034687 | 1 |
Register a new cloud generator. | function register(fn, name, creator) {
generators.push({
fn: fn,
name: name,
creator: creator
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(generator) {\n this.generator = generator;\n }",
"setGenerator(generatorArg) {\n this.generator = generatorArg;\n }",
"function GeneratorClass () {}",
"async register (vuetalisk) {\n }",
"registerGenerator ({ module_path, relative_path, absolute_path }) {\n\n // Resolves... | [
"0.56738603",
"0.54281634",
"0.5388197",
"0.53738487",
"0.5224867",
"0.51631606",
"0.51220965",
"0.51220965",
"0.51220965",
"0.50931287",
"0.50931287",
"0.50311685",
"0.49735206",
"0.49735206",
"0.49735206",
"0.49735206",
"0.49735206",
"0.49735206",
"0.49735206",
"0.49735206",
... | 0.6016058 | 0 |
Save or SaveAs ROM event from menu. | function saveROM(event, saveAs) {
if (!_appState.isDirty) return;
console.log('Saving ROM.')
let fileName = _appState.openFileName;
if (saveAs) {
fileName = dialogs.showSaveDialog();
// We only update openFileName after save is successful.
if (!fileName) return; // User cancelled.
}
fs.writeF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function va02Save(){\r\n\r\n\tonscreen 'SAPLSPO2.0300'\r\n\t\tHANDLE_POPUP_0300:;\r\n\t\tenter('=OPT1');\r\n\r\n\tonscreen 'SAPLATP4.0500'\r\n\t\tenter('=WEIT');\r\n\r\n\tonscreen 'SAPLSPO2.0300'\r\n\t\tgoto HANDLE_POPUP_0300\r\n\r\n\tonscreen 'SAPMV45A.0102'\t\r\n\t\tif(_message){\r\n\t\t\tmessage(\"S:\"+_message... | [
"0.63875234",
"0.63428265",
"0.62701935",
"0.62146884",
"0.61394197",
"0.6134633",
"0.60467696",
"0.59033823",
"0.5885859",
"0.58772314",
"0.5859187",
"0.5766715",
"0.57361466",
"0.5709273",
"0.5697353",
"0.566438",
"0.56111723",
"0.557206",
"0.556967",
"0.5546177",
"0.552574... | 0.74280685 | 0 |
Helper function, returns true if one of the game's platforms are NOT in the list of filters Returns false if all of the game's platforms are in the list of filters (game should not be displayed). | function filterGames(game, filters) {
for (let i = 0; i < game.platforms.length; i++) {
if (!filters.find(item => item === game.platforms[i])) {
return true;
}
}
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function filterGames(gamesArray, platforms, genres) {\n let anyCheckedBoxes = false\n let filteredGames = []\n\n for (let [key, value] of Object.entries(platforms)) {\n if (value === true)\n anyCheckedBoxes = true\n //use 'key' or 'value'\n }\n ... | [
"0.5999665",
"0.5648189",
"0.5638915",
"0.5632572",
"0.55978596",
"0.557067",
"0.54297507",
"0.5411722",
"0.5381327",
"0.5379716",
"0.5358446",
"0.5351198",
"0.5325431",
"0.53207445",
"0.5317453",
"0.5313748",
"0.5313748",
"0.5307189",
"0.5307189",
"0.5307189",
"0.5307189",
... | 0.84898823 | 0 |
constructor : initializes numCards to zero(set is empty) | constructor()
{
this.cards = new Array(MAX_CARDS);
this.numCards = 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"initialize(cards) {\n if ((this.rounds.length == 4) && (cards.length != 8)) {\n throw \"wrong number of cards\";\n }\n else if ((this.rounds.length == 5) && (cards.length != 16)) {\n throw \"got the wrong number of cards\";\n }\n\n // TODO: verify that the s... | [
"0.71475923",
"0.7073526",
"0.6910585",
"0.689358",
"0.68647593",
"0.6852731",
"0.6768025",
"0.6750887",
"0.67025214",
"0.66551536",
"0.6503937",
"0.64975864",
"0.6477686",
"0.64764947",
"0.64609665",
"0.6434726",
"0.6432271",
"0.6412092",
"0.6404843",
"0.6402042",
"0.6396913... | 0.75308776 | 0 |
returns the number of cards in the set | count()
{
return this.numCards;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function card(setA) {\n return setA.length;\n}",
"cardCount(card) {\n return this.state.currentDeck.reduce((n, val) => {return n + (val === card);}, 0);\n }",
"count () {\n return Object.keys(this.cards).length;\n }",
"function getNumCards(deck)\n{\n\treturn deck.length;\n}",
"getNumberOfS... | [
"0.80191094",
"0.79863274",
"0.782635",
"0.76402116",
"0.76120836",
"0.75905335",
"0.73232555",
"0.7219241",
"0.7200315",
"0.7047005",
"0.7000876",
"0.70005",
"0.67609745",
"0.67090076",
"0.6699439",
"0.66557485",
"0.6653726",
"0.66080815",
"0.6596146",
"0.6574168",
"0.654622... | 0.7996684 | 1 |
removes the last card in the set and returns it.If there is not a card to Remove, an error msg is printed to cerr and program exits. | removeCard()
{
if (this.numCards >= 1)
{
this.numCards--;
const card = this.cards[this.numCards];
this.cards[this.numCards] = null;
return card;
}
else
{
cerr("no card to remove");
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"removeCard(card) {\n const cardIndex = this.findCardIndex(card);\n\n if (cardIndex !== -1)\n return this.cards.splice(cardIndex, 1).pop();\n else\n throw new Error(`card: ${card.type} cannot be removed as it is not found.`)\n\n }",
"dealCard(){\n // Deal a ran... | [
"0.76697856",
"0.7279808",
"0.71938974",
"0.7130567",
"0.68133885",
"0.6762909",
"0.65868753",
"0.6570524",
"0.6480772",
"0.6479899",
"0.64630616",
"0.64504826",
"0.64364904",
"0.64296067",
"0.6417282",
"0.64171654",
"0.6412432",
"0.6410043",
"0.63966554",
"0.639462",
"0.6381... | 0.8070962 | 0 |
prints out all the cards in the set. If hideFirstCard is true, two are printed in place of the first card. | show(hideFirstCard = false)
{
if (this.numCards == 0)
return;
if (hideFirstCard == true)
cout("** ");
else
{
this.cards[0].print(true);
cout(" ");
}
for (let x = 1; x < this.numCards; x++)
{
this.cards[x].print(true);
cout(" ");
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayPlayerCards() {\n\tconst allPossibleInputs = [\"two\", \"three\", \"ten\"];\n\tconst classLookup = { 2: \"two\", 3: \"three\", 10: \"ten\" };\n\n\tfor (const n of allPossibleInputs) {\n\t\t$(`.${n}-card`).hide();\n\t}\n\t$(`.${classLookup[possibleInputs]}-card`).show();\n}",
"function showall(){\... | [
"0.6339556",
"0.62854606",
"0.6284957",
"0.61833525",
"0.61720127",
"0.61441714",
"0.6049006",
"0.6044521",
"0.60360783",
"0.6032082",
"0.59720933",
"0.58605516",
"0.5844934",
"0.5837521",
"0.5790571",
"0.57737476",
"0.57638603",
"0.57591015",
"0.5739415",
"0.57121044",
"0.57... | 0.83625823 | 0 |
Returns the exact number of distinct real roots in the open interval (a,b) of the given polynomial subject to floating point underflow / overflow of intermediate calculations. | function numRootsInRange(p, a, b) {
const ps = sturmChain(p);
const as = ps.map(p => eHorner(p, a));
const bs = ps.map(p => eHorner(p, b));
return eSignChanges(as) - eSignChanges(bs);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function numRootsInRange(p, a, b) {\n let ps = sturmChain(p);\n let as = ps.map(p => evaluate(p, a));\n let bs = ps.map(p => evaluate(p, b));\n return signChanges(as) - signChanges(bs);\n}",
"function evaluatePolynomial(polynomial, x) {\n\n let n = polynomial.length-1;\n\n let result = polynomial[n... | [
"0.6436624",
"0.5764429",
"0.5698686",
"0.55305815",
"0.54233885",
"0.5396883",
"0.53915817",
"0.538223",
"0.53558373",
"0.53193194",
"0.5302218",
"0.52619845",
"0.5210804",
"0.5209923",
"0.5205491",
"0.5203764",
"0.50885785",
"0.5072837",
"0.5057768",
"0.5037243",
"0.5031613... | 0.6243649 | 1 |
Options for the ButtonListener: mouseButton: 0 fireOnDown: false // default is to fire on 'up' after 'down', but passing fireOnDown: true will fire on 'down' instead up: null // Called on an 'up' state change, as up( event, oldState ) over: null // Called on an 'over' state change, as over( event, oldState ) down: null... | constructor( options ) {
assert && deprecationWarning( 'ButtonListener is deprecated, please use FireListener instead' );
options = merge( {
// When running in PhET-iO brand, the tandem must be supplied
phetioType: ButtonListener.ButtonListenerIO,
phetioState: false,
phetioEventType: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static _HandleButtonDown(e) {\n if (!Mouse._button_down.includes(e.button))\n Mouse._button_down.push(e.button)\n }",
"mouseDown(e){\n if(e.button == 0){\n e.stopPropagation();\n e.preventDefault();\n\n this.set('moveStart', true);\n\n const self = this;\n this.set('mouseMove... | [
"0.6851045",
"0.67776406",
"0.6659418",
"0.6659418",
"0.6608791",
"0.66031146",
"0.6601109",
"0.65703624",
"0.6556459",
"0.6556459",
"0.6549258",
"0.6492473",
"0.646177",
"0.6434807",
"0.6433793",
"0.63689315",
"0.6363423",
"0.6353096",
"0.6349208",
"0.63325864",
"0.6327214",... | 0.6974028 | 0 |
the value of "autocompletion_widget_id" used in the function is the value at the time the function was defined rather than the value at the time it is run. That is, we want a closure. | function create_select_function(autocompletion_widget_id) {
return function(event, ui) {
// Prevent the value (the id number) of the item selected from
// displaying after a selection has been made ...
event.preventDefault();
// ... and display the *label* of the item selected inste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function BocAutoCompleteReferenceValue()\n{\n}",
"function makeAutosuggest(_ref) {var _ref$completers = _ref.completers,completers = _ref$completers === undefined ? [] : _ref$completers; //eslint-disable-next-line no-unused-vars\n\t return function (editor, _ref2, _ref3) {var fetchDomainSuggestions = _ref2.fetc... | [
"0.63268286",
"0.6266787",
"0.6224006",
"0.60760576",
"0.60267276",
"0.5825663",
"0.5754514",
"0.57287943",
"0.5662441",
"0.5639214",
"0.5620414",
"0.5619693",
"0.56193274",
"0.5619319",
"0.5609647",
"0.5573154",
"0.55534136",
"0.5550663",
"0.551459",
"0.55138206",
"0.5513491... | 0.75667846 | 0 |
Pullstream which recursively flattens streams of streams | function pullFlattenDeep () {
var stack = []
var _stack = []
return function (read) {
var _read
if (!read) {
throw new Error('No read provided to pull-flatten-deep.')
}
return function (err, cb) {
if (err) {
abortAll(err, cb)
} else if (_read == null && _stack.length <=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function recurse (streams) {\n if(streams.length < 2)\n return\n streams[0].pipe(streams[1])\n recurse(streams.slice(1)) \n }",
"function recurse (streams) {\n if(streams.length < 2)\n return\n streams[0].pipe(streams[1])\n recurse(streams.slice(1)) \n }",
"function recurse (str... | [
"0.67646825",
"0.67646825",
"0.6747405",
"0.6747405",
"0.6747405",
"0.5765071",
"0.576264",
"0.57184094",
"0.55490285",
"0.55167454",
"0.5516489",
"0.55146825",
"0.5461314",
"0.5434864",
"0.54202896",
"0.53959066",
"0.5356592",
"0.5324292",
"0.52916706",
"0.51708496",
"0.5040... | 0.72466266 | 0 |
handler that alerts clicks outside of the passed ref | function useOutsideAlerter(ref, action) {
function handleClickOutside(event) {
if (ref.current && !ref.current.contains(event.target)) {
action();
}
}
useEffect(() => {
document.addEventListener("mousedown", handleClickOutside);
return () => {
document... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleClickOutside(event) {\n if (ref.current && !ref.current.contains(event.target)) {\n setVerticalState_state(false);\n // alert(\"You clicked outside of me!\");\n }\n }",
"function handleClickOutside(event) {\n if (ref.current && !ref.current.contains(event.target)) {... | [
"0.6448775",
"0.6414187",
"0.6352913",
"0.6332559",
"0.6227184",
"0.6213743",
"0.6165581",
"0.6153932",
"0.61468303",
"0.6130107",
"0.61133397",
"0.61120474",
"0.6073752",
"0.6072289",
"0.60568404",
"0.60484654",
"0.6047324",
"0.60286975",
"0.6025848",
"0.59700227",
"0.595354... | 0.6575312 | 0 |
Makes a new keypair and calculates its address from that. The address is the hash of the public key. | makeAddress() {
let kp = keypair();
let addr = utils.calcAddress(kp.public);
this.addresses[addr] = kp;
return addr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_key_pair()\n{\n\tvar privKey = chance.string(\n {\n length: 64,\n pool: '0123456789abcdef'\n });\n var pubKey = lib.straight_hex(lib.curve25519_to8bitString(lib.curve25519(lib.curve25519_from8bitString(h2s(privKey)), lib.curve25519_nine())));\n\tvar key_pair = {\n\t\tprivateKey:... | [
"0.65476424",
"0.65092885",
"0.6500212",
"0.63440526",
"0.6329722",
"0.6318407",
"0.62875766",
"0.6216305",
"0.6200798",
"0.61563987",
"0.61512786",
"0.6106698",
"0.6060214",
"0.6059478",
"0.60463625",
"0.60100913",
"0.6000123",
"0.5980718",
"0.5926837",
"0.58976215",
"0.5888... | 0.8304099 | 0 |
Init Initializes project Returns a Promise | init() {
let _this = this;
return BbPromise.try(function() {
// Load Core & Project Plugins before anything
_this._loadPlugins(__dirname, require('./Actions.json').plugins);
if (_this.hasProject()) _this.loadProjectPlugins();
})
.then(function() {
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async init() {}",
"async init() {}",
"async init(){}",
"function __init() {\n let initResolve, initReject;\n const initPromise = new Promise((resolve, reject) => {\n initResolve = resolve;\n initReject = reject;\n });\n ... | [
"0.70606107",
"0.70606107",
"0.69954073",
"0.6979605",
"0.6870141",
"0.6827636",
"0.67928773",
"0.6650027",
"0.6617603",
"0.6591501",
"0.6514117",
"0.6484628",
"0.64584094",
"0.64306325",
"0.64090955",
"0.6397131",
"0.63763666",
"0.6367071",
"0.63619494",
"0.6337174",
"0.6323... | 0.75711817 | 0 |
Bind a callback which is only invoked once | once(event, callback) {
const boundCallback = (...args) => {
// invoke the callback
callback(...args);
// remove the event
this.off(event, boundCallback);
};
this.on(event, boundCallback);
return this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"defer(cb) {\n this.event.once(\"*\", cb);\n }",
"function once (fn) {\n var called = false;\n return function () {\n if (!called) {\n called = true;\n fn.apply(this, arguments);\n }\n }\n }",
"function once(fn){var called=false;return function(){if(!c... | [
"0.676377",
"0.6710677",
"0.6681167",
"0.6681167",
"0.6675032",
"0.66683245",
"0.66683245",
"0.66683245",
"0.66683245",
"0.66309834",
"0.6615397",
"0.6603704",
"0.6603704",
"0.6603704",
"0.6584014",
"0.6584014",
"0.6556486",
"0.6556486",
"0.65502095",
"0.6518121",
"0.6518121"... | 0.6754769 | 1 |
adds a todo to a card (& to db) | todo_addNew(card){
todosRef.push(new todo(card.id, this.currCardTodo));
card.todoing=false;
this.currCardTodo="";
this.activity_add("Todo addded to card named " + card.myName);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addTodo(todo) {\n\n if (todo.title != \"\") {\n var newTodo = angular.copy(todo);\n newTodo._id = (new Date()).getTime();\n newTodo.date = new Date();\n\n $scope.todos.push(newTodo);\n $scope.todo.title = \"\";\n ... | [
"0.7321048",
"0.72444046",
"0.72137284",
"0.7176486",
"0.7132697",
"0.71242166",
"0.711752",
"0.70870876",
"0.70427895",
"0.70241135",
"0.7008173",
"0.6995555",
"0.69877183",
"0.6986191",
"0.6977978",
"0.69697434",
"0.69543993",
"0.69288313",
"0.6925742",
"0.6924435",
"0.6913... | 0.8098498 | 0 |
deletes a todo from a card | todo_delete(todo){
todosRef.child(todo['.key']).remove();
this.activity_add("Todo with text " + todo.task + " removed");
var index = this.todos.indexOf(todo);
if(index > -1){
this.todos.splice(index, 1);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteTodo(todo){\n self.todos.$remove(todo);\n }",
"deleteTodo(todo) {\r\n this.todos.splice(todo, 1);\r\n // console.log(todo);\r\n }",
"function deleteButtonPressed(todo) {\n db.remove(todo);\n }",
"function deleteButtonPressed(todo) ... | [
"0.74239016",
"0.73800635",
"0.72498083",
"0.7119965",
"0.70448595",
"0.7021618",
"0.6971625",
"0.6950047",
"0.6942274",
"0.6938865",
"0.69134486",
"0.68632585",
"0.68625826",
"0.68557334",
"0.68398947",
"0.6833879",
"0.6815909",
"0.6814512",
"0.68142885",
"0.6801523",
"0.677... | 0.7429264 | 0 |
deletes a comment from a card | comment_delete(comment){
commentsRef.child(comment['.key']).remove();
this.activity_add("Comment with text " + comment.text + " removed");
var index = this.comments.indexOf(comment);
if(index > -1){
this.comments.splice(index, 1);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteComment() {\n\t\tlet courseId = $(this).attr('data-target');\n\t\tlet commentId = $(this).attr('data-id');\n\n\t\tcommentsService.deleteComment(commentId)\n\t\t\t.then(() => {\n\t\t\t\tshowInfo('Comment deleted.');\n\t\t\t\tloadCourseDetails(courseId);\n\t\t\t}).catch(handleError);\n\t}",
"functio... | [
"0.72623134",
"0.7191707",
"0.70485896",
"0.7041251",
"0.70200986",
"0.69603217",
"0.6906686",
"0.682425",
"0.6809893",
"0.6796623",
"0.6789326",
"0.6758736",
"0.6752048",
"0.6732992",
"0.6681703",
"0.66536206",
"0.6642778",
"0.66346234",
"0.6580102",
"0.6568674",
"0.6547679"... | 0.7269545 | 0 |
checks if a card is categorized or not | card_hasCategory(card){
return card.category!=="";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"card_getCategory(card){\n return card.category;\n }",
"function categorify(cat) {\n var ret;\n if(typeof cat == \"string\")\n ret = cat\n ;\n else ret = d3.entries(cat) // Overview pseudo-phase\n .filter(function(e) { ret... | [
"0.67486286",
"0.6530915",
"0.60498095",
"0.60009664",
"0.5967204",
"0.5959847",
"0.59192246",
"0.5894274",
"0.585189",
"0.5822634",
"0.5726835",
"0.5714459",
"0.5711558",
"0.5705434",
"0.5598526",
"0.5571379",
"0.55667084",
"0.5561287",
"0.55601865",
"0.5556953",
"0.5533823"... | 0.78161407 | 0 |
gett for card category | card_getCategory(card){
return card.category;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"card_hasCategory(card){\n return card.category!==\"\";\n }",
"get category () {\n\t\treturn this._category;\n\t}",
"get category () {\n\t\treturn this._category;\n\t}",
"get category () {\n\t\treturn this._category;\n\t}",
"get category () {\n\t\treturn this._category;\n\t}",
"function ... | [
"0.72160935",
"0.67955995",
"0.67955995",
"0.67955995",
"0.67955995",
"0.6760833",
"0.67353314",
"0.6670563",
"0.6661342",
"0.6657142",
"0.65825677",
"0.65652937",
"0.6470415",
"0.64370733",
"0.64316297",
"0.6429168",
"0.63525504",
"0.6342143",
"0.6306387",
"0.62576944",
"0.6... | 0.8910908 | 0 |
get all the comments that belong to a card, given a card id | card_comments(card){
return this.comments.filter(comment => comment.parent === card.id);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getComments(id){\n\t\t$('.comment-list').empty();\n\t\t$.ajax({\n\t\t\ttype: \"GET\",\n\t\t\turl: \"/comments/\" + id\n\t\t})\n\t\t\t.then(function(data) {\n\n\t\t\t\t$(\".modal-title\").text('Comments for article: ' + data._id);\n\t\t\t\t$(\"div.modal-footer\").attr('id',data._id);\n\t\t\t\tvar comments ... | [
"0.6640511",
"0.6626187",
"0.6566104",
"0.65545404",
"0.65359867",
"0.6427292",
"0.6424862",
"0.64076215",
"0.63566047",
"0.6323049",
"0.6317523",
"0.63140374",
"0.6302937",
"0.62972575",
"0.6268776",
"0.62210953",
"0.6219652",
"0.6197865",
"0.61823606",
"0.61661524",
"0.6165... | 0.7446122 | 0 |
retrieves attachments bound to a card, based off of a given card id | card_atts(card){
// return this.attachments;
return this.attachments.filter(att => att.parent == card.id);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAttachmentsByEntityTypeId(id) {\n var url = svApiURLs.Attachment + id;\n return $resource(\n url,\n {isEntityTypeId:true},\n {'query': {method:'GET', isArray:true}}\n ).query(function() { // GET: /attachment/3?isEntityTypeId=true\n }, function(error) { // err... | [
"0.626229",
"0.6073571",
"0.59305155",
"0.5901619",
"0.5877166",
"0.5877166",
"0.5875163",
"0.5732229",
"0.5696408",
"0.5696408",
"0.5691485",
"0.5690046",
"0.5649763",
"0.563811",
"0.5635576",
"0.5604642",
"0.55755484",
"0.5529239",
"0.54913604",
"0.54864734",
"0.54616475",
... | 0.6728369 | 0 |
dumb method to toggle my "commenting" boolean on a card | card_startStopCommenting(card){
card.commenting=!card.commenting;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toggleCardAndComment() {\n if (commentOpen) {\n setCommentOpen(false);\n };\n toggleCard();\n }",
"setCommentsOn(on) {\r\n return this.getItem().then(i => {\r\n const updater = new Item(i, `SetCommentsDisabled(${!on})`);\r\n return updater.... | [
"0.7986642",
"0.67551637",
"0.6705891",
"0.6636296",
"0.66271424",
"0.6513172",
"0.6505513",
"0.6489709",
"0.64752436",
"0.6470305",
"0.63955754",
"0.628903",
"0.62879074",
"0.621934",
"0.6212377",
"0.6204671",
"0.6166285",
"0.6166285",
"0.61419153",
"0.6120384",
"0.6103862",... | 0.78279865 | 1 |
dumb method to toggle my "todoing" boolean on a card | card_startStopTodoing(card){
card.todoing=!card.todoing;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"toggle() {\n this.setFavorite(!this.restaurant.is_favorite);\n }",
"function cardToggleObject(id) {\n tasks.forEach(card => {\n if (card.id === id) {\n if (card.state === 'pending') {\n card.state = 'done';\n } else {\n card.state = 'pending';\n }\n }\n });\n}",
"change... | [
"0.69709057",
"0.6725222",
"0.6620807",
"0.6561703",
"0.65598685",
"0.65286994",
"0.64203036",
"0.64118296",
"0.6388558",
"0.6365854",
"0.63607055",
"0.6341504",
"0.6320787",
"0.6305237",
"0.62934285",
"0.6291746",
"0.6279956",
"0.6279326",
"0.62446254",
"0.6240636",
"0.61488... | 0.79298174 | 0 |
adds a new comment to a card based off of a given id | card_addComment(card){
commentsRef.push(new comment(this.currentUser, card.id, this.currCardComment));
card.commenting=false;
this.currCardComment="";
this.activity_add("Comment added to card named " + card.myName);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addComment() {\n CommentService.post(vm.user.username, $stateParams.id, vm.comment, vm.currentUser)\n .then(comment => {\n\n // set variables\n vm.loadedComments = 0;\n vm.commentLimit = vm.comments.length + 1;\n vm.allComments+... | [
"0.71151316",
"0.70153296",
"0.6956349",
"0.69259423",
"0.68995327",
"0.6868083",
"0.68211514",
"0.68204045",
"0.6743255",
"0.6709947",
"0.6699819",
"0.6667222",
"0.66529304",
"0.6565553",
"0.654098",
"0.65270525",
"0.65211684",
"0.6520805",
"0.6518387",
"0.65163827",
"0.6492... | 0.80171555 | 0 |
This function changes the slice size and creates a new set of slices | function createNewSlices() {
// Decrease the slice size by a factor of 2
sliceSize /= 2;
// If the size is too small, set it to a larger value
if (sliceSize < 2) {
sliceSize = 32;
}
// Create the new slices
slices = createSlices(originalImg);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function UnifyingSlice() {\n}",
"slice() {\n // redefine method in derived classes\n }",
"function sliceAndSplice(original, start, deleteCount, ...args) {\n const returnArray = original.slice();\n returnArray.splice(start, deleteCount, ...args);\n return returnArray;\n}",
"function chunk(a... | [
"0.61462635",
"0.5897712",
"0.5776608",
"0.57489246",
"0.57217133",
"0.5664421",
"0.5639262",
"0.5622985",
"0.56081665",
"0.5596089",
"0.55940306",
"0.5585379",
"0.55741763",
"0.5553921",
"0.5518396",
"0.55177546",
"0.54885775",
"0.54855424",
"0.5463199",
"0.5443067",
"0.5433... | 0.7108692 | 0 |
prints job to view | function printJob(jobId) {
jobname = localStorage["timepunch.job" + jobId + ".name"];
document.getElementById("view").innerHTML += '<button class="jobs" id="' + jobId + '" onclick="selectJob(this.id)"> ' + jobname + '</button>';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _jobs(jobs) {\n if(_.size(jobs)>0) {\n _jobsHeader();\n _.each(jobs, function(job) { \n console.log(sprintf(headerstr,job.id, job.next, Number(job.progress*100).toFixed(0), job.name, job.description));\n });\n } else {\n console.log('** no jobs **');\n }\n}",
"function launch_easy_pr... | [
"0.624112",
"0.6204383",
"0.60022765",
"0.58704245",
"0.57793266",
"0.57777625",
"0.57076985",
"0.5657654",
"0.56515265",
"0.560134",
"0.5598773",
"0.5562629",
"0.55612814",
"0.55576843",
"0.55529714",
"0.5552173",
"0.5533902",
"0.54466504",
"0.5443136",
"0.5393811",
"0.53887... | 0.6787515 | 0 |
Funcion validarContinuacion permite identificar si es posible continuar con el Juego teniendo en cuenta el movimiento del jugador | function validarContinuacion(posX,posY){
var valorActual = arregloPosiciones[posX][posY];
if((posY-2)>=0){
valorPosArriba1 = arregloPosiciones[posX][posY-1];
valorPosArriba2 = arregloPosiciones[posX][posY-2];
if(valorActual == valorPosArriba1 && valorActual == valorPosArriba2){
return true;
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validaFormProvimento() {\n var ueid = document.getElementById(\"ueid\");\n var matricula = document.getElementById(\"Matricula\");\n var motivo = document.getElementById(\"inputMotivo\");\n var motivo_data_inicio = date(document.getElementById(\"DataInicio\"));\n var motivo_data_fim = date(... | [
"0.6463256",
"0.6246318",
"0.60969716",
"0.6055556",
"0.6036814",
"0.59808433",
"0.59213203",
"0.5919823",
"0.5870329",
"0.5860931",
"0.5838225",
"0.58364487",
"0.58346355",
"0.5800427",
"0.5782341",
"0.5780679",
"0.5747751",
"0.57337093",
"0.57337093",
"0.5730104",
"0.572563... | 0.6380823 | 1 |
Shows directions between cal_event_id1 and cal_event_id2 on the map Closes current infowindow | function directions_api_getDirections(cal_event_id1, cal_event_id2){
var event1 = calendar_helper_getCalendarEvent(cal_event_id1);
var event2 = calendar_helper_getCalendarEvent(cal_event_id2);
directions_cache_showDirections(event1.marker.getPosition(), event2.marker.getPosition());
calendar_and_map_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function closeMapWindows() {\n\t\t\t if (click_infowindow!=undefined) click_infowindow.hide();\n \t\t\tif (delete_infowindow!=undefined) delete_infowindow.hide();\n if (edit_metadata!=undefined) edit_metadata.hide();\n\t\t\t}",
"function clickEventer(event){\n\t\t// get the coordinate of the clicked pos... | [
"0.6249046",
"0.613966",
"0.6016692",
"0.59917116",
"0.5965289",
"0.5932946",
"0.5870243",
"0.5858382",
"0.5835585",
"0.58240634",
"0.5784365",
"0.5775736",
"0.5764312",
"0.5759457",
"0.57401",
"0.57285047",
"0.57143956",
"0.57003593",
"0.56948435",
"0.5689178",
"0.5684474",
... | 0.7941756 | 0 |
changes the title of supplied cal_event_id to the travel time required to get there if no previous event, title is preserved | function directions_api_addTravelTimeToTitle(cal_event){
var previous_event = calendar_helper_getPreviousEvent(cal_event)
var title = "";
if (previous_event != null && previous_event.marker != null && cal_event != null && cal_event.marker != null){
getWalkingTime(previous_event.marker.getPosition()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calendar_helper_setTitleAndBackground(cal_event){\n if (cal_event!=null){\n if (cal_event.is_valid)\n directions_api_addTravelTimeToTitle(cal_event);\n else\n calendar_helper_updateCalEventTitleAndBackground(cal_event, openingHoursToString(cal_event.available_destina... | [
"0.746585",
"0.6564308",
"0.56953245",
"0.55161464",
"0.5497452",
"0.5437447",
"0.5381931",
"0.5281215",
"0.5274131",
"0.5243614",
"0.52402276",
"0.5182611",
"0.51543087",
"0.51453567",
"0.5141133",
"0.51065195",
"0.5106244",
"0.5104545",
"0.5091091",
"0.50738597",
"0.5072046... | 0.81473225 | 0 |
returns an array of locations for all the markers on the day of the cal_event | function getMarkersByDay(cal_event){
var results = new Array();
calendar_events = $('#calendar').weekCalendar("serializeEvents");
calendar_helper_sortEvents(calendar_events);
for (var i in calendar_events){
var evnt = calendar_events[i];
if (calendar_helper_dateEquals(evnt.start, ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _getLocs(callback) {\n\tfinalLocs.push(possibleLocs[0])\n\tpointer1 = 0\n\tpointer2 = 1\n\twhile (pointer2 < possibleLocs.length) {\n\t\tloc1 = possibleLocs[pointer1]\n\t\tloc2 = possibleLocs[pointer2]\n\t\tif (loc1 == loc2-1) {\n\t\t\tpointer1 = pointer2;\n\t\t\tpointer2 = pointer2 + 1\n\t\t}\n\t\telse {... | [
"0.65565974",
"0.6387695",
"0.63570875",
"0.6020281",
"0.6005686",
"0.5985812",
"0.5974647",
"0.59201944",
"0.5763788",
"0.5739577",
"0.5718619",
"0.57019895",
"0.5692389",
"0.5679067",
"0.5678497",
"0.56719095",
"0.5642629",
"0.5642362",
"0.5633654",
"0.56135213",
"0.5607434... | 0.77487236 | 0 |
Convert a variable name string to camelback style | function camelback (name) {
var parts = varname.split(name);
return parts.shift() + titleCaseWords(parts).join('');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function camelcase (name) {\n var parts = varname.split(name);\n return titleCaseWords(parts).join('');\n}",
"function camelcase (name) {\n var parts = varname.split(name);\n return titleCaseWords(parts).join('');\n}",
"function kebabToCamel(name){return name.replace(DASH_LOWERCASE_REGEXP,fnCamelCa... | [
"0.78963846",
"0.78963846",
"0.76163065",
"0.75440764",
"0.74264395",
"0.73978007",
"0.73090124",
"0.7278796",
"0.72783273",
"0.7159039",
"0.7153372",
"0.71461034",
"0.7085029",
"0.7085029",
"0.7085029",
"0.7085029",
"0.7085029",
"0.7085029",
"0.706505",
"0.7052286",
"0.70493... | 0.83647335 | 1 |
Convert a variable name string to camelcase style | function camelcase (name) {
var parts = varname.split(name);
return titleCaseWords(parts).join('');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function camelback (name) {\n var parts = varname.split(name);\n return parts.shift() + titleCaseWords(parts).join('');\n}",
"function camelback (name) {\n var parts = varname.split(name);\n return parts.shift() + titleCaseWords(parts).join('');\n}",
"function camelCase(name){return name.charAt(0).... | [
"0.8242542",
"0.8242542",
"0.7762374",
"0.77282995",
"0.75040555",
"0.75002563",
"0.7466539",
"0.74467975",
"0.7400003",
"0.738021",
"0.73664695",
"0.7354139",
"0.73273534",
"0.72659886",
"0.72659886",
"0.7258529",
"0.7258529",
"0.7258529",
"0.7258529",
"0.7258529",
"0.725852... | 0.82908076 | 1 |
Convert a variable name string to dashseparated style | function dash (name) {
return varname.split(name).join('-');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _dasherize(str){return _decamelize(str).replace(/[ _]/g, '-')}",
"function dashify(str){\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}",
"function camelCaseToDash(key) {\n return key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n }",
"function camelCaseToDas... | [
"0.7546802",
"0.7195434",
"0.701",
"0.701",
"0.6900833",
"0.68805546",
"0.66946816",
"0.66909695",
"0.6680992",
"0.66781133",
"0.66690123",
"0.66356033",
"0.66356033",
"0.66356033",
"0.66356033",
"0.66356033",
"0.66356033",
"0.66356033",
"0.66356033",
"0.65457183",
"0.6510689... | 0.8648195 | 1 |
Convert a variable name string to underscoreseparated style | function underscore (name) {
return varname.split(name).join('_');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function varName(s) {\n\t // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _\n\t const alphanumericS = s.replace(/\\W/g, '_');\n\t // Add _ if the string has leading numbers.\n\t return (s.match(/^\\d+/) ? '_' : '') + alphanumericS;\n\t}",
"function varName(s) {\n // Rep... | [
"0.77893275",
"0.77772516",
"0.77628803",
"0.7641095",
"0.749566",
"0.7430585",
"0.73604506",
"0.7286454",
"0.7227147",
"0.71385103",
"0.71182144",
"0.70317966",
"0.70294017",
"0.69055986",
"0.68173444",
"0.67995477",
"0.6776182",
"0.67454255",
"0.67047143",
"0.6683046",
"0.6... | 0.8762711 | 1 |
The function that will determine the color of a neighborhood based on the borough that it belongs to | function chooseColor(borough) {
if (borough == "Brooklyn") return "yellow";
else if (borough == "Bronx") return "red";
else if (borough == "Manhattan") return "orange";
else if (borough == "Queens") return "green";
else if (borough == "Staten Island") return "purple";
else return "black";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function chooseColor(borough) {\n switch (borough) {\n case \"Brooklyn\":\n return \"yellow\";\n case \"Bronx\":\n return \"red\";\n case \"Manhattan\":\n return \"orange\";\n case \"Queens\":\n return \"green\";\n case \"Staten Island\":\n return \"purple\";\n default:\n return \"black\";... | [
"0.6326179",
"0.62130433",
"0.61016434",
"0.603066",
"0.60258764",
"0.6015119",
"0.6003648",
"0.59604",
"0.5952018",
"0.59464055",
"0.5935692",
"0.5921271",
"0.58130026",
"0.5775352",
"0.57721746",
"0.57679695",
"0.57539976",
"0.5741855",
"0.57309276",
"0.5729185",
"0.572601"... | 0.6484739 | 0 |
function to create a table with cities and their populations | function cities(){
var cities = [
'Madison',
'Milwaukee',
'Green Bay',
'Superior'
];
var population = [
233209,
594833,
104057,
27244
];
//create a table element
var table = document.createElement("table");
//create a header r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function cities(){\r\n var cities = [\r\n 'Madison',\r\n 'Milwaukee',\r\n 'Green Bay',\r\n 'Superior'\r\n ];\r\n var population = [\r\n 233209,\r\n 594833,\r\n 104057,\r\n 27244\r\n ];\r\n// Creation of html table element\r\n var table = docume... | [
"0.75606424",
"0.7087371",
"0.70747304",
"0.700243",
"0.699043",
"0.6909443",
"0.68425226",
"0.6808585",
"0.6724581",
"0.66040087",
"0.6462256",
"0.6458908",
"0.64401245",
"0.63899046",
"0.6345992",
"0.6344443",
"0.6322403",
"0.63108593",
"0.60923445",
"0.60488456",
"0.598136... | 0.7118398 | 1 |
debugCallback function is primarily for just making sure the GeoJSON labels itself in the div and below the cities table. mydata is the only variable that will be called in this function, but is created in the next function. | function debugCallback(mydata){
//appending the text label of "GeoJSON data: " as well as the actual
//text of the GeoJSON file.
//JSON stringify is what helps label the data file.
$("#mydiv").append('<br>GeoJSON data: <br>' + JSON.stringify(mydata));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function debugCallback(data){\r\n\t\r\n\t//check success with console.log statement\r\n\tconsole.log (data)\r\n\t//create and format as heading level 3 label \r\n\tvar htmlString = \"<h3>GeoJSON data:</h3>\";\r\n\t//append GeoJson data to the htmlString heading\r\n\thtmlString += JSON.stringify(data);\r\n\t//using... | [
"0.76437885",
"0.72010005",
"0.70321035",
"0.689157",
"0.6668895",
"0.6657284",
"0.6529863",
"0.6056403",
"0.59984183",
"0.59901464",
"0.5979752",
"0.58380955",
"0.5793257",
"0.5785639",
"0.57754344",
"0.5774364",
"0.576772",
"0.57385194",
"0.57264936",
"0.5683247",
"0.565087... | 0.7825709 | 0 |
debugAjax function is what defines the mydata variable, as well as helps execute the debugCallback function. | function debugAjax(){
//mydata variable is defined.
var mydata;
//ajax() is a jQuery method to have an AJAX request
//brings in the GeoJSON file from my data folder
$.ajax("data/MegaCities.geojson", {
//data type is json
dataType: "json",
//success brings the debugCallback function that is needed.
success:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initialize(){\n debugAjax();\n}",
"function debugAjax(){ //sets up debugAjax function\n\t\n\n\t$.ajax(\"../data/MegaCities.geojson\", { //calls the JQueryAjax method that requests the geojson data\n\t\tdataType: \"json\", //formats the data that is called from the server\n\t\tsuccess: function(respon... | [
"0.72028273",
"0.71845996",
"0.6991306",
"0.68255925",
"0.6686279",
"0.6518193",
"0.6297279",
"0.6269473",
"0.62599564",
"0.6246293",
"0.6145185",
"0.6065793",
"0.6055216",
"0.60292643",
"0.60287446",
"0.6005647",
"0.5994014",
"0.5878382",
"0.58353525",
"0.5831477",
"0.580316... | 0.8287944 | 0 |
Update the page background to current version of currentAverageHue. | updateAppBackground() {
appBackgroundElement.style.backgroundColor =
this.hslFromHue(currentAverageHue);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updatePageBackground() {\n\n\t\tconsole.debug( 'Update background' );\n\n\t\tvar tmp = renderResult();\n\t\tpageBackground.style.backgroundImage = 'url(' + tmp.toDataURL() + ')';\n\t}",
"function updateColors() {\n SKIN.options.container = PAGE_BG_COLOR;\n if (SCHEME_NAME === 'custom') {\n... | [
"0.62666243",
"0.6063284",
"0.5923036",
"0.5922151",
"0.59093225",
"0.5735783",
"0.5698662",
"0.5683403",
"0.5637389",
"0.55421746",
"0.55396473",
"0.5533201",
"0.55286884",
"0.55185586",
"0.5509697",
"0.5502561",
"0.55009806",
"0.5495067",
"0.5448634",
"0.5409265",
"0.539070... | 0.75895005 | 0 |
Update the specified input element's background color. element = DOM element | updateInputBackground(element) {
element.style.backgroundColor = this.hslFromHue(element.value);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setFormElementBackgroundColor(element, newColor) {\n element.style.backgroundColor=newColor;\n}",
"function colorFull(element) {\n let color = pickColor.val();\n $(element).css(\"background-color\",color);\n}",
"function changeInputColor(color) {\n myInput.style.backgroundColor = color;\n}"... | [
"0.7542244",
"0.7335378",
"0.72649693",
"0.7238346",
"0.7095769",
"0.7080179",
"0.70665854",
"0.703659",
"0.6986035",
"0.69170976",
"0.6912735",
"0.69091046",
"0.6869525",
"0.682627",
"0.67868453",
"0.6784814",
"0.6715559",
"0.663267",
"0.661253",
"0.6578673",
"0.65103686",
... | 0.85306877 | 0 |
seperateString() always returns false and accepts html node as parameter. seperateString will resize elements fontsize value until all text fits on one line. | function seperateString(obj){
obj.text = obj.node.innerHTML;
var list = [];
var playerName = obj.text.split("");
var addSpans = inputSpan(obj.node, list);
obj.currentFontSize = obj.maxFontSize;
obj.offset = obj.node.getBoundingClientRect();
// clears element
obj.node.innerHTML = "";
playerName.forEa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doubleTextSize(){\r\n var x = document.querySelectorAll('p, h1, h2, h3, h4, h5, h6');\r\n var text = \"\";\r\n var style1 = \"\";\r\n var size = \"\";\r\n\r\n var i;\r\n\r\n //If they are not doubled in size make them double in size.\r\n if(!switched)\r\n {\r\n for(i = 0; i < x.length; i++)\r\n... | [
"0.5514556",
"0.52330047",
"0.5207194",
"0.5113195",
"0.5068784",
"0.50396705",
"0.50293833",
"0.49952316",
"0.4989175",
"0.49464914",
"0.4908867",
"0.48940465",
"0.48940465",
"0.48366538",
"0.4816681",
"0.48126978",
"0.47917864",
"0.47788364",
"0.47551233",
"0.47522402",
"0.... | 0.5859566 | 0 |
check if hours worked is valid | function checkHoursWorked(hours) {
/*var nstring = "0." + num.substring(2);
var integer = parseFloat(nstring);
integer = integer * 60;
if (integer % 15 != 0) {
alert("Hours Worked is invalid, it must be in fifteen-minute intervals. E.g. 1.50, 2.75, 3.25 or 1.00.")
document.getElement... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isWorkingHours(time){\n let date = new Date(time);\n if(date.getHours() >= 6 && date.getHours() < 18){\n return true;\n }\n return false;\n }",
"function test(expected, input){\n if(parseHours(input) !== expected)\n \tconsole.log(\"ParseHours Problem with: \"+input... | [
"0.74551105",
"0.70334935",
"0.6918864",
"0.68147707",
"0.67895216",
"0.6787551",
"0.6711307",
"0.6660803",
"0.6612227",
"0.6591392",
"0.65223444",
"0.64979833",
"0.64921016",
"0.64507204",
"0.6443741",
"0.6404736",
"0.6393926",
"0.6393015",
"0.6354811",
"0.63232845",
"0.6316... | 0.73320556 | 1 |
function to set the default date to current date | function setDateDefault() {
document.getElementById("txtDateWorked").valueAsDate = new Date();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setDateToToday()\n {\n var today = new Date();\n\n /* The following idiocy is due to bizarre incompatibilities\n\t in the behaviour of getYear() between Netscrape and\n\t Exploder. The ideal solution is to use getFullYear(),\n\t which returns the actual year number, but that would\n\t bre... | [
"0.7605655",
"0.74218285",
"0.7408326",
"0.73034966",
"0.7263869",
"0.71207905",
"0.6997361",
"0.69360167",
"0.689659",
"0.68880695",
"0.6815339",
"0.6809548",
"0.68020034",
"0.6795867",
"0.67745066",
"0.6611788",
"0.66071725",
"0.6593994",
"0.657158",
"0.6562896",
"0.6524902... | 0.7475556 | 1 |
Creates a new instance of the Camera2dCanvasContextBuilder object. | function Camera2dCanvasContextBuilder(camera) {
this._camera = camera;
this._canvasCenter = this._camera.Position.Clone();
this._translated = false;
this._translationState = [];
this._translationState.push(this._translat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"init() {\n const wrapper = document.getElementById('canvasWrapper');\n let newCanvas;\n if (!document.querySelector('canvas')) {\n newCanvas = document.createElement('canvas');\n newCanvas.width = this.width;\n newCanvas.height = this.height;\n newCa... | [
"0.6568524",
"0.63615865",
"0.63057613",
"0.6229642",
"0.6074754",
"0.60472184",
"0.5992297",
"0.59699535",
"0.5918892",
"0.59171623",
"0.5885952",
"0.58582515",
"0.58243114",
"0.5815007",
"0.5809433",
"0.5798941",
"0.5798941",
"0.5798269",
"0.57893974",
"0.5784705",
"0.57722... | 0.8340119 | 0 |
function to update the object in the localstorage | function dataObjectUpdated() {
//set item in localstorage in JSON string format
localStorage.setItem('todoList', JSON.stringify(data))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateLocalStorage() {\n objString = '{\"nextId\": \"' + nextId + '\"}';\n convertObjectToString(root);\n localStorage.setItem(LOCAL_STORAGE, objString);\n }",
"function setLocalObject(objName, obj) {\n localStorage.setItem(objName, JSON.stringify(obj)); \n }",
"funct... | [
"0.7746035",
"0.7304827",
"0.727431",
"0.7118166",
"0.7114596",
"0.71087694",
"0.7107203",
"0.7093137",
"0.70708555",
"0.7068503",
"0.7026209",
"0.7021034",
"0.70001197",
"0.69412655",
"0.6919845",
"0.69067806",
"0.68990797",
"0.68925923",
"0.68862325",
"0.6856541",
"0.685515... | 0.7437943 | 1 |
generates a disaster popup for the given disaster | function generateDisasterPopup(x, y, disaster) {
var tempDisaster = new Disaster(0, 0, disaster);
var deaths = tempDisaster.deaths(100);
var damage = tempDisaster.destruction(100);
var deathsString = "Deaths: ";
var damageString = "Damage: ";
if(deaths < 10) {
deathsString += "Low";
} else if(deaths ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function seatPopup(id, array)\n{\n\tvar index=getIndex(id, array);\n\tif (index != null)\n\t{\n\tpreurl = 'student_stats.html?id=';\n\turl = preurl + id;\n\twindow.open(url,'popUpWindow','height=500,width=800,left=300,top=100,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=0, directories=no, status=no');... | [
"0.62270975",
"0.6207661",
"0.61871016",
"0.6088865",
"0.6070296",
"0.5976509",
"0.5899992",
"0.5837034",
"0.5828308",
"0.5819846",
"0.5804526",
"0.5777704",
"0.5768041",
"0.5760343",
"0.5759343",
"0.56686276",
"0.5652508",
"0.56485415",
"0.5633768",
"0.56298083",
"0.5619929"... | 0.8277051 | 0 |
creates disaster at x, y with type | constructor(x, y, type) {
this.x = x;
this.y = y;
this.type = type;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Target(x, y, type) {\n this.x = x;\n this.y = y;\n this.type = type;\n}",
"function newElement(type, x, y) {\n const element = {\n type: type,\n x: x,\n y: y,\n width: 0,\n height: 0\n };\n generateShape(element);\n return element;\n}",
"function createMonster(number, x, y) {\n\t... | [
"0.584566",
"0.5795619",
"0.57336986",
"0.56389916",
"0.5615751",
"0.5580582",
"0.5567819",
"0.5419042",
"0.5401269",
"0.53916615",
"0.5389356",
"0.5372395",
"0.5298957",
"0.529544",
"0.52850837",
"0.52779603",
"0.52318335",
"0.521317",
"0.5208174",
"0.51919276",
"0.51887274"... | 0.63762724 | 1 |
calculate deaths based on population | deaths(population) {
return Math.min(population, population * .2 * this.type.populationDamageFactor * (1 + (this.type.level - 1) * .1));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function death(agent) {\n console.log('death: agent.parameters = ' + JSON.stringify(agent.parameters));\n // Currently we only support country-wide metrics, but you can extend\n // this webhook to use other location parameters if you want.\n // See the comment in queryCovid19dataset function.\n var country = ... | [
"0.64620596",
"0.6440211",
"0.6289695",
"0.6237395",
"0.609023",
"0.5958577",
"0.5767984",
"0.5732609",
"0.5672664",
"0.5669985",
"0.5557002",
"0.5542002",
"0.5533531",
"0.55279",
"0.5517559",
"0.5495464",
"0.5491554",
"0.54630494",
"0.54630494",
"0.54405487",
"0.54278964",
... | 0.78931916 | 0 |
Return a function that filters a result object or array and picks only the fields passed as `params.query.$select` and additional `otherFields` | function select(params, ...otherFields) {
cov_w3vwktd8z.f[1]++;
const fields = (cov_w3vwktd8z.s[12]++, (cov_w3vwktd8z.b[1][0]++, params) && (cov_w3vwktd8z.b[1][1]++, params.query) && (cov_w3vwktd8z.b[1][2]++, params.query.$select));
cov_w3vwktd8z.s[13]++;
if ((cov_w3vwktd8z.b[3][0]++, Array.isArray(fie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"filter() {\n //remove fields for pagination, sroting and limiting in req.query, which go in the options\n //object for mongo query, not the filter object\n //if dont remove then mongo will look for properties with this name\n const queryObj = { ...this.queryObj }; //create copy do remov... | [
"0.6105633",
"0.6069365",
"0.60315496",
"0.58695424",
"0.5677933",
"0.5671138",
"0.5630873",
"0.5573065",
"0.54307175",
"0.5369087",
"0.5364384",
"0.5357999",
"0.53444356",
"0.53430694",
"0.5335352",
"0.5319132",
"0.53048104",
"0.5292849",
"0.526946",
"0.5246174",
"0.5211553"... | 0.6486065 | 0 |
Retrieve Comparison Criteria for the current product | function loadProductComparisonCriteria() {
$rootScope.local_load = true;
metaService.getSingleProduct($scope.product_uid,(product)=>{
$scope.product = product;
if(product.comparisons){
$scope.comparison_keys = Object.keys($scope.product.comparisons);
$scope.comparison_count = $scope.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getComparisonOptions() {\n return getOptionsWithDescriptions(COMPARISON_OPTIONS);\n }",
"function compareByPrice(prod1, prod2)\n{\n return prod1.price - prod2.price;\n}",
"function getCriteria(){\n\tvar queryString=\"\";\n\tvar ret=\"\";\n\tsearchCriteria=\"\";\n\tvar x=document.getElementB... | [
"0.5837525",
"0.5684414",
"0.5592898",
"0.55002546",
"0.5472159",
"0.53743553",
"0.52938753",
"0.52938753",
"0.52938753",
"0.5245851",
"0.5224664",
"0.52010965",
"0.5099949",
"0.5018451",
"0.5018451",
"0.5018451",
"0.5018451",
"0.5018451",
"0.5018451",
"0.5010014",
"0.4997887... | 0.640634 | 0 |
Function that moves ship forward Gets position and rotation, and uses static array to calculate the amount of movement per direction | function move_forward () {
var ship = $('#ship');
$(ship).stop();
clearTimeout(t);
if (t) {
gravity_stop();
}
if (agent.webkit) {
var deg = $(ship).css(transformation_html);
}
if (agent.mozilla) {
var deg = $(ship).attr('style');
}
deg = parseInt(deg.replace(/[\D]{1,200}/, ''));
var b ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcMovement(params){\n\tvar angle = params.angle;\n\n\t// Base angles: 0, 90, 180, 270, 360\n\tvar baseMovements = [[1, 0, -1], [0.5, -1, 0.5], [-1, 0, 1], [-0.5, 1, -0.5], [1, 0, -1]];\n\t\n\tvar quarter = 0;\n\n\twhile (angle < 0) {\n\t\tangle += 360;\n\t}\n\n\twhile (angle >= 360) {\n\t\tangle -= 360;... | [
"0.6507796",
"0.65025324",
"0.64150614",
"0.6373676",
"0.63498205",
"0.62974876",
"0.62854993",
"0.62771064",
"0.6185527",
"0.6176618",
"0.61643535",
"0.6146363",
"0.61012685",
"0.6087394",
"0.6061053",
"0.6040131",
"0.601712",
"0.6010262",
"0.5973759",
"0.5949748",
"0.592047... | 0.68742186 | 0 |
for adding new box | function addNewBox () {
if (input.value == "") {
return false;
} else {
index++;
var newDiv = document.createElement("div");
var inputValue = document.createTextNode(input.value);
parent.appendChild(newDiv);
newDiv.appendChild(inputValue)
newDiv.setAttribute... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createBox()\n\t{\n\t\tbox = that.add('rect', {\n\t\t\tcolor: style.boxColor,\n\t\t\tborderWidth: style.borderWidth,\n\t\t\tborderColor: style.borderColor,\n\t\t\tdepth: that.depth\n\t\t}, fw.dockTo(that));\n\t}",
"function addBox(width, height, center = [0, 0, 1]) {\n let object = {\n name: ... | [
"0.7671136",
"0.73761266",
"0.7332449",
"0.7209026",
"0.70939726",
"0.70798135",
"0.70741904",
"0.7041414",
"0.7004764",
"0.69906396",
"0.68894655",
"0.6862296",
"0.6831497",
"0.6808073",
"0.6803775",
"0.67999166",
"0.6751626",
"0.6685914",
"0.6679383",
"0.6657075",
"0.662806... | 0.7581307 | 1 |
Usage: ```javascript var userScale = scale() .domain(0, 10) .range(0,100); userScale(2); => 20 userScale.range(100, 0); userScale(2); => 80 ``` | function scale() {
var domain = [];
var range = [];
var _scale = function(x) {
if (domain.length < 2) {return _scale;}
if (range.length < 2) {return _scale;}
x = Math.max(x, domain.min);
x = Math.min(x, domain.max);
var x2 = distance(domain[0], x);
var rangeVal = x2/domain.distance * range.distance;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Scale() {\n var domain = new Normalizer(0, 1);\n var range = new Interpolater(0, 1);\n var s = function(val) {\n return range(domain(val));\n };\n s.domain = function(min, max) {\n if (!arguments.length) return domain;\n domain = new Normalizer(min, max)\n return s\n };\n s.range = func... | [
"0.7543172",
"0.74944276",
"0.74018943",
"0.73052377",
"0.7118361",
"0.711764",
"0.7102989",
"0.7035901",
"0.69685966",
"0.68399304",
"0.6788684",
"0.6788684",
"0.67546654",
"0.6693478",
"0.6691938",
"0.6613859",
"0.6586926",
"0.65641755",
"0.65637547",
"0.6507507",
"0.650531... | 0.7962557 | 0 |
Create an element by name with optional text content and attributes. | function element(name, content, attributes) {
var e = $(document.createElement(name));
if (content) { e.append(content); }
for (var a in attributes) { e.attr(a, attributes[a]); }
return e;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function elt(name, attributes) {\n var node = document.createElement(name);\n if (attributes) {\n for (var attr in attributes)\n if (attributes.hasOwnProperty(attr))\n node.setAttribute(attr, attributes[attr]);\n }\n for (var i = 2; i < arguments.length; i++) {\n var child = arguments[i];\n ... | [
"0.7549945",
"0.7549945",
"0.7530028",
"0.7237056",
"0.71920717",
"0.7151843",
"0.7113152",
"0.6994195",
"0.69465834",
"0.69394696",
"0.69005686",
"0.6844176",
"0.68288237",
"0.68268245",
"0.68267554",
"0.67625177",
"0.6753732",
"0.6752476",
"0.6735013",
"0.67146426",
"0.6698... | 0.77667284 | 0 |
Initialize isotope layout only if there is a indexisotope container element on a page and the device in use is not a phone or a tablet | function initiate_isotope() {
var is_origin_left = true;
if($('body').hasClass('rtl')){
is_origin_left = false;
}
if($('.index-isotope').length && (not_display_type("tablet") || (is_display_type("tablet") && $('body').hasClass('menu-position-top') && $('body').hasClass('no-sidebar'))) && not_displ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function izotopInit() {\n if ($('.izotope-container').length) {\n var $container = $('.izotope-container');\n $container.isotope({\n itemSelector: '.item',\n layoutMode: 'masonry',\n masonry: {\n columnWidth: '.grid-sizer'\n }\n });\n $('.filter-mob-list'... | [
"0.67752206",
"0.6621696",
"0.66144186",
"0.6470699",
"0.6373989",
"0.63057774",
"0.62515885",
"0.6237286",
"0.6205331",
"0.612529",
"0.5991913",
"0.5902634",
"0.58861125",
"0.5851404",
"0.58470356",
"0.58418787",
"0.5814772",
"0.58053994",
"0.5782184",
"0.57807016",
"0.57651... | 0.75984913 | 0 |
function to create and update tree view and add watcher on a file | updateTreeView(path, type) {
// function to create tree view
let merge = (treeView, tempView, type) =>{
// temp View has a single key always
key = Object.keys(tempView);
// if key not present then add it to treeView object
if(Object.keys(treeView).indexOf(key[0]) == -1)
{
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_register() {\n // let relativeStartIndex = this.root.length + 1\n // let pathRelativeToRoot = (absolutePath) => {\n // return absolutePath.substr(relativeStartIndex)\n // }\n \n let watcher = this.watcher\n // add\n watcher.on(\"add\", (filepath) => {\n \n invokeNodeChildEventC... | [
"0.700824",
"0.646052",
"0.63591415",
"0.62742627",
"0.6185055",
"0.61545557",
"0.61144894",
"0.6002367",
"0.59602684",
"0.59581137",
"0.58758026",
"0.5861652",
"0.5834459",
"0.5822362",
"0.5770883",
"0.5765783",
"0.5750668",
"0.5747342",
"0.57334316",
"0.5731891",
"0.5689938... | 0.7035214 | 0 |
clear all tariff inputs | function clearAllTariff(){
clearkmfields();
clearhrfields();
clearperdaykmfields();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"reset() {\n this.droppedFiles = null;\n this.el.classList.remove('is-uploading');\n this.inputEl.value = '';\n }",
"clearAll() {\n this.clearGraphic()\n this.clearData()\n }",
"clear() {\n this._selectedFilesMetaData = [];\n this.uploadResponse = [];\n this.modelValue = [];\n }",
"... | [
"0.70839924",
"0.65536726",
"0.6537655",
"0.6495287",
"0.64372694",
"0.64016235",
"0.63760734",
"0.63644475",
"0.63469607",
"0.63445807",
"0.6325006",
"0.63201076",
"0.63115144",
"0.63061076",
"0.6286315",
"0.6252064",
"0.62503946",
"0.6228881",
"0.618597",
"0.6182798",
"0.61... | 0.7727853 | 0 |
calculate amount with time string and hourly rate | function calculateHrsAmount(time_str,hrsrate){
var parts = time_str.split(':');
var hr_amount = 0;
var min_amount = 0;
if(hrsrate != ''){
if(parts[0]){
var hrs = Number(parts[0]);
hr_amount = hrs*hrsrate;
}
if(parts[1]){
var mns = Number(parts[1]);
if(mns >0 && mns < 16){
min_amount = hrsrat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateHrsAmount(time_str,hrsrate){\n\t\n\t\tvar parts = time_str.split(':');\n\t\tvar hr_amount = 0;\n\t\tvar min_amount = 0;\n\t\tif(hrsrate != ''){\n\t\t\tif(parts[0]){\n\t\t\t\tvar hrs = Number(parts[0]);\n\t\t\t\thr_amount = hrs*hrsrate;\n\t\t\t}\n\t\t\tif(parts[1]){\n\t\t\t\tvar mns = Number(parts... | [
"0.69567984",
"0.6267435",
"0.61833787",
"0.6042222",
"0.6016563",
"0.59566414",
"0.58914447",
"0.5868504",
"0.58628106",
"0.5862651",
"0.5860083",
"0.58522123",
"0.58484584",
"0.58228236",
"0.5817338",
"0.5812585",
"0.5806483",
"0.5784191",
"0.577381",
"0.5771877",
"0.575787... | 0.70411813 | 0 |
get tariff details into trip voucher inputs | function getTariff(minimum_kilometers,rate,additional_kilometer_rate)
{
var total_km = $('.totalkm').val();
var base_amount = minimum_kilometers * rate;
var adt_km = 0;
if(total_km > minimum_kilometers){
adt_km = total_km - minimum_kilometers;
}
var adt_amount = adt_km * additional_kilometer_rate;
var total... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getTariffForm() {\n\n \tvar tariffFormInput = {\n \t\t\t\t\t\t\t\"Entity_object\" : 'FACILITY',\n \t\t\t\t\t\t\t\"CATEGORY_CODE\" : 'TARIFF',\n \t\t\t\t\t\t };\n if (facilityId) {\n \t tariffFormInput.facility_id = facilityId\n }\n\n var deferred = $q.defer();\n if (fa... | [
"0.5562769",
"0.5142265",
"0.5009667",
"0.49379462",
"0.48992053",
"0.48975676",
"0.48946592",
"0.4892868",
"0.48211634",
"0.47946355",
"0.479315",
"0.47724572",
"0.47686198",
"0.47654065",
"0.47651508",
"0.47647858",
"0.474889",
"0.47366902",
"0.4732493",
"0.47321004",
"0.47... | 0.5355798 | 1 |
feeds the food array to the renderedList to fix performance | addToRenderedList() {
if (this.state.renderedArray.length <= 5) {
let renderedArray = this.state.renderedArray;
let foodArray = this.state.foodArray;
if (this.state.foodArray.length > 5) {
renderedArray = renderedArray.concat(foodArray.slice(0, 5));
foodArray = foodArray.slice(5);... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function genFoodList(searchAr) {\n\t\t\t\t\t//var foodsAr = [];\n\t\t\t\t\t_.each(searchAr, function(elem, idx) {\n\t\t\t\t\t\tapp.food = new app.Food();\n\t\t\t\t\t\tapp.food.set('id', elem.fields.item_id);\n\t\t\t\t\t\tapp.food.set('name', elem.fields.item_name);\n\t\t\t\t\t\tapp.food.set('brandName', elem.field... | [
"0.6559634",
"0.64811534",
"0.64661044",
"0.6455577",
"0.64330184",
"0.6372514",
"0.6296485",
"0.6250268",
"0.62315726",
"0.62190473",
"0.6202096",
"0.6172376",
"0.61501646",
"0.61426127",
"0.6132875",
"0.6117064",
"0.6078378",
"0.6078271",
"0.60690475",
"0.6046874",
"0.60468... | 0.65864074 | 0 |
this example, is working with a single datatype, called boolean, and using our knowledge of 'number operations' we use every day to build simple 'step by step logic' here we will combine our knowledge of string, number and boolean to achieve a simple 'repeat message operation' we will use a string, represented in aMess... | function repeatMessage(aMessage, numberOfTimes)
{
let aCount = 0; // set an initial value, so we are not undefined
while (aCount < numberOfTimes) // ask our boolean question and pass the result, true or false, to while
{
aCount = aCount + 1 // i did this instead of aCount++ because it is the same thing, aCount+... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function repeatMessageExcersizeExample(aMessage,numberOfTimes)\n\t{\n\tlet ifFinished = 'IS FINISHED'\n\tlet ifNotFinished = 'IS NOT FINISHED'\n\tlet currentCondition = ifNotFinished\n\n\tlet finishLoopCondition = ifFinished;\n\tlet aCounterToKeepTrackOf = 0;\n\twhile (finishLoopCondition != currentCondition)\n\t\... | [
"0.7343066",
"0.648064",
"0.54931176",
"0.54713756",
"0.5441034",
"0.53673804",
"0.5277513",
"0.52721685",
"0.52448326",
"0.52139884",
"0.5210237",
"0.52001625",
"0.5168495",
"0.5136794",
"0.51212",
"0.50750375",
"0.5062971",
"0.5053119",
"0.5039837",
"0.5029838",
"0.50207067... | 0.8059717 | 0 |
it could also be written as, like below here, using a technique called 'recursion', notice the use of 1 less variable required, let aCount = 0 is missing, instead, here, I decide to check again if aCount is not equal to zero, and I just make sure that before I 'call' my repeatMessageAlt function again, I give it a new ... | function repeatMessageAlt(aMessage, count)
{
if (count === 0) return false
else
{
console.log(aMessage);
repeatMessageAlt(aMessage,(count-1));
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function repeatMessage(aMessage, numberOfTimes)\n\t{\n\tlet aCount = 0; // set an initial value, so we are not undefined\n\twhile (aCount < numberOfTimes) // ask our boolean question and pass the result, true or false, to while\n\t\t{\n\t\taCount = aCount + 1 // i did this instead of aCount++ because it is the sa... | [
"0.7138241",
"0.6740949",
"0.5966795",
"0.59461516",
"0.58296955",
"0.5668519",
"0.55934626",
"0.5318514",
"0.53016174",
"0.52621496",
"0.522825",
"0.5175902",
"0.5173926",
"0.51558304",
"0.5155513",
"0.51450235",
"0.5142175",
"0.5128975",
"0.51099974",
"0.5098304",
"0.507666... | 0.81198144 | 0 |
NOTE: There are many ways to combine things, many points of view many technicques that are 'correct' some code can be better 'optimized' while other code may be suited to different circumstances or just not implemented as well. so when you see example code, undestand, it is not the only way, the thing you should look f... | function EX_11(messageBeforeCount, messageAfterCount, countMessage, countDownFrom)
{
// INSERT YOUR CODE HERE
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function count(){\n \n \n /* wszystko co jest na wyswietlaczu zostaje 'pociete' na numer1 i numer 2 */\n\n var screen = document.getElementById('screen');\n var length = screen.length;\n \n number2 = screen.value.substring(howManyDigits, length);\n number2 = Number(number2);\n \n // w zalezno... | [
"0.60003924",
"0.5758837",
"0.57053566",
"0.5638518",
"0.5630577",
"0.56170464",
"0.5569283",
"0.5565632",
"0.5562897",
"0.55342036",
"0.54874843",
"0.54462445",
"0.5437342",
"0.54371035",
"0.54370165",
"0.54129076",
"0.538933",
"0.5388404",
"0.53867275",
"0.537383",
"0.53703... | 0.68367136 | 0 |
Thus function generates a unique id based on a month, year and day. | function getUID(month, year, day){
if(month == 12){
month = 0;
year++;
}
monthString = "" + month;
yearString = "" + year;
dayString = "" + day;
if(day <= 9) {
dayString = "0" + dayString;
}
if(month <= 9) {
monthString = "0" + monthString;
}
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateObjectId(year, month, day) {\n var m = String(Number(month) - 1)\n var date = new Date();\n date.setFullYear(year);\n date.setMonth(m); // 0-11\n date.setDate(day);\n var timestamp = Math.floor(date.getTime() / 1000);\n var id = new mongoose.Types.ObjectId(timestamp);\n ret... | [
"0.79584837",
"0.7591157",
"0.70474476",
"0.7027659",
"0.70191544",
"0.70173",
"0.7011419",
"0.70004225",
"0.6965338",
"0.6897853",
"0.6881523",
"0.68077374",
"0.67697096",
"0.67332345",
"0.66889095",
"0.66761255",
"0.66740775",
"0.6665028",
"0.6639355",
"0.6609718",
"0.66097... | 0.76763433 | 1 |
Toggle between selected and unselected on users | toggleuser(event, uname) {
event.preventDefault();
// If not already selected
if (this.selectedusers.indexOf(uname) < 0) {
document.querySelector("#" + uname).setAttribute("class", "btn btn-primary selected");
this.selectedusers.push(uname);
// If already sele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"toggle() {\n this.selected = !this.selected;\n }",
"toggle() {\n this.selected = !this.selected;\n }",
"toggleSelected() {\n\t\t\tthis._selected = !this._selected;\n\t\t}",
"toggleSelected(options) {\n this.setSelected(options, true);\n }",
"toggle(value) {\n this.isSelected(valu... | [
"0.7153235",
"0.7153235",
"0.70752627",
"0.68343514",
"0.6832291",
"0.67676896",
"0.67676896",
"0.65766287",
"0.6501067",
"0.6482406",
"0.64396805",
"0.6387046",
"0.6339777",
"0.62919974",
"0.6226014",
"0.6180429",
"0.6139836",
"0.6129945",
"0.6097447",
"0.60834134",
"0.60747... | 0.76188564 | 0 |
________________________________________________________________________________________________ trim to num of letters retrim if in the middle of a word by substringing from letter 0 to the first space encountered via counting from the back(firsttrim.length) | function truncate(str, num) {
//trim to num# of letters
if (str.length > num) {
var firsttrim = str.substring(0,num);
//re-trim if in the middle of a word by substringing from letter 0 to the first space encountered via counting from the back(firsttrim.length)
firsttrim = firsttrim.substring(0, Math.min(firs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function strTrim(strng){\n if(ht == 0){ loc = 0; } // head clip\n else { loc = strng.length - 1; }// tail clip ht = 1 \n if( strng.charAt( loc ) == \" \"){\n aString = strng.substring( - ( ht - 1 ), strng.length - ht);\n aString = strTrim(aString);\n } else { \n var flg = false;\n ... | [
"0.66907126",
"0.6386783",
"0.61794215",
"0.6155084",
"0.6142883",
"0.610542",
"0.6083431",
"0.5994801",
"0.59752023",
"0.5956982",
"0.591891",
"0.59153044",
"0.58878285",
"0.58744293",
"0.5858329",
"0.58531326",
"0.58494425",
"0.5846496",
"0.58156914",
"0.5815",
"0.5793305",... | 0.65644425 | 1 |
________________________________________________________________________________________________ start at the end and repeating from the start, splice off "howMany" numbers. | function slasher(arr, howMany) {
// it doesn't always pay to be first
return arr.splice(howMany,arr.length-howMany);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function slasher(arr, howMany) {\n var splicedArray = [];\n arr.splice(0, howMany);\n return arr;\n}",
"function splice(array, start, count, ...values) {\n var narray = [];\n var count = Math.min(array.length - start, count);\n var difference = count - 0;\n var extra = shuffleUp(array, values.length, star... | [
"0.616319",
"0.6076927",
"0.6065764",
"0.6051743",
"0.6005554",
"0.5863108",
"0.5836631",
"0.5759622",
"0.56745994",
"0.5673485",
"0.56701434",
"0.5666026",
"0.56209666",
"0.5590997",
"0.5571999",
"0.55627805",
"0.55482787",
"0.55350184",
"0.55300045",
"0.5520109",
"0.5517857... | 0.6200204 | 0 |
________________________________________________________________________________________________ for the stuff in the arguments, first push anything not in an array into "targets" array, then push them into the first array, then remove the outer copies convert both the array and the "targets" array into a string, make ... | function destroyer(arr) {
// Remove all the values
var targets = [];
for (var i = 0; i < arguments.length; i++){
if (arguments[i].constructor !== Array ) {
targets.push(arguments[i]);
arr.push(arguments[i]);
delete arguments[i];
}
}
targets = targe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doReplace(target, arr) {\n var pattern;\n var index = 0;\n\n do {\n\n var arg = arr.shift();\n\n if (typeof arg === 'object') {\n for (var key in arg) {\n pattern = new RegExp('#\\\\{' + key + '\\\\}', 'g');\n target = target.replace(pattern, arg[key]);\n ... | [
"0.5742687",
"0.57356054",
"0.54718614",
"0.53878284",
"0.5265595",
"0.5257325",
"0.5072757",
"0.5041975",
"0.5040847",
"0.50386053",
"0.50237787",
"0.5005198",
"0.49479997",
"0.4946166",
"0.49099648",
"0.4896885",
"0.48869953",
"0.48835397",
"0.4873267",
"0.4843133",
"0.4838... | 0.67667025 | 1 |
Add new pending item to pending list | function addNewPendingItem(label) {
document.querySelector('.pending-items')
.insertAdjacentHTML('afterbegin', newPendingItemHTML(label));
// Add EventListeners to New Pending Items:
let trashButton = document.querySelector('.pending-items>li>.btn-delete-item')
trashButton.addEventListen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addPendingList(todo, item=null){\n // If new item is added\n if(todo){\n return {\n type: ADD_NEW_PENDING_LIST,\n payload: {\n count: store.getState()['totalItems']['count'],\n todo\n }\n }\n }\n // If existing item i... | [
"0.7353652",
"0.6782502",
"0.66830504",
"0.66748893",
"0.64084995",
"0.6389572",
"0.6384416",
"0.62707865",
"0.62680113",
"0.62570626",
"0.62248653",
"0.61947984",
"0.61754966",
"0.6174205",
"0.61692834",
"0.6157054",
"0.6143051",
"0.61223567",
"0.61170626",
"0.60913235",
"0.... | 0.70112026 | 1 |
Get Dummy Data for Example | function getDummyData()
{
return [
{EmpId:2, name:'Jitendra', Email: 'jz@gmail.com'},
{EmpId:1, name:'Minal', Email: 'amz@gmail.com'},
{EmpId:3, name:'Rudra', Email: 'ruz@gmail.com'}
];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _getDummyData(){\n return [\n {\n \"id\": \"fba28a4a-177d-444c-8901-3cf65232cfe8\",\n \"Company\": \"odlo-ch\",\n \"Url\": \"http://www.sap.com\",\n ... | [
"0.58088374",
"0.5559515",
"0.55586344",
"0.55113727",
"0.5366929",
"0.53613317",
"0.5263385",
"0.5254935",
"0.5237051",
"0.5226107",
"0.5197853",
"0.51882285",
"0.5181029",
"0.5151395",
"0.51102805",
"0.51091695",
"0.5106986",
"0.5101295",
"0.5074036",
"0.50445306",
"0.50330... | 0.57920146 | 1 |
funcao que prepara o valor do campo InputAutoSuggest e preenche o input de busca por Regiao | function fillInputRegiao(stringRegiao){
if((stringRegiao==undefined) || (stringRegiao=="")){
return false;
}else{
var jsonRegiao = JSON.parse(stringRegiao);
var arrayRegiao = $.map(jsonRegiao, function(value, index) {
return [JSON.stringify(value)];
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"checkAutoCompletion(targetInput) {\n if (!targetInput)\n return;\n if (targetInput.value) {\n // if value is already set, we set the value directly\n this.setAutoCompleteValue(targetInput.value);\n }\n else {\n // if value is not set, we start... | [
"0.6288316",
"0.6212177",
"0.6199375",
"0.6141484",
"0.6141484",
"0.6141484",
"0.6141484",
"0.6116108",
"0.6109675",
"0.61059135",
"0.60823584",
"0.6050947",
"0.5997365",
"0.59906435",
"0.59663147",
"0.5953461",
"0.5948397",
"0.5874247",
"0.58561313",
"0.5848356",
"0.5847733"... | 0.67566633 | 0 |
pide datos al servidor y muestra los markers en el mapa | async function getData() {
const response = await fetch('/api') // podria ser otra ruta , pero como este es un metodo GET, la mantengo
const data = await response.json();
console.log(data);
for (item of data) {
const marker =L.marker([item.lat, item.lon]).addTo(mymap);
const txt = ` el clima aqui ${ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initMap() {\n map = new google.maps.Map(document.getElementById(\"map\"), {\n center: { lat: -19.0543600132232, lng: -65.2539886472899 },\n zoom: 12,\n });\n\n var xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n ... | [
"0.74330807",
"0.7020931",
"0.7011396",
"0.6883361",
"0.67582655",
"0.6692655",
"0.6633836",
"0.6620974",
"0.6620397",
"0.66130465",
"0.65856564",
"0.65853816",
"0.65779966",
"0.6576381",
"0.6526509",
"0.6509412",
"0.6494781",
"0.64792114",
"0.6473925",
"0.6453906",
"0.645157... | 0.7155724 | 1 |
Retrieve the XML for the responses. | getResponsesXML(index) {
var content = "";
var responses = this.questions[index].getResponses();
var answers = this.decodeAnswers(this.questions[index].getType(), this.questions[index].getCorrectAnswers());
for (var i = 0; i < responses.length; i++) {
content = content + '<answer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getXML() {\n var content = this.getHeader();\n for (var i = 0; i < this.questions.length; i++) {\n content = content + this.getQuestionXML(i) + \"\\n\\n\";\n }\n content = content + this.getFooter();\n return content;\n }",
"function resolveResponseXML(request) {\n ... | [
"0.6267973",
"0.6114861",
"0.59102523",
"0.5894511",
"0.5719116",
"0.56002074",
"0.55944335",
"0.5567879",
"0.5564061",
"0.5540439",
"0.5540439",
"0.5508908",
"0.5490494",
"0.54796743",
"0.5471713",
"0.5409029",
"0.5376538",
"0.53743076",
"0.53451794",
"0.5309975",
"0.5280767... | 0.6137631 | 1 |
Same as `query_loop` but using a preallocated array. | function query_loop_preallocate(entities) {
let res = new Array(entities.length);
for (let i = 0; i < entities.length; i++) {
res[i] = [entities[i].a, entities[i].b];
}
return res;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function arrayManipulation(n, queries) {\n\n\n}",
"from(arr){\n let sq = SmallQuery.create();\n for(let i = 0, l = arr.length; i < l; i++){\n sq[i] = arr[i];\n }\n sq.length = arr.length;\n return sq;\n }",
"function do_loop(loop_pc, an_array, an_index, start_value, step, end_value) {\r\n\... | [
"0.6034449",
"0.5512727",
"0.5370579",
"0.53668237",
"0.5359351",
"0.51664674",
"0.5166432",
"0.51477736",
"0.51253307",
"0.51050186",
"0.50481325",
"0.5024709",
"0.5014383",
"0.49751925",
"0.49352407",
"0.48799458",
"0.48726958",
"0.48428145",
"0.4811334",
"0.4795084",
"0.47... | 0.561789 | 1 |
Inserts a new item or adds amount to existing cart item, based on SKU (first element) Uses existing inventory to check for quantity of desired items | add(item, Inventory) {
if (!this.isValid(item)) {
throw "Invalid item input, expected [SKU QUANTITY]";
}
item = this.normalize(item);
if (this.items.filter(i => i[0] == item[0]).length) { // item with SKU exists already
this.items = this.items.map(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addItem(item){\r\n\tvar found = false;\r\n\tfor(var i =0; i < inventory.length; i++){\r\n\t\tif(inventory[i].name == item.name){\r\n\t\t\tinventory[i].qty += item.qty;\r\n\t\t\tfound = true;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\tif(!found){\r\n\t\tinventory.push(assignItem(invMaster[item.name]));\r\n\t}\r\... | [
"0.7192048",
"0.71665287",
"0.71106774",
"0.7105135",
"0.7097745",
"0.70613194",
"0.7027305",
"0.70272577",
"0.7026214",
"0.70166194",
"0.6997501",
"0.6948593",
"0.69265586",
"0.6918259",
"0.69098395",
"0.69098395",
"0.6888832",
"0.6884829",
"0.6859824",
"0.68586713",
"0.6847... | 0.7733778 | 0 |
Prints the state of the cart with calculated prices and clears the cart state Uses Inventory of items | checkout(Inventory) {
let total = 0;
this.items.forEach(i => {
let [ sku, name, quantity, price ] = Inventory.get(i[0]);
console.log(`${name} ${i[1]} x ${price} = ${i[1] * price}`);
total += i[1] * price;
// update Inventory state
Inventory.it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showItems() {\n\tconst qty = getQty()\n\tcartQty.innerHTML = `You have ${qty} items in your cart.`\n\t//console.log(`You have ${qty} items in your cart.`)\n\n\tlet itemStr = ''\n\tfor (let i = 0; i < cart.length; i++) {\n\t\tlet itemTotal = cart[i].price * cart[i].qty\n\t\t//console.log(`- ${cart[i].name}... | [
"0.6787546",
"0.6661885",
"0.6538138",
"0.6528509",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"0.6496841",
"... | 0.68743 | 0 |
Produces the item with string elements cast to int | normalize(item) {
return item.map(x => parseInt(x));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function IntItem(str) {\n this.value = parseInt(str, 10);\n }",
"function get_int(str, index) {\n var orig = index;\n while (str[index] >= '0' && str[index] <= '9') {\n index++;\n }\n return { value: parseInt(str.slice(orig)), len: index - orig };\n}",
"function stringInt(str) {\n\treturn Numb... | [
"0.74199337",
"0.61686814",
"0.5974557",
"0.58750117",
"0.58056",
"0.5746145",
"0.57331145",
"0.5718769",
"0.56900454",
"0.5677667",
"0.5663745",
"0.56507236",
"0.56507236",
"0.56507236",
"0.5609077",
"0.56062365",
"0.56033444",
"0.5584061",
"0.5583686",
"0.55133986",
"0.5488... | 0.6366817 | 1 |
Default the return date if selecting return trip | function setReturnDate(isAutoTrainBookingPath){
var depDate = $('wdfdate1');
var retDate = $('wdfdate2');
var dateOnPage = getValidatedDateArray(1);
if (isValidDate(dateOnPage)) {
var dateOnPageObj = new Date(dateOnPage[0], (dateOnPage[1]-1), dateOnPage[2]);
dateOnPageObj.setDate(dateOnPageObj.getDate()+1);... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function returnDateParam () { \n if (roundTrip === false) { return 'N/A' }\n else if (flexReturnDate) { return 'Flex' }\n else { return flightSearchParams[4]}\n }",
"function setTripTypeIfReturnDateSelected(isAutoTrainBookingPath){\n\tif(isAutoTrainBookingPath == false) {\n if(docum... | [
"0.682172",
"0.66540956",
"0.6537187",
"0.61840695",
"0.58190393",
"0.57582265",
"0.57007015",
"0.55561525",
"0.55266625",
"0.5488224",
"0.54396176",
"0.54227173",
"0.5384781",
"0.5373331",
"0.53557813",
"0.5321239",
"0.52809715",
"0.52775323",
"0.52165484",
"0.52065295",
"0.... | 0.7106668 | 0 |
Auto select the return trip type button if the return date is populated | function setTripTypeIfReturnDateSelected(isAutoTrainBookingPath){
if(isAutoTrainBookingPath == false) {
if(document.getElementById('wdfdate2').value != '' || document.getElementById('wdftime2').selectedIndex > 0){
if (document.getElementById('oneway') != null)
document.getElementById('oneway').checked =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setReturnDate(isAutoTrainBookingPath){\n\tvar depDate = $('wdfdate1'); \n\tvar retDate = $('wdfdate2');\n\tvar dateOnPage = getValidatedDateArray(1);\n if (isValidDate(dateOnPage)) {\n\t\tvar dateOnPageObj = new Date(dateOnPage[0], (dateOnPage[1]-1), dateOnPage[2]);\n\t\tdateOnPageObj.setDate(dateOnPag... | [
"0.6620745",
"0.6312436",
"0.6253324",
"0.61304486",
"0.5876416",
"0.5842556",
"0.5735128",
"0.5720156",
"0.56875277",
"0.55970323",
"0.5578851",
"0.55598193",
"0.55021393",
"0.54954505",
"0.54730916",
"0.54728365",
"0.5469707",
"0.54619277",
"0.54555076",
"0.5424173",
"0.542... | 0.72722715 | 0 |
Compares the depart date field with the current date. If it is before then it resets the depart date field to today AIBE1998 | function compare_dates(dateid) {
var today = new Date();
var depart = Date.parse($(dateid).value);
var departDate = new Date(depart);
// If the depart date is before today then reset the field
if (!(today < departDate)) {
var text = formatDate(today);
$(dateid).value = text;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function departDateOnChange() {\n var returnNewMinDate = document.getElementById(\"departDateID\").value;\n var getReturnValue = document.getElementById(\"returnDateID\").value;\n\n document.getElementById(\"returnDateID\").setAttribute(\"min\", returnNewMinDate);\n\n if (returnNewMinDate > getReturnVa... | [
"0.59547734",
"0.5929144",
"0.58691114",
"0.58066946",
"0.5767054",
"0.5760514",
"0.5717503",
"0.56266594",
"0.56149936",
"0.5605433",
"0.5595993",
"0.55932766",
"0.5560889",
"0.5555735",
"0.5553897",
"0.5536592",
"0.55329835",
"0.5530611",
"0.5510305",
"0.54944366",
"0.54759... | 0.76024723 | 0 |
Extract the visitor object from the given plugin. | function getPluginVisitorAndOptions(ast, code, pluginItem) {
let plugin = pluginItem;
const pluginOptions = {
file: {ast, code},
opts: {},
};
if (Array.isArray(pluginItem)) {
plugin = pluginItem[0];
pluginOptions.opts = pluginItem[1];
}
if (typeof plugin === 'function') {
return [plugi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Visitor() {}",
"function Visitor() {}",
"function Visitor() {}",
"use(plugin) {\r\n if (typeof plugin !== 'object' || !plugin._isPuppeteerExtraPlugin) {\r\n console.error(`Warning: Plugin is not derived from PuppeteerExtraPlugin, ignoring.`, plugin);\r\n return this;\r\n... | [
"0.4844841",
"0.4844841",
"0.4844841",
"0.47913715",
"0.46597487",
"0.4602276",
"0.45651564",
"0.4538525",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"0.44983855",
"... | 0.57407475 | 1 |
Function to draw the frontier nodes | function DrawFrontierAgent(selector, h, w, problem) {
this.canvas = document.getElementById(selector);
this.canvas.innerHTML = '';
this.two = new Two({
height: h,
width: w
}).appendTo(this.canvas);
this.problem = problem;
this.nodeRadius = 15;
this.iterate = function() {
this.two.clear();
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"p5display() {\n this.nodes.forEach(node => {\n node.draw();\n })\n\n strokeWeight(1)\n\n this.edges.forEach(edge => {\n let realNode1 = this.nodes.find(node => node.name === edge.node1);\n let realNode2 = this.nodes.find(node => node.name === edge.node2)... | [
"0.6584798",
"0.6381646",
"0.6289903",
"0.62424517",
"0.6200826",
"0.6141532",
"0.60726655",
"0.6068344",
"0.60520434",
"0.6022484",
"0.5961044",
"0.5951974",
"0.5898269",
"0.58658904",
"0.5841565",
"0.5836172",
"0.5827036",
"0.5803113",
"0.57844466",
"0.5774746",
"0.5771809"... | 0.6538415 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.