Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
build geo database to `api/assets/geolite`
async function buildGeoLite() { // init geolite database url let url = 'https://cdn.jsdelivr.net/gh/GitSquared/node-geolite2-redist@master/redist/GeoLite2-Country.tar.gz'; if (process.env.MAXMIND_LICENSE_KEY) { url = 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=' + process.env.MAXMIND_LICENSE_KEY + '&suffix=tar.gz'; } // file infos const folder = path.resolve(__dirname, '../api/assets'); if (!fs.existsSync(folder)) { fs.mkdirSync(folder); } const zippedFile = path.join(folder, 'GeoLite2-Country.tar.gz'); // fetch database from remote await new Promise((resolve, reject) => { // file write stream const zippedFileStream = fs.createWriteStream(zippedFile); zippedFileStream.on('finish', () => { resolve(); }); // https request const request = https.get(url, (response) => { if (response.statusCode !== 200) { reject(new Error('failed to fetch geo database')); } response.pipe(zippedFileStream); }); // error handler const handleFailure = () => { fs.unlinkSync(zippedFile); reject(new Error('failed to write geo database file')); }; zippedFileStream.on('error', handleFailure); request.on('error', handleFailure); }); if (!fs.existsSync(zippedFile)) { throw new Error('failed to fetch geo database'); } // extract file await new Promise((resolve, reject) => { const zippedFileStream = fs .createReadStream(zippedFile) .pipe(zlib.createGunzip()) .pipe(tar.t()); zippedFileStream.on('error', () => { reject(new Error('failed to read compressed geo database')); }); zippedFileStream.on('entry', (entry) => { if (entry.path.endsWith('.mmdb')) { const file = path.join(folder, path.basename(entry.path)); const extractedFileStream = fs.createWriteStream(file); entry.pipe(extractedFileStream); extractedFileStream.on('error', () => { fs.unlinkSync(file); reject(new Error('failed to write extracted geo database')); }); extractedFileStream.on('finish', () => { resolve(); }); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function geoWrite(config, geoData) {\n // mongoose.connect(config.db);\n // var db = mongoose.connection;\n // var collection = db.collection('geo');\n // console.log(\"about to update\")\n // console.log(geoData);\n // collection.update({ _id: ObjectId(\"5773497a893c69e9b7a86dad\") }, { $push: {...
[ "0.6086823", "0.5971749", "0.5591861", "0.5364068", "0.5344317", "0.5341805", "0.52946705", "0.525791", "0.52495766", "0.5244347", "0.52382904", "0.5211483", "0.5194075", "0.51929337", "0.5191231", "0.5182689", "0.5163114", "0.5163105", "0.51567286", "0.5155177", "0.51371336"...
0.74019617
0
function for Opening the form modal
function openForm() { setTimeout(function () { document.querySelector(".bg-modal").style.display = "flex"; }, 250); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showPopupFormular() {\r\n $(\"#\" + global.Element.PopupFormular).modal(\"show\");\r\n }", "function openModalForm(){\n createForm();\n openModalWindow();\n}", "function showPopupElementFormular() {\r\n $(\"#\" + global.Element.PopupElementFormular).modal(\"show\");\r\n }", "fu...
[ "0.8050791", "0.8043072", "0.7801808", "0.76161504", "0.7606348", "0.76003146", "0.7569609", "0.7417896", "0.7369556", "0.72558624", "0.72436935", "0.72137374", "0.7212796", "0.7200347", "0.71990985", "0.7193316", "0.71826047", "0.71826047", "0.7181887", "0.7181887", "0.71778...
0.0
-1
function for closing the form modal
function closeForm() { setTimeout(function () { document.querySelector(".bg-modal").style.display = "none"; }, 250); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function close() {\n $modalInstance.dismiss();\n }", "function closeModal() {\n clearForm();\n props.onChangeModalState();\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n ...
[ "0.82786494", "0.80185705", "0.7909187", "0.7909187", "0.7909187", "0.7791786", "0.7750621", "0.7714938", "0.7652777", "0.76196045", "0.76196045", "0.76196045", "0.7617899", "0.76046133", "0.75742334", "0.75723326", "0.75723326", "0.75659204", "0.7557311", "0.7546813", "0.753...
0.7162215
83
there are 3 patterns to deal with aynchronous code: callbacks, prmoise, async/await
function getUser(id) { setTimeout(() => { console.log('Reading a user from database...'); return { id: id, gitHubUsername: 'Nilank Nikhil' }; }, 2000); return 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function someAsyncApiCall(callback) { callback(); }", "function async_io_normal(cb) {\n\n}", "async function helloCatAsync(callback) {\n console.log(\"2. callback here is the function passed as argument above...\")\n // 3. Start async operation:\n setTimeout(function () {\n console.log(\"3. start as...
[ "0.72206724", "0.6711249", "0.664578", "0.6581096", "0.6559593", "0.6488737", "0.64628863", "0.63935167", "0.637816", "0.63749075", "0.6334935", "0.633491", "0.62870884", "0.627751", "0.627751", "0.627751", "0.627751", "0.627751", "0.6244162", "0.62290543", "0.6191366", "0....
0.0
-1
this is run during init (from stackoverflow)
function setUrlParams(){ (window.onpopstate = function () { var match, pl = /\+/g, // Regex for replacing addition symbol with a space search = /([^&=]+)=?([^&]*)/g, decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, query = window.location.search.substring(1); urlParams = new setUrlParamDefaults(); while (match = search.exec(query)) urlParams[decode(match[1])] = decode(match[2]); })(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "__previnit(){}", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "function _init() {\n }", "function init() {\n\t \t\n\t }", "function init() {\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "init() {\n }", "fu...
[ "0.7408453", "0.7398333", "0.72870994", "0.7266828", "0.70448935", "0.70441484", "0.70441484", "0.70441484", "0.70441484", "0.70441484", "0.70297956", "0.70166373", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962768", "0.6962...
0.0
-1
file handling handler for new file selection
function loadFile(file) { //explicitly loaded files should start at the beginning window.location.hash = ''; //read file var reader = new FileReader(); reader.onload = function(e) { //clear view resetData(); generateMovie(e.target.result); } if(file) reader.readAsText(file); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fileSelected(data, evt) {\n /*jshint validthis: true */\n this.file = evt.target.files[0];\n if (this.file)\n this.filename(this.file.name);\n this.errorMessage('');\n }", "function handleFileSelect(e) {\n e.stopPropagation();\n e.preventDefault();\n\n var file = n...
[ "0.7215183", "0.7182604", "0.71252555", "0.71106064", "0.70418435", "0.7032427", "0.7028404", "0.7027565", "0.6983275", "0.6959631", "0.6896054", "0.6891452", "0.68791944", "0.6874909", "0.68583596", "0.68463135", "0.68230844", "0.67484", "0.67197675", "0.67115265", "0.667505...
0.0
-1
var colors = new Colors();
function GetAxiomTree() { var Waxiom = rules.axiom; var newf = rules.mainRule; var newb = 'bb'; var newx = rules.Rule2; var level = params.iterations; while (level > 0) { var m = Waxiom.length; var T = ''; for (var j=0; j < m; j++) { var a = Waxiom[j]; if (a == 'F'){T += newf;} else if (a == 'b'){T += newb;} else if (a == 'X'){T += newx;} else T += a; } Waxiom = T; level--; } return Waxiom; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Color() {}", "constructor(color){\n this.color = color\n }", "constructor() {\n\t\tthis.colors = ['red', 'pink', 'green', 'blue', 'yellow', 'purple', 'grey'];\n\t}", "function Color() { }", "constructor(coloring = []){\n this._coloring = coloring;\n }", "function Colour(rgb) {\n t...
[ "0.78174037", "0.7696213", "0.7669188", "0.7565268", "0.7455361", "0.7296242", "0.7123405", "0.7061253", "0.7023974", "0.70067036", "0.69883984", "0.69475466", "0.6870564", "0.6857136", "0.6839013", "0.68067133", "0.6763742", "0.6599667", "0.656793", "0.65335137", "0.6520825"...
0.0
-1
The draw function for the Tree which takes a empty geometry and inital position as input and returns geometry with added vertices
function DrawTheTree(geom, x_init, y_init, z_init){ var geometry = geom; var Wrule = GetAxiomTree(); var n = Wrule.length; var stackX = []; var stackY = []; var stackZ = []; var stackA = []; var stackV = []; var stackAxis = []; var theta = params.theta * Math.PI / 180; var scale = params.scale; var angle = params.angle * Math.PI / 180; var x0 = x_init; var y0 = y_init; var z0 = z_init ; var x; var y; var z; var rota = 0, rota2 = 0, deltarota = 18 * Math.PI/180; var newbranch = false; var axis_x = new THREE.Vector3( 1, 0, 0 ); var axis_y = new THREE.Vector3( 0, 1, 0 ); var axis_z = new THREE.Vector3( 0, 0, 1 ); var zero = new THREE.Vector3( 0, 0, 0 ); var axis_delta = new THREE.Vector3(), prev_startpoint = new THREE.Vector3(); var startpoint = new THREE.Vector3(x0,y0,z0), endpoint = new THREE.Vector3(); var bush_mark; var vector_delta = new THREE.Vector3(scale, scale, 0); for (var j=0; j<n; j++){ var a = Wrule[j]; if (a == "+"){angle -= theta; } if (a == "-"){angle += theta; } if (a == "F"){ var a = vector_delta.clone().applyAxisAngle( axis_y, angle ); endpoint.addVectors(startpoint, a); geometry.vertices.push(startpoint.clone()); geometry.vertices.push(endpoint.clone()); prev_startpoint.copy(startpoint); startpoint.copy(endpoint); axis_delta = new THREE.Vector3().copy(a).normalize(); rota += deltarota;// + (5.0 - Math.random()*10.0); } if (a == "L"){ endpoint.copy(startpoint); endpoint.add(new THREE.Vector3(0, scale*1.5, 0)); var vector_delta2 = new THREE.Vector3().subVectors(endpoint, startpoint); vector_delta2.applyAxisAngle( axis_delta, rota2 ); endpoint.addVectors(startpoint, vector_delta2); geometry.vertices.push(startpoint.clone()); geometry.vertices.push(endpoint.clone()); rota2 += 45 * Math.PI/180; } if (a == "%"){ } if (a == "["){ stackV.push(new THREE.Vector3(startpoint.x, startpoint.y, startpoint.z)); stackA[stackA.length] = angle; } if (a == "]"){ var point = stackV.pop(); startpoint.copy(new THREE.Vector3(point.x, point.y, point.z)); angle = stackA.pop(); } bush_mark = a; } return geometry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawTree(){\n drawLeaves();\n drawTrunk();\n penUp();\n}", "DrawTree()\n {\n\n }", "insertTreeVertexNode(tree, q_node) { \n\t\ttree.vertices.push(q_node);\n\t}", "function tree_init(q) {\n\n // create tree object\n var tree = {};\n\n // initialize with vertex for given configuratio...
[ "0.6588249", "0.6539659", "0.60968155", "0.6004436", "0.5975557", "0.59688026", "0.59235865", "0.59235865", "0.5895816", "0.5879113", "0.5870597", "0.5868967", "0.5859389", "0.5853435", "0.5836282", "0.58235264", "0.5771436", "0.5765022", "0.57234573", "0.57196176", "0.569927...
0.6361335
2
Some predefined rules for the Lsystem
function setRules0(){ rules.axiom = "F"; rules.mainRule = "F[--F++][F]"; params.iterations =1; params.theta = 12; params.scale = 16; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get rules() {\n\t\treturn [];\n\t}", "function ruleslanguage(hljs) {\n return {\n name: 'Oracle Rules Language',\n keywords: {\n keyword:\n 'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' +\n 'INTDADDATTRIBUTE|5 INTDADDVMSG|5 IN...
[ "0.6121276", "0.60369444", "0.60369444", "0.598585", "0.598585", "0.58960414", "0.572993", "0.5647609", "0.56428504", "0.5637207", "0.56331825", "0.56065226", "0.55734676", "0.55734676", "0.5549632", "0.55333686", "0.5476405", "0.54638815", "0.54311925", "0.54306453", "0.5429...
0.57895505
6
The draw function for the Tree which takes a empty geometry and Return cylindermesh!
function DrawTheTree2(geom, x_init, y_init, z_init){ var geometry = geom; var Wrule = GetAxiomTree(); var n = Wrule.length; var stackX = []; var stackY = []; var stackZ = []; var stackA = []; var stackV = []; var stackAxis = []; var theta = params.theta * Math.PI / 180; var scale = params.scale; var angle = params.angle * Math.PI / 180; var x0 = x_init; var y0 = y_init; var z0 = z_init ; var x; var y; var z; var rota = 0, rota2 = 0, deltarota = 18 * Math.PI/180; var newbranch = false; var axis_x = new THREE.Vector3( 1, 0, 0 ); var axis_y = new THREE.Vector3( 0, 1, 0 ); var axis_z = new THREE.Vector3( 0, 0, 1 ); var zero = new THREE.Vector3( 0, 0, 0 ); var axis_delta = new THREE.Vector3(), prev_startpoint = new THREE.Vector3(); // NEW var decrease = params.treeDecrease; var treeWidth = params.treeWidth; // END var startpoint = new THREE.Vector3(x0,y0,z0), endpoint = new THREE.Vector3(); var bush_mark; var vector_delta = new THREE.Vector3(scale, scale, 0); var cylindermesh = new THREE.Object3D(); for (var j=0; j<n; j++){ treeWidth = treeWidth-decrease; var a = Wrule[j]; if (a == "+"){angle -= theta;} if (a == "-"){angle += theta;} if (a == "F"){ var a = vector_delta.clone().applyAxisAngle( axis_y, angle ); endpoint.addVectors(startpoint, a); cylindermesh.add(cylinderMesh(startpoint,endpoint,treeWidth)); prev_startpoint.copy(startpoint); startpoint.copy(endpoint); axis_delta = new THREE.Vector3().copy(a).normalize(); rota += deltarota; } if (a == "L"){ endpoint.copy(startpoint); endpoint.add(new THREE.Vector3(0, scale*1.5, 0)); var vector_delta2 = new THREE.Vector3().subVectors(endpoint, startpoint); vector_delta2.applyAxisAngle( axis_delta, rota2 ); endpoint.addVectors(startpoint, vector_delta2); cylindermesh.add(cylinderMesh(startpoint,endpoint,treeWidth)); rota2 += 45 * Math.PI/180; } if (a == "%"){ } if (a == "["){ stackV.push(new THREE.Vector3(startpoint.x, startpoint.y, startpoint.z)); stackA[stackA.length] = angle; } if (a == "]"){ var point = stackV.pop(); startpoint.copy(new THREE.Vector3(point.x, point.y, point.z)); angle = stackA.pop(); } bush_mark = a; } return cylindermesh; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Tree() {\n\n this.mesh = new THREE.Object3D();\n var top = createCylinder( 1, 30, 30, 4, Colors.green, 0, 90, 0 );\n var mid = createCylinder( 1, 40, 40, 4, Colors.green, 0, 70, 0 );\n var bottom = createCylinder( 1, 50, 50, 4, Colors.green, 0, 40, 0 );\n var trunk = createCylinder( 10, 10,...
[ "0.6898562", "0.6708071", "0.6708071", "0.6635934", "0.6594494", "0.6302421", "0.625228", "0.61873144", "0.61303943", "0.60439575", "0.6031439", "0.60280377", "0.6002882", "0.5967892", "0.5916542", "0.59140736", "0.5893779", "0.5878236", "0.5820949", "0.5817835", "0.5817835",...
0.7074454
0
Convert vector between point X and Y to a cylinder...
function cylinderMesh(pointX, pointY,treeWidth) { var direction = new THREE.Vector3().subVectors(pointY, pointX); var orientation = new THREE.Matrix4(); orientation.lookAt(pointX, pointY, new THREE.Object3D().up); orientation.multiply(new THREE.Matrix4(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1)); var edgeGeometry = new THREE.CylinderGeometry(0.5, 0.5, direction.length(), 8, 1); var edge = new THREE.Mesh(edgeGeometry); edge.applyMatrix(orientation); // position based on midpoints - there may be a better solution than this edge.position.x = (pointY.x + pointX.x) / 2; edge.position.y = (pointY.y + pointX.y) / 2; edge.position.z = (pointY.z + pointX.z) / 2; return edge; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawcylinder(gl,canvas,a_Position,r,s,x1,y1,x2,y2){\r\n\r\n // ** DRAW CYLINDERS **\r\n //\r\n\r\n // multiply degrees by convert to get value in radians \r\n // a circle is 360 degrees, rotate by (360 / s) degrees for every side, where n is number of sides!\r\n const convert = Math.PI/180 \r\n co...
[ "0.6336584", "0.62820566", "0.62040854", "0.61241597", "0.60885936", "0.60264266", "0.59795725", "0.5966922", "0.596528", "0.596528", "0.5951377", "0.5938583", "0.58713025", "0.5854693", "0.5854693", "0.58434", "0.5820725", "0.5793484", "0.57743734", "0.5753707", "0.57500565"...
0.63864774
0
set this to false to stop Spam of "Activated Robotrimp MagnetoShriek Ability" Finish Challenge2
function finishChallengeSquared() { // some checks done before reaching this: // getPageSetting('FinishC2')>0 && game.global.runningChallengeSquared var zone = getPageSetting('FinishC2'); if (game.global.world >= zone) { abandonChallenge(); debug("Finished challenge2 because we are on zone " + game.global.world, "other", 'oil'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shouldFarmHackingSkill() {\n return true;\n }", "function Claim()\r\n\t{\r\n\t\t//Show_Solution(Sudoku_Solution);\r\n\t\tfor(var i=0; i<3; i++)\r\n\t\t{\r\n\t\t\tfor(var j=0; j<3; j++)\r\n\t\t\t{\r\n\t\t\t\tif(Claiming(i,j))\r\n\t\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", ...
[ "0.6115727", "0.59832543", "0.58398336", "0.5813325", "0.5813325", "0.56470424", "0.55181205", "0.5482211", "0.54789466", "0.54771143", "0.54616475", "0.5461621", "0.5454641", "0.5447134", "0.5416185", "0.541275", "0.536525", "0.5362943", "0.53395885", "0.53361195", "0.533456...
0.636713
0
Version 3.6 Golden Upgrades
function autoGoldenUpgradesAT() { var setting = getPageSetting('AutoGoldenUpgrades'); //get the numerical value of the selected index of the dropdown box try { if (setting == "Off") return; //if disabled, exit. var num = getAvailableGoldenUpgrades(); if (num == 0) return; //if we have nothing to buy, exit. //buy one upgrade per loop. var success = buyGoldenUpgrade(setting); //Challenge^2 cant Get/Buy Helium, so adapt - do Derskagg mod. var challSQ = game.global.runningChallengeSquared; var doDerskaggChallSQ = false; if (setting == "Helium" && challSQ && !success) doDerskaggChallSQ = true; // DZUGAVILI MOD - SMART VOID GUs // Assumption: buyGoldenUpgrades is not an asynchronous operation and resolves completely in function execution. // Assumption: "Locking" game option is not set or does not prevent buying Golden Void if (!success && setting == "Void" || doDerskaggChallSQ) { num = getAvailableGoldenUpgrades(); //recheck availables. if (num == 0) return; //we already bought the upgrade...(unreachable) // DerSkagg Mod - Instead of Voids, For every Helium upgrade buy X-1 battle upgrades to maintain speed runs var goldStrat = getPageSetting('goldStrat'); if (goldStrat == "Alternating") { var goldAlternating = getPageSetting('goldAlternating'); setting = (game.global.goldenUpgrades%goldAlternating == 0) ? "Helium" : "Battle"; } else if (goldStrat == "Zone") { var goldZone = getPageSetting('goldZone'); setting = (game.global.world <= goldZone) ? "Helium" : "Battle"; } else setting = (!challSQ) ? "Helium" : "Battle"; buyGoldenUpgrade(setting); } // END OF DerSkagg & DZUGAVILI MOD } catch(err) { debug("Error in autoGoldenUpgrades: " + err.message, "other"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "upgrade() {}", "static final private internal function m106() {}", "transient final protected internal function m174() {}", "private internal function m248() {}", "transient private internal function m185() {}", "private public function m246() {}", "function version(){ return \"0.13.0\" }", "transien...
[ "0.73138237", "0.64810467", "0.6443062", "0.63842195", "0.6379148", "0.6364988", "0.6344824", "0.6263174", "0.6259987", "0.61239207", "0.609727", "0.60332894", "0.59703374", "0.5967174", "0.5901337", "0.5901337", "0.5889574", "0.5877613", "0.5871053", "0.5856033", "0.5830225"...
0.0
-1
auto spend nature tokens
function autoNatureTokens() { var changed = false; for (var nature in game.empowerments) { var empowerment = game.empowerments[nature]; var setting = getPageSetting('Auto' + nature); if (!setting || setting == 'Off') continue; //buy/convert once per nature per loop if (setting == 'Empowerment') { var cost = getNextNatureCost(nature); if (empowerment.tokens < cost) continue; empowerment.tokens -= cost; empowerment.level++; changed = true; debug('Upgraded Empowerment of ' + nature, 'nature'); } else if (setting == 'Transfer') { if (empowerment.retainLevel >= 80) continue; var cost = getNextNatureCost(nature, true); if (empowerment.tokens < cost) continue; empowerment.tokens -= cost; empowerment.retainLevel++; changed = true; debug('Upgraded ' + nature + ' transfer rate', 'nature'); } else if (setting == 'Convert to Both') { if (empowerment.tokens < 20) continue; for (var targetNature in game.empowerments) { if (targetNature == nature) continue; empowerment.tokens -= 10; var convertRate = (game.talents.nature.purchased) ? ((game.talents.nature2.purchased) ? 8 : 6) : 5; game.empowerments[targetNature].tokens += convertRate; changed = true; debug('Converted ' + nature + ' tokens to ' + targetNature, 'nature'); } } else { if (empowerment.tokens < 10) continue; var match = setting.match(/Convert to (\w+)/); var targetNature = match ? match[1] : null; //sanity check if (!targetNature || targetNature === nature || !game.empowerments[targetNature]) continue; empowerment.tokens -= 10; var convertRate = (game.talents.nature.purchased) ? ((game.talents.nature2.purchased) ? 8 : 6) : 5; game.empowerments[targetNature].tokens += convertRate; changed = true; debug('Converted ' + nature + ' tokens to ' + targetNature, 'nature'); } } if (changed) updateNatureInfoSpans(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function twTokenStrong(stream, state) {\n var maybeEnd = false,\n ch;\n while (ch = stream.next()) {\n if (ch == \"'\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"'\");\n }\n return \"strong\";\n }", "function twTokenStrong(stream, ...
[ "0.5863265", "0.5863265", "0.58330864", "0.5793421", "0.56981754", "0.56959707", "0.54972523", "0.5487911", "0.5402416", "0.53890204", "0.5384637", "0.53822684", "0.53205913", "0.5316284", "0.5263694", "0.52555865", "0.52546984", "0.521633", "0.5209758", "0.5195845", "0.51811...
0.62111944
0
Check if currently in a Spire past IgnoreSpiresUntil
function isActiveSpireAT() { return game.global.spireActive && game.global.world >= getPageSetting('IgnoreSpiresUntil'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isPastCutoff() {\n return this.isTracking && Date.now() - this.pauses.last() > 5 * 60 * 1000\n }", "getExpiresIn() {}", "isExpired() {\n return this.expirationTime < msalCommon.TimeUtils.nowSeconds();\n }", "get expired() {\n if (this.expiresAt) {\n const now = Math.floor(Date...
[ "0.63156515", "0.59460473", "0.5745443", "0.5693015", "0.56757474", "0.55865324", "0.55576295", "0.5487151", "0.5472766", "0.54438704", "0.54003155", "0.5389266", "0.5375843", "0.53474784", "0.534482", "0.5264681", "0.5250081", "0.5219429", "0.52010095", "0.52005845", "0.5197...
0.6629535
0
Exits the Spire after completing the specified cell.
function exitSpireCell() { if(isActiveSpireAT() && game.global.lastClearedCell >= getPageSetting('ExitSpireCell')-1) endSpire(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exitSpireCell() { \n if(game.global.world == 200 && game.global.spireActive && game.global.lastClearedCell >= getPageSetting('ExitSpireCell')-1) \n endSpire(); \n}", "function exit() {\r\n if (\r\n snake[0].x < 0 ||\r\n snake[0].x > boardSize - cellSize ||\r\n snake[0].y < 0 ||...
[ "0.6708773", "0.59724855", "0.5608793", "0.55897707", "0.5581135", "0.5578321", "0.5554778", "0.5473993", "0.5440729", "0.5413619", "0.53994715", "0.5396247", "0.5391786", "0.5362772", "0.53435344", "0.53435344", "0.53435344", "0.53435344", "0.5325293", "0.5319718", "0.531341...
0.717676
0
save info to firebase
function saveContactInfo(name, email, message) { let newContactInfo = contactInfo.push(); newContactInfo.set({ name: name, email: email, message: message, }); retrieveInfos(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveToDB(book) {\n\tlet firebaseID = firebaseRef.push({\n\t\ttitle: book.title,\n\t\tauthor: book.author,\n\t\tpages: book.pages,\n\t\tread: book.read,\n\t}).key;\n\tbook.firebaseKey = firebaseID; // Add Firebase Key to object to be able to find and upd items on firebase\n}", "function sendToFirebase() ...
[ "0.73403907", "0.7223977", "0.7133635", "0.71329314", "0.71327555", "0.7105246", "0.7085891", "0.7059027", "0.7053349", "0.7037053", "0.6972085", "0.6971323", "0.69181395", "0.6901785", "0.68614864", "0.6848471", "0.6832074", "0.6831864", "0.67889655", "0.6771658", "0.6739188...
0.0
-1
retrieves list of SIGNIFICANT biomarkers over API and updates biomarker gene
async getBiomarkerTableData(score) { const { getPlotData } = this; const { drugId1, drugId2, dataset, } = this.state; let biomarkerCheck = true; // checks is there is any biomarker data available for a given dataset if (dataset) { await fetch(`/api/biomarkers/dataset/${dataset}/${score}`) .then(response => response.json()) .then((data) => { biomarkerCheck = data.biomarkers; }) .catch(() => { console.log('Unable to check biomarker data availability'); }); } if (biomarkerCheck) { let url = `/api/biomarkers/synergy?allowAll=true&type=${score}`; if (drugId1) url = url.concat(`&drugId1=${drugId1}`); if (drugId2) url = url.concat(`&drugId2=${drugId2}`); if (dataset) url = url.concat(`&dataset=${dataset}`); fetch(url, { method: 'GET', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, }) .then(response => response.json()) .then((data) => { const occurenceObj = {}; data.forEach((row) => { const { gene, drugA, drugB } = row; const key = `${gene}-${drugA}-${drugB}`; if (!occurenceObj[key]) { occurenceObj[key] = 1; } else { occurenceObj[key] += 1; } }); const processedData = data.map((row) => { const { gene, drugA, drugB } = row; const key = `${gene}-${drugA}-${drugB}`; return { ...row, occurrences: occurenceObj[key] }; }).sort((a, b) => { if (a.occurrences > b.occurrences) return -1; if (a.occurrences < b.occurrences) return 1; return 0; }); switch (score) { case 'zip': this.setState({ zipBiomarkers: processedData, loadingTable: false, }); break; case 'bliss': this.setState({ blissBiomarkers: processedData, loadingTable: false, }); break; case 'hsa': this.setState({ hsaBiomarkers: processedData, loadingTable: false, }); break; case 'loewe': this.setState({ loeweBiomarkers: processedData, loadingTable: false, }); break; default: break; } getPlotData( processedData[0].gene, score, { name: processedData[0].dataset, id: processedData[0].idSource }, ); }) .catch((err) => { console.log(err); this.setState({ loadingTable: false, loadingGraph: false, }); }); } else { this.setState({ loadingTable: false, loadingGraph: false, biomarkersAvailable: false, }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async retrieveGeneData(gene, dataset) {\r\n const {\r\n sample, drugId1, drugId2, biomarkerGeneStorage,\r\n selectedScore,\r\n } = this.state;\r\n // Checks if biomarker gene data has already been retrieved over API\r\n if (biomarkerGeneStorage[selectedScore]\r\n && biomarkerGeneStorage[...
[ "0.5867201", "0.51226395", "0.50003886", "0.49300683", "0.4908202", "0.48789683", "0.4871747", "0.4869367", "0.48645556", "0.4862381", "0.48595357", "0.48576158", "0.48504704", "0.48414898", "0.4810649", "0.47929314", "0.47552264", "0.47494516", "0.47177842", "0.47174838", "0...
0.4802124
15
Updates state with data that is needed to render expression profile plot, box plot and slider for a given gene
async getPlotData(gene, score, dataset) { try { const { retrieveGeneData } = this; const synergyArray = await retrieveGeneData(gene, dataset); // *************************** // Sets plot range // *************************** const paddingPercent = 0.05; let lowestFPKM = 0; let highestFPKM = 0; let lowestSynScore = 0; let highestSynScore = 0; synergyArray.forEach((item) => { if (item.fpkm < lowestFPKM) lowestFPKM = item.fpkm; if (item.fpkm > highestFPKM) highestFPKM = item.fpkm; if (item[score] < lowestSynScore) lowestSynScore = item[score]; if (item[score] > highestSynScore) highestSynScore = item[score]; }); const rangeFPKM = highestFPKM - lowestFPKM; let xRange; if (rangeFPKM) { xRange = [ lowestFPKM - rangeFPKM * paddingPercent, highestFPKM + rangeFPKM * paddingPercent, ]; } else { xRange = [-1, 1]; } const rangeSynScore = highestSynScore - lowestSynScore; const yRange = [ lowestSynScore - rangeSynScore * paddingPercent, highestSynScore + rangeSynScore * paddingPercent, ]; const synScoreArray = synergyArray.map(item => item[score]); const boxPlotData = synergyArray.map(item => ({ score: item[score], fpkm: item.fpkm })); synScoreArray.sort((a, b) => a - b); boxPlotData.sort((a, b) => a.score - b.score); const defaultThreshold = calculateThreshold(synScoreArray); this.setState({ selectedBiomarker: gene, selectedDataset: dataset, selectedScore: score, loadingTable: false, loadingGraph: false, biomarkerData: synergyArray, xRange, yRange, defaultThreshold, confirmedThreshold: null, boxPlotData, biomarkersAvailable: true, }); } catch (err) { console.log(err); this.setState({ loadingGraph: false, biomarkersAvailable: true, }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Changed(newSample) {\n// Fetch new data each time a new sample is selected\nbuildPlot(newSample);\noptionChanged(newSample);\n}", "addGenes() {\n const mappingTypes = this.state.mutationOptions.filter(d => d.selected).map(d => d.id);\n const profiles = this.state.molecularOptions.filter(d ...
[ "0.59132713", "0.5899463", "0.5863856", "0.58184355", "0.56355625", "0.5582816", "0.55715245", "0.5563501", "0.5562832", "0.55531603", "0.5546761", "0.5513617", "0.5490715", "0.5444991", "0.5418182", "0.5382886", "0.5379203", "0.53773487", "0.5363989", "0.5345762", "0.5334844...
0.0
-1
eturn data that is needed for expression profile and box plot
async retrieveGeneData(gene, dataset) { const { sample, drugId1, drugId2, biomarkerGeneStorage, selectedScore, } = this.state; // Checks if biomarker gene data has already been retrieved over API if (biomarkerGeneStorage[selectedScore] && biomarkerGeneStorage[selectedScore][dataset.name] && biomarkerGeneStorage[selectedScore][dataset.name][gene]) { return biomarkerGeneStorage[selectedScore][dataset.name][gene]; } try { // Retrieves data from the API and stores it in the state this.setState({ loadingGraph: true }); let queryParams = `?&dataset=${dataset.id}`; if (sample) queryParams = queryParams.concat(`&sample=${sample}`); if (drugId1) queryParams = queryParams.concat(`&drugId1=${drugId1}`); if (drugId2) queryParams = queryParams.concat(`&drugId2=${drugId2}`); let synergyArray; await fetch('/api/biomarkers/association'.concat(queryParams).concat(`&gene=${gene}`), { method: 'GET', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, }).then(response => response.json()) .then((data) => { synergyArray = data; }); // created a nested storage object with three levels // top level is synergy score, then dataset, then biomarker gene const updatedGeneStorage = { ...biomarkerGeneStorage }; if (!updatedGeneStorage[selectedScore]) updatedGeneStorage[selectedScore] = {}; if (!updatedGeneStorage[selectedScore][dataset.name]) { updatedGeneStorage[selectedScore][dataset.name] = {}; } updatedGeneStorage[selectedScore][dataset.name][gene] = synergyArray; this.setState({ biomarkerGeneStorage: updatedGeneStorage }); return synergyArray; } catch (err) { console.log(err); return []; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepareBoxplotData(rawData, opt) {\n\t opt = opt || {};\n\t var boxData = [];\n\t var outliers = [];\n\t var boundIQR = opt.boundIQR;\n\t var useExtreme = boundIQR === 'none' || boundIQR === 0;\n\t\n\t for (var i = 0; i < rawData.length; i++) {\n\t var ascList = asc(ra...
[ "0.6345036", "0.6102414", "0.5885389", "0.58116937", "0.57201636", "0.5688615", "0.5674354", "0.56702757", "0.5669321", "0.5609144", "0.56041586", "0.55990803", "0.5579146", "0.5547881", "0.5510071", "0.5503642", "0.547955", "0.54794556", "0.547929", "0.5467214", "0.54609644"...
0.0
-1
build markov machine; read in text.
constructor(text) { let words = text.split(/[ \r\n]+/); let markovChain = this.makeChains(words); this.words = words; this.markovChain = markovChain; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createText(text){\n let mm = new markov.MarkovMachine(text)\n console.log(mm.makeText())\n}", "function generateText(text) {\n let mm = new MarkovMachine(text);\n console.log(mm.makeText());\n}", "function fileMarkov(path) {\n fs.readFile(path, 'utf8', (err, data) => {\n if (err) {\n...
[ "0.75802875", "0.7417897", "0.6977266", "0.6777092", "0.59956497", "0.57939446", "0.5779247", "0.571849", "0.5679027", "0.56694925", "0.56502324", "0.56502324", "0.54595965", "0.5457738", "0.54551107", "0.5422826", "0.5389011", "0.5389011", "0.5389011", "0.5389011", "0.538901...
0.6682317
4
Helper function to generate a random number Takes in object Returns a random number between 1 and length of object passed in
_getRandomNum(array){ // console.log("array = ", array); return Math.floor(Math.random() * Math.floor(array.length)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateRandomlyNumber(){\n\treturn Math.floor(Math.random()*10)\n}", "generateRandomNumber() {\n return this.generateRandom(0, 10);\n }", "function randNumber () {\n\treturn Math.floor(Math.random() * 10);\n}", "function randomNumberGenerator() {\n\treturn (Math.floor(((Math.random() * 9) + 1))...
[ "0.7339179", "0.7238554", "0.7232579", "0.71919245", "0.7161117", "0.71608317", "0.71505284", "0.7147857", "0.71470064", "0.7139242", "0.7139242", "0.7137532", "0.7134615", "0.7127958", "0.71106315", "0.7110365", "0.71077687", "0.71077687", "0.7087935", "0.70866597", "0.70866...
0.0
-1
return random text from chains
getText(numWords = 100) { const objKeys = Object.keys(this.markovChain); // console.log("objKeys = ", objKeys); let chosenWord; let currNumWords = text.length; let randomKeyIdx = this._getRandomNum(objKeys); let key = objKeys[randomKeyIdx]; let text = []; while (chosenWord !== null && currNumWords <= numWords) { console.log("key = ", key); let wordList = this.markovChain[key]; console.log("wordlist = ", wordList); let randomWordIdx = this._getRandomNum(wordList); if (wordList.length === 1) chosenWord = wordList[0]; chosenWord = wordList[randomWordIdx]; // console.log("chosenWord = ", chosenWord); key = chosenWord; text.push(chosenWord); currNumWords = text.length; } console.log("text = ", text.join(' ')); return text.join(' '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeText(numWords = 100) {\n let chains = this.makeChains(); // MM object\n \n // first word to start chaining\n let key_words = Object.keys(chains); // array of key-words in MM object to choose from\n let key_num = key_words.length; // number of words to choose from\n let key_ind = Math.floor(Ma...
[ "0.76589763", "0.76443344", "0.7599267", "0.7574173", "0.7511702", "0.7511279", "0.72814023", "0.71984774", "0.7190295", "0.71337676", "0.7123781", "0.6900931", "0.6816729", "0.6805939", "0.6632002", "0.65934294", "0.6556045", "0.65482455", "0.64869976", "0.63568276", "0.6343...
0.7168974
9
Return the school value
getSchool() { return this.school; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getschool() {\n return this.school;\n }", "getSchool () {\n return this.school;\n }", "getSchool() {\r\n return this.school;\r\n }", "getSchool() {\n return this.school\n }", "getSchool() {\n return this.school;\n }", "getSchool(){\n \n return thi...
[ "0.7883279", "0.7675038", "0.76711863", "0.7641319", "0.7619529", "0.7567898", "0.7478936", "0.7478936", "0.7478936", "0.7392111", "0.7392111", "0.731801", "0.7130422", "0.7116012", "0.69902337", "0.6876591", "0.6616988", "0.6229336", "0.6229148", "0.616906", "0.61309236", ...
0.6977147
15
bracketRegex is used to specify which type of bracket to scan should be a regexp, e.g. /[[\]]/ Note: If "where" is on an open bracket, then this bracket is ignored. Returns false when no bracket was found, null when it reached maxScanLines and gave up
function scanForBracket(cm, where, dir, style, config) { var maxScanLen = (config && config.maxScanLineLength) || 10000; var maxScanLines = (config && config.maxScanLines) || 1000; var stack = []; var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/; var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) : Math.max(cm.firstLine() - 1, where.line - maxScanLines); for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { var line = cm.getLine(lineNo); if (!line) continue; var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1; if (line.length > maxScanLen) continue; if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); for (; pos != end; pos += dir) { var ch = line.charAt(pos); if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { var match = matching[ch]; if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch); else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; else stack.pop(); } } } return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scanForBracket(cm,where,dir,style,config){for(var maxScanLen=config&&config.maxScanLineLength||1e4,maxScanLines=config&&config.maxScanLines||1e3,stack=[],re=config&&config.bracketRegex?config.bracketRegex:/[(){}[\\]]/,lineEnd=dir>0?Math.min(where.line+maxScanLines,cm.lastLine()+1):Math.max(cm.firstLine()-...
[ "0.6587802", "0.6267505", "0.6267505", "0.6131918", "0.6109955", "0.6094728", "0.60717857", "0.6065751", "0.59929025", "0.5840662", "0.58073765", "0.56219184", "0.54613787", "0.54366475", "0.5270894", "0.5224024", "0.5059215", "0.4968047", "0.49521586", "0.48946953", "0.48444...
0.6207647
3
function that adjusts the data
function combineDataFromMultipleDataSources(aSources) { return aSources[0].concat(aSources[1]).concat(aSources[2]).concat(aSources[3]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateData() {\n\t\txyData = pruneData(xyData);\n\t\tllmseFit = xyHelper.llmse(xyData, xPowers);\n\t\tupdate();\n\t}", "function updateData(data) {\n\t\t\t\t\t\t\tvar updatedData = angular.copy(data);\n\t\t\t\t\t\t\tangular\n\t\t\t\t\t\t\t\t\t.forEach(\n\t\t\t\t\t\t\t\t\t\t\tupdatedData,\n\t\t\t\t\t\t\t...
[ "0.6687704", "0.65922827", "0.6474521", "0.6411509", "0.6402488", "0.62500304", "0.62078094", "0.61798334", "0.59558105", "0.58987385", "0.5892078", "0.58432204", "0.5781464", "0.576219", "0.57237154", "0.570365", "0.5700649", "0.5698834", "0.5641815", "0.5620254", "0.5609066...
0.0
-1
Try to reduce the number of times language list is iterated over
getFilteredLanguages(width, height) { const { languages, languageCode, filterText, fromCountry } = this.props; const filteredLanguages = filterText ? matchSorter(languages, filterText, { threshold: matchSorter.rankings.ACRONYM, keys: [ 'name', 'iso', { maxRanking: matchSorter.rankings.STARTS_WITH, key: 'alt_names', }, ], }) : languages; if (languages.length === 0) { return null; } const renderARow = ({ index, style, key }) => { const language = filteredLanguages[index]; return ( <div style={style} key={key} className="language-name" role="button" tabIndex={0} title={language.englishName || language.name} onClick={(e) => this.handleLanguageClick(e, language)} > <h4 className={ language.id === languageCode ? 'active-language-name' : '' } > {language.alt_names && language.alt_names.includes(filterText) ? filterText : language.autonym || language.englishName || language.name} {language.autonym && language.autonym !== (language.englishName || language.name) ? ` - ( ${language.englishName || language.name} )` : null} </h4> </div> ); }; const getActiveIndex = () => { let activeIndex = 0; filteredLanguages.forEach((l, i) => { if (l.id === languageCode) { activeIndex = i; } }); return activeIndex; }; return filteredLanguages.length ? ( <List id={'list-element'} estimatedRowSize={34 * filteredLanguages.length} height={height} rowRenderer={renderARow} rowCount={filteredLanguages.length} overscanRowCount={2} rowHeight={34} scrollToIndex={fromCountry ? 0 : getActiveIndex()} width={width} scrollToAlignment={'start'} /> ) : ( <div className={'language-error-message'}> There are no matches for your search. </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateNextLangIndex () {\n let index = this.langIndex + 1\n if (index >= LANG_LIST.length) {\n index = 0\n }\n this.langIndex = index\n }", "trainLanguages() {\n\t\tlet self=this;\n\t\treturn Q.all(this.languages.map((language)=>{\n\t\t\treturn self.trainLanguage(language);\n\t\t}));\n\t}", "...
[ "0.6152354", "0.59042716", "0.57948375", "0.56115246", "0.55984294", "0.5559476", "0.5559476", "0.5559091", "0.5480814", "0.5477001", "0.54756427", "0.5472458", "0.5441969", "0.5435204", "0.5430011", "0.5423498", "0.54228973", "0.54136986", "0.53981185", "0.53883815", "0.5377...
0.5534149
8
by removing some characters from it. Example: / for s = 'ceoydefthf5h5yts and t= ' codefights' the output should be true
function convertString(s, t) { let word = ""; let tIndex = 0; const sChars = s.split(" "); for (let i = 0; i < s.length; i++) { if (s[i] === t[tIndex]) { word = word.concat(s[i]); tIndex++; if (word === t) { return true; } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeSpecial(s) {\n return s.replace(/[^a-z0-9]/ig, '');\n }", "function isnotSpecial(str){\nstringSpecialCheck=\"!#$%^&*()+|<>?/=~,;:][{}\"+\"\\\\\"+\"\\'\";\nf4=1;\nfor(j=0;j<str.length;j++)\n{if(stringSpecialCheck.indexOf(str.charAt(j))!=-1)\n{f4=0;}}\nif(f4==0)\n{return true;}else{return ...
[ "0.65463436", "0.64395005", "0.6371885", "0.632304", "0.6316935", "0.6281303", "0.62589574", "0.6255047", "0.61815035", "0.61736774", "0.6148167", "0.61431986", "0.61252415", "0.6120773", "0.6096078", "0.60883284", "0.60867673", "0.60794497", "0.60705763", "0.60705763", "0.60...
0.62158936
8
function to keep earth gif moving
function validateField() { var docs = document.getElementById("img"); docs.setAttribute("src", "gif_path"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function moveGif(){\r\n\tvar intViewportWidth = window.innerWidth\r\n\tb1.style.opacity = \".5\"\r\n\torange.style.transition = \"transform 2s ease\"\r\n\torange.style.transform = \"translate(30vw, 0)\"\r\n\tif(x.matches){\r\n\t\torange.style.transform = \"translate(0, -165px)\"\r\n\t}\r\n\r\n}", "function anima...
[ "0.68467385", "0.6639768", "0.661927", "0.6576437", "0.6525546", "0.6523847", "0.650001", "0.64799887", "0.64518267", "0.63920295", "0.6387297", "0.633111", "0.6308683", "0.62749034", "0.6272526", "0.626896", "0.6259028", "0.6236334", "0.620578", "0.6199799", "0.61984265", ...
0.0
-1
generates initial screen / home page
function initialScreen() { startScreen = "<p class='text-center main-button-container'><a class='btn btn-primary btn-lg btn-block startbtn' href='#' role='button'>Click Here To Start</a></p>"; $(".mainDiv").html(startScreen); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function home(){\n\tapp.getView().render('vipinsider/insider_home.isml');\n}", "function displayHome() {\n\tvar message = HomeServices.generateHome();\n\tdisplay = document.getElementById(\"displayWindow\");\n\tif(message) {\n\t\tdisplay.innerHTML = message;\n\t}\n\telse {\n\t\tdisplay.innerHTML = \"<h1>The 'gen...
[ "0.7357644", "0.7179117", "0.7104492", "0.70907503", "0.68889254", "0.68687934", "0.6804751", "0.67880094", "0.67692447", "0.67104256", "0.6693577", "0.66696626", "0.6647739", "0.66474706", "0.66443276", "0.66066295", "0.65838253", "0.65696615", "0.65686077", "0.65462", "0.65...
0.6127038
59
if the user does not select an answer before the timer runs out
function userLossTimeOut() { unansweredTally++; gameHTML = correctAnswers[questionCounter] + "" + losingImages[questionCounter]; $(".mainDiv").html(gameHTML); setTimeout(wait, 5000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function answerCheck() {\n if (timeLeftPlay === 0) {\n pauseTimer = true;\n unanswered++;\n msgCreator(\"Time ran out!\", \"The correct answer is: \" + currentCorrectAnswer.answer, currentCorrectAnswer.image);\n setTimeout(unansweredPause, 3000);\n $(\"...
[ "0.7467261", "0.7242716", "0.7192307", "0.7177728", "0.7177728", "0.7148943", "0.7129041", "0.70838726", "0.70810384", "0.70033336", "0.6975034", "0.69453955", "0.6929539", "0.69245476", "0.69025725", "0.689427", "0.689175", "0.68881583", "0.68793625", "0.68499315", "0.684988...
0.0
-1
if the user selects the correct answer
function generateWin() { correctTally++; gameHTML = "<p class='text-center timerText'></p>" + "<p class='text-center msg'>" + correctAnswers[questionCounter] + "</p>" + imageArray[questionCounter]; $(".mainDiv").html(gameHTML); setTimeout(wait, 5000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function answerSelected() {\n let selected = $('input:checked');\n let answer = selected.val();\n\n if(answer !==undefined){\n\n let correctAnswer = `${STORE[questionNumber].correctAnswer}`;\n if (answer === correctAnswer) {\n rightAnswerFeedback();\n } else {\n wrongAnswerFeedback(correctAnswer);\n }...
[ "0.76616037", "0.7653011", "0.75845397", "0.7515136", "0.74669963", "0.74516445", "0.7447925", "0.74352103", "0.74136347", "0.7407009", "0.73902565", "0.7390235", "0.7383392", "0.7378582", "0.73462164", "0.73422813", "0.7342097", "0.73239917", "0.73123807", "0.730571", "0.729...
0.0
-1
if the user selects the wrong answer
function generateLoss() { incorrectTally++; gameHTML = correctAnswers[questionCounter] + "" + losingImages[questionCounter]; $(".mainDiv").html(gameHTML); setTimeout(wait, 5000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function choose0() { checkAnswer(0) }", "function answerSelected() {\n let selected = $('input:checked');\n let answer = selected.val();\n\n if(answer !==undefined){\n\n let correctAnswer = `${STORE[questionNumber].correctAnswer}`;\n if (answer === correctAnswer) {\n rightAnswerFeedback();\n } else {\n ...
[ "0.7331716", "0.72632146", "0.7203991", "0.7195673", "0.71757287", "0.71658623", "0.71628815", "0.71563923", "0.7114494", "0.7106288", "0.7074535", "0.7050443", "0.6987985", "0.6976106", "0.6975805", "0.69701964", "0.69617337", "0.69583863", "0.69239616", "0.6921542", "0.6917...
0.0
-1
YOU CAN PUT BUTTONS HERE TEXTHERE TO GENERATE BUTTONS AND CLICK THROUGH EVERY OTHER PIC function to generate possible answers for each question
function generateHTML() { gameHTML = answerArray[questionCounter] +"<p class='text-center msg'>" + questionArray[questionCounter] + "</p>"; $(".mainDiv").html(gameHTML); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function questionGenerator() {\n \n questionEl.textContent = questions[indexPlace].q;\n questionEl.setAttribute('style', 'margin-top:125px; width:100%;');\n\n // create buttons for selecting answers\n var answerBtn1 = document.getElementById(\"answerBtn1\")\n answerBtn1.onclick=function(){correctAnswerCh...
[ "0.7513611", "0.72971696", "0.7236651", "0.7226144", "0.71696675", "0.710609", "0.70444113", "0.7041013", "0.70290446", "0.69883245", "0.6983873", "0.6975619", "0.6973797", "0.69731414", "0.6964209", "0.6918448", "0.69055265", "0.6897879", "0.6882865", "0.6878244", "0.687444"...
0.0
-1
function to check if there are more questions after each question, it will either show the next question or generate the final 'gameover' page
function wait() { if (questionCounter < 7) { questionCounter++; generateHTML(); counter = 5; timerWrapper(); } else { finalScreen(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextQuestion(){\n questionIndex++\n if (theQuestions.length > questionIndex){\n showQuestion()\n } else {\n quizEnd()\n }\n}", "function nextQuestion(){\n var isQuestionOver= (quizQuestions.length - 1) === currentQuestion;\n if (isQuestionOver){\n console.log(\"game is o...
[ "0.78652984", "0.7744782", "0.7699313", "0.763074", "0.7627635", "0.7603933", "0.7597288", "0.7577071", "0.75422096", "0.75070554", "0.7504014", "0.7493591", "0.74880195", "0.74428755", "0.7427179", "0.7422695", "0.7421834", "0.74183136", "0.73895574", "0.7389002", "0.7384066...
0.0
-1
function to give each question 20 seconds, show countdown in html, and generate loss if player does not select an answer in time
function timerWrapper() { theClock = setInterval(twentySeconds, 1000); function twentySeconds() { if (counter === 0) { clearInterval(theClock); userLossTimeOut(); } if (counter > 0) { counter--; } $(".timer").html(counter); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestion () {\n counter = 30;\n timer = setInterval(countDown, 1000);\n //Set both the question and choices as variables \n const question = triviaQuestions[currentQuestion].question;\n const choices = triviaQuestions[currentQuestion].choices;\n //Add the question and its answers into...
[ "0.74916095", "0.7463579", "0.74063206", "0.73588055", "0.7302", "0.72965103", "0.72755635", "0.7266828", "0.72627234", "0.7234411", "0.7221665", "0.7217018", "0.72166795", "0.7216227", "0.7192297", "0.7188614", "0.71868753", "0.71615577", "0.71591514", "0.7156588", "0.715495...
0.0
-1
function for when it's game over
function finalScreen() { // unique end-game message if the user got a perfect score of 8 if (correctTally === 8) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>100%! You got a perfect score!" + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if correct tally is 5-7 out of 8 else if (correctTally < 8 && correctTally > 4) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>Game Over! You did great!" + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if tally is 4 out of 8 else if (correctTally === 4) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>Game Over! You scored 50%." + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if correct tally is between 1-3 else if (correctTally < 4 && correctTally != 0) { gameHTML = "<p class='text-center timerText'>Time Remaining: <span class='timer'>" + counter + "</span></p>" + "<p class='text-center'>Game Over! You need to stay in school." + "</p>" + "<p class='summary-correct'>Correct Answers: " + correctTally + "</p>" + "<p>Wrong Answers: " + incorrectTally + "</p>" + "<p>Unanswered: " + unansweredTally + "</p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Watch Again</a></p>"; $(".mainDiv").html(gameHTML); } //if the correct tally is zero else { gameHTML = "<p class='text-center timerText msg finalmsg'>YOU DA BEST!<br><img src='https://i.imgur.com/uvVWKNX.gif' class='picDisplay noBorder'></p>" + "<p class='text-center'></p>" + "<p class='summary-correct'></p>" + "<p class='text-center resetBtn-container'><a class='btn btn-primary btn-lg btn-block resetBtn' href='#' role='button'>Replay</a></p>"; // DOG GIF: https://i.imgur.com/FpJ79Ry.gif DANCING LADY: https://i.imgur.com/uvVWKNX.gif $(".mainDiv").html(gameHTML); // $(".endPic").html("<img class='endDancers' width='100px' src='https://i.imgur.com/uvVWKNX.gif'>"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameOver(){\n \tconsole.log(\"game over\");\n \t_onGameOver();\n }", "function dys_ChecGameOver(){\r\n\t\r\n}", "function gameOver() {\r\n disableActions();\r\n }", "gameOverAction() {\n\n }", "function gameOver(){\n getPlayerName();\n clearInterval(hoopInterv...
[ "0.84893155", "0.8010906", "0.800335", "0.79886425", "0.7971993", "0.7964767", "0.79334044", "0.7927763", "0.79084", "0.78725964", "0.78541034", "0.7815751", "0.7794266", "0.777794", "0.7767837", "0.7752036", "0.7730443", "0.7730377", "0.7717406", "0.77043515", "0.76926523", ...
0.0
-1
function to reset game (function called when player presses button to restart the game)
function resetGame() { questionCounter = 0; correctTally = 0; incorrectTally = 0; unansweredTally = 0; counter = 5; generateHTML(); timerWrapper(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function actionOnResetClick () {\n gameRestart();\n }", "function resetGame() {\n resetClockAndTime();\n resetMoves(); \n resetRatings();\n startGame();\n}", "function resetGame() {\n resetClockAndTime();\n resetMoves();\n resetStars();\n initGame();\n activ...
[ "0.8691483", "0.86848384", "0.86516255", "0.8635654", "0.8469898", "0.8454153", "0.8448497", "0.84446216", "0.84363186", "0.8423012", "0.84075946", "0.83964264", "0.8380649", "0.83785933", "0.83557516", "0.83191633", "0.8297104", "0.8288342", "0.8285303", "0.8280323", "0.8263...
0.0
-1
props: upgradeSteps, upgradeComplete, setUpgradeComplete
function UpgradeBox(props) { return rce('span', {className: 'upgrade-box'}, rce('img', {src: triangle}, null), rce('span', {className: 'cool-corners steps-and-check'}, props.upgradeSteps, rce('div', {className: 'checkbox-wrapper'}, rce(Checkbox, {checked: props.upgradeComplete, setChecked: props.setUpgradeComplete}) ) ), ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "upgrade() {}", "async function upgrade(){\n logger.log(\"info\", \"Entering upgrade\");\n try{\n await logExistingFiles();\n logger.log(\"debug\", \"|before upgrade|\"); \n let [versionToBkup, upgradeToVersion, preList] = await bkupPrevVersion();\n let sqlScripts = RESTOR...
[ "0.637879", "0.5989545", "0.5688554", "0.5596042", "0.5468055", "0.5439752", "0.54389423", "0.5422736", "0.5419075", "0.5405851", "0.5319746", "0.5292955", "0.52844745", "0.52463245", "0.524178", "0.52223927", "0.5215805", "0.52133083", "0.5199023", "0.5161679", "0.51441133",...
0.48798162
39
How many times we have retried.
function toJson(str) { // Convert the XML output into JSON var output = xt.xmlToJson(str); if(output[0].success) { rtValue = { "Product_ID":output[0].data[1].value, "PTF":output[0].data[2].value, "Release":output[0].data[3].value, "Option":output[0].data[4].value, "LoadID":output[0].data[5].value, "Load_State":output[0].data[6].value, }; } else rtValue = errMsg; if(async) // If it is in asynchronized mode. cb(rtValue); // Run the call back function against the returned value. stop = 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRetryTimeout() {\n return RETRY_SEC * 1000;\n }", "function getRetryLimit() {\n return 5;\n}", "function getRetryLimit() {\n return 5;\n}", "_countAttempts () {\n this.attemptsCount++\n const counter = this.shadowRoot.querySelector('.counter > h3')\n // Grammar cor...
[ "0.6733216", "0.6695627", "0.6695627", "0.6476172", "0.634825", "0.6310979", "0.6293349", "0.6293349", "0.62714106", "0.6268611", "0.6246035", "0.6222447", "0.60690403", "0.59899974", "0.59899974", "0.5967827", "0.5910319", "0.5881494", "0.5860974", "0.58421546", "0.5817233",...
0.0
-1
How many times we have retried.
function toJson(str) { // Convert the XML output into JSON var output = xt.xmlToJson(str); if(output[0].success) { rtValue = { "Product_ID":output[0].data[1].value, "Release":output[0].data[2].value, "Option":output[0].data[3].value, "Load_String":output[0].data[5].value, "Load_Error":output[0].data[6].value, "Load_State":output[0].data[7].value, }; } else rtValue = errMsg; if(async) // If it is in asynchronized mode. cb(rtValue); // Run the call back function against the returned value. stop = 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRetryTimeout() {\n return RETRY_SEC * 1000;\n }", "function getRetryLimit() {\n return 5;\n}", "function getRetryLimit() {\n return 5;\n}", "_countAttempts () {\n this.attemptsCount++\n const counter = this.shadowRoot.querySelector('.counter > h3')\n // Grammar cor...
[ "0.6733216", "0.6695627", "0.6695627", "0.6476172", "0.634825", "0.6310979", "0.6293349", "0.6293349", "0.62714106", "0.6268611", "0.6246035", "0.6222447", "0.60690403", "0.59899974", "0.59899974", "0.5967827", "0.5910319", "0.5881494", "0.5860974", "0.58421546", "0.5817233",...
0.0
-1
How many times we have retried.
function toJson(str) { // Convert the XML output into JSON var output = xt.xmlToJson(str); var length = output[0].data.length; var count = Number(output[0].data[length - 6].value); if(output[0].success) { for(var i = 0; i < count * 5; i+=5) rtValue.push({ "ProductID":output[0].data[i].value, "Option":output[0].data[i+1].value, "Release":output[0].data[i+2].value, "Description":output[0].data[i+4].value }); } else rtValue = errMsg; if(async) // If it is in asynchronized mode. cb(rtValue); // Run the call back function against the returned value. stop = 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRetryTimeout() {\n return RETRY_SEC * 1000;\n }", "function getRetryLimit() {\n return 5;\n}", "function getRetryLimit() {\n return 5;\n}", "_countAttempts () {\n this.attemptsCount++\n const counter = this.shadowRoot.querySelector('.counter > h3')\n // Grammar cor...
[ "0.6733216", "0.6695627", "0.6695627", "0.6476172", "0.634825", "0.6310979", "0.6293349", "0.6293349", "0.62714106", "0.6268611", "0.6246035", "0.6222447", "0.60690403", "0.59899974", "0.59899974", "0.5967827", "0.5910319", "0.5881494", "0.5860974", "0.58421546", "0.5817233",...
0.0
-1
handle all other input changes
function handleInputChange(event) { event.persist(); setSuccess(false); setFormValues(currentValues => ({ ...currentValues, [event.target.name]: event.target.value, })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inputChanged() {\n parseInput(this);\n getDataFromTable();\n }", "changedInput() {\n\n\t\tlet {isValid, error} = this.state.wasInvalid ? this.validate() : this.state;\n\t\tlet onChange = this.props.onChange;\n\t\tif (onChange) {\n\t\t\tonChange(this.getValue(), isValid, error);\n\t\t}\n\t\tif (th...
[ "0.73533297", "0.7341883", "0.6961452", "0.6952631", "0.6863717", "0.68561506", "0.6744633", "0.6706013", "0.66919005", "0.6678626", "0.6632247", "0.66103953", "0.66069067", "0.6597832", "0.6574189", "0.65631753", "0.6555126", "0.6528805", "0.64918345", "0.6463922", "0.644917...
0.0
-1
function to switch to gold loan from any CJ
function switchToGoldLoan(product_id, quote_id, lead_id, switch_is_interested) { var loan_type_id = ''; if ($('.gold_loan_type:checked').length == 0) { $(".thanx-question").addClass("error"); return false; } else { $(".thanx-question").removeClass("error"); loan_type_id = $('.gold_loan_type:checkbox:checked').map(function () { return this.value; }).get(); } var validator_status = 0; var gold_weight = $.trim($("#gold_weight").val()); if (gold_weight != "" && gold_weight > 0 && gold_weight <= 999 && !isNaN(gold_weight)) { validator_status = 1; } //alert(validator_status); //var validator_status = formatValidatorNew('', $("#gold_weight"), '', '', '', 23, 0, 9999, "", '', ''); if (validator_status == 1 || validator_status == true) { $("#gold_weight").closest('.mRight').find('.thanx-question').removeAttr('style'); } else { $("#gold_weight").closest('.mRight').find('.thanx-question').css("color", "red") return false; } //Save Pincode for gl journey,23112015 var validate_resonse = 0; var gold_pincode = $.trim($("#gold_pincode").val()); var gold_pincode_length = gold_pincode.length; if (gold_pincode != "" && gold_pincode > 0 && gold_pincode_length == 6) { validate_resonse = 1; } if (validate_resonse == 1) { $("#gold_pincode").closest('.mRight').find('.thanx-question').removeAttr('style'); } else { $("#gold_pincode").closest('.mRight').find('.thanx-question').css("color", "red") return false; } //End showLoader('loading', 'display-block'); var data = {step: 'switch_to_gold_loan', product_id: product_id, quote_id: quote_id, lead_id: lead_id, mode: 'switch_to_gold_loan', switch_is_interested: switch_is_interested, loan_type_id: loan_type_id, gold_weight: $.trim($("#gold_weight").val()), pincode: $.trim($("#gold_pincode").val())}; $.post("/gold-loan", data, '', 'json') .done(function (response) { showLoader('loading', 'display-none'); if (switch_is_interested == 1 && response.redirect_url != undefined) { window.location = response.redirect_url; } else { noLoanResponseMessage(); $('.proceed_to_gl_step').remove(); } console.log(response); return false; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function turn_on(target){\n if (coffeeStatus != \"off\") {\n phonon.alert(\"\", \"Coffeemaker is already on!!\", true)\n }\n else {\n query = \"command=on\"\n function state(resultOn){\n alrt = phonon.indicator('Coffeemaker is starting', true);\n...
[ "0.5775484", "0.57092154", "0.56171525", "0.5586435", "0.5569915", "0.55401623", "0.55099064", "0.5484802", "0.54785234", "0.54754204", "0.5451688", "0.5438896", "0.54044884", "0.53793186", "0.53560555", "0.5335163", "0.5316526", "0.53100467", "0.5305946", "0.528372", "0.5261...
0.5369343
14
console.log(find_missing_number([8,3,5,1], [1,5,3])); Time complexity O(n) Declare a function that compares each element to every other element of the list. Then return the element if all the other elements are greater than it. Phase I
function my_min1(arr){ for (let i=0; i<arr.length; i++){ let min= true; for(let k=i+1; k<arr.length; k++){ if (arr[k]<arr[i]){ min = false; } } if (min){ console.log(arr[i]); return arr[i]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMissing() {\n let array = [9, 2, 0, 5, 3, 1, 7, 8, 4];\n // sort the array in ascending order first.\n for (let i = array.length; i >= 0; i--) {\n for (let j = array.length - 1; j >= 0; j--) {\n if (array[i] > array[j]) {\n let tempNum = array[i];\n ...
[ "0.76524097", "0.7522754", "0.7431381", "0.7401072", "0.72407895", "0.7215962", "0.7166935", "0.7163105", "0.70930403", "0.7090222", "0.6986603", "0.696486", "0.6934275", "0.692626", "0.6886246", "0.6816413", "0.68081075", "0.66888136", "0.6685135", "0.66517574", "0.66433394"...
0.58608615
96
Time Complexity is O(n^2) which is quadratic time and O(n^2) constant space Phase II
function my_min2(arr){ let min = arr[0]; for (let i=1; i<arr.length; i++){ if (arr[i]<min){ min = arr[i]; } } return min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function anotherFunChallenge(input) {\n let a = 5; //O(1)\n let b = 10; //O(1)\n let c = 50; //O(1)\n for (let i = 0; i < input; i++) { //* \n let x = i + 1; // O(n)\n let y = i + 2; // O(n)\n let z = i + 3; // O(n)\n\n }\n for (let j = 0; j < input; j++) { //*\n let p = j * 2; // O(n)\n...
[ "0.5929643", "0.58918965", "0.5870955", "0.5828068", "0.5807698", "0.57651836", "0.5749533", "0.5721601", "0.5712676", "0.56322896", "0.5627353", "0.5559439", "0.5507587", "0.5499367", "0.5494092", "0.54710156", "0.5446482", "0.54110646", "0.53637314", "0.53607726", "0.533735...
0.0
-1
console.log(my_min2(list)); // => 5 Largest Contiguous Subsum We have an array of integers, and we need to find the largest contiguous (togetherin sequence) subsum. Find the sums of all the contiguous subarrays and return the max. Phase 1 Write a function that interates through the array and finds all the subarrays using nested loops. Create a new array that holds all the subarrays. Then find the sums of each subarray and return the max.
function largest_contiguous_subsum1(arr){ let arrays = []; for (let i=0; i<arr.length; i++){ for (let k=i; k<arr.length; k++){ let array = []; for (let j=i; j<=k; j++){ array.push(arr[j]); } let sum = array.reduce((a,b) => a+b); arrays.push(sum); } } return Math.max(...arrays); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function largest_contiguous_subsum2(arr){\n\n let max_so_far = arr[0];\n let curr_max = arr[0];\n\n for (i=1; i<arr.length; i++){\n curr_max = Math.max(arr[i], curr_max+arr[i]);\n max_so_far = Math.max(max_so_far, curr_max);\n }\n return max_so_far;\n}", "function getMaxSubSum(arr) { \n let ...
[ "0.86087215", "0.804534", "0.7817947", "0.77800906", "0.77481604", "0.7629411", "0.75651944", "0.7529762", "0.7519463", "0.7472336", "0.7471453", "0.7446639", "0.7392624", "0.7384808", "0.7374659", "0.73616666", "0.73517835", "0.73487926", "0.73056227", "0.72722715", "0.72620...
0.8231295
1
Time complexity is 0(n3) which is cubic time and cubic space. Phase II Write a new function using O(n) time and O(1) memory. Keep a running tally of the largest sum.
function largest_contiguous_subsum2(arr){ let max_so_far = arr[0]; let curr_max = arr[0]; for (i=1; i<arr.length; i++){ curr_max = Math.max(arr[i], curr_max+arr[i]); max_so_far = Math.max(max_so_far, curr_max); } return max_so_far; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maximumSumBruteForce(arr, n) {\n if (n > arr.length) return null\n let max = 0\n /**\n * [* * *] // deepest calculation\n * iterates over until the length of the array - n. [1, 2, 3, 4]\n * because we do not want to pass the end of the array w...
[ "0.73002195", "0.72304404", "0.718815", "0.7182351", "0.71370167", "0.7045055", "0.6952253", "0.69207835", "0.69073343", "0.69040924", "0.68880427", "0.6863262", "0.6853558", "0.6841851", "0.68351406", "0.68329936", "0.6814845", "0.67975795", "0.679301", "0.67837244", "0.6776...
0.68228924
16
console.log(largest_contiguous_subsum2(list)); // => 8 (from [7, 6, 7]) Time complexity is O(n) time which is linear time and O(1) memory which is constant. Big O Is Shuffle Given three strings, return if the third string is composed of the first two strings. It also preserves the sequence of the characters.
function is_shuffle(str1, str2, str3) { var seen_candidates = {}; var candidates = [[0, 0]]; while (candidates.length != 0) { var temp = candidates.shift(); var str1_used_len = candidates[0]; var str2_used_len = candidates[1]; var str3_used_len = str1_used_len + str2_used_len; if (str3_used_len == str3.length) { return true; } if (str1[str1_used_len] == str3[str3_used_len]) { var new_candidate = [str1_used_len + 1, str2_used_len]; if (!seen_candidates[new_candidate]) { candidates.push(new_candidate); seen_candidates[new_candidate] = true; } } if (str2[str2_used_len] == str3[str3_used_len]) { var new_candidate = [str1_used_len, str2_used_len + 1]; if (!seen_candidates[new_candidate]) { candidates.push(new_candidate); seen_candidates[new_candidate] = true; } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function largest_contiguous_subsum2(arr){\n\n let max_so_far = arr[0];\n let curr_max = arr[0];\n\n for (i=1; i<arr.length; i++){\n curr_max = Math.max(arr[i], curr_max+arr[i]);\n max_so_far = Math.max(max_so_far, curr_max);\n }\n return max_so_far;\n}", "function largest_contiguous_subsum1(a...
[ "0.7232479", "0.688215", "0.60438263", "0.59723204", "0.59661424", "0.59362054", "0.58410186", "0.58243066", "0.5799806", "0.57910436", "0.5728125", "0.5725404", "0.57239693", "0.57215697", "0.5718321", "0.57033706", "0.56951517", "0.5678769", "0.5670136", "0.5648168", "0.563...
0.5605692
23
declaring variables for position, animation frames, and time
constructor(){ this.x = 100; this.y = 100; this.frameHeight = 53; this.frameWidth = 64; this.currentFrameX = 23; this.currentFrameY = 16; this.spriteSheet; this.currentFrameNum = 1; this.time = 0; this.timeUntilLast = 0; this.timeFromLast = 0; this.animationTime = 50; this.maxFrame = 6; this.startTime; this.lifeTime; this.alive = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animations() {\n\tarthur.srcX = arthur.currentFrame * arthur.width;\n\tif (arthur.goRight) {\n\t\tarthur.srcY = arthur.goRowRight * arthur.height;\n\t} else if (arthur.goLeft) {\n\t\tarthur.srcY = arthur.goRowLeft * arthur.height;\n\t} else if (arthur.duckRight) {\n\t\tarthur.srcY = arthur.duckRowRight * ...
[ "0.69716364", "0.6904034", "0.68851423", "0.67007816", "0.6552989", "0.6547332", "0.65439856", "0.65439767", "0.65066624", "0.64970833", "0.6486129", "0.64780354", "0.6476743", "0.64639014", "0.6432951", "0.6432079", "0.64233345", "0.64219034", "0.6420977", "0.63988847", "0.6...
0.7134445
0
function for setting the start coordinates for the projectile
setStart(x, y){ if (this.alive == false){ this.x = x + 130; this.y = y + 17; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setStartingPosition() {\n this.x = CELL_WIDTH * 2;\n this.y = CELL_HEIGHT * COLS;\n }", "setStart() {\n this.start = this.setPos();\n this.locationX = this.start.x;\n this.locationY = this.start.y;\n this.field[this.start.y][this.start.x] = pathCharacter;\n }", "rtnStartPos() {\n this.x ...
[ "0.6912226", "0.6832978", "0.6782371", "0.67650247", "0.6622884", "0.6473286", "0.64385235", "0.6422049", "0.63959634", "0.6380487", "0.6364963", "0.63424397", "0.63280666", "0.632175", "0.6293732", "0.622061", "0.6207966", "0.6100578", "0.6099007", "0.60922694", "0.60753715"...
0.70478463
0
drawing the projectile if it is "alive"
draw(){ if (this.alive === true) image(this.spriteSheet, this.x, this.y, this.frameWidth*1.5, this.frameHeight*1.5, this.currentFrameX, this.currentFrameY, this.frameWidth, this.frameHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "projectile(enemy) {\n this.vx = this.speed * cos(this.angle);\n this.vy = this.speed * sin(this.angle);\n\n this.x += this.vx;\n this.y += this.vy;\n\n if (this.x > width) {\n this.active = false;\n } else if (this.y > height) {\n this.active = false;\n }\n\n //Gray round projecti...
[ "0.72319365", "0.69851524", "0.6584378", "0.65443337", "0.65265095", "0.6457312", "0.64331245", "0.63287836", "0.62822413", "0.62814957", "0.62703824", "0.6269629", "0.6249608", "0.6248368", "0.6239905", "0.62342167", "0.6231608", "0.6230253", "0.622411", "0.6194181", "0.6193...
0.6533748
4
using 'millis()' to get the time and the time from the last animation frame switch as well as the lifetime of the projectile
getTime(){ this.time = millis(); this.timeFromLast = this.time - this.timeUntilLast; this.lifeTime = this.time - this.startTime; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.curren...
[ "0.6714792", "0.66146725", "0.644252", "0.62793094", "0.62427026", "0.6230366", "0.6174319", "0.6162955", "0.61012864", "0.6094267", "0.6085944", "0.60453236", "0.604237", "0.6029735", "0.6029735", "0.6029735", "0.6029735", "0.6029735", "0.59791684", "0.5957901", "0.5957794",...
0.59160703
25
changing animation frames every 55 milliseconds and when it reaches max frame
animate(){ if (this.timeFromLast > this.animationTime){ this.currentFrameNum++; this.currentFrameX += this.frameWidth; this.timeFromLast = 0; this.timeUntilLast = millis(); } if (this.currentFrameNum > this.maxFrame){ this.currentFrameNum = 3; this.currentFrameX = 22; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "animate(framesCounter) {\n\n if (f...
[ "0.7321077", "0.69107866", "0.6903336", "0.689462", "0.6847129", "0.68330157", "0.6783298", "0.6773496", "0.6739243", "0.67279994", "0.66336834", "0.6625943", "0.65799457", "0.6579243", "0.6539542", "0.65038145", "0.64870876", "0.6486413", "0.64746475", "0.6471799", "0.645795...
0.7823296
0
checking to see if the projectile is "alive" and making it dead after a certain amount of time
checkAlive(){ if (this.lifeTime > 1000){ this.alive = false; this.lifeTime = 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function invincibilityAfterDamage() {\n timeoutInvincible = true;\n setTimeout(function () {\n timeoutInvincible = false;\n }, INVINCIBILITY_DURATION_AFTER_HIT);\n\n}", "function PlayerHandling()\n{\n //Moves the player\n PlayerMovementExecute();\n \n //Creates a projectile if the tim...
[ "0.6809358", "0.6721133", "0.66944253", "0.65348965", "0.6498517", "0.6456021", "0.6448426", "0.6435977", "0.6420949", "0.6404034", "0.64015037", "0.63790363", "0.63747144", "0.63722575", "0.63546497", "0.6322217", "0.6289837", "0.627741", "0.62360317", "0.62277955", "0.62241...
0.66819614
3
changing frames for when the character is facing the right
rightState(){ this.state = "right"; this.animationTime = 40; this.currentFrameNum = 0; this.currentFrameY = 436; this.currentFrameX = 0; this.frameHeight = 114; this.frameWidth = 94; this.maxFrame = 9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "rightTurn() {\r\n this.fltire.rotateY(-16);\r\n this.frtire.rotateY(-16);\r\n }", "frame () {\n\t\t// If th bonuss is without life, dn't move it.\n\t\tsuper.frame();\n\t\tthis.setDirection(this.direction.rotate(this.rotationSpeed))\n\t}", "frame () {\n\t\tsuper.frame();\n\t\tthis.setDirection(this.direc...
[ "0.6988162", "0.6734525", "0.67239493", "0.67080015", "0.6569484", "0.64698386", "0.6454202", "0.6439852", "0.6434033", "0.637835", "0.6367711", "0.63643557", "0.63638145", "0.6348461", "0.6297219", "0.62657034", "0.6243334", "0.62404716", "0.62372714", "0.62338144", "0.62209...
0.71798813
0
frames for when character is facing left
leftState(){ this.state = "left"; this.animationTime = 40; this.currentFrameNum = 0; this.currentFrameY = 553; this.currentFrameX = 0; this.frameHeight = 114; this.frameWidth = 94; this.maxFrame = 9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "left() {\n // If the LEFT key is down, set the player velocity to move left\n this.sprite.body.velocity.x = -this.RUN_SPEED;\n //this.animate_walk();\n }", "leftTurn() {\r\n this.fltire.rotateY(16);\r\n this.frtire.rotateY(16);\r\n }", "turnLeft() {\n this._currentLinearSpeed = 0;\n ...
[ "0.73133856", "0.693303", "0.6691323", "0.6678744", "0.6556454", "0.6552337", "0.6549804", "0.65222216", "0.65061015", "0.6499008", "0.6482977", "0.643752", "0.6428309", "0.64126855", "0.63954884", "0.6318961", "0.63065434", "0.6305223", "0.62657773", "0.62638646", "0.6261632...
0.731095
1
frames for when the character is stationary
stationaryState(){ this.state = "stationary"; this.animationTime = 55; this.currentFrameNum = 0; this.willStop = false; this.currentFrameX = 0; this.currentFrameY = 0; this.frameHeight = 112; this.frameWidth = 79; this.maxFrame = 9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n //change to stationary after hadouken is used\n if (this.state === \"hadouken\" && this....
[ "0.68405306", "0.62424135", "0.6224361", "0.6168025", "0.6137486", "0.60569984", "0.6055182", "0.60536665", "0.6029969", "0.6026117", "0.6007218", "0.6005884", "0.59817666", "0.59764534", "0.5971013", "0.59471613", "0.5947107", "0.59462726", "0.5945132", "0.5942897", "0.59209...
0.6790762
1
frames for when the character uses the hadouken
hadouken(){ this.state = "hadouken"; this.animationTime = 55; this.currentFrameNum = 0; this.willStop = false; this.currentFrameX = 0; this.currentFrameY = 2348; this.frameHeight = 109; this.frameWidth = 125; this.maxFrame = 8; hadouken1.startTime = millis(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleheroFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "function victoryAnimation() {\n\tfor (let i = 0; i < 8; i++) {\n\t\tflashLetters(i);\n\t}\n}", "function drawFrame() {\n //Fundo e Caixas\n for (var i = 0; i < HUD.length; i++) {\n ...
[ "0.6500949", "0.63717014", "0.6194328", "0.6180196", "0.6158472", "0.61305386", "0.6129825", "0.61229867", "0.608366", "0.608046", "0.6079174", "0.6054578", "0.6049512", "0.6047945", "0.6003271", "0.5988211", "0.5986313", "0.59711975", "0.5958426", "0.59512115", "0.59268063",...
0.7360992
0
loading all the sprites i need from a single file
loadSpriteSheet(){ this.spriteSheet = loadImage('assets/sprites.png'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadSprites() {\n Loader.add(\"assets/imgs/resize1.png\")\n .add(\"assets/imgs/resize2.png\")\n .add(\"assets/imgs/colorize.png\")\n .add(\"assets/imgs/rotate.png\")\n .add(\"assets/imgs/select.png\")\n .add(\"assets/imgs/win.png\")\n .add(\"assets/imgs/logo.png\")\n .add(\"assets/im...
[ "0.76824445", "0.72199464", "0.71704096", "0.71398735", "0.7103305", "0.71013194", "0.7095047", "0.7093334", "0.70919806", "0.70239604", "0.70221657", "0.6981963", "0.6953683", "0.6944999", "0.6860466", "0.68525463", "0.6818738", "0.67565095", "0.6753676", "0.67405385", "0.67...
0.68521756
16
function for drawing a certain portion from the spritesheet
draw(){ image(this.spriteSheet, this.charX, this.charY, this.frameWidth*1.5, this.frameHeight*1.5, this.currentFrameX, this.currentFrameY, this.frameWidth, this.frameHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawSprite(context){\n const yOffset = 5;\n //rounds down to whole number so sprites aren't drawn looking blurry\n\n //TODO: once board is set, this should draw in the lower left corner of each cell\n const x = Math.ceil(this.center.x) - this.creature.width/2;\n const y = Math.ce...
[ "0.7170279", "0.7157409", "0.7115168", "0.6986985", "0.6884575", "0.6859903", "0.68532044", "0.68512654", "0.6772024", "0.6772024", "0.6748956", "0.674499", "0.6683687", "0.6683687", "0.66590476", "0.66555816", "0.66442746", "0.66420686", "0.66361123", "0.6627111", "0.6618065...
0.70307994
3
using 'millis()' to get the time and the time from the last animation frame switch
getTime(){ this.time = millis(); this.timeFromLast = this.time - this.timeUntilLast; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.curren...
[ "0.6868393", "0.6667374", "0.64613104", "0.6407692", "0.63257295", "0.63257295", "0.63257295", "0.63257295", "0.63257295", "0.6235029", "0.6197615", "0.6124715", "0.60761446", "0.60631233", "0.60245687", "0.60226065", "0.6019981", "0.59993863", "0.59953475", "0.5978372", "0.5...
0.59194434
25
changing animation frames every 55 milliseconds
animate(){ if (this.timeFromLast > this.animationTime){ this.currentFrameNum++; this.currentFrameX += this.frameWidth; this.timeFromLast = 0; this.timeUntilLast = millis(); } //change to stationary after hadouken is used if (this.state === "hadouken" && this.currentFrameNum > this.maxFrame) this.stationaryState(); //resetting the animation after the ninth frame if (this.currentFrameNum > this.maxFrame){ this.currentFrameX = 0; this.currentFrameNum = 0; //changed to stationary if the user has let go of a movement key if (this.willStop === true) this.stationaryState(); this.timeFromLast = 0; this.timeUntilLast = millis(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "animate(){\n if (this.timeFromLast > this.animationTime){\n this.currentFrameNum++;\n this.currentFrameX += this.frameWidth;\n this.timeFromLast = 0;\n this.timeUntilLast = millis();\n }\n \n if (this.currentFrameNum > this.maxFrame){\n this.currentFrameNum = 3;\n this.curren...
[ "0.7329447", "0.7280513", "0.70089525", "0.6969101", "0.69429106", "0.68552095", "0.68387365", "0.682925", "0.6801606", "0.67762524", "0.67652965", "0.67377716", "0.6661474", "0.66526407", "0.6652522", "0.66121095", "0.6601998", "0.65852386", "0.6569535", "0.6539542", "0.6538...
0.6775994
10
moving the character based on its state
move(){ this.charY = windowHeight - 200; if (this.state === "right") this.charX += 4; if (this.state === "left") this.charX -= 4; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move(){\n switch(this.direction){\n case \"n\":\n this.col-=1;\n this.direction=\"n\";\n break;\n case \"e\":\n this.row += 1;\n this.direction=\"e\"; \n break;\n case \"s\":\n ...
[ "0.69844955", "0.67858887", "0.67705536", "0.67487365", "0.66506577", "0.66484547", "0.654065", "0.6479425", "0.6444482", "0.6443363", "0.64170367", "0.64132804", "0.63788944", "0.6371097", "0.63512313", "0.63495356", "0.6326806", "0.6315239", "0.6291548", "0.6288259", "0.628...
0.7941872
0
calling directional functions and changing the character state based on key presses (of the character isnt already that state)
function keyPressed(){ if (keyCode === RIGHT_ARROW){ char1.willStop = false; if (char1.state !== "right") char1.rightState(); } if (keyCode === LEFT_ARROW){ char1.willStop = false; if (char1.state !== "left") char1.leftState(); } if (keyCode === DOWN_ARROW){ char1.willStop = false; if (hadouken1.alive === false){ hadouken1.setStart(char1.charX, char1.charY); hadouken1.startTime = 0; hadouken1.lifeTime = 0; hadouken1.alive = true; //playing the sound effect char1.sound.play(); } if (char1.state !== "hadouken") char1.hadouken(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "keyPressed(){\n if(keyCode === 66) {\n this.b = !this.b;\n }\n if(keyCode === 68) {\n this.d = !this.d;\n }\n if(keyCode === 71) {\n this.g = !this.g;\n }\n if(keyCode === 80) {\n this.p = !this.p;\n }\n if(keyCode === 83) {\n this.s = !this.s;\n }\n if(key...
[ "0.7302839", "0.72026944", "0.7122367", "0.70631295", "0.701217", "0.69186395", "0.688831", "0.6866995", "0.6831692", "0.68246555", "0.67790097", "0.67708826", "0.67642766", "0.6757925", "0.6756514", "0.67531675", "0.6748992", "0.6746513", "0.6742833", "0.6739954", "0.6739954...
0.7120514
3
making character stationary if directional keys are released
function keyReleased(){ if (keyCode === RIGHT_ARROW){ char1.willStop = true; } if (keyCode === LEFT_ARROW){ char1.willStop = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onKeyDown(event) {\n if (event.keyCode == 90) { // z\n controls.resetSensor();\n }\n if (event.keyCode == 87) {\n walking = true;\n }\n}", "function keyLifted() {\n down = false;\n\n return down;\n}", "function keyPressed(){\n if (keyCode === RIGHT_ARROW){\n char1.w...
[ "0.74877346", "0.7171018", "0.711841", "0.702407", "0.7021228", "0.694932", "0.69156545", "0.6880561", "0.6880433", "0.6867722", "0.6867722", "0.6866141", "0.68632156", "0.68593454", "0.68265134", "0.682073", "0.6814232", "0.6809712", "0.67907214", "0.6784257", "0.67515874", ...
0.69584334
5
preloading the sound effect
function preload() { char1.sound = loadSound("assets/hadouken.mp3"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function preload(){\n\t sound = loadSound('sound.mp3');\n}", "function preload() {\n soundFormats('wav'); \n mySound = loadSound('assets/00-kick_acoustic.wav');\n}", "function preload() {\n song = loadSound('Sound-of-water-running.mp3');\n}", "function preload() {\n //bling = loadSound('images/sound.m...
[ "0.8098017", "0.79172784", "0.785401", "0.7842114", "0.7827337", "0.7827337", "0.7825268", "0.7808181", "0.7808181", "0.77804434", "0.77799255", "0.7766321", "0.77567863", "0.7752618", "0.773052", "0.77179396", "0.77134436", "0.7708638", "0.7708341", "0.7698495", "0.76982063"...
0.7492857
42
b.fsGp fsToGPol... for each of my fxs, turn them into gP's and then aggregate them all by unioning each reductively so it gets bigger and bigger..
function _pre(){ b2d.divPoints = b2d.divPts = b2d.vs = function () { var g = G(arguments) //all this does is to 'scale down' a series of points //can pass in pts naked OR in an array return _.m( g.s ? g : //passed in verts ([],[],[]) g.f, b2d.div ) //passed an array [[],[],[]] //b2d.div <- function div(v){return V(v).div()} }}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mul(f, g) {\r\n const f0 = BigInt(f.data[0]);\r\n const f1 = BigInt(f.data[1]);\r\n const f2 = BigInt(f.data[2]);\r\n const f3 = BigInt(f.data[3]);\r\n const f4 = BigInt(f.data[4]);\r\n const f5 = BigInt(f.data[5]);\r\n const f6 = BigInt(f.data[6]);\r\n const...
[ "0.52820486", "0.517149", "0.5119514", "0.50312907", "0.49870434", "0.49559712", "0.49406353", "0.49193355", "0.48954755", "0.48953038", "0.48771963", "0.48440468", "0.48396826", "0.48280913", "0.48101825", "0.4805804", "0.47903848", "0.47861093", "0.47793156", "0.47790134", ...
0.0
-1
Added by salim dt:17/10/2018..
constructor(props) { super(props); if (props.user) { autoRefreshToken(); /* const checkToken = auth.isAuthenticated(); if(!checkToken) { redirectToLogin(); } */ } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "transient protected internal function m189() {}", "transient final protected i...
[ "0.6913885", "0.68436104", "0.6648685", "0.65081716", "0.6436301", "0.6368377", "0.6335471", "0.61588955", "0.6085396", "0.60841024", "0.60019535", "0.5970945", "0.59071696", "0.5870283", "0.58647156", "0.58637774", "0.5851704", "0.5845241", "0.58328706", "0.5747419", "0.5689...
0.0
-1
used to valid the form inputs
function validationFields(numberOfPeople, billAmount, tipPercentage) { console.log(isNaN(billAmount)); console.log(billAmount); var noErrors = true; //Check Bill Amount Validation if (billAmount === "" || numberOfPeople === "" || tipPercentage === "") { alert("All field must be filled"); } else { if (isNaN(billAmount) || billAmount === "") { document.getElementById("billAmountError").style.display = "block"; document.getElementById("billAmountError").innerHTML = "bill amount must be a number"; noErrors = false; } else { document.getElementById("billAmountError").style.display = "none"; } //Checks if the number of people is a number if (isNaN(numberOfPeople)) { document.getElementById("numOfPeopleError").style.display = "block"; document.getElementById("numOfPeopleError").innerHTML = "number of people must be an interger"; noErrors = false; } else if (numberOfPeople <= 0) { document.getElementById("numOfPeopleError").style.display = "block"; document.getElementById("numOfPeopleError").innerHTML = "number of people greater than zero"; noErrors = false; } else { document.getElementById("numOfPeopleError").style.display = "none"; } //Checks if the percentage is a number if (isNaN(tipPercentage)) { document.getElementById("tipPercentError").style.display = "block"; document.getElementById("tipPercentError").innerHTML = "bill amount must be a number"; noErrors = false; } else { document.getElementById("tipPercentError").style.display = "none"; } return noErrors; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate(){\n\n\t\t//TODO: make this work\n\n\n\t}", "function validation() {\r\n\t\t\r\n\t}", "validateInputs(){\r\n if(this.state.brand === \"\" || this.state.plates === \"\" || (this.state.year===\"\" || isNaN(this.state.year)) || this.state.currentState===\"\" || this.state.model===\"\" || ...
[ "0.73166907", "0.7295985", "0.71020275", "0.70454836", "0.701639", "0.70110303", "0.6992709", "0.6991851", "0.6973798", "0.6970252", "0.6967508", "0.6955684", "0.69477284", "0.69455993", "0.6930452", "0.6929004", "0.6920506", "0.68955076", "0.68725926", "0.6872013", "0.685135...
0.0
-1
you can only write your code here!
function balikAngka(angka){ var terbalik = 0 while(angka > 0){ let kanan = Math.floor(angka%10) terbalik = terbalik * 10 + kanan angka = Math.floor(angka/10) } return terbalik }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "function _____SHARED_functions_____(){}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "static private internal function ...
[ "0.6697473", "0.64510566", "0.6395561", "0.62958", "0.61033803", "0.6083399", "0.6074526", "0.60422486", "0.60295534", "0.602307", "0.599555", "0.59687126", "0.59435284", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.59124917", "0.5912...
0.0
-1
try to JSONParse the given variable if it is a string return: object or false on error
function safeJSONParse(variable) { try { if (typeof variable == "string") variable=JSON.parse(variable); return variable; } catch { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isJson( string, )\n{\n\ttry\n\t{\n\t\treturn JSON.parse( string, ()=> true, );\n\t}\n\tcatch( e )\n\t{\n\t\treturn false;\n\t}\n}", "IsJsonString(str) {\n try {\n return JSON.parse(str);\n } catch (e) {\n return str;\n }\n }", "function parseJson (jsonStri...
[ "0.7793528", "0.7639939", "0.7635331", "0.7635331", "0.763151", "0.75653297", "0.756432", "0.7550463", "0.75309414", "0.75213104", "0.74761117", "0.7467963", "0.7457585", "0.7445528", "0.7421885", "0.74177", "0.7408275", "0.74075574", "0.73891443", "0.73891443", "0.73891443",...
0.7683708
1
must be called first to initialize all parameters curStep is typically set to 0
function globalInit(curStep) { var methodName = "globalInit"; adapter.log.debug("in: " + methodName + " v0.02"); // All states changes inside the adapter's namespace are subscribed adapter.subscribeStates('*'); var zoe_username = adapter.config.username; var zoe_password = adapter.config.password; var zoe_locale = adapter.config.locale; var zoe_vin = adapter.config.vin; var ignoreApiError = adapter.config.ignoreApiError; var kamereonapikey = adapter.config.kamereonApiKey; var localeParts=zoe_locale.split("_"); var country="FR"; if (localeParts.length>=2) country=localeParts[1]; adapter.log.info("Username:"+zoe_username); //adapter.log.info("Password:"+zoe_password); adapter.log.info("Locale:" +zoe_locale ); adapter.log.info("VIN:" +zoe_vin ); adapter.log.info("Country:" +country ); adapter.log.info("ignoreApiError:"+(ignoreApiError?'true':'false')); var requestClient = axios.create(); var defaultTimeout = adapter.config.timeout; var params={ url:"https://renault-wrd-prod-1-euw1-myrapp-one.s3-eu-west-1.amazonaws.com/configuration/android/config_"+zoe_locale+".json", method:"get", timeout: defaultTimeout, validateStatus: function (status) { return true; } }; adapter.log.info("URL: "+params.url); requestClient(params).catch(function (error) { adapter.log.error('No valid response1 from Renault server'); adapter.log.error(safeJSONParse(error)); return processingFailed({}, 0, ZOEERROR_UNCORRECT_RESPONSE); }).then(function (response) { var statusCode = response.status; var body = response.data; var gigyarooturl = null; var gigyaapikey = null; var kamereonrooturl = null; if (statusCode != 200) { adapter.log.error('No valid response2 from Renault server, using default values'); // Working default values gigyarooturl = 'https://accounts.eu1.gigya.com'; gigyaapikey = '3_7PLksOyBRkHv126x5WhHb-5pqC1qFR8pQjxSeLB6nhAnPERTUlwnYoznHSxwX668'; kamereonrooturl = 'https://api-wired-prod-1-euw1.wrd-aws.com'; // return processingFailed({}, 0, ZOEERROR_UNCORRECT_RESPONSE); } else { adapter.log.debug('Data received from Renault server'); var data = safeJSONParse(body); if (data===false) return processingFailed({}, 0, ZOEERROR_UNPARSABLE_JSON); gigyarooturl = data.servers.gigyaProd.target; gigyaapikey = data.servers.gigyaProd.apikey; kamereonrooturl = data.servers.wiredProd.target; // var kamereonapikey = data.servers.wiredProd.apikey; } adapter.log.info("gigyarooturl:"+gigyarooturl); adapter.log.info("gigyaapikey:"+gigyaapikey); adapter.log.info("kamereonrooturl:"+kamereonrooturl); adapter.log.info("kamereonapikey:"+kamereonapikey); var globalParams = { zoe_username:zoe_username, zoe_password:zoe_password, zoe_locale:zoe_locale, zoe_vin:zoe_vin, gigyarooturl:gigyarooturl, gigyaapikey:gigyaapikey, kamereonrooturl:kamereonrooturl, kamereonapikey:kamereonapikey, country:country, ignoreApiError:ignoreApiError, useLocationApi:adapter.config.useLocationApi, useHVACApi:adapter.config.useHVACApi, stopChargeWorkaroundHour:adapter.config.stopChargeWorkaroundHour, requestClient:requestClient, defaultTimeout:defaultTimeout }; // create root config element adapter.setObjectNotExists(zoe_vin, { type : 'device', common : { name : zoe_vin, type : 'string', role : 'sensor', ack : true }, native : {} }); processNextStep(globalParams, curStep); }); adapter.log.debug("out: " + methodName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "reset() {\n this.steps = 0;\n }", "constructor(el, steps, stepType) {\n super();\n this.intervalTime = 100;\n this.increment = 1000;\n this.el = el;\n this.steps = steps;\n this.stepType = stepType;\n this.countDown = true;\n //this.steps.map((step, index) => {\n // step[\"t...
[ "0.6810469", "0.6426847", "0.6373974", "0.63318944", "0.6224623", "0.61836684", "0.61595196", "0.6155686", "0.6134686", "0.6134271", "0.6114381", "0.6094011", "0.609038", "0.6082072", "0.6075736", "0.60755587", "0.60662836", "0.60606503", "0.60580635", "0.60491234", "0.604229...
0.0
-1
called on success, start next step
function processNextStep(globalParams, curStep) { adapter.log.debug("in: processNextStep, curStep: "+ curStep); var nextStep = curStep + 1; // only one shot if curStep = -1 (for debugging or testing) if (curStep==-1) return; switch(nextStep) { case 1: return globalInit (nextStep); case 2: return loginToGigya (globalParams, nextStep); case 3: return gigyaGetJWT (globalParams, nextStep); case 4: return gigyaGetAccount (globalParams, nextStep); case 5: return getKamereonAccount (globalParams, nextStep); case 6: return getKamereonCars (globalParams, nextStep); case 7: return getBatteryStatus (globalParams, nextStep); case 8: return getCockpit (globalParams, nextStep); case 9: return getLocation (globalParams, nextStep); case 10: return getHVACStatus (globalParams, nextStep); case 11: return initCheckPreconAndCharge (globalParams, nextStep); case 12: return checkPreconNow (globalParams, nextStep); case 13: return checkChargeCancel (globalParams, nextStep); case 14: return checkChargeEnable (globalParams, nextStep); case 15: return processingFinished (globalParams, nextStep); default: return processingFailed(globalParams, curStep, ZOEERROR_NONEXTSTEP); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "__nextStep() {\n this.openNextStep();\n }", "function step() {\n\n // if there's more to do\n if (!result.done) {\n result = task.next();\n step();\n }\n }", "function step() {\n paused = true;\n executeNext(true);\n }", "nextstep(step) {}"...
[ "0.709895", "0.7038313", "0.6856321", "0.6854222", "0.68436325", "0.68436325", "0.68436325", "0.68436325", "0.68246377", "0.6816382", "0.67627627", "0.67562646", "0.6735613", "0.6735613", "0.6735613", "0.67294556", "0.66476667", "0.662761", "0.6595572", "0.647254", "0.6469834...
0.6076435
28
called on error, exiting with error code
function processingFailed(globalParams, curStep, errorCode) { // check if failing in step is ok if (errorCode==ZOEERROR_UNCORRECT_RESPONSE && globalParams.ignoreApiError) { switch(curStep) { case 7: return processNextStep(globalParams, curStep); case 8: return processNextStep(globalParams, curStep); case 9: return processNextStep(globalParams, curStep); case 10: return processNextStep(globalParams, curStep); default: break; } } adapter.log.debug("in: processingFailed, curStep: "+ curStep); adapter.log.error('Error in step '+curStep+', errorCode: '+errorCode); adapter.terminate ? adapter.terminate(1) :process.exit(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exitError() {\n process.exit(1);\n }", "onerror() {}", "onerror() {}", "function endOnError(err) {\n console.log(err);\n process.exit(1);\n}", "handleFailure (error_)\n\t{\n\t\tthrow error_;\n\t}", "function e_error(code) {\n pj_ctx_set_errno(code);\n fatal();\n}", "function error (err...
[ "0.708033", "0.69563377", "0.69563377", "0.6875588", "0.6785166", "0.6778355", "0.6717557", "0.6685013", "0.66156256", "0.66156256", "0.66156256", "0.66131437", "0.6585356", "0.6564009", "0.6552909", "0.6548624", "0.654608", "0.64903915", "0.64833313", "0.646155", "0.6452815"...
0.6226109
42
New packet error, extends default error class.
function PacketError(message, extra) { if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); } this.name = this.constructor.name; this.level = 'Critical'; this.message = message; this.extra = extra; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CustomError() {}", "function CustomError(type,message){\n\t\t\tthis.type=type;\n\t\t\tthis.message=message;\n\t\t}", "function extendError(constructor, error_name, default_message, status_code, safe_message) {\n /*jshint validthis:true */\n \n // check for optional constructor\n ...
[ "0.7020092", "0.635068", "0.63197356", "0.63026273", "0.62938434", "0.62360144", "0.62108105", "0.6192444", "0.61341524", "0.6121295", "0.6079457", "0.6031701", "0.6028829", "0.60282385", "0.60117376", "0.6008815", "0.59550375", "0.5922795", "0.59172416", "0.59131163", "0.590...
0.7008456
1
only use after constructing.
setXY(x,y) { this.x = x; this.y = y; this.drawx = x; this.drawy = y; this.vis = { dx : 0, dy : 0, x : this.x, y : this.y }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _construct()\n\t\t{;\n\t\t}", "__previnit(){}", "constructor() {\r\n // ohne Inhalt\r\n }", "constructor() {\n\t\t// ...\n\t}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {\n ...
[ "0.7161022", "0.6976652", "0.68866026", "0.67762905", "0.6746007", "0.6746007", "0.6746007", "0.6746007", "0.6746007", "0.6746007", "0.671666", "0.6706376", "0.6671625", "0.66642827", "0.66343075", "0.6632068", "0.66071916", "0.65947217", "0.65764874", "0.6542642", "0.6534200...
0.0
-1
TODO weapon ranks and stuff
canUseWeapon(w) { // if eqWeap == -1 then this.weapons[eqWeap] -> undefined let r = true; if (w === undefined) return false else if (this.hasSkill("noncombatant")) r = false; else if (w !== null && w.pref !== null && this.name != w.pref) r = false; return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomWeapon() {\r\n let array = [\r\n { weapon: \"Sword\", type: \"physical\", ability: \"randomInt(4, 12)\", deathNote: \"was sliced in half by a sword!\" },\r\n { weapon: \"Shovel\", type: \"physical\", ability:\"randomInt(3, 10)\", deathNote: \"got dugged by a shovel!\" },\r\n ...
[ "0.67575055", "0.66651475", "0.659243", "0.6518746", "0.65130043", "0.6504878", "0.64964586", "0.6477606", "0.64665306", "0.6460312", "0.6445884", "0.64417624", "0.64142144", "0.64136213", "0.63646126", "0.63240844", "0.62791085", "0.6267591", "0.62572294", "0.6245686", "0.61...
0.0
-1
more interesting stuff here later
generateActions(g) { return ["attack", "wait"]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "protected internal function m252() {}", "static private internal fun...
[ "0.6807197", "0.6442346", "0.6221956", "0.61659944", "0.6142497", "0.60902244", "0.6063322", "0.58593875", "0.5825794", "0.5702422", "0.5676093", "0.56689405", "0.5661094", "0.565304", "0.5627449", "0.55998325", "0.55659175", "0.5514499", "0.5508515", "0.54884124", "0.5467439...
0.0
-1
usually used in cutscenes speed: number of frames per tile
moveTo(g, x, y, speed = this.baseMapSpeed*2) { if (this.x == x && this.y == y) return if (Settings.get("cut_skip") == true) { this.teleport(g, x, y); return; } return new Promise( async (resolve) => { let p = await generatePath(g, this.x, this.y, x, y, this.movcost); if (p == null) { throw "Could not find path to (x, y) = (" + this.x + ", " + this.y + ") to (" + x + ", " + y + ")."; } this.path_iter = p.iter(); this.path_iter.onDone = resolve; this.path_iter.counter = speed; this.mapSpeed = speed; this.path_iter.next(); this.moving = true; g.Map.removeUnit(this); g.Map.getTile(x, y).unit = this; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "GetTileCount()\n\t{\n\t\tvar value = this.tileCountPerGrid * this.gridCount * this.tileCountPerGrid * this.gridCount ; \n\t\treturn value;\n\t}", "countFrames() {\nreturn this.fCount;\n}", "async getTotalFrames() {\r\n return this.lottieAnimation.totalFrames;\r\n }", "function GetNumTiles() {\n va...
[ "0.69714344", "0.67848927", "0.6593722", "0.649643", "0.6483208", "0.64464253", "0.63163495", "0.62803954", "0.6234065", "0.6233675", "0.6186772", "0.6172054", "0.615826", "0.6126344", "0.6119385", "0.6091285", "0.60773027", "0.6062018", "0.60596883", "0.6020417", "0.5968177"...
0.0
-1
attackable from a certain coordinate ie does not factor in movement
attackableTiles(map, wlist = this.weapons) { let wlist2 = [] for (let w of wlist) { if (this.canUseWeapon(w)) { wlist2.push(w) } } let p = inRange(this, this.getRange(wlist2), "tiles", map); p.setArt("C_atk"); return p; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attackXY(x, y){\n arrow.pos.Vector = x;\n arrow.pos.Vector = y;\n}", "attack(enemyShip) {\n if (this.canAttack(enemyShip)) {\n const hit = Math.round(Math.random() + .3)\n if (hit && !enemyShip.sunk) {\n const damage = this.damage * Math.random()\n enemyShip.hp -= damage\n ...
[ "0.7289693", "0.701776", "0.6895369", "0.67279935", "0.6709622", "0.660727", "0.65514874", "0.65250105", "0.6498388", "0.647404", "0.64613736", "0.64321285", "0.63751817", "0.6326892", "0.628847", "0.62724495", "0.6246679", "0.6246571", "0.623883", "0.62380874", "0.6219181", ...
0.5889322
70
attackable from a certain coordinate ie does not factor in movement
attackableUnits(g, wlist = null) { return this.attackableUnitsFrom(g, null, wlist); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attackXY(x, y){\n arrow.pos.Vector = x;\n arrow.pos.Vector = y;\n}", "attack(enemyShip) {\n if (this.canAttack(enemyShip)) {\n const hit = Math.round(Math.random() + .3)\n if (hit && !enemyShip.sunk) {\n const damage = this.damage * Math.random()\n enemyShip.hp -= damage\n ...
[ "0.7288861", "0.7018269", "0.6895771", "0.6729098", "0.6710337", "0.6606484", "0.6551421", "0.65252167", "0.64997894", "0.6474597", "0.6461502", "0.64315295", "0.6376862", "0.63266724", "0.6287607", "0.62723", "0.6247899", "0.624592", "0.6239743", "0.6239565", "0.6219992", ...
0.0
-1
will be used later if move is affected by anything. if not, then this will just be a getter
getMov() { let bn = 0 for (let i of this.equipment) { for (let [stat, amt] of Object.entries(i.stats)) { if (stat == "mov") bn += amt } } let ret = this.stats.mov + bn; if (ret < 0) ret = 0 return ret }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getMove() {\n return this.nextAction;\n }", "get moves() {\n return this._moves;\n }", "move () {\n //console.warn(\"WARNING\" + this + \" : not implemented move method\");\n }", "getMovements() {\n return this.#movements;\n }", "getMovements() {\n return this.#movements;\n }", "_getC...
[ "0.7011311", "0.6899151", "0.6733691", "0.66751665", "0.66751665", "0.6539174", "0.6418189", "0.64128286", "0.63664794", "0.63359445", "0.6287659", "0.6287659", "0.6213541", "0.61799604", "0.6143535", "0.6102703", "0.609781", "0.60841054", "0.60810554", "0.6012407", "0.600643...
0.0
-1
Construct a generic Request object. The URL is |test_url|. All other fields are defaults.
function new_test_request() { return new Request(test_url) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static request(method, url, config = {}) {\n return Request.make(method, url, config);\n }", "@exposedMethod\n\trequest(options, url=null, json=null) {\n\t\t/*\n\t\t*\tCreate, send, and return a new `Request`. See the `Request`\n\t\t*\tconstructor for the `options` specification.\n\t\t*/\n\t\tif (typeo...
[ "0.6638846", "0.64101845", "0.6334804", "0.63018996", "0.62438667", "0.6103885", "0.58861715", "0.57570624", "0.5753225", "0.5723475", "0.5692982", "0.56849635", "0.5586672", "0.5580204", "0.55631196", "0.55519205", "0.55082494", "0.5448006", "0.5383356", "0.5369603", "0.5365...
0.78611463
0
Construct a generic Response object.
function new_test_response() { return new Response('Hello world!', { status: 200 }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create() {\n return new Response();\n}", "function ResponseBase() {}", "function createResponseObject(status, message, data)\n{\n var object = { status: status, message: message, data: data };\n return object;\n}", "function Response(body, headers, status) {\n if (!(this instanceof Respo...
[ "0.74712926", "0.6968805", "0.67969537", "0.6745664", "0.6582377", "0.64811665", "0.6448642", "0.6364888", "0.6360363", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.6171889", "0.61714923",...
0.6348323
9
Return an identifier for the tree expansion state.
function nodeExpansionIdentifier(path) { const splitPath = path.split('/'); if (splitPath.length > 1) { return `G:${splitPath[splitPath.length - 1]}`; } return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_getExpandedState() {\n return this.expanded ? 'expanded' : 'collapsed';\n }", "_getExpandedState() {\n return this.expanded ? 'expanded' : 'collapsed';\n }", "function getExpandableTargetElementID()\r\n{\r\n}", "getIdentifier () {\n return (this._identifier);\n }", "getId() {\n ...
[ "0.5656337", "0.5656337", "0.5645384", "0.55834687", "0.5345829", "0.53317225", "0.51989716", "0.5192754", "0.5062759", "0.50327003", "0.5027351", "0.50154865", "0.50127435", "0.50047374", "0.5004341", "0.49946573", "0.4952317", "0.4916813", "0.4911228", "0.4900761", "0.48924...
0.63093114
0
Expands or shrinks tutorial code blocks
function togglecode(event) { var child = event.currentTarget.parentElement.firstChild; var counter = 0; while(child!= null){ // skip TextNodes if(child.nodeType == Node.TEXT_NODE) { child = child.nextSibling; continue; } if(counter === 0) { toggleclass($(child), 'collapsed'); } else { toggleclass($(child), 'hidden'); } child = child.nextSibling; counter++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setCodeExamples(){\n\n\t\n\n\tvar html=\"\";\n\t$('*[data-language]').each(function(){\n\t\tvar code=$(this).html();\n\t\tcode=code.replace(/</g,\"&lt;\");\n\t \tcode=code.replace(/>/g,\"&gt;\");\n\t \tcode=$.trim(code);\n\n\t \tif(code!==\"\"){\n\t\t \thtml+=\"<h3>\"+$(this).attr('data-language-label...
[ "0.5884831", "0.5861695", "0.57132167", "0.5552831", "0.55197155", "0.5501783", "0.54489464", "0.54361385", "0.54100937", "0.5300956", "0.527157", "0.5257795", "0.5243929", "0.5239504", "0.51865286", "0.5186303", "0.518126", "0.51614493", "0.51585096", "0.5150986", "0.5141165...
0.0
-1
Call this method for tutorials with deprecated content, it will display a message in the beginnig of the page stating that the tutorial is deprecated. Pass a string if you want to display any other text.
function displayDeprecatedWarning(text) { var container = $('<div />', { 'class': 'deprecated-container' }); var cell = $('<div />', { 'class': 'deprecated-cell' }).appendTo(container); var p = $('<p />', { 'text': text != null ? text : 'Functionality explained in this tutorial has been deprecated and should not be used for any new products!' }).appendTo(cell); var header = $('.c1'); if(header.length !== 0) { container.insertAfter(header); } else { container.prependTo($('.body-content')); } var closeSymbol = $('<div />', { 'class': 'close-warning' }); var span = $('<span />', { 'class': 'glyphicon glyphicon-remove' }).appendTo(closeSymbol); closeSymbol.appendTo(container); closeSymbol.click(function() { container.hide(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onTutorialDone() {\n this.show();\n this.app.message('The tutorial is always available in the settings menu at the bottom right.',5000)\n }", "function deprecated(details) {\n console.log('Deprecated API usage: ' + details);\n }", "function showHelp(helpMessage) {\n $(\"#hel...
[ "0.6155814", "0.60845333", "0.5817553", "0.57777125", "0.5719948", "0.5641764", "0.5538467", "0.55131286", "0.55131286", "0.54956704", "0.547804", "0.54641485", "0.54181254", "0.5416328", "0.54139847", "0.5406566", "0.540531", "0.5400667", "0.53845036", "0.53598875", "0.53132...
0.6557683
0
helper function to transform array of answers into radio options for our HTML form
function createQuestionsHTML() { return QUESTIONS[currentQuestionIndex].answers .map((question, index) => { return ` <div class="answer"> <input type="radio" name="answer" value="${index}" id="option${index}" class="pr-2"/> <label for="option${index}">${question.text}</label> </div>` }) .join('\n') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function answers() {\n // for loop through answerlist\n for (var i = 0; i < triviaQuestions[currentQuestion].answerList.length; i++) {\n var choice = $(\"<input>\")\n choice.attr(\"type\", \"radio\")\n choice.attr(\"id\", triviaQuestions[currentQuestion].answerList[i]...
[ "0.7307562", "0.72013414", "0.7122605", "0.7078965", "0.7004726", "0.688963", "0.68672985", "0.68615353", "0.6808318", "0.6767966", "0.67205757", "0.66582733", "0.66462916", "0.66335374", "0.6565449", "0.6535975", "0.6535975", "0.6535975", "0.6535975", "0.65352046", "0.653399...
0.6769052
9
check if the answer is valid
function checkAnswerValid() { let answerIndex = $('input[name=answer]:checked').val() let answerNotSelected = !answerIndex if (answerNotSelected) { alert('Whoever didnt pick an answer...ya moms a h0e') } else { let answer = QUESTIONS[currentQuestionIndex].answers[ Number($('input[name=answer]:checked').val()) ] updateForm({ answer, answerIndex }) // increment correct / incorrect count answer.correct ? numCorrect++ : numIncorrect++ updateCorrectIncorrect() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateAnswer() {\n switch (current_question_number) {\n case 1: {\n return validateQuestion1();\n }\n case 2: {\n return validateQuestion2();\n }\n case 3: {\n return validateQuestion3();\n ...
[ "0.6893438", "0.68778795", "0.65805656", "0.6507202", "0.64984584", "0.6467832", "0.6420612", "0.6392435", "0.6378431", "0.63439465", "0.6311938", "0.6288506", "0.6277815", "0.62592864", "0.6252495", "0.6244372", "0.62287843", "0.6213023", "0.6198579", "0.6187503", "0.6186214...
0.66034335
2
updates the question form with validation messages / classes
function updateForm({ answer, answerIndex }) { currentState = answer.correct ? STATES.CORRECT : STATES.INCORRECT // add correct/incorrect (stat) class to the form $('form').addClass(currentState) // disable all radios $('input[type=radio]').prop('disabled', true) if (answer.correct) { // add class, success message, and icon to correct answer $('.answer') .eq(answerIndex) .addClass('correct') .append( `<p> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> <path class="heroicon-ui" d="M17.62 10H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H8.5c-1.2 0-2.3-.72-2.74-1.79l-3.5-7-.03-.06A3 3 0 0 1 5 9h5V4c0-1.1.9-2 2-2h1.62l4 8zM16 11.24L12.38 4H12v7H5a1 1 0 0 0-.93 1.36l3.5 7.02a1 1 0 0 0 .93.62H16v-8.76zm2 .76v8h2v-8h-2z"/> </svg>Correct 🥰! Nice job!</p>` ) } else { let correctAnswerIndex = QUESTIONS[currentQuestionIndex].answers.findIndex( answer => answer.correct ) // add class, error, and icon to incorrect answer $('.answer') .eq(answerIndex) .addClass('incorrect') .append( `<p> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> <path class="heroicon-ui" d="M4.93 19.07A10 10 0 1 1 19.07 4.93 10 10 0 0 1 4.93 19.07zm1.41-1.41A8 8 0 1 0 17.66 6.34 8 8 0 0 0 6.34 17.66zM13.41 12l1.42 1.41a1 1 0 1 1-1.42 1.42L12 13.4l-1.41 1.42a1 1 0 1 1-1.42-1.42L10.6 12l-1.42-1.41a1 1 0 1 1 1.42-1.42L12 10.6l1.41-1.42a1 1 0 1 1 1.42 1.42L13.4 12z"/> </svg>Sorry, that's wrong 😭, correct answer was ${QUESTIONS[currentQuestionIndex].answers[correctAnswerIndex].text}` ) // add class to correct answer $('.answer') .eq(correctAnswerIndex) .addClass('correct') } // update button text $('button').html(`Next &raquo;`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate() {\r\n\r\n\r\n \r\n // set the progress of the background\r\n progress.style.width = ++position * 100 / questions.length + 'vw'\r\n\r\n // if there is a new question, hide current and load next\r\n if (questions[position]) hideCurrent(putQuestion)\r\n else hideCurre...
[ "0.6535848", "0.6398047", "0.6312606", "0.62959003", "0.62550265", "0.6219928", "0.6192129", "0.6094662", "0.6065104", "0.6041724", "0.600894", "0.59998304", "0.5971749", "0.5957085", "0.5917785", "0.590533", "0.5903665", "0.58990216", "0.58947426", "0.57842416", "0.5779262",...
0.6516944
1
updates the counter for number of correct/incorrect answers
function updateCorrectIncorrect() { if ($('footer.footer').length) { $('footer.footer').html(`${numCorrect} correct / ${numIncorrect} incorrect`) } else { $('body').append( `<footer class="footer">${numCorrect} correct / ${numIncorrect} incorrect</footer>` ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update_question_result(correct) {\n if (correct === true) {\n correct_answers++;\n document.getElementById(\"question_result\").innerText = \"Success!\"\n } else {\n document.getElementById(\"question_result\").innerText = \"Wrong!\"\n }\n}", "function scoreCount() {\n for (var i = 0;...
[ "0.7561109", "0.7514391", "0.74315643", "0.7414531", "0.73319864", "0.7325884", "0.72810787", "0.72481173", "0.72317797", "0.7213517", "0.720348", "0.7201827", "0.7192578", "0.7182521", "0.71707326", "0.7142154", "0.7116305", "0.71128964", "0.709268", "0.70350134", "0.7032912...
0.0
-1
listen for button clicks behavior changes based on the current state
function loadButtonListener() { $('main').on('click', 'button', function(event) { event.preventDefault() switch (currentState) { case STATES.START: loadNextQuestion() break case STATES.QUESTION: checkAnswerValid() break case STATES.CORRECT: case STATES.INCORRECT: currentQuestionIndex++ currentQuestionIndex >= QUESTIONS.length ? loadEnd() : loadNextQuestion() break case STATES.END: loadStart() break } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clickHandler() {\n // Activate if not active\n if (this.active === false) {\n // Button view press effect\n this.changeToActive();\n // No click 'action' for input - text is removed in visualEffectOnActivation\n }\n }", "setButtonState() {\n // this.vie...
[ "0.71063447", "0.69722575", "0.69307727", "0.679892", "0.67880434", "0.6735306", "0.6671232", "0.6668437", "0.6642453", "0.6615837", "0.65779763", "0.6566797", "0.64925015", "0.6483799", "0.64733166", "0.6463827", "0.6409078", "0.63712937", "0.63564706", "0.6356108", "0.62798...
0.0
-1
cleanup procedures start nodeEnd is the function called when the node instance receives an exit signal it needs to be reset every time the agora process refreshes if killed
function nodeEnd() { // signal all current processing requests that a terminate request has been received isTerminating = true; // if it is processing, ensure all events return before stopping if (processing) { (function wait() { if (processing) { setTimeout(wait, 100); } else { agora_process.kill(); } })() } else { agora_process.kill(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endMonitorProcess( signal, err ) {\n\n if ( err ) {\n \n log.e( 'Received error from ondeath?' + err ); \n\n releaseOracleResources( 2 ); \n\n\n } else {\n\n log.e( 'Node process has died or been interrupted - Signal: ' + signal );\n log.e( 'Normally this would be due to DOCKER STOP comman...
[ "0.66363543", "0.65154916", "0.6301238", "0.62487996", "0.62001604", "0.6180978", "0.6143477", "0.60690796", "0.6034279", "0.6033834", "0.6007936", "0.5979", "0.5979", "0.5979", "0.5979", "0.5979", "0.5974789", "0.5945357", "0.59279394", "0.5925792", "0.5925008", "0.5914519...
0.7573604
0
the chained parameter means that this function call is chained from a previous request,
function processNextRequest(chained) { // two conditions where the next request should not be processed // 1. processing is true (a function chain is currently processing) and // chained is false (this function is not part of the current // processing function chain) // 2. requests.length is false (no requests are left to process) if ((processing && !chained) || !requests.length) { // if there are no requests left to process, but we are part of the current // processing function chain, we are done processing. if (chained) { processing = false; } return; } processing = true; var request = requests.shift(); var question = JSON.stringify({ command: request.command, arguments: request.arguments }) + '\n'; try { rl.question(question, (response) => { var res; try { res = JSON.parse(response) } catch (err) { res = { error: 'An error has occurred with the Agora backend.' } console.log(response); } request.callback(res); if (requests.length > 0) { // if there are requests remaining // keep the current processing chain going process.nextTick(function() { processNextRequest(true) }); } else { // else terminate the processing processing = false; } }) } catch (e) { requests.unshift(request); processing = false; // try again if it fails after 200 ms setTimeout(processNextRequest, 200); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "chain (_) {\n return this \n }", "chain(_) {\n return this\n }", "function yelpAPIcall(frmtName,frmtAddr,ratingsarray,chain) {\n\nvar yelptoken = \"Bearer dlVH8b6SrxR8hB3Qt-kp8oNeaDzXSYP5O_pG7Gy6Sm5E7PxMa_6wbrpY88thyflQ3KVJ8xg6eAtGO_oEYRtC8c9oXBTVsCSbJGzV65ohKSdKhEIDxqvvZxGP5X_lWXYx\";\nvar chriskey = ...
[ "0.6890434", "0.67132396", "0.60674584", "0.59699416", "0.59361625", "0.5879877", "0.5711041", "0.570187", "0.5629198", "0.55755967", "0.5561867", "0.55550146", "0.5540326", "0.55025655", "0.5474994", "0.5472789", "0.5472789", "0.5472789", "0.5466544", "0.5464811", "0.5418719...
0.56908596
8
prevent default action of these events on the drop area
function preventDefaults (e) { e.preventDefault(); e.stopPropagation(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onDrop() {\n this.disable();\n }", "function drop(ev){\r\n ev.preventDefault(ev);\r\n}", "function presb_allowDrop(ev) {\n\tev.preventDefault();\n}", "function allowDrop(ev) { ev.preventDefault(); }", "function allowDrop(ev){\nev.preventDefault();}", "function allowDrop(event) {\n /...
[ "0.8396293", "0.8315724", "0.8175456", "0.8124752", "0.8047427", "0.8045716", "0.80389243", "0.80324674", "0.8024054", "0.8021333", "0.8021333", "0.8021333", "0.8021333", "0.8014659", "0.8006463", "0.8005092", "0.7994478", "0.79842836", "0.7974591", "0.7974373", "0.7966192", ...
0.0
-1
Add header in statistics table to group metrics by category format
function summaryTableHeader(header) { var newRow = header.insertRow(-1); newRow.className = "tablesorter-no-sort"; var cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 1; cell.innerHTML = "Requests"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 3; cell.innerHTML = "Executions"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 6; cell.innerHTML = "Response Times (ms)"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 1; cell.innerHTML = "Throughput"; newRow.appendChild(cell); cell = document.createElement('th'); cell.setAttribute("data-sorter", false); cell.colSpan = 2; cell.innerHTML = "Network (KB/sec)"; newRow.appendChild(cell); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function summaryTableHeader(header) {\n var newRow = header.insertRow(-1);\n newRow.className = \"tablesorter-no-sort\";\n var cell = document.createElement('th');\n cell.setAttribute(\"data-sorter\", false);\n cell.colSpan = 1;\n cell.innerHTML = \"Requests\";\n newRow.appendChild(cell);\n\n ...
[ "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.6639242", "0.66302717", "0.66302717", "0.66302717", "0.6612234", "0.6612234", "0.6612234", "0.6612234", "0.6612234", ...
0.6634643
13
Populates the table identified by id parameter with the specified data and format
function createTable(table, info, formatter, defaultSorts, seriesIndex, headerCreator) { var tableRef = table[0]; // Create header and populate it with data.titles array var header = tableRef.createTHead(); // Call callback is available if(headerCreator) { headerCreator(header); } var newRow = header.insertRow(-1); for (var index = 0; index < info.titles.length; index++) { var cell = document.createElement('th'); cell.innerHTML = info.titles[index]; newRow.appendChild(cell); } var tBody; // Create overall body if defined if(info.overall){ tBody = document.createElement('tbody'); tBody.className = "tablesorter-no-sort"; tableRef.appendChild(tBody); var newRow = tBody.insertRow(-1); var data = info.overall.data; for(var index=0;index < data.length; index++){ var cell = newRow.insertCell(-1); cell.innerHTML = formatter ? formatter(index, data[index]): data[index]; } } // Create regular body tBody = document.createElement('tbody'); tableRef.appendChild(tBody); var regexp; if(seriesFilter) { regexp = new RegExp(seriesFilter, 'i'); } // Populate body with data.items array for(var index=0; index < info.items.length; index++){ var item = info.items[index]; if((!regexp || filtersOnlySampleSeries && !info.supportsControllersDiscrimination || regexp.test(item.data[seriesIndex])) && (!showControllersOnly || !info.supportsControllersDiscrimination || item.isController)){ if(item.data.length > 0) { var newRow = tBody.insertRow(-1); for(var col=0; col < item.data.length; col++){ var cell = newRow.insertCell(-1); cell.innerHTML = formatter ? formatter(col, item.data[col]) : item.data[col]; } } } } // Add support of columns sort table.tablesorter({sortList : defaultSorts}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillTable(id) {\n\n // Pull the metadata\n d3.json(path).then((sampleData) => {\n var data = sampleData.metadata;\n\n // Grab the table element\n var demoInfo = d3.select(\"#sample-metadata\")\n\n // Clear any previous table\n demoInfo.html(\"\"); \n\n // Generate a blank list and ...
[ "0.6686535", "0.6420196", "0.6196701", "0.6184805", "0.61444736", "0.60633874", "0.6031633", "0.596071", "0.58881193", "0.5884037", "0.5879668", "0.5862247", "0.5862149", "0.5843813", "0.5841007", "0.58353907", "0.58286166", "0.5822772", "0.58211654", "0.5819544", "0.5818261"...
0.0
-1
Initializes the event handeling functions within the program.
constructor(canvas, scene) { this.canvas = canvas; this.scene = scene; _inputHandler = this; // Mouse Events this.canvas.onmousedown = function(ev) { _inputHandler.click(ev) }; this.canvas.onmousemove = function(ev) { }; // Button Events document.getElementById('fileLoad').onclick = function() { _inputHandler.readSelectedFile() }; // HTML Slider Events document.getElementById('exampleSlider').addEventListener('mouseup', function() { console.log(this.value); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initializeEvents () {\n }", "init () {\n const me = this;\n\n if (!me.eventsInitialized) {\n me.events.forEach(event => process.addListener(event, me.exec));\n\n me.eventsInitialized = true;\n }\n }", "function init() {\n\t\tinitEvents();\n\t}", "_initEvents(){\...
[ "0.7819221", "0.7742967", "0.7721209", "0.74809366", "0.74472845", "0.736311", "0.7303603", "0.72342724", "0.72149634", "0.7187284", "0.7175394", "0.71666014", "0.7140642", "0.71191394", "0.70814234", "0.7038503", "0.7002469", "0.69794565", "0.6948371", "0.6899367", "0.687997...
0.0
-1
Function called upon mouse click.
click(ev) { // Print x,y coordinates. console.log(ev.clientX, ev.clientY); var shape = new Triangle(shader); this.scene.addGeometry(shape); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mouseClick(p) {\n }", "onClick(event) {\n\t\t// console.log(\"mouse click\");\n\t\tthis.draw(event);\n\t}", "function mouseClicked(){\n sim.checkMouseClick();\n}", "function canvasClick(e) {\n\tblockus.mouseClicked();\n}", "function mouseClicked() {\n // If it has been clicked return true\n ...
[ "0.77607894", "0.77420837", "0.7663327", "0.7652763", "0.76443285", "0.7640984", "0.7640984", "0.76097023", "0.75493664", "0.7548157", "0.75453013", "0.7483764", "0.74433106", "0.73612285", "0.7358323", "0.7313255", "0.7306813", "0.72917074", "0.72869456", "0.72677", "0.72671...
0.0
-1