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
If the map position is out of range, move it back
function checkBounds() { // Perform the check and return if OK if (allowedBounds.contains(map.getCenter())) { return; } // It`s not OK, so find the nearest allowed point and move there var C = map.getCenter(); var X = C.lng(); var Y = C.lat(); var AmaxX = allowedBounds.getNorthEast().lng(); var AmaxY = allowedBounds.getNorthEast().lat(); var AminX = allowedBounds.getSouthWest().lng(); var AminY = allowedBounds.getSouthWest().lat(); if (X < AminX) {X = AminX;} if (X > AmaxX) {X = AmaxX;} if (Y < AminY) {Y = AminY;} if (Y > AmaxY) {Y = AmaxY;} //alert ("Restricting "+Y+" "+X); map.setCenter(new GLatLng(Y,X)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move() {\n //Move the kid to the determined location\n this.x = this.nextMoveX;\n this.y = this.nextMoveY;\n //Check in case the kid touches the edges of the map,\n // if so, prevent them from leaving.\n this.handleConstraints();\n }", "stop() {\n dataMap.get(this).moveX = 0;\n ...
[ "0.6972546", "0.6672955", "0.6629053", "0.6550322", "0.649555", "0.64214694", "0.6351626", "0.6306547", "0.623804", "0.620808", "0.6173601", "0.6154243", "0.612907", "0.61056775", "0.6096429", "0.60478914", "0.60388273", "0.60315776", "0.6029463", "0.60246664", "0.5997767", ...
0.0
-1
Manually invoke existing renderer.
render() { this.$.overlay.render(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addRenderer(renderer) {\n this.renderer = renderer;\n }", "registerRenderer(renderer) {\n this._renderer = renderer;\n this.performTransition();\n }", "rendererCallback () {\n // TODO: cannot move code here because tests expects renderer function to still exist on constructor!\n retu...
[ "0.69677925", "0.6877854", "0.68665683", "0.68665683", "0.6827173", "0.6821726", "0.67483604", "0.67107785", "0.66523", "0.6587107", "0.6587107", "0.6587107", "0.6569686", "0.6510735", "0.6441818", "0.6439868", "0.6435914", "0.64349604", "0.6428976", "0.6373714", "0.6342005",...
0.0
-1
Close the dialog if `noCloseOnOutsideClick` isn't set to true
_handleOutsideClick(e) { if (this.noCloseOnOutsideClick) { e.preventDefault(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_handleOutsideClick(e) {\n if (this.state.noCloseOnOutsideClick) {\n e.preventDefault();\n }\n }", "handleClickOutside() {\n this._closeOptions();\n }", "function clickOutside(e) {\n if(e.target == modal ) {\n modal.style.display = 'none';\n }\n}", "function clickOutside(e) {\n\tif(e.t...
[ "0.7278886", "0.7171496", "0.70916253", "0.70806336", "0.7067941", "0.70525706", "0.705054", "0.7002624", "0.6982755", "0.69816595", "0.69748914", "0.6971101", "0.6967399", "0.6961027", "0.694508", "0.68863404", "0.6875455", "0.68377805", "0.6834997", "0.6704097", "0.67016554...
0.7693915
1
Close the dialog if `noCloseOnEsc` isn't set to true
_handleEscPress(e) { if (this.noCloseOnEsc) { e.preventDefault(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkEsc(name) {\r\n // Capture the Esc key to close the dialog.\r\n $(document).on(\"keyup.dialog\", function (event) {\r\n if (event.keyCode === 27) {\r\n event.stopPropagation();\r\n close(name);\r\n }\r\n });\r\n }", "_handleEscPress(e) {\n if (th...
[ "0.7244565", "0.7121964", "0.71005625", "0.68334466", "0.68326956", "0.67944854", "0.67944854", "0.6608705", "0.6559097", "0.65186304", "0.6463825", "0.6418731", "0.6415561", "0.64043576", "0.6350256", "0.6316218", "0.6287584", "0.6277058", "0.6260934", "0.6238183", "0.623695...
0.7540487
1
Returns the Profiles and Projects associated with the passed Interest.
function getInterestData(name) { const vendors = _.pluck(VendorTypes.collection.find({ vendorType: name }).fetch(), 'vendor'); const vendorPictures = vendors.map(vendor => Vendors.collection.findOne({ email: vendor }).picture); // console.log(_.extend({ }, data, { interests, projects: projectPictures })); return _.extend({ }, { name, vendors: vendorPictures }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getProjects() {\n return []\n }", "getProjects() {\n return this.#fetchAdvanced(this.#getProjectsURL()).then((responseJSON) => {\n let projectBOs = ProjectBO.fromJSON(responseJSON);\n //console.info(projectBOs);\n return new Promise(function (resolve) {\n resolve(projectBOs);\n...
[ "0.5771579", "0.5649819", "0.56445163", "0.5529522", "0.5509322", "0.54768616", "0.5465083", "0.5406542", "0.5402939", "0.5383652", "0.5369943", "0.53506094", "0.530953", "0.5308078", "0.5286793", "0.5278126", "0.52184117", "0.5210045", "0.51988316", "0.5177392", "0.51467806"...
0.0
-1
If the subscription(s) have been received, render the page, otherwise show a loading icon.
render() { return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showLoading() {\n if (loadingMessageId === null) {\n loadingMessageId = rcmail.display_message('loading', 'loading');\n }\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.read...
[ "0.6480619", "0.6350569", "0.6349684", "0.629345", "0.6243007", "0.6243007", "0.6243007", "0.6243007", "0.62422377", "0.62412745", "0.61397916", "0.6128012", "0.60392493", "0.59955424", "0.5964248", "0.59292483", "0.592554", "0.5916828", "0.5914855", "0.58417475", "0.5823805"...
0.6306368
23
Render the page once subscriptions have been received.
renderPage() { const vendorTypes = _.pluck(VendorClass.collection.find().fetch(), 'vendor'); const vendorTypeData = vendorTypes.map(vendorType => getInterestData(vendorType)); return ( <div id='byCategory-Page' className='pages-background' style={{ paddingTop: '20px' }}> <Container id="interests-page"> <Card.Group> {_.map(vendorTypeData, (vendorType, index) => <MakeCard key={index} vendorType={vendorType}/>)} </Card.Group> </Container> <div className='green-gradient' style={{ paddingTop: '100px' }}/> <div className='footer-background'/> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleAPILoaded()\n{\n requestSubscriptionList();\n}", "function _render(){\n\t\tinfo = {\n\t\t\t\tpublishers_array: publishers_array\n\t\t}\n\t\t$element.html(Mustache.render(template, info))\n\t}", "function dataSubmittedPage() {\r\n app.getView().render('subscription/emarsys_datasubmitted');\...
[ "0.6166739", "0.6032917", "0.5972155", "0.5954931", "0.5884055", "0.583181", "0.57925886", "0.5769471", "0.5769471", "0.5769471", "0.56891847", "0.5639037", "0.5632166", "0.56310517", "0.56310517", "0.5630244", "0.5607981", "0.55974364", "0.55900705", "0.5580156", "0.5557037"...
0.0
-1
Returns vanilla data with 3 circular normals
function threenorm(n) { var random = d3.randomNormal(0, 0.2), sqrt3 = Math.sqrt(3), points0 = d3.range(50).map(function() { return {x:random() + sqrt3,y: random() + 1, cluster:0} }), points1 = d3.range(50).map(function() { return {x:random() - sqrt3,y: random() + 1, cluster:0}; }), points2 = d3.range(50).map(function() { return {x:random(),y: random() - 1, cluster:0}; }), points = d3.merge([points0, points1, points2]); return points; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get DepthNormals() {}", "function generateTorso() {\n const indexArray = []; // this will be used to calculate the normal\n\n const r = radiusTop - radiusBottom;\n const slope = r * r / height * Math.sign(r); // generate positions, normals and uvs\n\n for (let y = 0; y <= heig...
[ "0.66545326", "0.6629677", "0.65941006", "0.6454413", "0.63554573", "0.6320616", "0.63141966", "0.6237331", "0.6221246", "0.62168425", "0.6184713", "0.6181636", "0.6141608", "0.6134165", "0.6118319", "0.6104997", "0.61049294", "0.6096802", "0.6061261", "0.6055501", "0.6039629...
0.0
-1
Parse output that is formatted like this: uv loop at [0x559b65ed5770] has open handles: [0x7f2de0018430] timer (active) Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s) [...] Data: 0x7f2df33df140 example_instance [...] (First field): 0x7f2df33dedc0 vtable for ExampleOwnerClass [...] [0x7f2de000b870] timer Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s) [...] Data: (nil) [0x7f2de000b910] timer Close callback: 0x7f2df31de220 CloseCallback(uv_handle_s) [...] Data: 0x42 uv loop at [0x559b65ed5770] has 3 open handles in total
function isGlibc() { try { const lddOut = spawnSync('ldd', [process.execPath]).stdout; const libcInfo = lddOut.toString().split('\n').map( (line) => line.match(/libc\.so.+=>\s*(\S+)\s/)).filter((info) => info); if (libcInfo.length === 0) return false; const nmOut = spawnSync('nm', ['-D', libcInfo[0][1]]).stdout; if (/gnu_get_libc_version/.test(nmOut)) return true; } catch { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ParseOutput() {\n this.lines = [ ];\n this.currentLine = [];\n this.currentLineListItemType = null;\n }", "function DebugProtocolParser(inputStream,\n protocolVersion,\n rawDumpFileName,\n textDumpFileName,\n ...
[ "0.51066655", "0.49225134", "0.47151554", "0.4628691", "0.45853758", "0.45621577", "0.452999", "0.45146808", "0.4505238", "0.44953865", "0.44395724", "0.44302842", "0.44075388", "0.4406428", "0.44035548", "0.43800867", "0.436657", "0.43453223", "0.43328992", "0.43203926", "0....
0.0
-1
Funciones Insertar valores en la tabla
function ins_dato(filtro) { $.get("data-1.json",function (datos,status,xhr) { switch (xhr.status) { case 200: var tabla = $("#tabdatos"); for (var i = 0; i < filtro.length; i++) { datos.forEach(function (valor,indice,array) { if (filtro[i] == valor.Id) { $(tabla).append("<tr> <td> <p> <img src= 'img/home.jpg' width='400' height='300' align='middle'></p></td>"+ "<td><strong> <p> Dirección: </strong>" + valor.Direccion + "<br>"+ "<strong>Ciudad: </strong>" + valor.Ciudad + "<br>"+ "<strong>Teléfono: </strong>" + valor.Telefono + "<br>"+ "<strong>Código postal: </strong>" + valor.Codigo_Postal + "<br>"+ "<strong>Precio: </strong>" + valor.Precio + "<br>"+ "<strong>Tipo: </strong>" + valor.Tipo + "</p><br> </td> </tr>"); } }); } break; case 404: console.log("Error"); break; default: console.log("Error"); break; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertValueTable(id, name, username) {\n\n var table = document.getElementById(\"tabela\");\n var row = table.insertRow(-1);\n var cell1 = row.insertCell(0);\n var cell2 = row.insertCell(1);\n var cell3 = row.insertCell(2);\n\n cell1.innerHTML = id;\n cell2.innerHTML = name;\n cell...
[ "0.71134865", "0.6548284", "0.6496309", "0.649352", "0.6492645", "0.6464312", "0.6452731", "0.6428112", "0.64233875", "0.64076793", "0.6399971", "0.6398232", "0.6395614", "0.63947076", "0.63866067", "0.6376183", "0.6363089", "0.63600975", "0.6348873", "0.63228047", "0.6321852...
0.0
-1
does the keyup match any letter in the phrase create a boolean, an HTMLCollection with 0 length/which is true, return false. Read more about this in the unit04 thread
checkLetter(letter) { //works const boolean = document.getElementsByClassName(letter).length === 0; return !boolean; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkLetter(letter) {\r\n let keyboard = document.getElementById('qwerty');\r\n //check if button is clicked\r\n if (this.phrase.includes(letter)) {\r\n return true;\r\n // console.log(true)\r\n // this.showMatchedLetter(letter)\r\n } else {\r\n ...
[ "0.75248915", "0.7459201", "0.7458474", "0.7324257", "0.729602", "0.7289679", "0.725142", "0.72349733", "0.72045887", "0.71802545", "0.71492594", "0.71322864", "0.71143013", "0.7110448", "0.71099216", "0.7088287", "0.7062099", "0.70554143", "0.7037041", "0.7028106", "0.700277...
0.0
-1
Handler for authenticating the SocketIO connection
function authenticate(socket, data, callback) { // Set the Authorization header using the provided token socket.request.headers.authorization = 'JWT ' + data.token; // Use Passport to populate the user details passport.authenticate('jwt', { session: false }, function (err, user) { if (err) { return callback(new Error(err)); } if (!user) { return callback(new Error('User not found')); } // Set the socket user socket.request.user = user; return callback(null, true); })(socket.request, socket.request.res, callback); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function authenticate() {\n socket.emit(\"authenticate\", {auth: auth_key, player_id: user_id, username: username});\n socket.emit(\"game/connect\", {game_id: game_id, player_id: user_id, chat: false});\n}", "authenticate() { \n this.socket = io(this.protocol + '://' + this.host + ':' + this.port, {...
[ "0.70052505", "0.6896481", "0.68397284", "0.6716324", "0.66483927", "0.66483927", "0.6579648", "0.6517444", "0.64907813", "0.637823", "0.6366447", "0.63660526", "0.6283011", "0.62652594", "0.6247861", "0.62061334", "0.6205211", "0.61438215", "0.6136378", "0.6128855", "0.61188...
0.6358342
12
Utility function to parse an oldstyle tiddler DIV in a .tid file. It looks like this: The text of the tiddler (without the expected HTML encoding). Note that the field attributes are HTML encoded, but that the body of the tag is not encoded. When these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.
function parseTiddlerDiv(text /* [,fields] */) { // Slot together the default results var result = {}; if(arguments.length > 1) { for(var f=1; f<arguments.length; f++) { var fields = arguments[f]; for(var t in fields) { result[t] = fields[t]; } } } // Parse the DIV body var startRegExp = /^\s*<div\s+([^>]*)>(\s*<pre>)?/gi, endRegExp, match = startRegExp.exec(text); if(match) { // Old-style DIVs don't have the <pre> tag if(match[2]) { endRegExp = /<\/pre>\s*<\/div>\s*$/gi; } else { endRegExp = /<\/div>\s*$/gi; } var endMatch = endRegExp.exec(text); if(endMatch) { // Extract the text result.text = text.substring(match.index + match[0].length,endMatch.index); // Process the attributes var attrRegExp = /\s*([^=\s]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi, attrMatch; do { attrMatch = attrRegExp.exec(match[1]); if(attrMatch) { var name = attrMatch[1]; var value = attrMatch[2] !== undefined ? attrMatch[2] : attrMatch[3]; result[name] = value; } } while(attrMatch); return result; } } return undefined; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadDiv(div, body) {\n//\ttry {\n\t\tvar divs = $(div), ts, te;\n if (!body) {\n var head = divs.find('head');\n var ty = '', st = '', t;\n if (head.length > 0) {\n var note = $(head[0]).find('note');\n // console.log(note);\n ...
[ "0.5318621", "0.5318207", "0.5248225", "0.5144867", "0.5083701", "0.5052744", "0.50308007", "0.4956494", "0.48256215", "0.48246196", "0.47761884", "0.472897", "0.4724978", "0.47094837", "0.47001305", "0.4687524", "0.46806896", "0.46773297", "0.4656406", "0.46519637", "0.46342...
0.72910213
0
Parse a string array from a bracketed list. For example "OneTiddler [[Another Tiddler]] LastOne"
function parseStringArray(value, allowDuplicate) { if(typeof value === "string") { var memberRegExp = /(?:^|[^\S\xA0])(?:\[\[(.*?)\]\])(?=[^\S\xA0]|$)|([\S\xA0]+)/mg, results = [], names = {}, match; do { match = memberRegExp.exec(value); if(match) { var item = match[1] || match[2]; if(item !== undefined && (!(item in names) || allowDuplicate)) { results.push(item); names[item] = true; } } } while(match); return results; } else if(Array.isArray(value)) { return value; } else { return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse (input) {\n\tvar output = [];\n\tinput = input.trim();\n\tinput = input.split(\" \");\n\n\tfor (var i = 0; i < input.length; i++) {\n\t\tif (input[i].charAt(0) == \"[\") {\n\t\t\toutput.push(input[i].slice(1,3));\n\t\t};\n\t};\n\n\treturn output;\n}", "function getBracketedItems(content) {\n\tvar ...
[ "0.6090226", "0.58942544", "0.5650764", "0.564346", "0.5586686", "0.54979575", "0.5393847", "0.5298447", "0.5221156", "0.51865894", "0.51759875", "0.5132924", "0.51271933", "0.51052076", "0.50977755", "0.50975245", "0.50975245", "0.50975245", "0.50962394", "0.5062018", "0.503...
0.52878827
8
Stringify an array of tiddler titles into a list string
function stringifyList(value) { if(Array.isArray(value)) { var result = new Array(value.length); for(var t=0, l=value.length; t<l; t++) { var entry = value[t] || ""; if(entry.indexOf(" ") !== -1) { result[t] = "[[" + entry + "]]"; } else { result[t] = entry; } } return result.join(" "); } else { return value || ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function titleize(arr, cb){\n let titleized = arr.map(name => `Mx. ${name} Jingleheimer Schmidt`)\n cb(titleized);\n}", "function readTitles(_aMoviesArr) {\r\n var _stringToShow = \"The names of the movies are: \";\r\n\r\n for (var i = 0; i < _aMoviesArr.length; i++) {\r\n if (i < _aMoviesArr.length - 1) ...
[ "0.5963072", "0.59265506", "0.5860149", "0.5830318", "0.5664834", "0.5647244", "0.5615575", "0.55590373", "0.5557116", "0.55049396", "0.5464863", "0.54521245", "0.5445746", "0.5445021", "0.5444259", "0.5418803", "0.54169464", "0.54118204", "0.54090154", "0.53917605", "0.53908...
0.5767215
4
Convert "&amp;" to &, "&nbsp;" to nbsp, "&lt;" to and "&quot;" to "
function htmlDecode(s) { return s.toString().replace(/&lt;/mg,"<").replace(/&nbsp;/mg,"\xA0").replace(/&gt;/mg,">").replace(/&quot;/mg,"\"").replace(/&amp;/mg,"&"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleHtmlEntities(data){\n\t\t\tdata = data.replace(/&/g, '&amp;')\n\t\t\t.replace(/\"/g, '&quot;')\n\t\t\t.replace(/'/g, '&#39;')\n\t\t\t.replace(/</g, '&lt;')\n\t\t\t.replace(/>/g, '&gt;');\n\t\t\tdata = data.replace(/ /g, '&nbsp;');\n\t\t\treturn data;\n\t\t}", "function encodeHtml(str) {\n str = s...
[ "0.7283393", "0.70207536", "0.701524", "0.7010876", "0.6963887", "0.6963887", "0.69562256", "0.6934616", "0.6924484", "0.69124436", "0.685737", "0.6850765", "0.68409127", "0.68366456", "0.68317014", "0.6829094", "0.6807098", "0.67730194", "0.67401475", "0.6698233", "0.6698233...
0.0
-1
So our reducer will be:
function doAction2(state = initialState, action) { return dispatchTable[action.type] ? dispatchTable[action.type](state, action) : state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reducer(){\n\n}", "reducer(res) {\n return res;\n }", "function reducer(a,b) {\n return a + b;\n}", "function reducer(result, value, index) {\n const fieldId = info.fields[index].id\n const processorId = info.fields[index].type\n const processor = get(processorId, processType)\n ...
[ "0.8031392", "0.73299253", "0.68282187", "0.6596326", "0.6583302", "0.65826577", "0.6521134", "0.6516463", "0.6515308", "0.6285352", "0.6234829", "0.62317985", "0.62311137", "0.61962295", "0.6195356", "0.6192386", "0.6192382", "0.6173222", "0.60710514", "0.60470694", "0.59985...
0.0
-1
FUNZIONE CHE CONVERTE LE COORDINATE BROWSER DEL MOUSE ALLE COORDINATE CANVAS
function mouseBrowserToCanvas(canvas, x, y) { //x,y sono le coordinate browser del puntatore del mouse var bbox = canvas.getBoundingClientRect(); return { x: Math.round(x - bbox.left * (canvas.width / bbox.width)), y: Math.round(y - bbox.top * (canvas.height / bbox.height)) }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mouseDown(pt) {}", "mouseDown(pt) {}", "function click(){\n rect = leinwand.getBoundingClientRect();\n mouseX = event.clientX - rect.left;\n mouseY = event.clientY - rect.top;\n //draw();\n //context.fillStyle();\n context.fillRect(mouseX, mouseY, 40, 40);\n }", "mouseDown(x, y, _isLeftBut...
[ "0.68491703", "0.68491703", "0.68264055", "0.68190515", "0.67626137", "0.6726853", "0.66449887", "0.6611337", "0.6606188", "0.6588052", "0.6565388", "0.65525806", "0.6547862", "0.6529904", "0.6520954", "0.6498423", "0.6492553", "0.64751375", "0.6472459", "0.6459162", "0.64505...
0.0
-1
====================== GESTIONE DEI CLICK/TOUCH SULLE DUE CANVAS "GAMEPAD" ======================
function doMouseUp(e){ if(e.srcElement.id == "touchCanvas1"){ clicked1 = false; ctxTouchCanvas1.clearRect(0, 0, ctxTouchCanvas1.canvas.width, ctxTouchCanvas1.canvas.height); ctxTouchCanvas1.drawImage(cursorImg, -5, -5, 200, 200); cameraInteraction.moveForward = false; cameraInteraction.moveBackward = false; cameraInteraction.moveRight = false; cameraInteraction.moveLeft = false; key[0] = false; key[1] = false; key[2] = false; key[3] = false; } else{ clicked2 = false; ctxTouchCanvas2.clearRect(0, 0, ctxTouchCanvas2.canvas.width, ctxTouchCanvas2.canvas.height); ctxTouchCanvas2.drawImage(cursorImg, -5, -5, 200, 200); cameraInteraction.rotateUp = false; cameraInteraction.rotateDown = false; cameraInteraction.rotateRight = false; cameraInteraction.rotateLeft = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onTouchStart(ev) {\n onClickCanvas(ev, true);\n}", "function mouseClickedOnCanvas() {\n game.click = true;\n}", "function onClick( event ) {\n event.preventDefault();\n \n mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;\n mouse.y = - ( event.clientY / window.in...
[ "0.70594984", "0.68947816", "0.68403137", "0.68271595", "0.6802393", "0.67657787", "0.66740894", "0.6669814", "0.66688263", "0.6647324", "0.65812474", "0.65748274", "0.6573092", "0.6565624", "0.649676", "0.648754", "0.6466395", "0.6432844", "0.6421616", "0.6419846", "0.641144...
0.61073357
69
====================== GESTIONE DELLA PRESSIONE DEI TASTI DELLA TASTIERA ======================
function doKeyDown(e){ //==================== // THE W KEY //==================== if (e.keyCode == 87) { if(!modalitaGara) cameraInteraction.moveForward = true; else key[0]=true; } //==================== // THE S KEY //==================== if (e.keyCode == 83) { if(!modalitaGara) cameraInteraction.moveBackward = true; else key[2]=true; } //==================== // THE A KEY //==================== if (e.keyCode == 65) { if(!modalitaGara) cameraInteraction.moveLeft = true; else key[1]=true; } //==================== // THE D KEY //==================== if (e.keyCode == 68) { if(!modalitaGara) cameraInteraction.moveRight = true; else key[3]=true; } // RIGHT ARROW if (e.keyCode == 39){ if(!modalitaGara) cameraInteraction.rotateRight = true; } // LEFT ARROW if (e.keyCode == 37){ if(!modalitaGara) cameraInteraction.rotateLeft = true; } // UP ARROW if (e.keyCode == 38){ if(!modalitaGara) cameraInteraction.moveUp = true; } // DOWN ARROW if (e.keyCode == 40){ if(!modalitaGara) cameraInteraction.moveDown = true; } // NUM 8 if (e.keyCode == 104){ if(!modalitaGara) cameraInteraction.rotateUp = true; } // NUM 5 if (e.keyCode == 101){ if(!modalitaGara) cameraInteraction.rotateDown = true; } // SPACEBAR if (e.keyCode == 32 && modalitaGara){ lancio(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "xToOverpressure(xTNT){\n const a1 = -0.214362789151;\n const b1 = 1.35034249993;\n const c01 = 2.78076916577;\n const c11 = -1.6958988741;\n const c21 = -0.154159376846;\n const c31 = 0.514060730593;\n const c41 = 0.0988554365274;\n const c51 = -0.293912623038;\n const c61 = -0.026811234...
[ "0.61321664", "0.58022934", "0.5716744", "0.56321055", "0.5621674", "0.5478601", "0.5472039", "0.5283669", "0.5261521", "0.5229616", "0.5218887", "0.5192626", "0.516904", "0.5161146", "0.51399", "0.51247704", "0.5121781", "0.5121781", "0.51205933", "0.5106364", "0.5100934", ...
0.0
-1
====================== GESTIONE DELLE FUNZIONALITA' DEL PANNELLO UI ====================== Modalita' scena/gara
function changeMod(radioButton){ if(radioButton.value == "scena"){ modalitaGara = false; initCamera(); touchCanvas2.addEventListener("mousedown", doMouseDown); touchCanvas2.addEventListener("mouseup", doMouseUp); touchCanvas2.addEventListener("mousemove", doMouseMove2); document.getElementById("sceltaVisuale").hidden = true; document.getElementById('touchCanvas2').hidden = false; } else{ modalitaGara = true; //nascondo e disabilito la canvas di rotazione visuale che non serve document.getElementById('touchCanvas2').hidden = true; touchCanvas2.removeEventListener("mousedown", doMouseDown); touchCanvas2.removeEventListener("mouseup", doMouseUp); touchCanvas2.removeEventListener("mousemove", doMouseMove2); document.getElementById("sceltaVisuale").hidden = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nuevo_producto(){\t\t\n\t\tllama_formulario('NUEVA CIUDAD','nuevo');\t \n\t\tVentana_modal.show();\t\t\t\n\t}", "function mostrarDevoluciones(){ // Cuando toque el boton \"devoluciones\" voy a ver la seccion (hacer devoluciones)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n ...
[ "0.71202886", "0.7016336", "0.70131487", "0.6987887", "0.697702", "0.6911901", "0.6880727", "0.6829409", "0.6793059", "0.6792487", "0.67830306", "0.6769643", "0.6768539", "0.67561066", "0.67536664", "0.6716652", "0.6702014", "0.6701383", "0.6684609", "0.6684311", "0.66788584"...
0.0
-1
Attiva/disattiva movimento del sole
function activeLightMovement(checkbox){ if(checkbox.checked) lightMoveOpt = true; else lightMoveOpt = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function verRepeticion(cadena) {\n cargarCadenaMovimientos(cadena);\n // Muestro el primer movimiento de la partida\n crearEventosMovRepeticion();\n cargarTablero(1);\n estilosMovActualRep(0);\n}", "function actualizarCantidadMovimientos() {\n limiteMovimientos -= 1;\n}", "function vermovimie...
[ "0.6070929", "0.6011335", "0.591213", "0.5807454", "0.579562", "0.5771342", "0.57705873", "0.5764822", "0.57597023", "0.5744459", "0.5723331", "0.5671172", "0.56194365", "0.55685997", "0.5549548", "0.5492684", "0.5449385", "0.5443814", "0.5429616", "0.5421745", "0.5415066", ...
0.0
-1
fetch stats by country
fetchCountryData() { this.countriesLoaded = false; this.errorCountries = false; fetch(`${this.api}/countries`) .then((res) => res.json()) .then((data) => (this.items = data)) .finally(() => (this.countriesLoaded = true)) .catch((error) => { this.countriesLoaded = false; this.errorCountries = true; console.log(error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function requestCountrySpecificData() {\n DevSearchStore.getCountryDataFromServer();\n DevSearchStore.getDeveloperCountByCountryFromServer();\n DevSearchStore.getDeveloperCountByLanguageFromServer();\n}", "function fetchdata(country) {\n var data = [];\n for (x in nodes) {\n if (nodes...
[ "0.71858144", "0.6749322", "0.6736854", "0.67075634", "0.6704463", "0.6632638", "0.6436481", "0.631527", "0.62870216", "0.6184942", "0.6183807", "0.6175802", "0.61719215", "0.616218", "0.6148462", "0.61320513", "0.6096406", "0.60891145", "0.6066463", "0.60660785", "0.6059716"...
0.0
-1
Get the data ready to visualize
function prepData(local, region) { countyData = setupNumbers(_.clone(local[0], true)); regionData = setupNumbers(_.clone(region[0], true)); yearNames = []; var years = _.pluck(regionData, YEAR_KEY); var maxYear = _.max(years); var minYear = _.min(years); yearNames = _.uniq(years); // Once we have the data, set up the visualizations setup(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTheData() {\n if(expensesR) {\n\tmod3L.remove();\n\tmod3R.remove();\n }\n // get the data\n expensesP = d3.select('#expensesP')\n .property('value');\n expensesR = d3.select('#expensesR')\n .property('value');\n // use the function to show the painting\n show(parseInt(expensesP),parseInt(e...
[ "0.6935823", "0.6932973", "0.68572956", "0.68111944", "0.6731942", "0.6709401", "0.6687431", "0.6643146", "0.6612664", "0.66000646", "0.6579407", "0.65738785", "0.65654385", "0.6513586", "0.6486394", "0.6431203", "0.6425973", "0.6425973", "0.6392435", "0.6371812", "0.6354434"...
0.0
-1
eu and ru have different entity_iditem_id mappings so we need to get these mappings when region changes
async function getItemManifest(region) { if (region == 'eu') { const euResponse = await axios.get(euManifest); return euResponse.data; } else if (region == 'ru') { const ruResponse = await axios.get(ruManifest); return ruResponse.data; } else { const response = await axios.get(ruManifest); return response.data; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function valCountriesAndRegions() { \n var rcrdsObj = entityObj.curRcrds;\n var countries = buildCountryRefObj(); \n \n for (var locDesc in rcrdsObj) { checkCntryAndRegion(rcrdsObj[locDesc]); }\n\n function checkCntryAndRegion(rcrdsAry) {...
[ "0.5673479", "0.54454905", "0.5367876", "0.5277067", "0.52213895", "0.52213895", "0.519641", "0.5184962", "0.5180875", "0.517186", "0.51667744", "0.5149466", "0.51056194", "0.50919724", "0.50568193", "0.50346017", "0.5029587", "0.5024988", "0.5006605", "0.5001268", "0.500123"...
0.0
-1
search bar is mounted for the first time
componentDidMount() { console.log('search bar mounted'); getItemManifest(this.props.entity.region).then((data) => { this.setState( { entity: {...this.props.entity}, EntityList: data, }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSearch() {\n var wasActive = !!activeSearch\n activeSearch = searchBox.value\n if (!wasActive) {\n viewer.addFilter(searchFilter)\n }\n clearOption.style.visibility = \"visible\"\n onSearchBlur()\n viewer.filter()\n refreshFilterPane()\n }", "initSearch() {\n this....
[ "0.7141043", "0.71293", "0.70905656", "0.70059466", "0.6953724", "0.6938725", "0.68812084", "0.6847683", "0.6769326", "0.672978", "0.6717628", "0.670147", "0.66973746", "0.66817653", "0.66776663", "0.66580904", "0.66459495", "0.66376024", "0.6603134", "0.65878576", "0.6581097...
0.0
-1
either change of region or entity_id will trigger search bar rerendering
componentDidUpdate(prevProps, prevState) { const prevRegion = prevProps.entity.region; const currRegion = this.props.entity.region; const prevEntityId = prevProps.entity.entity_id; const currEntityId = this.props.entity.entity_id; if (prevRegion != currRegion || prevEntityId != currEntityId) { return getItemManifest(this.props.entity.region) .then((data) => { this.setState( { entity: {...this.props.entity}, EntityList: data, }); }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onRegionUpdate(updated_region) {\n this.viewing_region = updated_region;\n this.fetch_regions();\n }", "regionFilter(event) {\n const regionValue = event.target.value\n // updates search value to filter countries by region\n this.setState({ regionValue })\n }", "UpdateRegion() {\...
[ "0.6852377", "0.6463747", "0.6333217", "0.6124844", "0.6039995", "0.5998431", "0.59664583", "0.5940822", "0.59396416", "0.59047866", "0.5864491", "0.585949", "0.5846589", "0.581434", "0.5809582", "0.5804887", "0.5790324", "0.5679786", "0.5679088", "0.5671543", "0.5671543", ...
0.0
-1
Creates a Page timing Report object and gathers all related information at the same time. This reporst will be ready for dispatching after being created.
constructor() { super('page-timing'); let sourceInfo = {}; let timingInfo = {}; let timing = performance.timing; let timingEntries = ['connect', 'domainLookup', 'domContentLoadedEvent', 'loadEvent', 'redirect', 'response', 'unloadEvent']; let locationEntries = ['origin', 'protocol','pathname']; for (let entry of timingEntries) { let start = timing[entry + 'Start']; let end = timing[entry + 'End']; timingInfo[entry] = end - start; } sourceInfo['title'] = window.document.title; for (let entry of locationEntries) { sourceInfo[entry] = window.document.location[entry]; } this._data = { 'source' : sourceInfo, 'timing' : timingInfo }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async report() {\n const { logger, db } = this[OPTIONS];\n const testedPages = await db.read('tested_pages');\n\n logger.info('Saving JSON report');\n const json = new JSONReporter(this[OPTIONS]);\n await json.open();\n await json.write(testedPages);\n await json.close();\n\n logger.info('S...
[ "0.6146375", "0.55507445", "0.5533378", "0.5457022", "0.541526", "0.5398608", "0.53963065", "0.5384655", "0.53707755", "0.5368844", "0.53672594", "0.5346646", "0.53383744", "0.5328297", "0.5260353", "0.5260353", "0.52383643", "0.519164", "0.51885295", "0.5183171", "0.518133",...
0.6049583
1
naujo paketo siuntimo formavimas
function netwSend(aceObj,txPack) { // jeigu paketas nenurodytas tada vadinasi reikia siutimą vykdyti iš cache if(txPack===null){ txPack = aceObj.TxCache; // console.log("ACEPRO-NET UDP Sent from Cache."); }else{ aceObj.TxCache = txPack; // console.log("ACEPRO-NET UDP Sent. No Cache used."); } const TxBuf = Buffer.allocUnsafe(28); TxBuf.writeUInt32BE(txPack.CMD, 0); TxBuf.writeUInt32BE(txPack.Src, 4); TxBuf.writeUInt32BE(txPack.Dst, 8); TxBuf.writeInt32BE(txPack.State, 12); TxBuf.writeUInt32BE(txPack.IOID, 16); TxBuf.writeDoubleBE(txPack.val, 20); srv.send(TxBuf, 0, TxBuf.length, port, BrCastAddr, function() { // console.log("ACEPRO-NET UDP Sent '" + JSON.stringify(txPack) + "'"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "verificaDados(){\n this.verificaEndereco();\n if(!this.verificaVazio()) this.criaMensagem('Campo vazio detectado', true);\n if(!this.verificaIdade()) this.criaMensagem('Proibido cadastro de menores de idade', true);\n if(!this.verificaCpf()) this.criaMensagem('Cpf deve ser válido', true...
[ "0.68715876", "0.68280387", "0.67812854", "0.675915", "0.67059207", "0.6691888", "0.6675431", "0.66635", "0.66505617", "0.6627156", "0.6611526", "0.6602542", "0.66023296", "0.6599742", "0.65895236", "0.65596557", "0.65596557", "0.6550468", "0.65349567", "0.65242827", "0.65239...
0.0
-1
TODO add custom fields for profiler messages
function Profiler(logger, name, level) { this.logger = logger; this.name = name; this.times = 0; this.diff = 0; this.paused = true; this.level = level || 'debug'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _timeProfile(message) {\n if (config.show_performance)\n elapsed_time(message);\n}", "messages() {\n const messages = super.messages();\n messages[ACTIVE].push({\n level: INFO,\n code: \"hermit.scanning\",\n text: \"Scan Hermit QR code now.\",\n });\n return messages...
[ "0.6386364", "0.6029055", "0.5931499", "0.5689865", "0.55454767", "0.54338276", "0.5401419", "0.53847295", "0.5377581", "0.5339478", "0.53226006", "0.5314411", "0.5300518", "0.52959704", "0.5281602", "0.5262394", "0.5237166", "0.52005845", "0.51949733", "0.5188414", "0.518315...
0.5274832
15
Store user details in session storage. Session storage was used to store the user details so as to simulate a typical user login scenario. The user details would be cleared once the browser window is closed.
function saveToSessionStorage() { const passwordValue = password.value; // Get the password input value const usernameValue = username.value; // Get the username input value // The user object holds the username and password let user = { username: usernameValue, password: passwordValue, }; // Store the user object in session storage. // Also store a boolean variable that identifies if the user is // logged in. sessionStorage.setItem("user", JSON.stringify(user)); sessionStorage.setItem("isValidUser", JSON.stringify(true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static storeUser(user) {\n localStorage.setItem('userInfo', user);\n }", "function storeUserData () {\n\t\tvar key,\n\t\tstorageData = {};\n\n\t\t// Loop thru user object and encode each name/value.\n\t\tfor (key in user) {\n\t\t\tif (user.hasOwnProperty(key)) {\n\t\t\t\tstorageData[(encryption.encode(key))]...
[ "0.7763968", "0.74131286", "0.7411828", "0.73758596", "0.73696715", "0.7363886", "0.7301787", "0.72977257", "0.72938496", "0.72938496", "0.7250397", "0.7158515", "0.71335274", "0.70816964", "0.7065029", "0.70576197", "0.70398957", "0.7039261", "0.7002955", "0.6996285", "0.697...
0.7963589
0
array PUSH and SHIFTTTTTTTT
function nextInline (arr, numko) { arr.push(numko); return arr.shift(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ShiftArrayValsLeft(arr){\n}", "function shift(arr){\n console.log(arr.shift())\n console.log(arr)\n}", "function shiftLeft(arr){\n arr.push(arr.shift(0));\n return arr;\n}", "function task14_16_13(){\n var arr = [];\n arr.unshift(\"keyboard\");\n arr.unshift(\"mouse\");\n arr.unshift(\"p...
[ "0.71770066", "0.69691795", "0.69443846", "0.68355906", "0.6772296", "0.6729929", "0.6707596", "0.66854024", "0.6674943", "0.6667162", "0.66634804", "0.6663368", "0.6655321", "0.66288793", "0.6624209", "0.6587704", "0.6564944", "0.6561068", "0.65374446", "0.6514341", "0.65006...
0.0
-1
aug 4 math undefined
function abTest(a, b) { if (a > 0 || b > 0) { return undefined; } else { console.log("not undefined"); } return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function MathUtils() {}", "function math(m, b){\n return (-1 * b)/m\n}", "get std_eqn() {\n if (this.type == 0) {\n // parabola\n if (this.o == 0)\n return \"$$(y\"+ (this.k > 0 ? \"-\" : \"+\")+ Math.abs(this.k) +\")^2 = \" + this.lr + \"(x\" + (this.h > 0 ? \"-\" : \"+\") + Math.abs(this...
[ "0.71944296", "0.61095524", "0.6037894", "0.5964743", "0.59325355", "0.5914474", "0.5911294", "0.5911294", "0.5867642", "0.58452725", "0.58244795", "0.5816817", "0.5805406", "0.58046377", "0.5800606", "0.579539", "0.5756804", "0.573758", "0.5716843", "0.5716843", "0.569654", ...
0.0
-1
Change progress bar action
function setProgressBar(curStep){ var percent = parseFloat(100 / steps) * curStep; percent = percent.toFixed(); $(".progress-bar") .css("width",percent+"%") .html(percent+"%"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function progressBar(action) {\n if(action == 1){\n\t element.setAttribute('max', numberOfQuestions); \n }\n else if(action == 2){\n element.setAttribute('value', questionIndexTracker);\n }\n else{\n Console.log(\"Error in progress bar selection 1 == set, 2 == record\")\n }\n}", ...
[ "0.74477345", "0.72282267", "0.72270733", "0.7165991", "0.714557", "0.7068672", "0.70466894", "0.70089096", "0.70082325", "0.70082086", "0.6989072", "0.69709826", "0.6960757", "0.68830436", "0.6854484", "0.6828043", "0.67773724", "0.6769633", "0.67674536", "0.67616606", "0.67...
0.67241746
26
set with drawing.activate() drawing data constructor
function Drawing(){ this.header={ $INSBASE:{x:0,y:0,z:0}, $EXTMIN:{x:0,y:0,z:0}, $EXTMAX:{x:10,y:10,z:0} }; this.tables={ linetype:{ Continuous:{ name: "Continuous", description: "Solid line", patternLength: 0 }, HIDDEN2: { name: "HIDDEN2", description: "Hidden (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _", pattern:[0.125, -0.0625], patternLength: 0.1875 } }, layer:{ handle: "2", ownerHandle: "0", layers: { "0":{Name:"0", Visible:true, color:16711680}, "A-WALL":{Name:"0", Visible:true, color:16711680} } } }; this.blocks={}; this.entities=[ line.create(this) //new line.Line(this) ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "configureStartingData() {\n // We don't use a singleton because defaults could change between calls.\n new DrawingDefaultsConfig(this, this._last_tool).render(true);\n }", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "function newDrawing(data) {\n fill(0,255,0);...
[ "0.65772414", "0.6383411", "0.6240913", "0.60735613", "0.60711265", "0.6063453", "0.6028304", "0.6022559", "0.60153395", "0.5989123", "0.59854096", "0.59819174", "0.5849899", "0.58492386", "0.58143526", "0.5800647", "0.5796674", "0.577526", "0.5752931", "0.5751492", "0.574333...
0.5827011
14
Login the test user
function loginUser(authenticate, done) { request(app) .post('/authenticate') .send({ email: 'beerGutter@mail.com', password: 'whatWhat' }) .expect(200) .end(onResponse); function onResponse(error, res) { authenticate.token = res.body.token; done(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function login() {\n User.login(self.user, handleLogin);\n }", "login(user) {\n return this.perform('post', '/login', user);\n }", "async loginUser() {\n await this.userName.sendKeys(browser.params.loginData.login.login_set_1.username);\n await this.password.sendKeys(browser.params.loginD...
[ "0.7651535", "0.7440154", "0.7367435", "0.7206985", "0.71536726", "0.71252376", "0.7107737", "0.7081823", "0.6984199", "0.69768536", "0.69349104", "0.69219434", "0.6918515", "0.6914208", "0.68136704", "0.68124044", "0.6802883", "0.6800781", "0.68003964", "0.6782678", "0.67641...
0.0
-1
TEST SUITE TEST 1
function test1() { const actual = myAtoi('42'); const expected = 42; if (actual === expected) { return '✔'; } return 'X'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function testRun()\r\n{\r\n}", "run_test() { start_tests(); }", "function runTests() {\n\ttestBeepBoop();\n\ttestGetDigits();\n}", "function generateTest() {\n // TODO\n}", "function testMain() {\n var mode = 'test';\n main(mode);\n}", "function ct_test() {\n return ok;\n}", "function test() {\...
[ "0.7460813", "0.69406533", "0.6825967", "0.6769557", "0.67594725", "0.6685041", "0.6664985", "0.66433096", "0.66404855", "0.6636985", "0.65658647", "0.6559172", "0.6534115", "0.6496234", "0.64826566", "0.642303", "0.6373392", "0.63660884", "0.63588333", "0.6326417", "0.630312...
0.0
-1
Part Two Time to improve the polymer. One of the unit types is causing problems; it's preventing the polymer from collapsing as much as it should. Your goal is to figure out which unit type is causing the most problems, remove all instances of it (regardless of polarity), fully react the remaining polymer, and measure its length. For example, again using the polymer dabAcCaCBAcCcaDA from above: Removing all A/a units produces dbcCCBcCcD. Fully reacting this polymer produces dbCBcD, which has length 6. Removing all B/b units produces daAcCaCAcCcaDA. Fully reacting this polymer produces daCAcaDA, which has length 8. Removing all C/c units produces dabAaBAaDA. Fully reacting this polymer produces daDA, which has length 4. Removing all D/d units produces abAcCaCBAcCcaA. Fully reacting this polymer produces abCBAc, which has length 6. In this example, removing all C/c units was best, producing the answer 4. What is the length of the shortest polymer you can produce by removing all units of exactly one type and fully reacting the result?
function findWeakestLink(s) { var shortestOutput = 999999; for (let c = "A".charCodeAt(0); c < "Z".charCodeAt(0); c++) { var stripC = new RegExp(String.fromCharCode(c), "gi"); var output = react(s.replace(stripC, "")); if (output.length < shortestOutput) { shortestOutput = output.length; } } return shortestOutput; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reduce3(polymer, ignoreUnit = \"_\") {\n const stack = [];\n /* for of loop is slower than for loop\n https://jsperf.com/for-loop-vs-for-of-strings/1\n */\n for (let i = 0; i < polymer.length; i++) {\n const u = polymer[i];\n if (isSameLetter(u, ignoreUnit)) {\n continue;\n } else if (s...
[ "0.63914067", "0.5853434", "0.5441584", "0.52097565", "0.51795906", "0.5162899", "0.51582384", "0.51555383", "0.5133454", "0.5057177", "0.49457815", "0.47984436", "0.47984436", "0.47755983", "0.47750214", "0.4735101", "0.47300556", "0.47300556", "0.47300556", "0.47300556", "0...
0.0
-1
update button color when clicked
function updateButtonColors(button, parent) { parent.selectAll("rect") .attr("fill",defaultColor) button.select("rect") .attr("fill",pressedColor) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateButton(button, clicked) {\n button.innerText = clicked ? \"Pause\" : \"Animate\";\n updateColor(button, button.value);\n}", "function buttonColorIn(ev) {\n ev.target.style.backgroundColor = \"orange\";\n}", "function colorButton(button) {\n d3.selectAll('button')\n .transi...
[ "0.72542405", "0.7214219", "0.719813", "0.71524817", "0.7030263", "0.7025146", "0.7020735", "0.70176566", "0.6937343", "0.69048613", "0.6898962", "0.68876934", "0.683276", "0.68285376", "0.6785288", "0.6777175", "0.67688817", "0.6745452", "0.6721171", "0.67191696", "0.6683228...
0.69733685
8
BBB Generator base constructor Extend Yeoman base generator
function Generator(args, options, config) { var self = this; yeoman.generators.Base.apply(this, arguments); // Check parents directory recursively for a config file (only if we're not in bbb:init) if (this.constructor._name !== "bbb:init") { var root = grunt.file.findup(".bbb-rc.json"); if (root) { root = path.dirname(root); process.chdir(root); } } // Set default paths this.destinationRoot(process.cwd()); this.sourceRoot(path.join(__dirname, "../../templates")); // Extend grunt.file to namespace with source and destination directory. // Note: I don't like Yeoman file API, so here I use a wrapped Grunt instead. this.src = {}; this.dest = {}; _.assign(this.src, grunt.file, function(thisSrc, gruntFunc) { return function() { var src = arguments[0]; var args = Array.prototype.slice.call(arguments, 1); if (!grunt.file.isPathAbsolute(src)) { src = path.join(this.sourceRoot(), src); } args.unshift(src); return gruntFunc.apply(grunt.file, args); }.bind(this); }, this); _.assign(this.dest, grunt.file, function(thisSrc, gruntFunc) { return function() { var src = arguments[0]; var args = Array.prototype.slice.call(arguments, 1); if (!grunt.file.isPathAbsolute(src)) { src = path.join(this.destinationRoot(), src); } args.unshift(src); return gruntFunc.apply(grunt.file, args); }.bind(this); }, this); // `write` and `copy` are specials as they should check for collision before this.dest.write = _.bind(this.write, this); this.dest.copy = _.bind(this.copy, this); // Get existing configurations var packageJSON; try { packageJSON = this.dest.readJSON("package.json"); } catch(e) { packageJSON = {}; } var bbbrc; try { bbbrc = this.dest.readJSON(".bbb-rc.json"); } catch(e) { bbbrc = {}; } this.pkg = packageJSON; this.bbb = _.defaults(bbbrc, { name : "", testFramework : "qunit", moduleStyle : "amd", templateEngine : "underscore", indent : { char : "space", size : 2 }, paths : { base : ".", tests : "test", modules : "app/modules" } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { super(new GeneratorParser(true)) }", "function GeneratorClass () {}", "constructor(generator) {\n this.generator = generator;\n }", "constructor() {\n super();\n\n this.generateModules();\n }", "constructor(args, opts) {\n // Calling the super constructor is im...
[ "0.7307889", "0.71404356", "0.68152285", "0.67347217", "0.6701433", "0.6694148", "0.6639879", "0.6621982", "0.6364974", "0.6364974", "0.6364974", "0.6364974", "0.6364974", "0.6364974", "0.6312817", "0.6187555", "0.6187555", "0.6187555", "0.6187555", "0.6187555", "0.6187555", ...
0.0
-1
Finds the highest common factor of 2 numbers
function highestCommonFactor2(a, b) { if (b === 0) { return a; } return highestCommonFactor2(b, a%b); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function greatest_common_factor(number1, number2) {\n let divider = 1;\n let largeNum = number1 >= number2 ? number1 : number2;\n let smallNum = largeNum === number1 ? number2 : number1;\n while (divider <= smallNum) {\n let testNum = smallNum / divider;\n if (largeNum % testNum === 0) {\...
[ "0.79636997", "0.7768438", "0.7726953", "0.71830165", "0.7154436", "0.71394604", "0.71362287", "0.7019485", "0.701093", "0.69473815", "0.69366544", "0.6888408", "0.6885753", "0.6877195", "0.6808772", "0.67977816", "0.67941904", "0.6786153", "0.6780309", "0.6754238", "0.674157...
0.8107598
0
calculate2 the sum of the two fractions
function calculate2(radius){ var angle2 = 2 * Math.PI /commonMultiple2; x2 = canvas2.width/3; y2 = canvas2.height*2/3; var j= 0; var i= 0; if(j<number2){ context2.fillStyle = '#f00'; context2.fillText('=', 100,280); for(i=0; i < commonMultiple2; i++){ context2.beginPath(); context2.moveTo(x2+150*j, y2); context2.arc(x2+150*j, y2, radius, i*angle2, (i +1)*angle2, false); context2.lineWidth = segmentDepth2; context2.fillStyle = '#C45AEC'; context2.fill(); context2.lineWidth = 2; context2.strokeStyle = '#444'; context2.stroke(); } } if (newresNumerator2!==0){ context2.fillStyle = '#f00'; context2.fillText('=', 100,280); for(i=0; i < commonMultiple2; i++){ context2.beginPath(); context2.moveTo(x2 +150+150*j,y2); context2.arc(x2 +150+ 150*j, y2, radius, i*angle2, (i +1)*angle2, false); context2.lineWidth = segmentDepth2; if(i<newresNumerator2){ context2.fillStyle = '#C45AEC'; }else{ context2.fillStyle = '#fff'; } context2.fill(); context2.lineWidth = 2; context2.strokeStyle = '#444'; context2.stroke(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate(num1, num2) {\n var suma = returnNumberIntOrWithDecimal(num1 + num2);\n result.push(num1 + \" + \" + num2 + \" = \" + suma);\n\n var resta = returnNumberIntOrWithDecimal(num1 - num2);\n result.push(num1 + \" - \" + num2 + \" = \" + resta);\n\n var mult = returnNumberIntOrWithDecim...
[ "0.6793922", "0.6394161", "0.62732226", "0.62624997", "0.6213587", "0.61953163", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", "0.6186537", ...
0.0
-1
should substitute clientgenerated ids in main with promises of linked ids
function mix(main, linked, linkedModel){ //Main is defined but could mix existing resources and those to create return RSVP.all(_.map(_.isArray(main) ? main : [main], function(item){ var toCreate = _.find(linked, function(l){ return _.has(l, 'id') && l.id === item; }); if (!toCreate) return item; if (toCreate.$$createPromise) return toCreate.$$createPromise; toCreate.$$createPromise = createLinked(linkedModel, _.omit(toCreate, 'id')); return toCreate.$$createPromise; })).then(function(result) { return _.isArray(main) ? result : result[0]; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillInIds() {\n entityObj.curRcrds = attachTempIds(entityObj.curRcrds); //console.log(\"entityObj.curRcrds = %O\", entityObj.curRcrds)\n }", "all(inner, outer, traceId) {\n // NOTE: `reject` does not settle nested promises!\n const rootId = this.getCurrentVirtualRootContextId();\n co...
[ "0.63187206", "0.62814933", "0.6165819", "0.61442494", "0.6141721", "0.6042492", "0.59505856", "0.59123796", "0.5897462", "0.5817669", "0.57656187", "0.57368577", "0.57148826", "0.56886595", "0.5686155", "0.56849086", "0.5683023", "0.56461793", "0.56388587", "0.5590095", "0.5...
0.5605028
19
Creates single linked resource
function createLinked(linkedModel, linkedResource){ return createResources(linkedModel, [linkedResource]) .then(function(resources){ return resources[0].id; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createAndLink(fromResource, useProperty, type, dataCallback) {\n RDFAUTHOR_START_FIX = \"linkAndCreate\";\n var serviceUri = urlBase + 'service/rdfauthorinit';\n\n // check if an resource is in editing mode\n if (typeof RDFAUTHOR_STATUS != 'undefined') {\n if(RDFAUTHOR_STATUS === 'activ...
[ "0.7318703", "0.675712", "0.64981854", "0.6326865", "0.6103492", "0.59534866", "0.5906946", "0.588835", "0.58253855", "0.5800774", "0.57741034", "0.57535577", "0.5748674", "0.5725261", "0.5682321", "0.5679762", "0.56629163", "0.564455", "0.5627849", "0.55961746", "0.5590086",...
0.702165
1
Get the related resources of an individual resource. Called if request.method is GET and no matching action was found
function getSubresources(req, res) { var id = req.params.id, key = req.params.key, originalFilter = req.query.filter ? _.cloneDeep(req.query.filter) : {}; zipkinTracer.scoped(() => { const traceId = zipkinTracer.createRootId(); req.zipkinTraceId = traceId; zipkinTracer.setId(traceId); zipkinTracer.recordServiceName('fortune-read-sub-resource'); zipkinTracer.recordRpc(req.method.toUpperCase()); zipkinTracer.recordBinary('fortune.resource', name); zipkinTracer.recordBinary('fortune.subresource', key); zipkinTracer.recordAnnotation(new Annotation.ServerRecv()); }); const localTracer = zipkin.makeLocalCallsWrapper(req, zipkinTracer); var projection = {}; var select = parseSelectProjection(req.query.fields, model.modelName); req.query.fortuneExtensions = [{}]; req.fortune.routeMetadata = _.extend({}, req.fortune.routeMetadata, { type: ROUTE_TYPES.getSubresources, resource: collection, subResourcePath: key }); if (select){ projection = { select: select }; } if (!_.isUndefined(req.query.limit)){ projection.limit = parseInt(req.query.limit,10); } if(id){ //Reset query.filter to value applied to primary resource req.query.filter = {}; req.query.filter.id = id; } localTracer('before-read-hooks-primary', () => beforeReadHook({}, req, res)) .then(function(){ // get a resource by ID return localTracer('reading-database-primary', () => { zipkinTracer.recordBinary('fortune.mongo_query', zipkin.safeStringify(req.query.filter)); zipkinTracer.recordBinary('fortune.mongo_projection', zipkin.safeStringify(projection)); return adapter.find(model, req.query.filter, projection) }); }, function(err){ sendError(req, res, 500, err); }) // run after read hook .then(function(resource) { return localTracer('after-read-hooks-primary', () => afterReadHook(resource, req, res)); }, function(error) { sendError(req, res, 404, error); }) // change context to resource .then(function(resource) { var ids, relatedModel; try { ids = resource.links[key]; if (_.isUndefined(ids)) { ids = []; } ids = _.isArray(ids) ? ids : [ids]; relatedModel = _this._schema[name][key]; relatedModel = _.isArray(relatedModel) ? relatedModel[0] : relatedModel; relatedModel = _.isPlainObject(relatedModel) ? relatedModel.ref : relatedModel; if (key && key.length > 0 && !relatedModel) { return sendError(req, res, 404); } } catch(error) { return sendError(req, res, 404, error); } var findPromise; if (_.size(ids) > 0) { //Reset req.query.filter to original value discarding changes applied for parent resource req.query.filter = originalFilter; req.query.filter.id = {$in: ids}; //run before read hook findPromise = localTracer('before-read-hooks-secondary', () => beforeReadHook(relatedModel, {}, req, res)) .then(function(){ // find related resources return localTracer('readin-database-secondary', () => adapter.findMany(relatedModel, req.query.filter, _.isNumber(projection.limit) ? projection.limit : undefined)); }, function(err){ sendError(req, res, 500, err); }); } else { var deferred = RSVP.defer(); deferred.resolve([]); findPromise = deferred.promise; } // do after transforms findPromise.then(function(resources) { return localTracer('after-read-hooks-secondary', () => { return RSVP.all(resources.map(function (resource) { return afterReadHook(relatedModel, resource, req, res); })); }); }, function(error) { sendError(req, res, 500, error); }) // send the response .then(function(resources) { var body = {}; body[inflect.pluralize(relatedModel)] = resources; sendResponse(req, res, 200, body); }, function(error) { sendError(req, res, 403, error); }); }, function(error) { sendError(req, res, 403, error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRelated() {}", "function get(req, res, next) {\n const prop = pluralize.singular(req.params.resource);\n req.query[`${prop}${opts.foreignKeySuffix}`] = req.params.id;\n req.url = `/${req.params.nested}`;\n next();\n } // Rewrite URL (/:resource/:id/:nested -> /:nested) and request body", "funct...
[ "0.63456845", "0.6028967", "0.569128", "0.5680128", "0.5517527", "0.53564864", "0.53275687", "0.5288383", "0.5283731", "0.5280788", "0.5202523", "0.51622283", "0.51279396", "0.5089165", "0.50607973", "0.5022023", "0.50104743", "0.5009311", "0.49712893", "0.49617997", "0.49356...
0.5462412
5
Refactoring options: 1. Make it yield parts of `body` rather than operate on it directly
function appendLinked(linkpath, body, resources, schema, inclusions, req, res) { // build of tree of paths to fetch and maybe include var includePaths = buildPathsTree(inclusions); var _this = this; var fetchedIds = {}; body.linked = {}; return fetchChildren(linkpath, includePaths, resources, schema).then(function() { return body; }); function fetchChildren(linkpath, config, resources, schema) { return RSVP.all(_.map(_.keys(config), function(key) { if(key === "__includeInBody") return null; var type = getTypeOfRef(schema, key), ids = _.difference(linkedIds(resources, key, schema), fetchedIds[type]); //only wanna cache ids for resources that are going to be present in the body if(config[key].__includeInBody){ fetchedIds[type] = _.union(fetchedIds[type] || [], ids); } return getLinked.call(_this, ids, type, req, res).then(function(result) { var relation = _.isArray(schema[key]) ? schema[key][0] : schema[key]; if(relation && relation.external){ var pluralisedRef = inflect.pluralize(relation.ref || key); body.linked[pluralisedRef] = "external"; body.links[linkpath + "." + key] = {type: pluralisedRef}; } if (result && result.resources) { if (config[key].__includeInBody) { body.linked[result.type] = body.linked[result.type] || []; body.linked[result.type] = body.linked[result.type].concat(result.resources); body.links[linkpath + "." + key] = {type: result.type}; } return fetchChildren(linkpath + "." + key, config[key], result.resources, _this._schema[inflect.singularize(result.type)]); }else if (result && result.type){ if (config[key].__includeInBody){ body.linked[result.type] = body.linked[result.type] || []; body.links[linkpath + '.' + key] = {type: result.type} } } }); })); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bodyContentGenerator(_route) {\n if (_route[0] == 'isHomePage') {\n var isActive =['class=\"active\"','',''];\n } else if (_route[0] == 'isExplorer') {\n apiGetUgly('https://api.blockcypher.com/v1/btc/main', 'actualBlockHeight');\n prettyApiGet('https://api.blockcypher.com/v1/bt...
[ "0.59942055", "0.5750982", "0.57046455", "0.5624097", "0.55721575", "0.55424577", "0.5439902", "0.54165685", "0.5377422", "0.53667736", "0.53667736", "0.53667736", "0.53667736", "0.5365766", "0.5352186", "0.5348839", "0.5348839", "0.5348839", "0.5348839", "0.5348839", "0.5348...
0.0
-1
Define a function to print the player's current time
function showProgress () { var current = $('.js-player').prop('currentTime'); $('progress').prop("value", current); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output_time() { // output the current time\r\n\ttime.value = player_data.current_time;\r\n}", "function printTime(){\n var currentTime = new Date();\n var time = currentTime.getHours() + \":\" + currentTime.getMinutes() + \":\" + currentTime.getSeconds();\n return time;\n}", "function tellTi...
[ "0.7804829", "0.77773476", "0.76876307", "0.76045966", "0.7603456", "0.7533893", "0.7506032", "0.7506032", "0.74689245", "0.7463391", "0.7459716", "0.7335616", "0.73169553", "0.73098105", "0.73080784", "0.7302703", "0.7288477", "0.7274046", "0.71828634", "0.7170896", "0.71656...
0.0
-1
Add a constructor in the SearchBar Component
constructor(props) { super(props); this.state = { term: ' ', location: ' ', sortBy: 'best_match' }; //bind methods in the constructor this.handleTermChange = this.handleTermChange.bind(this); this.handleLocationChange = this.handleLocationChange.bind(this); this.handleSearch = this.handleSearch.bind(this); //Create an Object with keys and values that conform to what the API expects to reecieve this.sortByOptions = { 'Best Match': 'best_match', 'Highest Rated': 'rating', 'Most Reviewed': 'review_count' }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(props) { // always called when class initated\n super(props); // super calls parent method on parent class (Component)\n\n this.state = { term: '' }; // state - plain JS obj, initialised by defining a property.\n // component level state (SearchBar) \n }", "constructor(prop...
[ "0.757572", "0.72776276", "0.7120856", "0.70949227", "0.70257163", "0.7003477", "0.7001607", "0.6918931", "0.68518233", "0.68232673", "0.68171465", "0.68098783", "0.6807952", "0.6799482", "0.6736351", "0.6728042", "0.6696609", "0.669564", "0.6683961", "0.6658316", "0.6648982"...
0.0
-1
Add a method that returns the current CSS class of the sort Options
getSortByClass(sortByOption) { if (this.state.sortBy === sortByOption) { return 'active'; } else { return ''; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sortClass(){\n return {\n 'sort-btn': true,\n 'sort-asc icon-down': this.column.sort === 'asc',\n 'sort-desc icon-up': this.column.sort === 'desc'\n };\n }", "getSortByClass(sortByOption) {\n if (this.state.sortBy === sortByOption) {\n return 'active';\n } else {\n ...
[ "0.7296139", "0.7126677", "0.68716156", "0.6587146", "0.65364623", "0.6504597", "0.6308812", "0.6235036", "0.6223046", "0.59736294", "0.5956998", "0.5898191", "0.5890625", "0.5890625", "0.588406", "0.58394873", "0.5834518", "0.5797572", "0.5758416", "0.5710294", "0.57089", ...
0.70470965
2
Add a method that sets the state of a sorting option
handleSortByChange(sortByOption) { this.setState({sortBy: sortByOption}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set overrideSorting(value) {}", "changeSorting() {\n this.currentlySelectedOrder =\n (this.currentlySelectedColumn === this.columnName) ? !this.currentlySelectedOrder : false;\n this.currentlySelectedColumn = this.columnName;\n }", "handleSortByChange(sortByOption) {\n this.setState({ sort...
[ "0.73853576", "0.72529536", "0.7155989", "0.7048791", "0.7037462", "0.700547", "0.7001464", "0.69612354", "0.69599247", "0.6922674", "0.69113153", "0.68882793", "0.68489474", "0.6830895", "0.6820062", "0.67407084", "0.6676105", "0.66645443", "0.6663364", "0.6654602", "0.66181...
0.69886655
8
Add two methods to handle changes in two input elements, Terms and Location
handleTermChange(event){ this.setState({term: event.target.value}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onInputChangeTerms(terms_search) {\n console.log(\"onInputChangeTerms: \" + terms_search);\n let filters = this.props.filters;\n filters.terms_search = terms_search;\n filters.do_terms_search = true;\n this.props.setFilter( filters );\n }", "function termsGetDefinition()\r\n{\r\n terms = documen...
[ "0.54640776", "0.5349804", "0.53165483", "0.5291185", "0.52713245", "0.52152944", "0.5211825", "0.5150715", "0.51490843", "0.5141344", "0.5122521", "0.5112396", "0.51123685", "0.5086095", "0.50419736", "0.5003833", "0.49658164", "0.49428698", "0.49408758", "0.49325418", "0.49...
0.0
-1
Build GO button functionality
handleSearch(event) { this.props.searchYelp(this.state.term, this.state.location, this.state.sortBy); event.preventDefault(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildButtonDef(trumbowyg) {\n return {\n fn: function () {\n var $modal = trumbowyg.openModal('Code', [\n '<div class=\"' + trumbowyg.o.prefix + 'highlight-form-group\">',\n ' <select class=\"' + trumbowyg.o.prefix + 'highlight-form-...
[ "0.67070943", "0.66719586", "0.6615435", "0.6566278", "0.655044", "0.654363", "0.6522419", "0.6509046", "0.64899176", "0.6462648", "0.64305085", "0.6381419", "0.6377197", "0.6373988", "0.6318765", "0.63171023", "0.63163835", "0.6300956", "0.6296716", "0.6290063", "0.6284369",...
0.0
-1
Render the SearchBar Component
render() { return ( <div className="SearchBar"> <div className="SearchBar-sort-options"> <ul> {this.renderSortByOptions()} </ul> </div> <div className="SearchBar-fields"> <input placeholder="Search Businesses" onChange={this.handleTermChange}/> <input placeholder="Where?" onChange={this.handleLocationChange}/> </div> <div className="SearchBar-submit"> <a onClick={this.handleSearch}>Go</a> </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render(){\n\t\t// every class must have a render method \n\t\treturn(\n\t\t\t<div className=\"search-bar\">\n\t\t \t\t<input \n\t\t \t\t\tvalue = {this.state.term} // this turns into controlled component\n\t\t \t\t\tonChange={(event) => this.onInputChange(event.target.value)} />\n\t\t \t</div>\n\t\t );\n\t}", "r...
[ "0.7845681", "0.7794488", "0.764205", "0.75933236", "0.74759215", "0.74707884", "0.7363707", "0.73508847", "0.7344061", "0.7335953", "0.7325167", "0.73117745", "0.7269368", "0.7254632", "0.724693", "0.7229457", "0.71430224", "0.71334285", "0.71125776", "0.7060655", "0.7041672...
0.7320015
11
to get the coordinate from the address
function jsonTransform() { console.log("in json function"); $.getJSON("ajax/WagPregeo.json",function(data) { $.each(data,function(key, val) { addressArray.push({id: val.id, name: val.name,addresseng: val.addresseng, addresscn: val.addresscn}); }); initializeGeo(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async getCoordsFromAddress(address = '') {\n const platform = this.setPlatform();\n let data = {};\n const geocoder = platform.getGeocodingService();\n const geocodingParams = {\n searchText: address\n };\n await geocoder.geocode(geocodingParams, (result) => {\n const locations =...
[ "0.7615943", "0.74447", "0.73975205", "0.7380073", "0.7339588", "0.7115024", "0.7087174", "0.7076664", "0.6960761", "0.6901964", "0.6863626", "0.67996913", "0.66416305", "0.6625145", "0.6583819", "0.65761966", "0.6563513", "0.6541144", "0.6497", "0.649529", "0.64813447", "0...
0.0
-1
need a loop on all the line of the JSON
function initializeGeo() { console.log("in initializeGeo function"); console.log(addressArray.length); syncLoop(addressArray.length, function(loop){ // console.log("loop : " + loop.iteration()); var tmpId = loop.iteration(); function callnext() { loop.next(); } // SUBWAY GOOGLE // codeAddressGoogle(addressArray[loop.iteration()].station, tmpId, callnext); // STORE BAIDU codeAddressBaidu(addressArray[loop.iteration()].addresscn, tmpId, callnext); }, function (){ // console.log("finish !") }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function auxiliar(json){\n if(json.length==0 || json == null){\n alert(\"No hay productos en ese rango de precios\");\n return;\n }\n for(let producto of json){\n items(producto);\n }\n }", "function jsonlStreamForEach( ins, fn ) {\n return lineParser( ins, async ( line ) => {\n ...
[ "0.6221983", "0.6186221", "0.6083474", "0.59135765", "0.58868086", "0.5873911", "0.58502096", "0.5830202", "0.5817008", "0.5798865", "0.5755613", "0.56673425", "0.5643661", "0.55699533", "0.55613595", "0.55257434", "0.552127", "0.5505064", "0.5503737", "0.54819936", "0.547734...
0.0
-1
OLD VERSION TO GEOCOD AN ADDRESS
function codeAddressGoogle(address, tmpId, callback) { // alert("in codeAddress function"); // console.log(address); var geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { // alert(results[0].geometry.location); // console.log("lat: " +results[0].geometry.location.lat()); var tmplat = results[0].geometry.location.lat(); var tmplng = results[0].geometry.location.lng(); console.log("/" + tmpId + "/" + address+ "/" + tmplat + "/" + tmplng); addressArray[tmpId] = {lat: tmplat, lng: tmplng}; // alert("After push"); callback(); } else if (status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT) { // console.log("OVER_QUERY_LIMIT"); setTimeout(function() { codeAddressGoogle(address, tmpId, callback); }, 1500); } else { console.log('Geocode fail for the address: ' + address); console.log('Geocode was not successful for the following reason: ' + status); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverseGeocode(points) {\n var geocoder = new google.maps.Geocoder(),\n coordinates = new google.maps.LatLng(points[0], points[1]),\n setting = { 'latLng': coordinates };\n geocoder.geocode(setting, function (results, status) {\n if (status === 'OK') {\n var address =...
[ "0.6537228", "0.6524817", "0.6375113", "0.6339711", "0.6301076", "0.62485355", "0.6243433", "0.6216092", "0.6061961", "0.60589576", "0.6034297", "0.60336286", "0.59991384", "0.5974818", "0.5944917", "0.5928608", "0.5919886", "0.5919287", "0.5917513", "0.591317", "0.5908015", ...
0.0
-1
Season function with calendar and show titles and dates
function Season() { let [allShows, setAllShows] = useState(null) async function seeAllShows() { const showsRef = firestore.collection('shows') const showSnapshot = await showsRef.where('status', '!=', 'Proposal').get() const allShowsArray = showSnapshot.docs.map(collectAllIdsAndDocs) if (!allShows) { console.log('allShowsArray =', allShowsArray) setAllShows(allShowsArray) } } seeAllShows() return ( <div className="season_container"> <h1>Season 2020</h1> { allShows ? allShows.map(show => { return <SeasonEvent key={show.id} id={show.id} title={show.title} dates={show.dates} type={show.type} artist={show.artist} blurb={show.blurb} artist={show.displayName} imageLg={show.imageLg} ></SeasonEvent> }) : 'loading' } </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DrawSeasonCalendar() {\n let ourDate = BackendHelper.Filter.CalendarDate;\n let firstDayOfMonthDate = new C_YMD(ourDate.Year, ourDate.Month, 1);\n let firstDayOfMonthDayOfWeek = firstDayOfMonthDate.DayOfWeek();\n\n CalendarModalDate = ourDate;\n $('#vitasa_modal_calendar_date')[0].innerText...
[ "0.77897084", "0.6939122", "0.6911409", "0.68985325", "0.66730314", "0.6661029", "0.6644443", "0.66373426", "0.6617695", "0.6465469", "0.6412799", "0.6267902", "0.62401795", "0.6238997", "0.6215198", "0.6127396", "0.61130023", "0.60675347", "0.6067287", "0.60525984", "0.60314...
0.0
-1
k: products[i].length === 20 s: searchWord.length === 1000 sol 1) knslogs
function add(obj, key, value) { if (! (key in obj)) obj[key] = [value]; else { obj[key].push(value) obj[key].sort() if (obj[key].length === 4) { obj[key].pop() } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkForKeyWords(arsTest) {\n console.log(\"arstest, \", arsTest);\n arsKeyWords = [];\n arsKeyTot = [];\n bCheck = false;\n for (var i = 0; i < arsTest.length; i++) {\n arsKeyWords = [];\n var nStartCheck, nEndCheck;\n console.log(\"sStartIndexForEachLength: \", sStart...
[ "0.6051526", "0.5920228", "0.58063376", "0.5695481", "0.5681347", "0.56718266", "0.5662377", "0.5650793", "0.5596862", "0.55857015", "0.5581462", "0.5572365", "0.55683625", "0.556427", "0.55636114", "0.5531635", "0.5526469", "0.5520329", "0.551112", "0.55066603", "0.55022603"...
0.0
-1
Bind to relay events. Capture emitted events by the relay and send via websocket.
initSockets() { this.relay.on('requests satisfied', (data) => { const sockets = this.channel('relay'); if (!sockets) return; this.to('relay', 'relay requests satisfied', data); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_bindEvents () {\n this.channel.on('route', this.navigate)\n }", "function bindPusherEvents() {\n var pusher = new Pusher('bf3b73f9a228dfef0913');\n var channel = pusher.subscribe(divvy.channel);\n\n channel.bind('commentWasDeleted', commentWasDeleted);\n channel.bind('commentWasL...
[ "0.63512105", "0.6251112", "0.6139383", "0.6045059", "0.6021572", "0.6010052", "0.5994783", "0.59935796", "0.5982343", "0.596509", "0.5930961", "0.5929303", "0.59268016", "0.5896727", "0.588862", "0.5873009", "0.5872311", "0.5867207", "0.58462965", "0.5811057", "0.57656306", ...
0.58158666
19
one or the other or both spends is valid if both the hash and the index are valid. pays is valid if pays is valid
function isValidRequestInput(options) { const {hash, index, pays} = options; let isSpendsValid = false; let isPaysValid = false; if ( Buffer.isBuffer(hash) && hash.length === 32 && typeof index === 'number' && (index >>> 0) === index ) isSpendsValid = true; // TODO: check for size if (Buffer.isBuffer(pays)) isPaysValid = true; return isSpendsValid || isPaysValid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isChainValid(){\n\n //not putting index in 0 cause GENESIS is the 0\n for(let i = 1; i <this.chain.length; i++){\n const currentBlock = this.chain[i];\n const previousBlock = this.chain[i -1];\n\n //check if the propely block are link together\n //1.- if t...
[ "0.54913366", "0.5272588", "0.52386254", "0.5236217", "0.5190257", "0.5138925", "0.5124688", "0.5091307", "0.50820833", "0.5066742", "0.5047388", "0.50276417", "0.49885303", "0.49706858", "0.49332136", "0.49299714", "0.4924575", "0.49241933", "0.49210322", "0.49210256", "0.49...
0.5947727
0
TODO: save chords to display circle of fifths heatmap data visualization
function detectChord(notes) { notes = notes.map(n => Tonal.Note.pc(Tonal.Note.fromMidi(n.note))).sort(); return Tonal.PcSet.modes(notes) .map((mode, i) => { const tonic = Tonal.Note.name(notes[i]); const names = Tonal.Dictionary.chord.names(mode); return names.length ? tonic + names[0] : null; }) .filter(x => x); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawChords (matrix, mmap) {\n var w = 980, h = 750, r1 = h / 2, r0 = r1 - 110, duration=5000;\n\n var fill = d3.scale.ordinal()\n // .range(['#c7b570','#c6cdc7','#335c64','#768935','#507282','#5c4a56','#aa7455','#574109','#837722','#73342d','#0a5564','#9c8f57','#7895a4','#4a5456',...
[ "0.6713943", "0.6671842", "0.6503217", "0.63301", "0.61315715", "0.60597485", "0.6042422", "0.6019636", "0.60035074", "0.5991313", "0.5932931", "0.5911504", "0.58962834", "0.58921283", "0.5867655", "0.58638865", "0.5849583", "0.58356595", "0.5831848", "0.581714", "0.57955825"...
0.0
-1
For an additional challenge, add '' signs to scores in the bottom two percent of A, B, C, and D scores, and '+' signs to the top two percent of B, C and D scores (sorry, Mr.Cerise never gives an A+). Given 88, console.log "Score: 88. Grade: B+". Given 61 log "Score: 61. Grade: D".
function accLetterGrade(score) { var grade; if(score >= 0 && score <= 100) { if(score < 60) { grade = "F"; } else if(score < 70) { if(score <= 62) { grade = "D-"; } else if(score < 70) { grade = "D+"; } else { grade = "D"; } } else if(score < 80) { if(score <= 72) { grade = "C-"; } else if(score < 80) { grade = "C+"; } else { grade = "C"; } } else if(score < 90) { if(score <= 82) { grade = "B-"; } else if(score < 90) { grade = "B+"; } else { grade = "B"; } } else if(score < 100) { if(score <= 92) { grade = "A-"; } else { grade = "A"; } } console.log("Score: " + score + ". Grade: " + grade); } else if(score >= 100) { console.log("Woah, you got a score of " + score + "!? You're such an overachiever. Still no A+"); } else { console.log("Either you did so poorly in this class you managed to get a score less than 0, or I've accidentally logged your grade as something other than a number!"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function moreAccurateGrades(grade)\n{\n if(grade >= 93)\n {\n console.log(\"A\");\n }\n else if(grade >= 90)\n {\n console.log(\"A-\");\n }\n else if(grade >= 88)\n {\n console.log(\"B+\");\n }\n else if(grade >= 83)\n {\n console.log(\"B\");\n }\n ...
[ "0.7395894", "0.7371303", "0.73184234", "0.730597", "0.7254876", "0.72222245", "0.7221039", "0.7205958", "0.71949196", "0.7190736", "0.7185203", "0.717798", "0.7093158", "0.7086015", "0.70766014", "0.7070722", "0.7048823", "0.6979189", "0.697838", "0.6972952", "0.6959466", ...
0.7341423
2
component did mount fxn
componentDidMount(){ firebase.auth().onAuthStateChanged((user) => { if (user) { this.setState({ user }) document.getElementById("title").classList.add("loginTitle"); document.getElementById("title").classList.remove("logoutTitle"); document.getElementById("headImg").classList.add("loginImg"); document.getElementById("headImg").classList.remove("logoutImg"); // User is signed in. } else { this.setState({user: {} }) document.getElementById("title").classList.remove("loginTitle"); document.getElementById("title").classList.add("logoutTitle"); document.getElementById("headImg").classList.remove("loginImg"); document.getElementById("headImg").classList.add("logoutImg"); // No user is signed in. } }); firebase.database().ref('/growls').on('value', snapshot => { let growls = snapshot.val(); this.setState({growls}) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componenetWillMount() { }", "componenetDidMount() { }", "componentDidMount(){ //Cuando un compoennte se monta y se muestra en pantalla se llama este método\n console.log(\"did Mount\");\n }", "componentDidMount() {\n let state = this.state;\n this.mounted = true;\n this.setState( sta...
[ "0.81764495", "0.7803353", "0.7756498", "0.7564405", "0.75093657", "0.7385242", "0.73402876", "0.7327044", "0.7324841", "0.7324073", "0.72921973", "0.7288123", "0.72577995", "0.7251849", "0.7250091", "0.7241546", "0.7227328", "0.72191167", "0.719574", "0.7187165", "0.7180157"...
0.0
-1
we pass data as well as callback functions
function framework(data,scb,fcb){ //scb and fcb are success and failure call back for(let i=2;i*i<data;i++){ if(data%i==0){ return fcb(); } } return scb(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _callback(err, data) { _call(callback, err, data); }", "function callback(){}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }"...
[ "0.735528", "0.7317476", "0.69251835", "0.69251835", "0.69251835", "0.69251835", "0.69251835", "0.690911", "0.6904304", "0.6872763", "0.6863283", "0.6863283", "0.6863283", "0.6713949", "0.6713949", "0.6713949", "0.6713949", "0.6700758", "0.6658431", "0.6640857", "0.66309565",...
0.0
-1
require is just like import developers's code inversion of control
function scb(){ console.log("Number is prime"); exec('start chrome').unref(); //this will open chrome }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function require() { return {}; }", "function require(str) {}", "function require(id, parent) {\n parent = parent || __filename;\n\n function dir_prefix( uri ) {\n var split = uri.match(/.*\\//);\n return split ? split[0] : '';\n }\n\n function ends_with(str, suffix) {\n return...
[ "0.79007006", "0.6931596", "0.65954447", "0.6400872", "0.6366075", "0.63028336", "0.6299785", "0.6229978", "0.62218225", "0.6191262", "0.6175646", "0.61684793", "0.6142497", "0.61068124", "0.6105065", "0.60636157", "0.60487455", "0.60481995", "0.6042539", "0.6033574", "0.6033...
0.0
-1
currentFrame, currentTime and sampleRate are global variables of AudioWorkletProcessor currentFrame is does not give the same result as counting iterations (this._countBlock)
constructor() { super(); // Initialize parameters this.init(0.02); // Process message this.port.onmessage = this.handleMessage.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init(frameDuration){\n // Initialize variables\n\n // Frame information\n // Frame duration (e.g., 0.02 s)\n const fSize = frameDuration*sampleRate;\n // Make the framesize multiple of 128 (audio render block size)\n this._frameSize = 128*Math.round(fSize/128); // Frame duration = this._frameSize...
[ "0.6474039", "0.6331757", "0.6299864", "0.61680335", "0.6053511", "0.6043517", "0.603848", "0.59629", "0.5938586", "0.5862764", "0.5859396", "0.58417475", "0.5840197", "0.5809662", "0.56728184", "0.5640583", "0.56148857", "0.5599868", "0.5588118", "0.5577787", "0.5552177", ...
0.0
-1
input: Frame duration in seconds
init(frameDuration){ // Initialize variables // Frame information // Frame duration (e.g., 0.02 s) const fSize = frameDuration*sampleRate; // Make the framesize multiple of 128 (audio render block size) this._frameSize = 128*Math.round(fSize/128); // Frame duration = this._frameSize/sampleRate; this._frameSize = Math.max(128*2, this._frameSize); // Force a minimum of two blocks this._numBlocksInFrame = this._frameSize/128; // 8 at 48kHz and 20ms window // Force an even number of frames if (this._numBlocksInFrame % 2){ this._numBlocksInFrame++; this._frameSize += 128; } // Predefined 50% overlap this._numBlocksOverlap = Math.floor(this._numBlocksInFrame/2); // 4 at 48kHz and 20ms window // Define frame buffers this._oddBuffer = new Float32Array(this._frameSize); // previous and current are reused this._pairBuffer = new Float32Array(this._frameSize); // previous and current are reused // We want to reuse the two buffers. This part is a bit complicated and requires a detailed description // Finding the block indices that belong to each buffer is complicated // for buffers with an odd num of blocks. // Instead of using full blocks, half blocks could be used. This also adds // another layer of complexity, so not much to gain... // Module denominator to compute the block index this._modIndexBuffer = this._numBlocksInFrame + this._numBlocksInFrame % 2; // Adds 1 to numBlocksInFrame if it's odd, otherwise adds 0 // Count blocks this._countBlock = 0; // Computed buffers this._oddSynthBuffer = new Float32Array(this._frameSize); this._pairSynthBuffer = new Float32Array(this._frameSize); console.log("Frame size: " + this._frameSize + ". Set frame length: " + this._frameSize/sampleRate + " seconds" + ". Blocks per frame: " + this._numBlocksInFrame + ". Blocks overlap: " + this._numBlocksOverlap); // LCP variables this._lpcOrder = 20; // LPC filter coefficients this._lpcCoeff = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; // LPC k coefficients this._kCoeff = []; // Filter samples this._prevY = []; // Quantization this._quantOpt = false; this._quantBits = 2; // Reverse K's this._reverseKOpt = false; // Perfect synthesis this._perfectSynthOpt = false; // resampling before analysis this._resamplingFactor = 1; this._resampler = new Resampler(this._frameSize, this._resamplingFactor); // Unvoiced mix (adds noise to the perfect excitation signal) this._unvoicedMix = 0; // Pitch factor (modifies this._fundFreq) this._pitchFactor = 1; // Vibrato effect (modifies this._fundFreq) this._vibratoEffect = 0; // Synthesis // Create impulse signal this._oldTonalBuffer = new Float32Array(this._frameSize/2); this._excitationSignal = new Float32Array(this._frameSize); this._errorBuffer = new Float32Array(this._frameSize); this._mixedExcitationSignal = new Float32Array(this._frameSize); // autocorrelation indices for fundamental frequency estimation this._lowerACFBound = Math.floor(sampleRate / 200); // 200 Hz upper frequency limit -> lower limit for periodicity in samples this._upperACFBound = Math.ceil(sampleRate / 70); // 70 Hz lower frequency limit -> upper limit // excitation variables this._tonalConfidence = 0.5; this._confidenceTonalThreshold = 0.1; this._periodFactor = 1; // buffer for fundamental period estimation this._fundPeriodLen = this._upperACFBound - this._lowerACFBound; this._fundPeriodBuffer = []; this._oldPeriodSamples = this._upperACFBound; this._pulseOffset = 0; // Debug // Timer to give updates to the main thread this._lastUpdate = currentTime; // Block info this._block1 = new Float32Array(128); this._block2 = new Float32Array(128); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getFrameRate(frames) {\nvar frameok;\n//------------\n// Use 25fps as the somewhat arbitrary default value.\nframeok = frames && frames.length !== 0;\nif (frameok) {\nreturn 1000 / frames[0].duration;\n} else {\nreturn 25;\n}\n}", "function drawFrame(frame) {\n\t\tvideo.currentTime = (frame.second > video...
[ "0.70782954", "0.7076676", "0.70356077", "0.7027187", "0.6897035", "0.679971", "0.6738457", "0.67182046", "0.65745807", "0.6483586", "0.6443946", "0.6338004", "0.63288355", "0.6305262", "0.6217638", "0.62138844", "0.6160785", "0.61125994", "0.60788536", "0.60742015", "0.60491...
0.0
-1
Receive messages from main thread
handleMessage(e){ console.log("received message with id: ", e.data.id, "; message was: ", e); switch (e.data.id) { case "quantization": this._quantOpt = e.data.quantOpt; this._quantBits = e.data.quantBits; break; case "reverseK": this._reverseKOpt = e.data.reverseKOpt; break; case "perfectSynth": this._perfectSynthOpt = e.data.perfectSynthOpt; break; case "resampling": this._resamplingFactor = e.data.resampFactor; this._resampler.update(this._resamplingFactor); break; case "voicedThreshold": this._confidenceTonalThreshold = e.data.voicedThreshold; break; case "pitchFactor": this._pitchFactor = e.data.pitchFactor; break; case "voiceMap": // Voiced / Unvoiced Synthesis this._unvoicedMix = e.data.unvoicedMix; this._confidenceTonalThreshold = e.data.voicedThreshold; // Resampling (vocal tract length) if (e.data.vocalTractFactor != this._resamplingFactor){ this._resamplingFactor = e.data.vocalTractFactor; this._resampler.update(this._resamplingFactor); } // Pitch modifier this._pitchFactor = e.data.pitchFactor; // Vibrato //e.data.vibratoEffect; break; case "options": // Receive all options this._perfectSynthOpt = e.data.perfectSynthOpt; this._quantOpt = e.data.quantOpt; this._quantBits = e.data.quantBits; this._reverseKOpt = e.data.reverseKOpt; if (e.data.vocalTractFactor != this._resamplingFactor){ this._resamplingFactor = e.data.vocalTractFactor; this._resampler.update(this._resamplingFactor); } this._confidenceTonalThreshold = e.data.voicedThreshold; this._pitchFactor = e.data.pitchFactor; break; default: // any unknown ID: log the message ID console.log("unknown message received:") console.log(e.data) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMessageReceive() {}", "function mainThreadReceivedMessage(e) {\n var msg = e.data;\n var worker = workers[msg.workerId];\n var aborted = false;\n\n if (msg.error) worker.userError(msg.error, msg.file);\n else if (msg.results && msg.resu...
[ "0.68331236", "0.6715099", "0.6482904", "0.64415425", "0.64415425", "0.64415425", "0.64415425", "0.64415425", "0.64415425", "0.64415425", "0.63156927", "0.63097507", "0.6306779", "0.6293593", "0.6243852", "0.619123", "0.618337", "0.61290836", "0.6119623", "0.611042", "0.61104...
0.0
-1
This is only used in the 2D Voice Map when the error signal is used for synthesis
createMixedExcitation(periodSamples, errorRMS) { this._mixedExcitationSignal = this._errorBuffer; this._excitationSignal = this.createNoiseExcitation(errorRMS); for (let i=0; i<this._frameSize; i++){ this._excitationSignal[i] = (1-this._unvoicedMix) * this._mixedExcitationSignal[i] + this._unvoicedMix * this._excitationSignal[i]; } return this._excitationSignal; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SC_onError(e,t){$.scriptcam.SC_onError(e,t)}", "function showError() {\n\tdocument.getElementById(\"mistake\").innerHTML = \"<font color=\\\"red\\\">間違った!</font>\";\n\tplayErrorAudio();\n}", "function setError(reset) {\n\terror *= ramp;\n\tif (reset) error = 0.25;\n\tif (Math.random() < 0.5) error *= ...
[ "0.6336766", "0.61526114", "0.6119087", "0.6086941", "0.59979874", "0.5978996", "0.59165394", "0.5882012", "0.5825533", "0.5779841", "0.5762651", "0.5731029", "0.5730381", "0.5718879", "0.5716738", "0.57147044", "0.5703733", "0.5703733", "0.56806356", "0.5675614", "0.5629996"...
0.56280476
21
Quantize K coeficients TODO: it gives the same result as matlab, but there are errors at lower bit rates??
quantizeLPC(lpcCoeff, kCoeff, numBits){ let M = lpcCoeff.length-1; // Quantize Ks for (let i = 0; i< M; i++){ kCoeff[i] = this.quantizeK(kCoeff[i], numBits); } // recalculate LPC return LPC.recalculateLPC(lpcCoeff, kCoeff); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function coeff(n, k) {\n var coeff = 1;\n for (var x = n-k+1; x <= n; x++) coeff *= x;\n for (x = 1; x <= k; x++) coeff /= x;\n return coeff;\n}", "function multiply(x,k,base){var m,temp,xlo,xhi,carry=0,i=x.length,klo=k%SQRT_BASE,khi=k/SQRT_BASE|0;for(x=x.slice();i--;){xlo=x[i]%SQRT_BASE;xhi=x[i]/SQRT_BASE|0...
[ "0.64669013", "0.579708", "0.5733237", "0.5733237", "0.5627074", "0.55756706", "0.54587847", "0.544894", "0.54455554", "0.54455554", "0.54324776", "0.5430064", "0.5429248", "0.54154116", "0.5411437", "0.5406991", "0.53878427", "0.5379771", "0.5379771", "0.5379771", "0.5379771...
0.6159191
1
Bypass. Checks for overlap and add artifacts
bypass(inBuffer, outBuffer){ for (let i = 0; i < inBuffer.length; i++){ outBuffer[i] = inBuffer[i]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "intersectingArtifact(bb) {\n let sel = 0;\n bb = svgHelpers.boxPoints(bb.x, bb.y, bb.width ? bb.width : 1, bb.height ? bb.height : 1);\n const artifacts = svgHelpers.findIntersectingArtifactFromMap(bb, this.measureNoteMap, this.scroller.scrollState);\n // TODO: handle overlapping suggestions\n if (!...
[ "0.6045579", "0.5611285", "0.54688466", "0.5418428", "0.54057753", "0.5262794", "0.5208748", "0.52067304", "0.51245314", "0.51079255", "0.51079255", "0.51061606", "0.5095474", "0.5088224", "0.5078736", "0.5055305", "0.50309116", "0.5027557", "0.5023838", "0.49943924", "0.4992...
0.0
-1
Exponential Moving Average filter. Needs last sample of the previous synth buffer
ema (inBuffer, outBuffer){ for (let i = 0; i < inBuffer.length; i++){ // Smooth, EMA if (i == 0){// Skip first sample (Or take it from previous buffer?) outBuffer[i] = inBuffer[i]; } else { outBuffer[i] = inBuffer[i]*0.01 + outBuffer[i-1]*0.99; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateExponentialMovingAverage(currentObservation,\n previousExponentialMovingAverage) {\n\n //hacker diet suggests 0.9\n //TODO: make this configurable\n var smoothingFactor = 0.8;\n\n //inspired by hacker diet: \n //https://www.fourmilab.c...
[ "0.6945081", "0.57183474", "0.5713561", "0.55339795", "0.5522362", "0.54916936", "0.5223794", "0.51811856", "0.5147332", "0.51190215", "0.51054066", "0.50999105", "0.50976515", "0.5086508", "0.5082541", "0.50785434", "0.5076225", "0.5072351", "0.5057199", "0.50501716", "0.505...
0.74534476
0
Windowing and mixing odd and pair buffers
synthesizeOutputBlock(outBlock) { // Get block index for pair and odd buffers /* We want to get X: the current block to mix 0 0 0 X 0 --> Pair block X O O O O --> Odd block o o o x ... --> Synthesized block (outBlock) */ let indBlockPair = this._countBlock % this._modIndexBuffer; let indBlockOdd = (indBlockPair + this._modIndexBuffer/2) % this._modIndexBuffer; // TODO: Right now this only works for 50% overlap and an even number of blocks per frame. // More modifications would be necessary to include less than 50% overlap and an odd number of blocks per frame. Right now an amplitude modulation would appear for an odd number of blocks per frame (to be tested - AM from 1 to 0.5). // Iterate over the corresponding block of the synthesized buffers for (let i = 0; i<outBlock.length; i++){ let indPair = i + 128*indBlockPair; let indOdd = i + 128*indBlockOdd; // Hanning window // Use hanning window sin^2(pi*n/N) let hannPairBValue = Math.pow(Math.sin(Math.PI*indPair/this._frameSize), 2); let hannOddBValue = Math.pow(Math.sin(Math.PI*indOdd/this._frameSize), 2); //let hannPairBValue = 0.54 - 0.46 * Math.cos(2*Math.PI*indPair/(this._frameSize-1)); //let hannOddBValue = 0.54 - 0.46 * Math.cos(2*Math.PI*indOdd/(this._frameSize-1)); // Hanning windowed frames addition outBlock[i] = hannPairBValue*this._pairSynthBuffer[indPair] + hannOddBValue*this._oddSynthBuffer[indOdd]; // Debugging //outBlock[i] = this._pairBuffer[i];//this._pairSynthBuffer[indPair];//0.5*this._pairSynthBuffer[indPair] + 0.5*this._oddSynthBuffer[indOdd]; this._block1[i] = this._pairSynthBuffer[indPair]; this._block2[i] = this._oddSynthBuffer[indOdd]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatewindow(strm,src,end,copy){var dist;var state=strm.state;/* if it hasn't been done already, allocate space for the window */if(state.window===null){state.wsize=1<<state.wbits;state.wnext=0;state.whave=0;state.window=new utils.Buf8(state.wsize);}/* copy state->wsize or less output bytes into the circu...
[ "0.59155285", "0.58480716", "0.5809806", "0.5803648", "0.5788865", "0.57761717", "0.5769033", "0.5769033", "0.57507116", "0.57495636", "0.5729805", "0.5729805", "0.5729805", "0.5729805", "0.5729805", "0.5729805", "0.5729805", "0.5729805", "0.5729805", "0.5729805", "0.5729805"...
0.6297847
0
NOTE: modified to blend 2 single pixels color conversions
function hex2rgba(h) {return [hexToR(h), hexToG(h),hexToB(h), 255]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static blendDestOut(p1,id1,p2,id2){\n\t\tconst op1=p1[id1+3],op2=p2[id2+3];\n\t\tconst op=(op1*(0x10000-op2))>>>16;\n\t\t// blended op, shoud be (op1*(0xFFFF-op2))/0xFFFF\n\t\t// no change to color params, has nothing to do with the color of p2\n\t\t// op holds op>=0\n\t\tp1[id1+3]=op; // only change opacity\n\t}"...
[ "0.77154845", "0.75974333", "0.72799206", "0.72799206", "0.72740066", "0.7221746", "0.7195399", "0.69225717", "0.6917332", "0.68476653", "0.68445396", "0.6819772", "0.67996424", "0.67159295", "0.6688296", "0.66803706", "0.66134334", "0.6602085", "0.65860164", "0.6539119", "0....
0.0
-1
var logElement = $(".overlaytext1");
function updateParallax2(e) { if (isFirefox) return; e = window.event ? window.event : e; var delta = e.wheelDelta ? e.wheelDelta : -e.detail; delta = Math.floor( delta * 0.1 ); // console.log("wheel delta " + delta); e.preventDefault(); document.body.scrollTop -= delta; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appendToLogs(text) {\n $(\"#log\").append(\"<br>\" + $(\"<div/>\").text(text).html());\n}", "function log(text) {\t \n\t$(\"#datawindow\").append(\"<p>\" + text + \"</p>\");\n}", "function log(text){\n $('#consoleOutput').append('<p>'+text+'</p>');\n}", "function mylog(divTag, logTxt) {\n ...
[ "0.62317586", "0.6054275", "0.58416647", "0.5835165", "0.5753291", "0.57480377", "0.56529653", "0.5640447", "0.56026524", "0.5497163", "0.5435345", "0.539482", "0.53787166", "0.5368364", "0.5338706", "0.5325973", "0.5316682", "0.5311445", "0.53062785", "0.5278675", "0.5256526...
0.0
-1
Access an unsigned byte at location index.
at(index) { return this.bytes[index] & 0xff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getByte(idx) { return data.charCodeAt(idx); }", "getByte(index) {\n return this.track.floppyDisk.binary[this.track.offset + this.offset + index];\n }", "function getByte(bytes, offset) {\n return bytes.charCodeAt(offset) % 256;\n }", "getByte() {\n const r16 = this.registe...
[ "0.7577003", "0.66853446", "0.65939295", "0.61405", "0.61396", "0.61205125", "0.6051274", "0.60481846", "0.5847378", "0.5762398", "0.5715135", "0.56778294", "0.5675783", "0.56644213", "0.5624583", "0.5612432", "0.56009465", "0.56009465", "0.55862105", "0.5496427", "0.5490163"...
0.77251947
0
Copy count bytes from array source starting at offset.
_set(source, offset, count) { if (source == null) { this.bytes[offset] = count; } else { this.bytes = new Array(count); this.Size = count; for (var x = 0; x < count; x++) { // Flex doesn't know bytes -> make it a byte if (source[offset + x] > 127) { this.bytes[x] = (256-source[offset + x])*-1; } else { this.bytes[x] = source[offset + x]; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayCopy(src, srcOffset, dest, destOffset, count) {\n if (count == 0) {\n return;\n } \n if (!src) {\n throw \"Undef src\";\n } else if (!dest) {\n throw \"Undef dest\";\n }\n\n if (srcOffset == 0 && count == src.length) {\n arrayCopy_fast(src, dest, destOffs...
[ "0.6943671", "0.6926844", "0.6918663", "0.6084323", "0.5985706", "0.5976774", "0.5652309", "0.5578392", "0.5578392", "0.5499082", "0.5368627", "0.5325039", "0.5305069", "0.5243087", "0.52005035", "0.5178007", "0.5163052", "0.51621675", "0.50760424", "0.50664777", "0.5053397",...
0.67485946
3
Creates and renders the Task Chart
create() { if (this.cellmonitor.view !== 'tasks') { throw new Error('SparkMonitor: Drawing tasks graph when view is not tasks'); } this.clearRefresher(); const container = this.cellmonitor.displayElement.find('.taskcontainer').empty()[0]; const tasktrace = { x: this.taskChartDataX, y: this.taskChartDataY, fill: 'tozeroy', type: 'scatter', mode: 'none', fillcolor: '#00aedb', name: 'Active Tasks', }; const executortrace = { x: this.executorDataX, y: this.executorDataY, fill: 'tozeroy', type: 'scatter', mode: 'none', fillcolor: '#F5C936', name: 'Executor Cores', }; const jobtrace = { x: this.jobDataX, y: this.jobDataY, text: this.jobDataText, type: 'scatter', mode: 'markers', fillcolor: '#F5C936', // name: 'Jobs', showlegend: false, marker: { symbol: 23, color: '#4CB5AE', size: 1, }, }; const data = [executortrace, tasktrace, jobtrace]; const layout = { // title: 'Active Tasks and Executors Cores', // showlegend: false, margin: { t: 30, // top margin l: 30, // left margin r: 30, // right margin b: 60, // bottom margin }, xaxis: { type: 'date', // title: 'Time', }, yaxis: { fixedrange: true, }, dragmode: 'pan', shapes: this.shapes, legend: { orientation: 'h', x: 0, y: 5, // traceorder: 'normal', font: { family: 'sans-serif', size: 12, color: '#000', }, // bgcolor: '#E2E2E2', // bordercolor: '#FFFFFF', // borderwidth: 2 }, }; this.taskChartDataBufferX = []; this.taskChartDataBufferY = []; this.executorDataBufferX = []; this.executorDataBufferY = []; this.jobDataBufferX = []; this.jobDataBufferY = []; this.jobDataBufferText = []; const options = { displaylogo: false, scrollZoom: true }; Plotly.newPlot(container, data, layout, options); this.taskChart = container; if (!this.cellmonitor.allcompleted) this.registerRefresher(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateChart(object) {\n // Capture task data in an object for easy retrieval:\n var taskData = new Object();\n taskData.xLabels = [];\n taskData.preLevel = [];\n taskData.postLevel = [];\n\n // Loop through the returned REST API object and populate object:\n for (var i = 0; i < object.length; i++...
[ "0.6817981", "0.6662202", "0.6630699", "0.65272075", "0.64862126", "0.624846", "0.6194933", "0.6166404", "0.6163558", "0.615988", "0.6149903", "0.6101587", "0.60888565", "0.60379153", "0.6008593", "0.5998947", "0.59807456", "0.59807456", "0.5971516", "0.5971319", "0.5955703",...
0.7537642
0
Registers a refresher to update the TaskChart.
registerRefresher() { this.clearRefresher(); this.taskinterval = setInterval(() => { this.refreshTaskChart(); }, 800); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@action.bound refreshChart() {\n this.newChart();\n }", "function refreshChart() {\n ctrlChart.isLoading = true;\n // Update with the actual data.\n\n // Refresh electricity data.\n Electricity.refresh(FilterFactory.get('activeElectricityHash'));\n // Redraw...
[ "0.6577296", "0.5763539", "0.5738956", "0.55238926", "0.55238926", "0.55052876", "0.5476098", "0.54275936", "0.54275936", "0.54275936", "0.54275936", "0.54275936", "0.54275936", "0.54275936", "0.54275936", "0.54275936", "0.54275936", "0.541637", "0.541637", "0.541637", "0.541...
0.8037925
0
Removes the TaskChart Refresher.
clearRefresher() { if (this.taskinterval) { clearInterval(this.taskinterval); this.taskinterval = null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeChart() {\n chart.destroy();\n }", "registerRefresher() {\n this.clearRefresher();\n this.taskinterval = setInterval(() => {\n this.refreshTaskChart();\n }, 800);\n }", "_destroyChart () {\n if (this.chart) {\n // TODO: remove events o...
[ "0.6907121", "0.64784753", "0.6354735", "0.63445723", "0.58928794", "0.5878664", "0.5799613", "0.57671416", "0.5760118", "0.5749632", "0.5739396", "0.573142", "0.5695605", "0.56889904", "0.56596625", "0.56160873", "0.56099874", "0.56058615", "0.55969024", "0.55946594", "0.558...
0.73217994
0
Called when all cell execution is completed and all jobs have completed.
onAllCompleted() { this.clearRefresher(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFinish(values) {\n job.current = getJob(values, job.current, writeMessage);\n setBusy(job.current.pendingTime);\n }", "_onComplete() {\n // Ensure worker queues for all paths are stopped at the end of the query\n this.stop();\n }", "function allDone() {\n pub.stop();\n ...
[ "0.6444477", "0.63232344", "0.6282233", "0.62659574", "0.6121789", "0.60781753", "0.6031305", "0.6014177", "0.59923667", "0.59923667", "0.59923667", "0.59923667", "0.5947562", "0.5925103", "0.5856467", "0.5783831", "0.5769498", "0.57582635", "0.57485646", "0.5747945", "0.5730...
0.64539725
0
Data Handling Functions Called when a Spark job starts.
onSparkJobStart(data) { this.addJobData(data.jobId, new Date(data.submissionTime), 'started'); this.addExecutorData(data.submissionTime, data.totalCores); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onSparkTaskStart(data) {\n this.addData(data.launchTime, this.numActiveTasks);\n this.numActiveTasks += 1;\n this.addData(data.launchTime, this.numActiveTasks);\n }", "preIngestData() {}", "function startApp() {\n //first calls, default dataset? \n }", "loadData() {\n\n }...
[ "0.6682271", "0.634833", "0.5602043", "0.5578953", "0.55323356", "0.5530881", "0.5526608", "0.5514517", "0.5514517", "0.55013907", "0.5458517", "0.54127014", "0.5411505", "0.54040676", "0.5393013", "0.5376476", "0.5364742", "0.5354428", "0.53214115", "0.5308976", "0.52749586"...
0.7563005
0
Called when a Spark job ends.
onSparkJobEnd(data) { this.addJobData(data.jobId, new Date(data.completionTime), 'ended'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onSparkTaskEnd(data) {\n this.addData(data.finishTime, this.numActiveTasks);\n this.numActiveTasks -= 1;\n this.addData(data.finishTime, this.numActiveTasks);\n }", "function end() {\n stopProgressInfo();\n cancelAllJobs();\n if (fromDate) {\n clock.uninstall();\n }\n if (!isEnded...
[ "0.66854334", "0.64587086", "0.60315955", "0.5923702", "0.5905105", "0.5833336", "0.5798342", "0.5795892", "0.577486", "0.57483506", "0.57294565", "0.5614498", "0.5584179", "0.557839", "0.55777717", "0.55251354", "0.54955137", "0.54932195", "0.5484814", "0.5482978", "0.547422...
0.77688205
0
Called when a Spark task is started.
onSparkTaskStart(data) { this.addData(data.launchTime, this.numActiveTasks); this.numActiveTasks += 1; this.addData(data.launchTime, this.numActiveTasks); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start() {\n this.taskFunction_.apply(null, Array.prototype.slice.call(arguments));\n this.onTaskDone();\n }", "onSparkJobStart(data) {\n this.addJobData(data.jobId, new Date(data.submissionTime), 'started');\n this.addExecutorData(data.submissionTime, data.totalCores);\n }", "start() {\...
[ "0.6616614", "0.66153246", "0.59093875", "0.5892997", "0.5872101", "0.58540756", "0.57423764", "0.561637", "0.561637", "0.561637", "0.5596873", "0.5596873", "0.5596873", "0.5589091", "0.5549775", "0.5527974", "0.54829204", "0.5478452", "0.5469953", "0.5469953", "0.5469953", ...
0.7180664
0
Called when a Spark task is ended.
onSparkTaskEnd(data) { this.addData(data.finishTime, this.numActiveTasks); this.numActiveTasks -= 1; this.addData(data.finishTime, this.numActiveTasks); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onSparkJobEnd(data) {\n this.addJobData(data.jobId, new Date(data.completionTime), 'ended');\n }", "function end() {\n stopProgressInfo();\n cancelAllJobs();\n if (fromDate) {\n clock.uninstall();\n }\n if (!isEnded) {\n isEnded = true;\n emitEnd();\n }\n}", "function end() {\n task...
[ "0.6952476", "0.6588027", "0.6549342", "0.6549342", "0.6549342", "0.6549342", "0.6171832", "0.61573046", "0.6145893", "0.61072534", "0.60762584", "0.6073113", "0.6072836", "0.6064975", "0.6041452", "0.6039907", "0.58820724", "0.5860562", "0.5854848", "0.5846717", "0.58235437"...
0.74958163
0
var Information = "" console.log(Information) } fn()
function fn1(x,y) { var a = x var b = y console.log(a + b) // console.log(b) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function info()\n{\n console.log('Normal Functions') ;\n}", "function Info(text){\r\n\tvar txt=\"\";\r\n\tfor( var i = 0; i < arguments.length; i++ ) txt+=arguments[i];\r\n\tconsole.log(txt);\r\n}", "static info(){\r\n\t\t\tconsole.log('A dog is a mammal');\r\n\t\t}", "function someFunction(param) { // f...
[ "0.6570786", "0.65148836", "0.649348", "0.645016", "0.6449499", "0.6415561", "0.63766986", "0.6336509", "0.63353133", "0.6320371", "0.63149875", "0.63149875", "0.63149875", "0.629983", "0.6297747", "0.6274274", "0.62443835", "0.62426233", "0.6231536", "0.6215583", "0.6197755"...
0.0
-1
Simple helper function, which return all filters from state by given key.
function getFilters(key, movies) { return movies.reduce((acc, movie) => { if (!acc.includes(movie[key])) { return [...acc, movie[key]]; } return acc; }, []); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getAll(filter) {\n\t\t// this flattens the hash into an array\n\t\tlet result = _.map(this._cache);\n\n\t\tif (typeof filter === 'object') {\n\t\t\tresult = _.where(result, filter);\n\t\t}\n\n\t\treturn result;\n\t}", "isFiltered(key) {\n const item = this._.get(key);\n return item ? item.filtered ...
[ "0.6328111", "0.5901546", "0.58349544", "0.58121383", "0.5690221", "0.5685676", "0.56763643", "0.56332403", "0.5598371", "0.55732536", "0.5545668", "0.55348384", "0.5534282", "0.55137384", "0.5483862", "0.54693913", "0.5461851", "0.54310584", "0.539737", "0.5390439", "0.53695...
0.58016527
4
Here, we are providing callbacks with dispatching functions.
onYearChange(year) { dispatch({ type: 'SET_YEAR', year, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_dispatch(msg) {\n var i = msg.post || 0, action = msg.action;\n this.callback = i;\n var callbacks = this.callbacks[i] || [];\n for (var j = 0, m = callbacks.length; j < m; j++) {\n if (callbacks[j].hasOwnProperty(action)) {\n callbacks[j][action].call(this,msg.data);\n break;\n ...
[ "0.69337356", "0.68187547", "0.6443289", "0.63594806", "0.63036895", "0.6225387", "0.61851853", "0.61549896", "0.6128388", "0.6116177", "0.6063215", "0.6063215", "0.6063215", "0.6063215", "0.6063215", "0.60455024", "0.6032874", "0.59899586", "0.5964031", "0.5958332", "0.59480...
0.0
-1
destruction de la session
function detruireSession() { /* il faut detruire la session : copier coller de php.net... / La session est deja initialisee / Detruit toutes les variables de session */ $_SESSION = array(); /* Si vous voulez detruire completement la session, effacez egalement / le cookie de session. / cela detruira la session et pas seulement les donnees de session !*/ if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } /* Finalement, on detruit la session. session_destroy(); / on termine par la redirection*/ header("Location: index.php"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sessionCleanup() {\n\n\t}", "function destroy() {\n devlog.channel('iscSessionStorageHelper').debug( 'iscSessionStorageHelper.destroy');\n $window.sessionStorage.removeItem('loginResponse');\n $window.sessionStorage.removeItem('sessionTimeoutCounter');\n $window.sessionStorage.remove...
[ "0.76232225", "0.7553529", "0.7224527", "0.7035157", "0.70255184", "0.7019585", "0.6997646", "0.68235904", "0.67810684", "0.675823", "0.67419165", "0.6737653", "0.672311", "0.67098373", "0.6701298", "0.6682128", "0.6676892", "0.6673964", "0.66620404", "0.66323125", "0.6617079...
0.0
-1
another way to write a component, call it function
function NoMatch(){ return( <div> No Match Found </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FunctionalComponent() {}", "function Component() { }", "getFromComponent(componentName, funcName, args=undefined){\n return this.#components.get(componentName)[funcName](args);\n }", "function SomeComponent() {}", "message(componentName, funcName, args){\n this.#components.get(componentName...
[ "0.737132", "0.7364122", "0.71303815", "0.70566297", "0.69755214", "0.6674257", "0.6328816", "0.6289747", "0.6275815", "0.6270926", "0.62676793", "0.62541646", "0.62524074", "0.6234294", "0.6202065", "0.6195937", "0.6191933", "0.618333", "0.61314565", "0.61071986", "0.6092048...
0.0
-1
TODO: inline implementation into single call site
function onCHANNEL_OPEN(self, info) { // The server is trying to open a channel with us, this is usually when // we asked the server to forward us connections on some port and now they // are asking us to accept/deny an incoming connection on their side let localChan = -1; let reason; const accept = () => { const chanInfo = { type: info.type, incoming: { id: localChan, window: MAX_WINDOW, packetSize: PACKET_SIZE, state: 'open' }, outgoing: { id: info.sender, window: info.window, packetSize: info.packetSize, state: 'open' } }; const stream = new Channel(self, chanInfo); self._chanMgr.update(localChan, stream); self._protocol.channelOpenConfirm(info.sender, localChan, MAX_WINDOW, PACKET_SIZE); return stream; }; const reject = () => { if (reason === undefined) { if (localChan === -1) reason = CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE; else reason = CHANNEL_OPEN_FAILURE.CONNECT_FAILED; } if (localChan !== -1) self._chanMgr.remove(localChan); self._protocol.channelOpenFail(info.sender, reason, ''); }; const reserveChannel = () => { localChan = self._chanMgr.add(); if (localChan === -1) { reason = CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE; if (self.config.debug) { self.config.debug( 'Client: Automatic rejection of incoming channel open: ' + 'no channels available' ); } } return (localChan !== -1); }; const data = info.data; switch (info.type) { case 'forwarded-tcpip': { const val = self._forwarding[`${data.destIP}:${data.destPort}`]; if (val !== undefined && reserveChannel()) { if (data.destPort === 0) data.destPort = val; self.emit('tcp connection', data, accept, reject); return; } break; } case 'forwarded-streamlocal@openssh.com': if (self._forwardingUnix[data.socketPath] !== undefined && reserveChannel()) { self.emit('unix connection', data, accept, reject); return; } break; case 'auth-agent@openssh.com': if (self._agentFwdEnabled && typeof self._agent.getStream === 'function' && reserveChannel()) { self._agent.getStream((err, stream) => { if (err) return reject(); const upstream = accept(); upstream.pipe(stream).pipe(upstream); }); return; } break; case 'x11': if (self._acceptX11 !== 0 && reserveChannel()) { self.emit('x11', data, accept, reject); return; } break; default: // Automatically reject any unsupported channel open requests reason = CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE; if (self.config.debug) { self.config.debug( 'Client: Automatic rejection of unsupported incoming channel open ' + `type: ${info.type}` ); } } if (reason === undefined) { reason = CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED; if (self.config.debug) { self.config.debug( 'Client: Automatic rejection of unexpected incoming channel open for: ' + info.type ); } } reject(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient private protected internal function m182() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "transient private internal fun...
[ "0.6862103", "0.65810156", "0.64286816", "0.6407269", "0.6366164", "0.6211606", "0.6190751", "0.61487025", "0.60363835", "0.60345316", "0.59641826", "0.58858234", "0.58616424", "0.58480537", "0.5800668", "0.5785152", "0.5777472", "0.5710852", "0.57090497", "0.56764054", "0.56...
0.0
-1
This function starts a new game with the users chosen settings (Timer, Difficulty and Theme)
function startNewGame() { // Select game board difficulty let grid; if (id("easy-diff").checked) { grid = easy[0]; } else if (id("medium-diff").checked) { grid = medium[0]; } else if (id("hard-diff").checked) { grid = hard[0]; } else if (id("hardcore-diff").checked) { grid = hardcore[0]; } // Set number of lives to five and enable selection of squares and numbers lives = 5; noSelect = false; id("lives").textContent = "Remaining Lives: 5"; // Create game board based on difficulty createGrid(grid); // Start the timer startTimer(); // Assigns theme based on select if (id("theme-1").checked){ // Remove unwanted themes from list and adds light theme // Body qs("body").classList.remove("dark"); qs("body").classList.remove("coffee"); qs("body").classList.remove("unicorn"); qs("body").classList.add("light"); // Header qs("header").classList.remove("dark"); qs("header").classList.remove("coffee"); qs("header").classList.remove("unicorn"); qs("header").classList.add("light"); // Footer qs("footer").classList.remove("dark"); qs("footer").classList.remove("coffee"); qs("footer").classList.remove("unicorn"); qs("footer").classList.add("light"); } else if (id("theme-2").checked) { // Remove unwanted themes from list and adds dark theme // Body qs("body").classList.remove("light"); qs("body").classList.remove("coffee"); qs("body").classList.remove("unicorn"); qs("body").classList.add("dark"); // Header qs("header").classList.remove("light"); qs("header").classList.remove("coffee"); qs("header").classList.remove("unicorn"); qs("header").classList.add("dark"); // Footer qs("footer").classList.remove("light"); qs("footer").classList.remove("coffee"); qs("footer").classList.remove("unicorn"); qs("footer").classList.add("dark"); } else if (id("theme-3").checked) { // Remove unwanted themes from list and adds coffee theme // Body qs("body").classList.remove("light"); qs("body").classList.remove("dark"); qs("body").classList.remove("unicorn"); qs("body").classList.add("coffee"); // Header qs("header").classList.remove("light"); qs("header").classList.remove("dark"); qs("header").classList.remove("unicorn"); qs("header").classList.add("coffee"); // Footer qs("footer").classList.remove("light"); qs("footer").classList.remove("dark"); qs("footer").classList.remove("unicorn"); qs("footer").classList.add("coffee"); } else if (id("theme-4").checked) { // Remove unwanted themes from list and adds unicorn theme // Body qs("body").classList.remove("light"); qs("body").classList.remove("dark"); qs("body").classList.remove("coffee"); qs("body").classList.add("unicorn"); // Header qs("header").classList.remove("light"); qs("header").classList.remove("dark"); qs("header").classList.remove("coffee"); qs("header").classList.add("unicorn"); // Footer qs("footer").classList.remove("light"); qs("footer").classList.remove("dark"); qs("footer").classList.remove("coffee"); qs("footer").classList.add("unicorn"); } // Show the number selector id("number-selector").classList.remove("hidden"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startNewGame() {\n // Possible speeds\n var speeds = {\n 0: 60,\n 200: 77,\n 500: 120,\n 800: 300\n };\n\n // Getting speed based on difficulty\n var speed = difficulty.options[difficulty.selectedIndex].value;\n\n var mo...
[ "0.73494184", "0.72415197", "0.7241255", "0.7128199", "0.70512295", "0.70036256", "0.69970423", "0.6982174", "0.6955063", "0.68771404", "0.68770766", "0.6812864", "0.6778389", "0.6776338", "0.677211", "0.6748761", "0.67425144", "0.6733717", "0.67281985", "0.6726751", "0.66904...
0.6845081
11
This function starts the game timer with the selected time duration
function startTimer() { // Set time remaining based on selection if (id("time-3").checked) { timeLeft = 180; } else if (id("time-5").checked) { timeLeft = 300; } else { timeLeft = 600; } // Set the timer for first second id("timer").textContent = timeConvert(timeLeft); // Timer to update every second timer = setInterval(function() { timeLeft --; // If time runs out, end the game if (timeLeft === 0) { gameOver(); } id("timer").textContent = timeConvert(timeLeft); }, 1000); // function runs every 1000 ms }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startTimer(duration, display) {\n let timer = duration,\n minutes,\n seconds\n\n let updateTimer = () => {\n minutes = parseInt(timer / 60, 10)\n seconds = parseInt(timer % 60, 10)\n\n minutes = minutes < 10 ? '0' + minutes : minutes\n seconds = seconds < 10 ? '0' + seconds : seconds\n...
[ "0.76168585", "0.75543934", "0.73781145", "0.73288554", "0.72690344", "0.7131463", "0.71276635", "0.7034538", "0.7034284", "0.7030517", "0.69974965", "0.69954294", "0.6990467", "0.6970833", "0.6970506", "0.6967031", "0.6959388", "0.6955698", "0.69466543", "0.6930948", "0.6916...
0.70791966
7
This function converts the time to a format of mm:ss as a string
function timeConvert(time) { // Define minutes as 60 seconds or less let minutes = Math.floor(time / 60); // Display "0" infront of number of minutes if minutes is less than 10 if (minutes < 10) { minutes = "0" + minutes; } // Define seconds as remainder of 60 seconds let seconds = time % 60; // Display "0" infront of number of seconds if seconds is less than 10 if (seconds < 10) { seconds = "0" + seconds; } return minutes + ":" + seconds; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toMMSSFormat(time){\n var sec, min;\n\n sec = parseInt((time % 60), 10);\n sec = formatTime(sec);\n\n min = parseInt((time / 60), 10);\n min = formatTime(min);\n\n return min +\":\"+ sec;\n }", "function timeToString(time) {\n l...
[ "0.7927201", "0.79084516", "0.7874276", "0.7854004", "0.7851414", "0.78483313", "0.7812436", "0.7809364", "0.78092253", "0.78032494", "0.78020144", "0.7799904", "0.7793222", "0.7761326", "0.7726641", "0.7699753", "0.76643515", "0.766226", "0.7640788", "0.7626631", "0.761478",...
0.7876833
2
This function creates the game board for the game
function createGrid(grid) { // The game board and all variables are cleared clearPrevGrid(); // Increment the ids of the squares as they are created let idNumber = 0; // This creates 81 squares to fill the 9x9 grid of the game board for (let i = 0; i < 81; i++) { // This creates a new paragraph element let square = document.createElement("p"); // Checks the pre-defined game boards based on difficulty, to see if the squares should have numbers or be empty if (grid.charAt(i) != "-") { // Assign the correct number to the squares square.textContent = grid.charAt(i); } else { // Add event listener to each blank square square.addEventListener("click", function() { // If noSelect is not disabled if (!noSelect) { // If the square is already selected if (square.classList.contains("selected")) { // Deselect the square selected square.classList.remove("selected"); selectedSquare = null; } else { // Deselect all other squares selected for (let i = 0; i < 81; i++) { qsa(".square")[i].classList.remove("selected"); } // Select square and update selectedSquare variable square.classList.add("selected"); selectedSquare = square; updateSquare(); } } }); } // Assign an id to each square square.id = idNumber; // Increment the id for each square made idNumber ++; // // Add "square" class to each square created square.classList.add("square"); // Adding in a thicker bottom border on these lines to define the game board sections if ((square.id > 17 && square.id < 27) || (square.id > 44 && square.id < 54)) { square.classList.add("bottomBorder"); } // Adding in a thicker border on these right of these lines to define the game board sections (Selects the 3rd and 6th square in each row) if ((square.id + 1) % 9 == 3 || (square.id + 1) % 9 == 6) { square.classList.add("rightBorder"); } // Add square to the game board id("grid").appendChild(square); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create_game_board(){\n update_number_of_players();\n create_player_areas();\n // create new game\n game_instance.deal_cards();\n \n render_cards();\n apply_card_event_handlers();\n \n game_instance.determine_winners();\n // determine_wi...
[ "0.8567491", "0.82497925", "0.81799", "0.8129172", "0.8061828", "0.8031286", "0.8020527", "0.79634976", "0.7946054", "0.7884545", "0.7865835", "0.78648", "0.7855752", "0.7853354", "0.78226095", "0.7761402", "0.7740199", "0.77289814", "0.769943", "0.7694575", "0.7680842", "0...
0.71622854
94
This function assigns the chosen number to a square if correct, or removes a life if incorrect
function updateSquare() { // If a square and a number are both selected if (selectedSquare && selectedNumber) { // Assign the chosen number to the chosen square selectedSquare.textContent = selectedNumber.textContent; // If the number matches the number in the solution key if (checkIfCorrect(selectedSquare)){ // Deselect the selected square and number selector selectedSquare.classList.remove("selected"); selectedNumber.classList.remove("selected"); // Clear any selected variables selectedNumber = null; selectedSquare = null; // Check if the game board is completed if (checkGridComplete()) { gameOver(); } } else { // Check if the number does not match the solution key // Disallow selecting new numbers for half a second noSelect = true; // Turn the selected square dark with red text selectedSquare.classList.add("incorrect"); // Run after half a second setTimeout(function() { // Take 1 from lives lives --; // If user runs out of lives if (lives === 0) { gameOver(); } else { // If there are lives remaining // Update the remaining lives section with current lives id("lives").textContent = "Remaining Lives: " + lives; // Allow number and square selection noSelect = false; } // Restore square and number color and remove selected from both selectedSquare.classList.remove("incorrect"); selectedSquare.classList.remove("selected"); selectedNumber.classList.remove("selected"); // Clear the text in tiles and selected variables selectedSquare.textContent = ""; selectedSquare = null; selectedNumber = null; }, 500); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickSquare() {\n if (gameover || this.innerHTML !== '') return; \n this.innerHTML = selectTurn.value;\n if (selectTurn.value == 'X') {\n selectTurn.value = 'O';\n } else {\n selectTurn.value = 'X';\n }\n checkWin();\n }", "function randomSquare() {\n // clearing all squa...
[ "0.631566", "0.6223127", "0.61635333", "0.6143616", "0.61346024", "0.6128305", "0.61196375", "0.61172324", "0.6089684", "0.60799617", "0.6076921", "0.6067633", "0.60582596", "0.6035072", "0.60323584", "0.60217863", "0.6019556", "0.59916544", "0.59799534", "0.597427", "0.59654...
0.6794935
0
This function checks if every square of the game board is filled, meaning the user has won
function checkGridComplete() { // Make an array of all squares in the grid to look through let squares = qsa(".square"); // Make an empty array to store empty squares in let emptySquares = []; for (let i = 0; i < squares.length; i++) { // Define a variable to show the content of the squares within the squares array let squareContent = squares[i].textContent; // If the sqaure's content is an empty string if (squareContent === "") { // All empty squares are pushed onto the emptySquares array emptySquares.push(squareContent); } } // If the array is empty, the game is won. Else the game continues if (emptySquares.length === 0) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkdraw() {\n //recall board is 7x6\n for (var row = 0; row < 6; row++) {\n for (var col = 0; col < 7; col++) {\n if (board[row][col] == 0) {\n return false;\n }\n }\n }\n //else board is filled and game is draw\n return true;\n}", "che...
[ "0.82348824", "0.82010305", "0.8076892", "0.8006752", "0.7894706", "0.78840613", "0.7828072", "0.781161", "0.7785721", "0.7764963", "0.77531546", "0.7707633", "0.7705774", "0.7705438", "0.7696609", "0.76917857", "0.768961", "0.7666565", "0.76551497", "0.7652551", "0.76495224"...
0.8009917
3
Check if a number/square pair is correct when compared to the solution
function checkIfCorrect(square) { // Assign the solution based on the difficulty setting chosen let solution; if (id("easy-diff").checked) { solution = easy[1]; } else if (id("medium-diff").checked) { solution = medium[1]; } else if (id("hard-diff").checked) { solution = hard[1]; } else { solution = hardcore[1]; } // If square's number matches the solution number if (solution.charAt(square.id) === square.textContent) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isSquare(number) {\n for(var i = 0; i < number; i++) {\n if( number / i === i) { //alt i * i === number. Return true;\n return true;\n }\n }\n return false; //return false after loop.\n //if inside loop, may return false WAY too early. Checking 2 * 2,\n //if its not case return false BEFOR...
[ "0.7403783", "0.69677645", "0.6871938", "0.6852753", "0.68112", "0.67071897", "0.66064626", "0.6602473", "0.65732485", "0.65462554", "0.6521942", "0.6474136", "0.6396237", "0.638038", "0.6363018", "0.63210046", "0.6293471", "0.62910724", "0.62816775", "0.6280572", "0.6278807"...
0.7262081
1
This function clears the previously played game board
function clearPrevGrid(){ // Select all the squares let squares = qsa(".square"); // Remove the contents of all squares for (let i = 0; i < squares.length; i++) { squares[i].remove(); } // Clear any remaining time on timer if (timer) { clearTimeout(timer); } // Deselect any numbers still selected for (let i = 0; i < id("number-selector").children.length; i++) { id("number-selector").children[i].classList.remove("selected"); } // Clear all selected variables selectedNumber = null; selectedSquare = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearBoard(){\n sendChatMessage(\"Clearing game board...\");\n lives = 1;\n current = 0;\n modifiers = [];\n board = [];\n sendChatMessage(\"Everything cleared! Ready for new game... Please rechoose tags.\");\n}", "function clearBoard() {\n board.clear();\n pause();\n}", "funct...
[ "0.8653472", "0.85424453", "0.82889265", "0.82236856", "0.8210962", "0.81993014", "0.81949574", "0.817742", "0.8169628", "0.81675285", "0.81483865", "0.8135175", "0.81025004", "0.80984175", "0.8025854", "0.8010913", "0.79907864", "0.79464453", "0.7941973", "0.79218495", "0.79...
0.0
-1
This function ends the game
function gameOver() { // Disables any further moves and stops the timer noSelect = true; clearTimeout(timer); // Display a win or loss message if (lives === 0 || timeLeft === 0) { id("lives").textContent = "Uh oh! You lost! Want to try again?"; } else { id("lives").textContent = "Woohoo! You won! Want to try again?"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function end() {\n game.end();\n console.log('End!!, thank you for playing');\n }", "function endGame() {\n \n}", "function handleEndGame() {\n\n}", "function endGame() {\r\n\t\tgameOver = true;\r\n\t\tsetMessage2(\"Game Over\");\r\n\t}", "function endgame() {\n \tclearInterval(intervalId);\n ...
[ "0.8695062", "0.8652793", "0.842223", "0.84094644", "0.82225084", "0.82072544", "0.81989086", "0.81869495", "0.8170868", "0.8165294", "0.81194997", "0.8096833", "0.80869603", "0.80722296", "0.8029245", "0.8025281", "0.80249494", "0.8019394", "0.80151635", "0.7997619", "0.7972...
0.0
-1