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
Update mouse position and play a sound
function mousePressed() { // Store mouse position when pressed mouse = [mouseX, mouseY]; // Hirajoshi scale in C // https://www.pianoscales.org/hirajoshi.html const notes = ["C", "Db", "F", "Gb", "Bb"]; const octaves = [2, 3, 4]; const octave = random(octaves); const note = random(notes); synth.triggerAttackRelease(note + octave, "8n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mousePressed() {\n screamSound.play();\n}", "playSound() {\n let d = dist(width / 2, height / 2, mouseX, mouseY);\n if (d < defaultSoloSize) {\n (this.sound).play();\n } else {\n (this.sound).stop(); // stop the sound if the user hovers away from the planet\n }\n }", "function ...
[ "0.7222558", "0.7173278", "0.70272183", "0.6942484", "0.6900766", "0.6871986", "0.6851138", "0.6815783", "0.67965746", "0.67890954", "0.67423", "0.67423", "0.6655546", "0.6620155", "0.6600297", "0.6587625", "0.6529811", "0.6520023", "0.64978886", "0.647848", "0.6453655", "0...
0.60563874
57
Draw a basic polygon, handles triangles, squares, pentagons, etc
function polygon(x, y, radius, sides = 3, angle = 0) { beginShape(); for (let i = 0; i < sides; i++) { const a = angle + TWO_PI * (i / sides); let sx = x + cos(a) * radius; let sy = y + sin(a) * radius; vertex(sx, sy); } endShape(CLOSE); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawPolygon() {\n clearGeometry();\n drawingTools.setShape('polygon');\n drawingTools.draw();\n}", "function Render_polygon(ctx, x1, y1, x2, y2, x3, y3, x4, y4, color) {\n ctx.fillStyle = color;\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.lineTo(x3, y3);\n c...
[ "0.80510575", "0.7665781", "0.7639658", "0.75640893", "0.7378882", "0.7263126", "0.7262371", "0.7224503", "0.71760076", "0.7068137", "0.69390583", "0.68976253", "0.68759745", "0.6777351", "0.6777085", "0.6768707", "0.67679286", "0.675576", "0.6754173", "0.6753531", "0.6744336...
0.66326207
26
Get items from source
getItems() { this.axios.get(this.sourceUrl).then((response) => { // Load HTML if (response.status === 200) { const html = response.data, $ = this.cheerio.load(html); let items = []; let counter = 0; // Search HTML and collect values $('.headlines_content ul').first().find('li').each((i, element) => { // Create item object items[i] = { id: '', title: $(element).children('a').text().trim(), url: $(element).children('a').attr('href').trim(), date: '', author: '', image: { url: '', alt: '' }, content: '' } // Get single item content this.getItemContent(items[i].url).then((response) => { items[i].id = Date.now(); items[i].date = response.date; items[i].image = { url: response.image.url, alt: response.image.alt }; items[i].content = response.content; // Increment counter counter++; console.log(this.chalk.yellow(`Scraping item ${counter}`)); // Save to JSON file when counter is equal to items array if (counter == items.length) { console.log('\n'); // Save items to JSON file this.saveJson(items); } }); }); } }, (error) => this.errorHandler(error)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSources() {\n return query(\n `SELECT id, name\n FROM source\n WHERE deleted_at IS NULL\n ORDER BY name;`\n );\n}", "get sources() {\n const sources = []\n for (let i = 0; i < this._sections.length; i++) {\n for (let j = 0; j < this._sections[i].consumer.sources.length; j++) ...
[ "0.6102924", "0.6084613", "0.60445184", "0.5909613", "0.5880532", "0.584124", "0.5810234", "0.57554483", "0.57515776", "0.5740675", "0.56999546", "0.56923884", "0.56791073", "0.56773186", "0.5670293", "0.56588316", "0.56317973", "0.562852", "0.5619583", "0.55745125", "0.55726...
0.0
-1
Creates a Constructor for an Immutable object from a schema.
function Immutable (originalSchema) { var schema = {}, blueprint, prop, propCtor; if (!originalSchema) { return new InvalidArgumentException(new Error('A schema object, and values are required')); } // Convert any objects that aren't validatable by Blueprint into Immutables for (prop in originalSchema) { if (!originalSchema.hasOwnProperty(prop)) { continue; } else if (prop === '__skipValidation') { continue; } else if (prop === '__skipValdation') { schema.__skipValidation = originalSchema.skipValdation; } if ( is.object(originalSchema[prop]) && !Blueprint.isValidatableProperty(originalSchema[prop]) && !originalSchema[prop].__immutableCtor ) { schema[prop] = new Immutable(originalSchema[prop]); } else { schema[prop] = originalSchema[prop]; } if (schema[prop].__immutableCtor) { // Add access to the Immutable on the Parent Immutable propCtor = prop.substring(0,1).toUpperCase() + prop.substring(1); Constructor[propCtor] = schema[prop]; } } // This is the blueprint that the Immutable will be validated against blueprint = new Blueprint(schema); /* // The Constructor is returned by this Immutable function. Callers can // then use it to create new instances of objects that they expect to // meet the schema, set forth by this Immutable. */ function Constructor (values) { var propName, // we return self - it will provide access to the getters and setters self = {}; values = values || {}; if ( // you can override initial validation by setting // `schema.__skipValidation: true` originalSchema.__skipValidation !== true && !Blueprint.validate(blueprint, values).result ) { var err = new InvalidArgumentException( new Error(locale.errors.initialValidationFailed), Blueprint.validate(blueprint, values).errors ); config.onError(err); return err; } try { // Enumerate the schema, and create immutable properties for (propName in schema) { if (!schema.hasOwnProperty(propName)) { continue; } else if (propName === '__blueprintId') { continue; } if (is.nullOrUndefined(values[propName])) { makeReadOnlyNullProperty(self, propName); continue; } makeImmutableProperty(self, schema, values, propName); } Object.freeze(self); } catch (e) { return new InvalidArgumentException(e); } return self; } // /Constructor /* // Makes a new Immutable from an existing Immutable, replacing // values with the properties in the mergeVals argument // @param from: The Immutable to copy // @param mergeVals: The new values to overwrite as we copy */ setReadOnlyProp(Constructor, 'merge', function (from, mergeVals, callback) { if (typeof callback === 'function') { async.runAsync(function () { merge(Constructor, from, mergeVals, callback); }); } else { var output; merge(Constructor, from, mergeVals, function (err, merged) { output = err || merged; }); return output; } }); /* // Copies the values of an Immutable to a plain JS Object // @param from: The Immutable to copy */ setReadOnlyProp(Constructor, 'toObject', function (from, callback) { return objectHelper.cloneObject(from, true, callback); }); /* // Validates an instance of an Immutable against it's schema // @param instance: The instance that is being validated */ setReadOnlyProp(Constructor, 'validate', function (instance, callback) { return Blueprint.validate(blueprint, instance, callback); }); /* // Validates an instance of an Immutable against it's schema // @param instance: The instance that is being validated */ setReadOnlyProp(Constructor, 'validateProperty', function (instance, propertyName, callback) { if (!instance && is.function(callback)) { callback([locale.errors.validatePropertyInvalidArgs], false); } else if (!instance) { return { errors: [locale.errors.validatePropertyInvalidArgs], result: false }; } return Blueprint.validateProperty(blueprint, propertyName, instance[propertyName], callback); }); /* // Prints an immutable to the console, in a more readable way // @param instance: The Immutable to print */ setReadOnlyProp(Constructor, 'log', function (instance) { if (!instance) { console.log(null); } else { console.log(Constructor.toObject(instance)); } }); /* // Returns a copy of the original schema */ setReadOnlyProp(Constructor, 'getSchema', function (callback) { return objectHelper.cloneObject(originalSchema, true, callback); }); /* // Returns a this Immutable's blueprint */ setReadOnlyProp(Constructor, 'blueprint', blueprint); setReadOnlyProp(Constructor, '__immutableCtor', true); return Constructor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Constructor (values) {\n var propName,\n // we return self - it will provide access to the getters and setters\n self = {};\n\n values = values || {};\n\n if (\n // you can override initial validation by ...
[ "0.64946556", "0.6098677", "0.6028341", "0.6028341", "0.5984513", "0.5890175", "0.5673409", "0.5543228", "0.5372351", "0.5367328", "0.5352167", "0.5319163", "0.52733094", "0.5245628", "0.5244429", "0.52235764", "0.52235764", "0.519638", "0.5193204", "0.51500684", "0.51453054"...
0.67670506
0
The Constructor is returned by this Immutable function. Callers can then use it to create new instances of objects that they expect to meet the schema, set forth by this Immutable.
function Constructor (values) { var propName, // we return self - it will provide access to the getters and setters self = {}; values = values || {}; if ( // you can override initial validation by setting // `schema.__skipValidation: true` originalSchema.__skipValidation !== true && !Blueprint.validate(blueprint, values).result ) { var err = new InvalidArgumentException( new Error(locale.errors.initialValidationFailed), Blueprint.validate(blueprint, values).errors ); config.onError(err); return err; } try { // Enumerate the schema, and create immutable properties for (propName in schema) { if (!schema.hasOwnProperty(propName)) { continue; } else if (propName === '__blueprintId') { continue; } if (is.nullOrUndefined(values[propName])) { makeReadOnlyNullProperty(self, propName); continue; } makeImmutableProperty(self, schema, values, propName); } Object.freeze(self); } catch (e) { return new InvalidArgumentException(e); } return self; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Immutable (originalSchema) {\n var schema = {}, blueprint, prop, propCtor;\n\n if (!originalSchema) {\n return new InvalidArgumentException(new Error('A schema object, and values are required'));\n }\n\n // Convert any objects that aren't validata...
[ "0.6791926", "0.6657413", "0.6598576", "0.63822585", "0.6093695", "0.60557866", "0.5974791", "0.5974791", "0.5974791", "0.5880356", "0.5854953", "0.58489996", "0.57926", "0.5789543", "0.57499486", "0.5741624", "0.5736388", "0.5665391", "0.5631423", "0.56235254", "0.56166756",...
0.67129695
1
Immutable / Creates a copy of the value, and creates a readonly property on `self`
function makeImmutableProperty (self, schema, values, propName) { var Model, dateCopy; if (schema[propName].__immutableCtor && is.function(schema[propName])) { // this is a nested immutable Model = schema[propName]; self[propName] = new Model(values[propName]); } else if (isDate(values[propName])) { dateCopy = new Date(values[propName]); Object.defineProperty(self, propName, { get: function () { return new Date(dateCopy); }, enumerable: true, configurable: false }); Object.freeze(self[propName]); } else { objectHelper.setReadOnlyProperty( self, propName, // TODO: is it really necessary to clone the value if it isn't an object? objectHelper.copyValue(values[propName]), // typeof values[propName] === 'object' ? objectHelper.copyValue(values[propName]) : values[propName], makeSetHandler(propName) ); if (Array.isArray(values[propName])) { Object.freeze(self[propName]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "copyable(newValue = true) {\n this.value.copyable = newValue;\n return this;\n }", "set(value) {\n if (value === this._value) {\n return this;\n }\n\n return new ImmutableAccessor(value, this.path);\n }", "get shallowCopy() {\n return this.shallowCopy$();\n }", "copy...
[ "0.670268", "0.64647347", "0.619443", "0.61899436", "0.6068771", "0.60651004", "0.60070676", "0.5987902", "0.5985432", "0.5942874", "0.5942874", "0.5942874", "0.5942874", "0.5942874", "0.5887968", "0.58343893", "0.57599264", "0.5753789", "0.57491195", "0.57491195", "0.5740890...
0.6560574
1
makeImmutableProperty / make a readonly property that returns null
function makeReadOnlyNullProperty (self, propName) { objectHelper.setReadOnlyProperty(self, propName, null, makeSetHandler(propName)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function internalProperty(options) {\n return property({ attribute: false, hasChanged: options === null || options === void 0 ? void 0 : options.hasChanged });\n}", "function internalProperty(options){return property({attribute:false,hasChanged:options===null||options===void 0?void 0:options.hasChanged});}", ...
[ "0.6054209", "0.59780294", "0.5920431", "0.5707005", "0.5707005", "0.5630741", "0.562664", "0.5625052", "0.5625052", "0.56013256", "0.55963504", "0.5557508", "0.55510676", "0.55313903", "0.5501012", "0.5501012", "0.5501012", "0.5501012", "0.5448218", "0.5448218", "0.5448218",...
0.6763025
0
makeReadOnlyNullProperty / make a set handler that returns an exception
function makeSetHandler (propName) { return function () { var err = new Exception(locale.errorTypes.readOnlyViolation, new Error('Cannot set `' + propName + '`. This object is immutable')); config.onError(err); return err; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeReadOnlyNullProperty (self, propName) {\n objectHelper.setReadOnlyProperty(self, propName, null, makeSetHandler(propName));\n }", "function setter() {\n\t throw new Error('vuex getter properties are read-only.');\n\t }", "set booking(stuff){\n throw \"sorry you can...
[ "0.66587955", "0.6356464", "0.6235886", "0.6208156", "0.5865558", "0.58342254", "0.57981133", "0.57048345", "0.56855756", "0.5644346", "0.5636067", "0.56044286", "0.548204", "0.548204", "0.548204", "0.548204", "0.5450891", "0.5335113", "0.5334958", "0.5333292", "0.53252125", ...
0.7683469
0
Constructor for variables and functions / the delete function
constructor() { super(); this.DeleteFighter = this.DeleteFighter.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { \n // alias\n this.remove = this.delete;\n }", "delete() {}", "delete() {\n\n }", "constructur() {}", "deleteTattoo () {\n\n }", "constructor() {\n // this storage will be an empty obj\n this.storage = {};\n // this position will be 0\n this.position = 0;\n // t...
[ "0.64373237", "0.63899314", "0.63532823", "0.62995636", "0.624344", "0.61420774", "0.6078818", "0.60131097", "0.5940566", "0.5923135", "0.5922725", "0.5916731", "0.591326", "0.5881079", "0.5874083", "0.5867198", "0.58543986", "0.5842719", "0.584033", "0.5833293", "0.5826478",...
0.0
-1
globals __VUE_SSR_CONTEXT__ IMPORTANT: Do NOT use ES2015 features in this file (except for modules). This module is a runtime utility for cleaner component module output and will be included in the final webpack user bundle.
function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "extend(config, ctx) {\n // if (process.server && process.browser) {\n if (...
[ "0.5847333", "0.57279235", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897", "0.57266897",...
0.0
-1
Do the stuff to be called after D3.js has loaded
function dotheviz() { //--------------------------------- //------------------ select items to analyze / graph type //--------------------------------- function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } thehtml = '<select id="selectITEM" style="width:170px;" >' fields.filter(function(f){return (f!='S2' || database=='scopus') ; }).forEach(function(f){thehtml+='<option value="'+f+'" '+(field_option==f?'selected':'')+'>'+capitalizeFirstLetter(items[f])+'</option>'}) thehtml += '</select>' d3.select('#itemselection').html(thehtml) d3.select('#selectITEM').on('change',function(){update();}) thehtml = '<select id="selectGRAPH" style="width:170px;" >' thehtml += '<option value="custom" '+(graph_option=='custom'?'selected':'')+'>Custom</option>' thehtml += '<option value="science" '+(graph_option=='science'?'selected':'')+'>Distributions</option>' thehtml += '</select>' d3.select('#graphselection').html(thehtml) d3.select('#selectGRAPH').on('change',function(){update();}) foo='<select id="selectSORTtab" style="width:170px;" >' foo+='<option value="NB" selected>Record count</option>' foo+='<option value="ITEM">Item</option>' foo+='</select>' d3.select('#sortTAB').html(foo) //... d3.select('#NUMPUB').html(Npapers) prep_infobulle("#info_fs", "Items from that field will be listed on the left panel in numeric order, based on the number of documents in which they appear.") prep_infobulle("#info_gt", "Choose between different options:<br/><ul><li>The \"Custom\" option will display the information in the left panel in a custom representation (either a co-occurrence network, a pie chart, a word cloud or a map)</li><li>The \"Distributions\" option will produce a histogram of the number of items per publication and a cumulative distribution graph displaying the number of items appearing in at least <i>x</i> documents, for varying <i>x</i>. This last graph use logarithmic scales on both axes, which is useful to recognize power law relationships, appearing as straight lines.</li></ul>") prep_infobulle("#info_sl", "We only display items appearing more than <i>x</i> times, the threshold <i>x</i> being chosen so that the length of the list is less than 10000.") update(); } // end of D3ok()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\n svg = d3\n .select(\"#d3-container-1\")\n .append(\"svg\")\n\n draw(); // calls the draw function\n }", "function documentReady(){\n $.ajax({\n type: 'GET',\n url: '/initialdload',\n dataType: 'json'\n })\n .done(function(data){\n data[0...
[ "0.705255", "0.6885922", "0.68565935", "0.66266733", "0.66253453", "0.6545289", "0.6535469", "0.6512057", "0.65115803", "0.6481609", "0.64461374", "0.6429353", "0.63752764", "0.6360469", "0.6350081", "0.63429004", "0.6341875", "0.6337636", "0.63354945", "0.63226116", "0.63221...
0.0
-1
select items to analyze / graph type
function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSelectType(type){\n\t/*\n\t * if selected type is structure or land and selected group by option is property\n\t * we must reset group by option to ctry\n\t */\n\tif (type == \"structure\" || type == \"land\") {\n\t\tvar groupBy = $(\"group_by\").value;\n\t\tif (groupBy == \"property\") {\n\t\t\t$(\"gro...
[ "0.5915644", "0.56025255", "0.5541621", "0.5471803", "0.54138464", "0.53355885", "0.529513", "0.5268753", "0.5267664", "0.5261855", "0.5250799", "0.5216662", "0.518014", "0.5168487", "0.5147239", "0.514352", "0.5113984", "0.5091728", "0.5090887", "0.50452125", "0.50400203", ...
0.0
-1
Do the "real" stuff once the selection has been made
function update() { //--------------------------------- //------------------ select options //--------------------------------- field_option=document.getElementById("selectITEM").value; graph_option=document.getElementById("selectGRAPH").value; filename=file[field_option]; //--------------------------------- //------------------ deal with list //--------------------------------- function prepList(stuff){ d3.select("#noneAV").style("opacity", 0) // prep table with data mytable = '<table style="width:99%;table-layout:fixed;margin-left:1%;font-size:'+(field_option.indexOf('R')>-1?'0.75':'0.95')+'em;">' //mytable+="<colgroup><col ><col style='width:33%;'><col style='width: 20%;'><col style='width: 20%;'></colgroup>" mytable+='<tr><th align="left" style="width:7%;" >Rank</th><th align="left" style="width:63%;">Item='+items[field_option]+'</th><th align="right" style="width:15%;">Record count</th><th align="right" style="width:15%;">% of '+Npapers+'</th></tr>' sortby=document.getElementById("selectSORTtab").value; if(sortby=="ITEM"){stuff.sort(function(a, b){ return (b[1].toLowerCase() > a[1].toLowerCase()) ? -1:1 ; })} if(sortby=="NB"){stuff.sort(function(a, b){ if(a[2]==b[2]){return ((b[1].toLowerCase() > a[1].toLowerCase()) ? -1:1)} else {return (b[2] - a[2]);} })} stuff.forEach(function(elt) { ee=(elt[3]<0.01)?'&epsilon;':elt[3]; if (elt[1]=="none available"){d3.select("#noneAV").html("<strong>Note: this data is NOT available/existing for "+elt[3]+" % of the publications in the studied corpus.</strong>").style("opacity", 1)} else{mytable+="<tr><td>"+elt[0]+"</td><td style=\"width:63%;\">"+elt[1]+"</td><td align='right' >"+elt[2]+"</td><td align='right'>"+ee+"</td></tr>"} }) mytable += '</table>' // fancy decorum mylist = '' mylist += mytable // output d3.select('#listTAB').html(mylist).property("scrollTop", 0); return } d3.select("#titleTAB").html("<i>List of " + itemsB[field_option] + " in corpus</i>") stuff=[] d3.csv(dirdatafreqs+'freq_'+filename+'.dat', function(err,data) { data.forEach(function(d,i){ // use this to declare the format (string or float) of the data stuff.push([i+1,d.item,+d.count,+d.f]) }) // output the list and scroll to top d3.select('#selectSORTtab').on('change',function(){prepList(stuff);}) prepList(stuff) //--------------------------------- //------------------ deal with graph //--------------------------------- alpha = 0 draw_graph(); }) } // end of update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function updateSelection(){\n\t\t\tif(lastMousePos.pageX == null) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.second, lastMousePos);\n\t\t\tclearSelection();\n\t\t\t\n\t\...
[ "0.74893624", "0.74893624", "0.74893624", "0.74893624", "0.744857", "0.73624", "0.73624", "0.6963687", "0.6924228", "0.6874348", "0.67306197", "0.6705155", "0.6702453", "0.66762435", "0.663542", "0.6606934", "0.6605485", "0.6595165", "0.6595165", "0.65926903", "0.65926903", ...
0.0
-1
Stores a random userID in localStorage. Remove this once you have integrated your own authentication scheme.
function useUserID() { const [userID, setUserID] = useState(null); // useEffect forces this to happen on the client, since `window` is not // available on the server during server-side rendering useEffect(() => { let userID = window.localStorage.getItem("roomservice-user"); if (userID == null) { const generateBase62ID = customAlphabet( "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 22 ); userID = generateBase62ID(); window.localStorage.setItem("roomservice-user", userID); } setUserID(userID); }, []); return userID; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cacheUserID(userID) {\n localStorage.setItem(USER_ID, userID);\n }", "function userIdGenerator(){\r\n var pt1 = Math.floor((Math.random() * 9 ) + 1);\r\n var pt2 = Math.floor((Math.random() * 9 ) + 1);\r\n var pt3 = Math.floor((Math.random() * 9 ) + 1);\r\n var pt4 = Math.floor((Math.random() * 9...
[ "0.80057853", "0.76980156", "0.7214092", "0.71314824", "0.71070856", "0.69873935", "0.690461", "0.6807177", "0.67809165", "0.67739415", "0.6773735", "0.6752356", "0.6717299", "0.6717299", "0.67109925", "0.66859233", "0.6645169", "0.6645169", "0.6645169", "0.6645169", "0.66451...
0.70996904
5
toggle function for fixedheight displays with potentially large contents
function toggleDisplay(selector,singleRowHeight,bindType) { var display = $(selector); var toggler = display.find(gTogglerClass).first(); display.css({'height':'auto'});//set height to auto var fullHeight = display.height();//get full content height when auto display.css({'height':singleRowHeight});//now set height to one row if (display.height() >= fullHeight) {//only show toggler if full contents larger than 1 row toggler.css('visibility','hidden'); } else { toggler.css('visibility','visible'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleContents() {\n\t\tif (this.breakpoint === this.sizeS && this.sideContentVisibility !== SideContentVisibility.AlwaysShow) {\n\t\t\tthis._toggled = !this._toggled;\n\t\t}\n\t}", "toggleContents() {\n if (this.breakpoint === this.sizeS && this.sideContentVisibility !== _SideContentVisibility.default.Alwa...
[ "0.6962882", "0.67986274", "0.6457488", "0.6397949", "0.6359628", "0.6288883", "0.6118295", "0.6083848", "0.60695976", "0.60531247", "0.6044697", "0.60446244", "0.60446244", "0.60446244", "0.60394144", "0.6039283", "0.60283476", "0.60204124", "0.6008511", "0.6006757", "0.5926...
0.60407156
14
SACO EL ID DE LA GALERIA
function getIdGallery(hotspot){ return $.ajax({ url: getIdGalleryRoute.replace('hotspotid', hotspot), type: 'POST', data: { '_token': token, } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getIdOrden(){\n return orden_id;\n}", "function GeraId(prefixo, elemento) {\n //return prefixo + '-' + elemento.childNodes.length;\n var id = 0;\n while (true) {\n var tentativa = prefixo + '-' + id;\n var encontrou_igual = false;\n for (var i = 0; i < elemento.childNodes.length; ++i) {\n ...
[ "0.6470128", "0.6366212", "0.62819856", "0.6240039", "0.62393963", "0.62037885", "0.61227894", "0.6085263", "0.60740674", "0.6040701", "0.6038364", "0.60255605", "0.59959036", "0.5971114", "0.59625673", "0.59495467", "0.5919588", "0.5904595", "0.58878917", "0.5876722", "0.587...
0.0
-1
Metodo para finalizar accion de mover
function finishMove(){ //Cambiar estado hotspot $(".hots"+id).find(".in").removeClass("move"); $(".hots"+id).find(".out").removeClass("moveOut"); $(".hotspotElement").removeClass('active'); $(".hotspotElement").css("pointer-events", "all"); //Volver a desactivar las acciones de doble click $("#pano").off( "dblclick"); //Quitar el cursor de tipo cell $("#pano").removeClass("cursorAddHotspot"); //Mostrar el menu inicial showMain(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finMouvement() {\n\t\tthis.visuel.removeEventListener('transitionend', this.evt.visuel.transitionend);\n\t\tthis.file.shift();\n this.cellule.verifierObjet();\n\t\tthis.prochainMouvement();\n\t\t//this.vitesse = 0; //maintenant gere dans la fn prochainMouvement\n\t}", "function end(){\n this.previousRo...
[ "0.6835387", "0.62044543", "0.6173208", "0.6167339", "0.61224705", "0.61108464", "0.59987867", "0.5991849", "0.5975187", "0.5969416", "0.5935727", "0.5925944", "0.58890903", "0.5871062", "0.5811536", "0.5802742", "0.5782116", "0.5748354", "0.5741184", "0.5724469", "0.57241756...
0.63237244
1
For example: a = 1 b = 4 > [1, 2, 3, 4]
function between(a, b) { // your code here let array = [] let min = Math.min(a,b) let max = Math.max(a,b) for(let i=min; i<=max; i++){ array.push(i) } return array }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numberArray(a, b) {\n b = []; while (a--) b[a] = a + 1; return b\n}", "function xy2(a) {\n console.log(\"xy\");\n console.log(a.id);\n var u = Math.floor((a.id - 1) /2 / b_map[0].length );\n var d = ((a.id - 1) / 2 ) % b_map[0].length ;\n console.log(\"u\", u, \"d\", d);\n return [u, d];\n}", ...
[ "0.63695604", "0.6344727", "0.62177485", "0.6195431", "0.6175984", "0.613707", "0.60956305", "0.6072965", "0.6031429", "0.60289586", "0.588813", "0.58420485", "0.58420485", "0.58222", "0.57652986", "0.5755816", "0.5748876", "0.572668", "0.57206714", "0.5679669", "0.56724924",...
0.5496269
43
Code as fast as you can! You need to double the integer and return it.
function doubleInteger(i) { // i will be an integer. Double it and return it. return i*2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doubleInteger(i) {\n return i*2;\n}", "function doubleInteger(i) {\n // i will be an integer. Double it and return it.\n return i * 2;\n}", "function getInt(n){\n return Math.floor(get() * (n + 1));\n}", "function doubleIT(num){\n var result = num * 2;\n return result;\n}", "function dou...
[ "0.74438244", "0.74044526", "0.7052231", "0.69679093", "0.667166", "0.65629786", "0.6411179", "0.63856465", "0.6376736", "0.63684785", "0.6325474", "0.63242817", "0.63145906", "0.63068527", "0.628197", "0.6243972", "0.6173825", "0.61356324", "0.61268353", "0.6111958", "0.6100...
0.74575794
0
Function name: add module Author: Reccion, Jeremy Date Modified: 2018/04/02 Description: creates a new collection by the name inputted by the user. it is then registered to the "modules" collection. Parameter(s): Object. includes: name: required. string type fields: optional. Array type. initialized if not existing from input Return: Promise
function addModule(newModule){ //imitate angular promise. start by initializing this var deferred = Q.defer(); newModule.name = newModule.name.toLowerCase(); //check if there is an existing module db.modules.findOne({name: newModule.name}, function(err, aModule){ if(err){ deferred.reject(err); } //already exists else if(aModule){ deferred.reject(exists); } else{ //unique, so proceed //create table first before adding a new document to 'modules' collection (not necessary?) db.createCollection(newModule.name, function(err){ if(err){ deferred.reject(err); } else{ //initialize fields property as empty array if there are none in the input if(newModule.fields == undefined){ newModule.fields = []; } db.modules.insert(newModule, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); } }); } }); //return the promise along with either resolve or reject return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n ...
[ "0.69070256", "0.6625662", "0.6408294", "0.6319275", "0.6271609", "0.5992774", "0.59464574", "0.58238715", "0.57643443", "0.5700712", "0.5631341", "0.56060815", "0.5589861", "0.5577479", "0.5543143", "0.54741263", "0.5458044", "0.54475826", "0.54274565", "0.54143834", "0.5408...
0.72655445
1
Function name: get all modules Author: Reccion, Jeremy Date Modified: 2018/04/02 Description: gets all documents from 'modules' collection Parameter(s): none Return: Promise
function getAllModules(){ var deferred = Q.defer(); db.modules.find().toArray(function(err, modules){ if(err){ deferred.reject(err); } else{ deferred.resolve(modules); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAllModuleDocs(moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].find().toArray(function(err, moduleDocs){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve(...
[ "0.76914924", "0.76914924", "0.71097285", "0.70054066", "0.69624513", "0.6716536", "0.66984975", "0.6599894", "0.6338829", "0.63069487", "0.62283856", "0.6196353", "0.61157167", "0.6098662", "0.60881853", "0.6008931", "0.5953479", "0.5945948", "0.5880202", "0.5841107", "0.583...
0.751723
3
Function name: update module Author: Reccion, Jeremy Date Modified: 2018/04/02 Description: updates the name of the module Parameter(s): Object. Includes: _id: required. string type name: required. string type Return: Promise
function updateModule(updateModule){ var deferred = Q.defer(); updateModule.name = updateModule.name.toLowerCase(); //fields array should not be editable when using this function. therefore, delete it from input delete updateModule.fields; db.modules.find({$or: [ {_id: mongo.helper.toObjectID(updateModule._id)}, {name: updateModule.name} ]}).toArray(function(err, modules){ if(err){ deferred.reject(err); } else if(modules.length == 0){ deferred.reject(notFound); } //vali inputs, no other document have the same name else if(modules.length == 1){ var oldModule = modules[0]; //rename if old & new names are different if(oldModule.name != updateModule.name){ db.bind(oldModule.name); db[oldModule.name].rename(updateModule.name, function(err){ if(err){ deferred.reject(err); } else{ update(); } }); } //go straight to update else{ update(); } } //another module document with the same name exists else{ deferred.reject(exists); } }); //updates the document in the 'modules' collection function update(){ //create another object and copy. then delete the '_id' property of the new copy var forUpdate = {}; Object.assign(forUpdate, updateModule); delete forUpdate._id; db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); } return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateModule(updateModule){\n var deferred = Q.defer();\n\n updateModule.name = updateModule.name.toLowerCase();\n\n //fields array should not be editable when using this function. therefore, delete it from input\n delete updateModule.fields;\n\n //check if the name of the selected module h...
[ "0.7093112", "0.7071991", "0.68973994", "0.67273706", "0.67273706", "0.6495799", "0.6399463", "0.63616574", "0.6330262", "0.6246438", "0.62095666", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.6175385", "0.61658496", "0.6108117", "0.6101938...
0.7073509
1
updates the document in the 'modules' collection
function update(){ //create another object and copy. then delete the '_id' property of the new copy var forUpdate = {}; Object.assign(forUpdate, updateModule); delete forUpdate._id; db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n del...
[ "0.7028102", "0.68724585", "0.6806519", "0.65929127", "0.65024394", "0.62758046", "0.5672086", "0.54816806", "0.54205954", "0.541616", "0.53961957", "0.53902787", "0.536893", "0.53682184", "0.53382444", "0.53338647", "0.5300493", "0.52351755", "0.52254105", "0.5219383", "0.51...
0.6888609
2
Function name: delete module Author: Reccion, Jeremy Date Modified: 2018/04/23 Description: drops the specific collection then remove its document from the 'modules' collection Parameter(s): moduleName: string type Return: Promise
function deleteModule(moduleName){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //drop the collection db.bind(moduleName); db[moduleName].drop(function(err){ if(err){ if(err.codeName == 'NamespaceNotFound'){ deferred.reject(notFound); } else{ deferred.reject(err); } } else{ //remove document from 'modules' collection db.modules.remove({name: moduleName}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ //n is used to know if the document was removed if(writeResult.result.n == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteModule(id, moduleName){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //drop the collection\n db.bind(moduleName);\n db[moduleName].drop();\n\n //remove document from 'modules' collection\n db.modules.remove({_id: mongo.helper.toObjectID(id)}, function...
[ "0.84370935", "0.7958818", "0.79092586", "0.7097685", "0.6860468", "0.67647773", "0.662002", "0.6473157", "0.62492627", "0.58944094", "0.5845492", "0.5764855", "0.57641274", "0.573505", "0.57172936", "0.5634599", "0.5621253", "0.56094986", "0.55869454", "0.5581452", "0.552641...
0.87686384
0
Function name: add module field Author: Reccion, Jeremy Date Modified: 2018/04/20 Description: insert a new field object to the specific module's fields array Parameter(s): moduleName: required. string type fieldObject: required. object type. includes: name: required. string type unique: required. boolean type Return: Promise
function addModuleField(moduleName, fieldObject){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //create a new objectID to used as query for updates and delete fieldObject.id = new ObjectID(); //the query searches for the module name that do not have the inputted field name //this is to avoid pushing same field names on the 'fields' array of the specified module //writeResult will determine if the update was successful or not (i.e. writeResult.result.nModified) db.modules.update({name: moduleName, fields: {$not: {$elemMatch: {name: fieldObject.name}}}}, {$push: {fields: fieldObject}}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ //console.log(writeResult.result); //check the status of the update, if it failed, it means that there is an existing field name if(writeResult.result.nModified == 0){ deferred.reject(exists); } else{ deferred.resolve(); } } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //create a new objectID to used as query for updates and delete\n fieldObject.id = new ObjectID();\n\n db.modules.update({name: moduleName}, {$push: {fields: fieldObject}}, func...
[ "0.8235917", "0.679162", "0.67566025", "0.6683053", "0.6612175", "0.6491345", "0.64870906", "0.6423668", "0.6423668", "0.6410956", "0.62967265", "0.62095296", "0.6172234", "0.6075467", "0.60152245", "0.5900019", "0.58819133", "0.585371", "0.5834094", "0.5774164", "0.57685655"...
0.8132459
1
Function name: update module field Author: Reccion, Jeremy Date Modified: 2018/04/24 Description: update a field object from the specific module's fields array Parameter(s): moduleName: required. string type fieldObject: required. object type Return: Promise
function updateModuleField(moduleName, fieldObject){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); console.log(fieldObject); service.getModuleByName(moduleName).then(function(aModule){ //use array.filter() to get the duplicate fields var duplicateFields = aModule.fields.filter(function(field){ //lesson learned: use toString() in id return field.id.toString() == fieldObject.id.toString() || field.name == fieldObject.name; }); if(duplicateFields.length == 0){ deferred.reject(notFound); } //valid inputs else if(duplicateFields.length == 1){ //this is to ensure that the field is inside the specific module (in case of improper input parameters) fieldObject.id = new ObjectID(fieldObject.id); if(duplicateFields[0].id.toString() == fieldObject.id.toString()){ db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ console.log(writeResult.result); deferred.resolve(); } }); } //the only element has the same name but is different id, therefore, not inside the module document else{ deferred.reject(notFound); } } else{ deferred.reject(exists); } }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateModuleField(moduleName, fieldObject){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n fieldObject.id = new ObjectID(fieldObject.id);\n \n db.modules.update({name: moduleName, fields: {$elemMatch: {id: fieldObject.id}}}, {$set: {'fields.$': fieldObject}}, funct...
[ "0.8456608", "0.81074345", "0.805101", "0.7392945", "0.7392381", "0.70211095", "0.68865806", "0.66497767", "0.66221124", "0.647745", "0.6348413", "0.6348413", "0.63277465", "0.6174028", "0.60932803", "0.60513693", "0.6039068", "0.60181665", "0.5856864", "0.57826996", "0.57653...
0.8240337
1
Function name: delete module field Author: Reccion, Jeremy Date Modified: 2018/04/24 Description: delete a field object from the specific module's fields array Parameter(s): moduleName: required. string type fieldID: required. string type Return: Promise
function deleteModuleField(moduleName, fieldID){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ if(writeResult.result.nModified == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteModuleField(moduleName, fieldID){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n \n db.modules.update({name: moduleName}, {$pull: {fields: {id: mongo.helper.toObjectID(fieldID)}}}, function(err){\n if(err){\n deferred.reject(err);\n }\n ...
[ "0.8156747", "0.67469287", "0.66539174", "0.6590933", "0.65539515", "0.6496182", "0.6480931", "0.6474819", "0.6348002", "0.6331068", "0.62288254", "0.6219512", "0.6177473", "0.6077904", "0.6047087", "0.5973316", "0.59649444", "0.59559435", "0.59484595", "0.58134276", "0.58067...
0.80614734
1
Function name: get a specific module Author: Reccion, Jeremy Date Modified: 2018/04/20 Description: retrieves a specific module by its name Parameter(s): moduleName: string type Return: Promise
function getModuleByName(moduleName){ var deferred= Q.defer(); moduleName = moduleName.toLowerCase(); db.modules.findOne({name: moduleName}, function(err, aModule){ if(err){ deferred.reject(err); } else if(aModule){ deferred.resolve(aModule); } else{ deferred.reject(notFound); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getModuleByName(moduleName){\n var deferred= Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.findOne({name: moduleName}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve(aModule);\n }\n ...
[ "0.7550319", "0.64568645", "0.6341758", "0.61982876", "0.6101905", "0.5989672", "0.59674895", "0.5937421", "0.5917052", "0.5729546", "0.56361324", "0.5632423", "0.5617168", "0.5553284", "0.55260795", "0.55196166", "0.5515729", "0.5500644", "0.54888695", "0.548056", "0.5458297...
0.7540487
1
Function name: add document Author: Reccion, Jeremy Date Modified: 2018/04/24 Description: add a document in a specific collection Parameter(s): moduleName: string type newDoc: object type. //fields must be the specific module's 'fields' in 'modules' collection Return: Promise
function addModuleDoc(moduleName, newDoc){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); service.findDuplicateDoc(moduleName, newDoc).then(function(){ db.bind(moduleName); db[moduleName].insert(newDoc, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n ...
[ "0.79263556", "0.66809034", "0.66809034", "0.65259874", "0.6474247", "0.6462474", "0.6386402", "0.62038225", "0.6137509", "0.60923326", "0.60543627", "0.60535026", "0.60426795", "0.60029393", "0.5956532", "0.5956532", "0.5956532", "0.58633536", "0.5832858", "0.57799244", "0.5...
0.78352207
1
Function name: get documents of a module Author: Reccion, Jeremy Date Modified: 2018/04/04 Description: get all documents of a specific module Parameter(s): moduleName: string type Return: Promise
function getAllModuleDocs(moduleName){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); db.bind(moduleName); db[moduleName].find().toArray(function(err, moduleDocs){ if(err){ deferred.reject(err); } else{ deferred.resolve(moduleDocs); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getDocument(req, res, next){\n\n document.findAll({ attributes: ['name'] })\n .then(document => {\n res.status(200).send(document)\n })\n .catch(err => {\n res.status(400).send(e);\n })\n}", "GetAllDocuments() {\n return this.Start().then(Cache.DB).then(db => new Promise((resolve, re...
[ "0.6185267", "0.5993622", "0.59846175", "0.59552914", "0.57914364", "0.5780547", "0.57780313", "0.57778186", "0.5751649", "0.57448214", "0.5715541", "0.5707072", "0.5701094", "0.5696588", "0.56830984", "0.56245357", "0.56133175", "0.55978113", "0.55827266", "0.5580734", "0.55...
0.8136698
1
Function name: update a module document Author: Reccion, Jeremy Date Modified: 2018/04/04 Description: update a document of a specific module Parameter(s): moduleName: string type updateDoc: object type. includes: _id: required. string type //fields must be the specific module's 'fields' in 'modules' collection Return: Promise
function updateModuleDoc(moduleName, updateDoc){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); service.findDuplicateDoc(moduleName, updateDoc).then(function(){ db.bind(moduleName); //convert '_id' to ObjectID updateDoc._id = new ObjectID(updateDoc._id); db[moduleName].update({_id: updateDoc._id}, {$set: updateDoc}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ if(writeResult.result.nModified == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateModuleDoc(moduleName, updateDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateDoc);\n del...
[ "0.8221811", "0.7874364", "0.77189493", "0.738352", "0.72332454", "0.68794364", "0.68794364", "0.68435234", "0.6736119", "0.63068366", "0.6303614", "0.62880695", "0.62741476", "0.6246192", "0.61462486", "0.61180973", "0.60007644", "0.59134805", "0.59115833", "0.58952177", "0....
0.80793613
1
Function name: delete a module document Author: Reccion, Jeremy Date Modified: 2018/04/04 Description: delete a document of a specific module Parameter(s): moduleName: string type id: string type. //id of the specific document Return: Promise
function deleteModuleDoc(moduleName, id){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); db.bind(moduleName); db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err, writeResult){ if(err){ deferred.reject(err); } else{ //n is used to know if the document was removed if(writeResult.result.n == 0){ deferred.reject(notFound); } else{ deferred.resolve(); } } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteModuleDoc(moduleName, id){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].remove({_id: mongo.helper.toObjectID(id)}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n ...
[ "0.8478919", "0.8008632", "0.79626316", "0.7090099", "0.69446784", "0.6760206", "0.6703368", "0.6679069", "0.6499352", "0.648364", "0.6419483", "0.6418587", "0.63801485", "0.63159657", "0.6239152", "0.6212612", "0.6169452", "0.61594284", "0.61558723", "0.61168295", "0.6104319...
0.8466946
1
Function name: find duplicate values Author: Reccion, Jeremy Date Modified: 2018/04/12 Description: check for duplicate values according to one or more unique fields Parameter(s): moduleName: required. string type moduleDoc: required. object type. includes: _id: optional. string type //if this exists, the document is being updated Return: Promise
function findDuplicateDoc(moduleName, moduleDoc){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //get the fields of the specific module service.getModuleByName(moduleName).then(function(aModule){ //initialize array & object for querying var uniqueValues = []; var tempObj; //push the value of the document when a field is unique aModule.fields.forEach(function(field){ if(field.unique){ tempObj = {}; tempObj[field.name] = moduleDoc[field.name]; uniqueValues.push(tempObj); } }); if(uniqueValues.length == 0){ deferred.resolve(); } else{ db.bind(moduleName); //use $or for checking each field for uniqueness, not their combination db[moduleName].findOne({$or: uniqueValues}, function(err, duplicateDoc){ if(err){ deferred.reject(err); } //a duplicate exists, but needs further checking else if(duplicateDoc){ //updating a module document if(moduleDoc._id){ //different module documents with similar unique values if(moduleDoc._id != duplicateDoc._id){ deferred.reject(exists); } //since it is the same document, it is not duplicate else{ deferred.resolve(); } } //adding new module documennt else{ deferred.reject(exists); } } //does not exist - similar to notFound. but it is not rejected based on design else{ deferred.resolve(); } }); } }).catch(function(err){ deferred.reject(err); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findDuplicateDoc(moduleName, moduleDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n //get the fields of the specific module\n service.getModuleByName(moduleName).then(function(aModule){\n //initialize array & object for querying\n var uniqueFields = ...
[ "0.7790472", "0.6359789", "0.6185164", "0.60583496", "0.59461486", "0.5890801", "0.57857865", "0.563223", "0.5565228", "0.55593705", "0.55330694", "0.5467956", "0.5450589", "0.5444566", "0.54175276", "0.53952575", "0.53873485", "0.5369162", "0.53616375", "0.53610873", "0.5342...
0.77881294
1
Function name: update fields array Author: Reccion, Jeremy Date Modified: 2018/04/12 Description: sets the 'fields' property of the specific module to the inputted array. Parameter(s): moduleName: required. string type fieldArray: required. array type. //this array is from angular's UISORTABLE Return: Promise
function updateFieldArray(moduleName, fieldArray){ var deferred = Q.defer(); moduleName = moduleName.toLowerCase(); //need to convert each 'id' property to an ObjectID for(var i = 0; i < fieldArray.length; i++){ fieldArray[i].id = new ObjectID(fieldArray[i].id); } db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){ if(err){ deferred.reject(err); } else{ deferred.resolve(); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateFieldArray(moduleName, fieldArray){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.update({name: moduleName}, {$set: {fields: fieldArray}}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferre...
[ "0.8652673", "0.70994407", "0.69737965", "0.6589965", "0.6513358", "0.6509463", "0.59435564", "0.5773354", "0.5769816", "0.5576439", "0.55589837", "0.55294067", "0.54397786", "0.5399783", "0.5358418", "0.53507483", "0.530652", "0.5295252", "0.5295252", "0.5285423", "0.5277235...
0.84816843
1
Clears the query params
clearQueryParams() { this.queryParams = {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeAllURLQueryString() {\n delete this.urlObj.search;\n }", "clearQs() {\n this.forwardQueryString = false;\n this.queryString = {};\n return this;\n }", "clearInitialSearch() {\n const params = this.params();\n delete params.q;\n\n m.route(app.route(this.searchRoute, pa...
[ "0.7641261", "0.75850177", "0.7096127", "0.7081908", "0.7053546", "0.70035225", "0.6965717", "0.69373214", "0.67906666", "0.6681247", "0.6549215", "0.65451187", "0.64949024", "0.6426417", "0.64178604", "0.6417518", "0.63831586", "0.6334712", "0.63329154", "0.6330536", "0.6310...
0.8285499
0
Clones the query params
_cloneQueryParams() { var extend = function (object) { const scratch = {}; Object.keys(object).forEach((key) => { const value = object[key]; if (Array.isArray(value)) { scratch[key] = value.splice(0); } else if (typeof value === 'object') { scratch[key] = extend(value); } else { scratch[key] = value; } }, this); return scratch; }; return extend(this.queryParams); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clearQueryParams() {\n this.queryParams = {};\n }", "clearQs() {\n this.forwardQueryString = false;\n this.queryString = {};\n return this;\n }", "addQueryParams(additionalQueryParams) {\n for (const key in additionalQueryParams) {\n if (additionalQueryParams.hasOwnProperty(...
[ "0.72527725", "0.6354464", "0.62944865", "0.62072563", "0.6136836", "0.60743904", "0.603191", "0.5953603", "0.5945542", "0.59019774", "0.59019774", "0.58880925", "0.58802503", "0.5855626", "0.58492976", "0.58412933", "0.58412933", "0.58412933", "0.58412933", "0.58412933", "0....
0.7555594
0
returns true if the month and year are within min date and max date
function isMonthYearInRange (month, year) { // adjust month to 1-based because format date returns month as 1-based var monthPlusOne = month + 1; var leadingZero = monthPlusOne < 10 ? '0' : ''; if (parseInt(year + leadingZero + monthPlusOne) < parseInt(formatDate(minDate, 'YYYYMM')) || parseInt(year + leadingZero + monthPlusOne) > parseInt(formatDate(maxDate, 'YYYYMM'))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_isYearAndMonthBeforeMinDate(year, month) {\n if (this.minDate) {\n const minYear = this._dateAdapter.getYear(this.minDate);\n const minMonth = this._dateAdapter.getMonth(this.minDate);\n return year < minYear || (year === minYear && month < minMonth);\n }\n re...
[ "0.7404555", "0.7404555", "0.7337931", "0.7337931", "0.72220564", "0.6979821", "0.6933853", "0.66925365", "0.6619252", "0.6610714", "0.66050076", "0.66050076", "0.66050076", "0.66050076", "0.66050076", "0.66050076", "0.66050076", "0.66050076", "0.66050076", "0.66050076", "0.6...
0.7219827
5
sets that.selectedMonth and that.selectedYear if different. returns true if the properties were set
function setMonthYear(date) { var month = date.getMonth(); var year = date.getFullYear(); // update properties if different if (month !== that.selectedMonth || year !== that.selectedYear) { that.selectedMonth = month; that.selectedYear = year; return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setSelectedMonth(value) {\n if (value instanceof DateRange) {\n this._selectedMonth = this._getMonthInCurrentYear(value.start) ||\n this._getMonthInCurrentYear(value.end);\n }\n else {\n this._selectedMonth = this._getMonthInCurrentYear(value);\n }\...
[ "0.65656024", "0.65656024", "0.63593584", "0.60906655", "0.5955042", "0.5863237", "0.5845072", "0.57911855", "0.5727883", "0.56956816", "0.56956816", "0.56865835", "0.56865835", "0.5653115", "0.56506276", "0.5645195", "0.5645195", "0.564405", "0.55890894", "0.557247", "0.5555...
0.776558
0
maybe there is a better way to do this 1. start counting the days from the left side (firstDayOfWeek) 2. increment firstDayOfWeek to mimic moving towards the right side (firstDayOfMonth) 3. if firstDayOfWeek becomes > 6 reset to 0 continue until firstDayOfWeek === firstDayOfMonth
function getDaysBeforeFirstDayOfMonth(firstDayOfWeek, firstDayOfMonth) { if (firstDayOfMonth === firstDayOfWeek || firstDayOfMonth < 0 || firstDayOfMonth > 6 || firstDayOfWeek < 0 || firstDayOfWeek > 6) { return; } var daysBefore = 0; while (firstDayOfWeek !== firstDayOfMonth) { daysBefore++; firstDayOfWeek++; if (firstDayOfWeek > 6) { firstDayOfWeek = 0; } } return daysBefore; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function weekCycler (day) {\n day += 1;\n if (day > 6) {\n day = 0;\n }\n return day\n}", "weekDaysBeforeFirstDayOfTheMonth() {\n const firstDayOfTheMonth = new Date(`${this.displayedYear}-${pad(this.displayedMonth + 1)}-01T00:00:00+00:00`);\n const weekDay = firstDayOfTheMonth.getUT...
[ "0.68556434", "0.68231857", "0.6699148", "0.66821057", "0.6583973", "0.6583973", "0.6548333", "0.6470098", "0.6458274", "0.6440805", "0.6351508", "0.6340209", "0.6316454", "0.63061154", "0.630426", "0.6291998", "0.62695694", "0.6254319", "0.62514544", "0.62332827", "0.6209635...
0.67823327
2
build the calendar array
function buildCalendar() { var year = that.selectedYear; var month = that.selectedMonth; var firstDateOfMonth = getDate(year, month, 1); var firstDayOfMonth = firstDateOfMonth.getDay(); var firstDayOfWeek = that.options.firstDayOfWeek; var rowIndex = 0, datesInWeek = 0, date = 1; calendarItems = []; that.weeks = []; // if first day of month != firstDayOfWeek then start dates from prior month if (firstDayOfWeek != firstDayOfMonth) { var daysBefore = getDaysBeforeFirstDayOfMonth(firstDayOfWeek, firstDayOfMonth); if (daysBefore) { // 0 is one day prior; 1 is two days prior and so forth date = date - daysBefore; } } while (date <= getDaysInMonth(year, month)) { calendarItems.push(createCellData(getDate(year, month, date++))); } // fill remaining cells with dates from next month while ((calendarItems.length % 7) !== 0) { calendarItems.push(createCellData(getDate(year, month, date++))); } // populate the that.weeks array. create a 2D array of 7 days per row angular.forEach(calendarItems, function (cellData) { if ((datesInWeek % 7) === 0) { that.weeks.push([]); rowIndex = that.weeks.length - 1; } that.weeks[rowIndex].push(cellData); datesInWeek++; }); //raise the callback for each cell data raiseRenderDateCallback(calendarItems); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function constructCalendar(selectedDate){\n scope.calendarDays = [];\n //Setting up the array\n var endOfMonth = angular.copy(defaultDate);\n endOfMonth = endOfMonth.endOf('month').format('DD');\n var currentDate = angular.copy(defaultD...
[ "0.71836436", "0.7157168", "0.69721913", "0.67158526", "0.6659444", "0.6658404", "0.6619664", "0.65990007", "0.6590704", "0.6581579", "0.6548451", "0.6483488", "0.6477152", "0.6459985", "0.64313257", "0.6424336", "0.6384324", "0.63710535", "0.6348234", "0.6305048", "0.624175"...
0.7292485
0
functions to work with the linked list instert node into list
insertvalueToList(value) { let newNode = new Node(value) if (this.length == 0) { this.head = newNode this.tail = newNode this.pointer = newNode this.length = 1; return; } if (newNode.value > this.head.value) { // the new value is now the highest value newNode.next = this.head; // the new node is inserted to the list at the head - new acting head node this.head = newNode; } else { // then the node has to go somewhere in the list this.pointer = this.head; while (true) { if (this.pointer.next) { if (newNode.value < this.pointer.next.value) { // then move pointer this.pointer = this.pointer.next } else { // this is where the node belongs newNode.next = this.pointer.next; // two different nodes point to 'pointer.next' this.pointer.next = newNode; this.length++; break; } } else { // then the node goes at the end this.pointer.next = newNode; this.tail = newNode; this.length++; break; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "insert(index, val) {\n\n //if index is less than zero or greater than the length return false;\n if (index < 0 || index > this.length) return false;\n //if index is equal to the length of the list call push(val)\n if (index === this.length) {\n this.push(val);\n re...
[ "0.6367616", "0.63442177", "0.63405275", "0.62677336", "0.62351674", "0.6233125", "0.62290007", "0.62147605", "0.6210884", "0.619933", "0.61899394", "0.61769485", "0.61632425", "0.61616254", "0.6146706", "0.6121456", "0.6110628", "0.6109532", "0.6100239", "0.6091059", "0.6053...
0.0
-1
output the whole list
print() { this.pointer = this.head; while (true) { console.log(this.pointer.value) if (this.pointer.next) { this.pointer = this.pointer.next; } else { break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "print() {\n let s = \"\"\n this.list.forEach((e) => {\n s += \"[\" + e[0] + \", \" + e[1] + \") \"\n })\n console.log(s.trim())\n }", "function printList(inputList){\n console.log(inputList.join(\" | \"));\n}", "function printList( list ) {\n var listHTML = '<ol>';\n for (var i = 0; ...
[ "0.71806157", "0.7161504", "0.7050791", "0.6943736", "0.6901646", "0.6869288", "0.68383664", "0.6796317", "0.6777125", "0.67752", "0.67587954", "0.66958815", "0.66811985", "0.66723055", "0.6627805", "0.65750843", "0.6549527", "0.6524592", "0.6451126", "0.6438901", "0.6421504"...
0.0
-1
Keep track of the active TextEditor, because when single clicking a file from the treeview, atom.workspace.getEditor() returns undefined
subscribeToFileOpen() { return atom.workspace.onDidOpen(event => { this.activeEditor = event.item; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onEditorChanged() {\n\t\t_close();\n\t\tcurrentEditor = EditorManager.getCurrentFullEditor();\n\n\t\tcurrentEditor.$textNode = $(currentEditor.getRootElement()).find(\".CodeMirror-lines\");\n\t\tcurrentEditor.$textNode = $(currentEditor.$textNode.children()[0].children[3]);\n\t\tcurrentEditor.$numbersNod...
[ "0.6879253", "0.66936564", "0.6544721", "0.6524527", "0.6499231", "0.6499231", "0.64954007", "0.64462477", "0.6404208", "0.63776016", "0.62949413", "0.627102", "0.6243174", "0.618155", "0.61683685", "0.61574864", "0.61540544", "0.61104655", "0.60639465", "0.60564834", "0.6051...
0.7107289
0
Populate the sourceLinks and targetLinks for each node. Also, if the source and target are not objects, assume they are indices.
function computeNodeLinks() { var nodeHash = {}; var linkHash = {}; // remove duplicated node nodes = nodes.filter(function (node) { if (typeof nodeHash[node.id] !== 'undefined') { $.extend(nodeHash[node.id], node); return false; } nodeHash[node.id] = node; return true; }); // remove duplicated link links = links.filter(function (link) { var id1 = typeof link.source === 'string' ? link.source : link.source.id; var id2 = typeof link.target === 'string' ? link.target : link.target.id; if (typeof nodeHash[id1] === 'undefined' || typeof nodeHash[id2] === 'undefined') { return false; } var key = id1 + '_' + id2; if (typeof linkHash[key] !== 'undefined') { //$.extend(linkHash[key], link); return false; } linkHash[key] = link; return true; }); nodes.forEach(function(node) { //nodeHash[node.id] = node; node.sourceLinks = []; node.targetLinks = []; }); links.forEach(function(link) { var source = link.source, target = link.target; if (typeof source === "string") source = link.source = nodeHash[link.source]; if (typeof target === "string") target = link.target = nodeHash[link.target]; source.sourceLinks.push(link); target.targetLinks.push(link); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeNodeLinks() {\n nodes.forEach(function (node) {\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n links.forEach(function (link) {\n var source = link.source, target = link.target;\n link.source_index = source;\n link.target_index = target;\n...
[ "0.7977855", "0.79253113", "0.78906596", "0.7886118", "0.78162855", "0.7815691", "0.7815691", "0.7770885", "0.77210164", "0.77036065", "0.7308495", "0.6941912", "0.6864947", "0.68478954", "0.6836942", "0.6836942", "0.6815989", "0.68087345", "0.6788788", "0.6512627", "0.631240...
0.67821574
19
Iteratively assign the breadth (xposition) for each node. Nodes are assigned the maximum breadth of incoming neighbors plus one; nodes with no incoming links are assigned breadth zero, while nodes with no outgoing links are assigned the minimum breadth.
function computeNodeLevels() { nodes.forEach(function (d) { d._linkNumber = d.sourceLinks.length + d.targetLinks.length; d._levelSetted = false; }); var x = 0; var remainingNodes, nextNodes; var boneNodes; // get bone nodes var shrink = true; remainingNodes = nodes; while (shrink) { shrink = false; nextNodes = []; remainingNodes.forEach(function(node) { if (node._linkNumber === 1) { shrink = true; node._linkNumber = 0; node.sourceLinks.forEach(function (d) { if (d.target._linkNumber > 0) { d.target._linkNumber -= 1; } }); node.targetLinks.forEach(function (d) { if (d.source._linkNumber > 0) { d.source._linkNumber -= 1; } }); } }); remainingNodes = remainingNodes.filter(function (d) { return d._linkNumber > 0; }); } boneNodes = remainingNodes; if (boneNodes.length > 0) { //有环 remainingNodes = boneNodes; x = 0; nextNodes = []; while (remainingNodes.length) { nextNodes = []; remainingNodes.forEach(function(node) { node.x = x; node.sourceLinks.forEach(function(link) { nextNodes.push(link.target); }); }); remainingNodes = nextNodes; ++x; } boneNodes.forEach(function (node) { node._isBone = true; }); boneNodes.forEach(function (node) { var parentBoneNode = []; node.targetLinks.forEach(function (d) { if (d.source._isBone) { parentBoneNode.push(d.source); } }); var childrenBoneNode = []; node.sourceLinks.forEach(function (d) { if (d.target._isBone) { childrenBoneNode.push(d.target); } }); node._parentBoneNode = parentBoneNode; node._childrenBoneNode = childrenBoneNode; }); // move down to make links to be shortest boneNodes.forEach(function (node) { var minChildrenLevel = d3.min(node._childrenBoneNode, function (d) { return d.x; }); // not parent bone node if (node._parentBoneNode.length === 0) { node.x = minChildrenLevel - 1; } // target is far away if (minChildrenLevel - node.x > 1) { if (node._childrenBoneNode.length > node._parentBoneNode.length) { // parents more than children, do nothing } else if (node._childrenBoneNode.length < node._parentBoneNode.length) { // parents less than children, move to children node.x = minChildrenLevel - 1; } else { // parents = children, do nothing; } } }); } else { //无环 if (nodes.length > 0) { nodes[0].x = 0; boneNodes = [nodes[0]]; } else { boneNodes = []; } } // 添加节点 boneNodes.forEach(function (d) { d._levelSetted = true; }); remainingNodes = boneNodes; nextNodes = []; while (remainingNodes.length) { nextNodes = []; remainingNodes.forEach(function(node) { node.sourceLinks.forEach(function(link) { var n = link.target; if (!n._levelSetted) { n.x = node.x + 1; node._levelSetted = true; nextNodes.push(n); } }); node.targetLinks.forEach(function(link) { var n = link.source; if (!n._levelSetted) { n.x = node.x - 1; node._levelSetted = true; nextNodes.push(n); } }); }); remainingNodes = nextNodes; } //调整节点的最小层为0 var minLevel = d3.min(nodes, function (d) { return d.x; }); nodes.forEach(function (d) { d.x -= minLevel; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeNodeBreadths() {\n let remainingNodes = nodes\n let nextNodes\n let x = 0\n\n while (remainingNodes.length) {\n nextNodes = []\n remainingNodes.forEach(function(node) {\n node.x = x\n node.dx = nodeWidth\n node.sourceLinks.forEach(function(link) {\n ...
[ "0.7134106", "0.706675", "0.70626557", "0.70609784", "0.70221484", "0.69733214", "0.6967342", "0.69643974", "0.69643974", "0.69112635", "0.68268794", "0.6628682", "0.6403013", "0.63009024", "0.61131173", "0.6045317", "0.5994476", "0.5898872", "0.58699536", "0.58485484", "0.58...
0.529692
57
! Get the bson type, if it exists
function y(t,e){return a(t,"_bsontype",void 0)===e}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isBsonType(obj, typename) {\n return get(obj, '_bsontype', void 0) === typename;\n}", "function isBsonType(obj, typename) {\n return get(obj, '_bsontype', void 0) === typename;\n}", "function isBsonType(obj, typename) {\n return get(obj, '_bsontype', void 0) === typename;\n}", "get type() {}", ...
[ "0.665152", "0.665152", "0.665152", "0.65151536", "0.6410235", "0.63352346", "0.6325141", "0.6305704", "0.6225867", "0.6218908", "0.618438", "0.61640024", "0.6131096", "0.61008996", "0.6092149", "0.6056588", "0.59996563", "0.59996563", "0.5914181", "0.5901641", "0.5863613", ...
0.0
-1
! ignore /! ignore
function m(t,e){const n=e&&e.minimize,r={};let i,o,s;for(s in t)o=_(t[s],e),n&&void 0===o||(i||(i=!0),r[s]=o);return n?i&&r:r}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ignore() { }", "get Ignore() {}", "set Ignore(value) {}", "function ignore() {\n return null\n}", "function ignore() {\n return null;\n}", "function ignore() {\n return null\n }", "function IGNORE() {\r\n //Do not delete.\r\n }", "function skip(){\n\t\n}", "function ign...
[ "0.8653394", "0.7446816", "0.7386236", "0.7235458", "0.7168867", "0.7022659", "0.67721653", "0.64045095", "0.6191315", "0.6140491", "0.6120082", "0.61128414", "0.6085999", "0.6049541", "0.6046634", "0.6044394", "0.600617", "0.5982768", "0.59775823", "0.59717566", "0.59364134"...
0.0
-1
! Document exposes the NodeJS event emitter API, so you can use `on`, `once`, etc.
function M(t,e,n,r,i,o,s){const a=Object.keys(t.schema.paths),u=a.length;for(let c=0;c<u;++c){let u,l="";const f=a[c];if("_id"===f&&n)continue;const p=t.schema.paths[f],h=f.split("."),d=h.length;let y=!1,_=t._doc;for(let n=0;n<d&&null!=_;++n){const a=h[n];if(l+=(l.length?".":"")+a,!0===r){if(l in e)break}else if(!1===r&&e&&!y)if(l in e)y=!0;else if(!i[l])break;if(n===d-1){if(void 0!==_[a])break;if("function"==typeof p.defaultValue){if(!p.defaultValue.$runBeforeSetters&&o)break;if(p.defaultValue.$runBeforeSetters&&!o)break}else if(!o)continue;if(s&&s[l])break;if(e&&null!==r)if(!0===r){if(f in e)continue;void 0!==(u=p.getDefault(t,!1))&&(_[a]=u,t.$__.activePaths.default(f))}else y&&void 0!==(u=p.getDefault(t,!1))&&(_[a]=u,t.$__.activePaths.default(f));else void 0!==(u=p.getDefault(t,!1))&&(_[a]=u,t.$__.activePaths.default(f))}else _=_[a]}}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventEmitter() {} // Shortcuts to improve speed and size", "function EventEmitter(){}// Shortcuts to improve speed and size", "function on (event, cb) {\n emitter.on(event, cb)\n }", "function on (event, cb) {\n emitter.on(event, cb)\n }", "function on (event, cb) {\n emitter.on(event, ...
[ "0.73722035", "0.733537", "0.72937536", "0.72937536", "0.72937536", "0.70783603", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", "0.699271", ...
0.0
-1
! ignore /! ignore
function g(t,e){const n=e.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean);if(n.length<2)return t.paths[n[0]];let r=t.path(n[0]),i=!1;if(!r)return r;let o,a=n.length-1,c=1;for(;c<n.length;++c){if(i=!1,o=n[c],c===a&&r&&!/\D/.test(o)){if(r.$isMongooseDocumentArray){const t=r;(r=new s(o,{required:u(r,"schemaOptions.required",!1)})).cast=function(e,n,r){return t.cast(e,n,r)[0]},r.$isMongooseDocumentArrayElement=!0,r.caster=t.caster,r.schema=t.schema}else r=r instanceof h.Array?r.caster:void 0;break}if(!/\D/.test(o))continue;if(!r||!r.schema){r=void 0;break}i="nested"===r.schema.pathType(o),r=r.schema.path(o)}return t.subpaths[e]=r,r?"real":i?"nested":"adhocOrUndefined"}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ignore() { }", "get Ignore() {}", "set Ignore(value) {}", "function ignore() {\n return null\n}", "function ignore() {\n return null;\n}", "function ignore() {\n return null\n }", "function IGNORE() {\r\n //Do not delete.\r\n }", "function skip(){\n\t\n}", "function ign...
[ "0.8652147", "0.7446572", "0.73859835", "0.7234087", "0.7167445", "0.70217335", "0.67718285", "0.6404717", "0.61901206", "0.6141006", "0.611969", "0.6112831", "0.60844624", "0.60475874", "0.60462904", "0.60432476", "0.60051274", "0.5981711", "0.5976254", "0.5972818", "0.59356...
0.0
-1
! Defines the accessor named prop on the incoming prototype.
function a(t,e,a,u,c,l){r=r||n(5);const f=(u?u+".":"")+t;u=u||"",e?Object.defineProperty(a,t,{enumerable:!0,configurable:!0,get:function(){const t=this;if(this.$__.getters||(this.$__.getters={}),!this.$__.getters[f]){const n=Object.create(r.prototype,function(t){const e={};return Object.getOwnPropertyNames(t).forEach(function(n){e[n]=Object.getOwnPropertyDescriptor(t,n),e[n].get?delete e[n]:e[n].enumerable=-1===["isNew","$__","errors","_doc"].indexOf(n)}),e}(this));u||(n.$__.scope=this),n.$__.nestedPath=f,Object.defineProperty(n,"schema",{enumerable:!1,configurable:!0,writable:!1,value:a.schema}),Object.defineProperty(n,"toObject",{enumerable:!1,configurable:!0,writable:!1,value:function(){return o.clone(t.get(f,null,{virtuals:i(this,"schema.options.toObject.virtuals",null)}))}}),Object.defineProperty(n,"toJSON",{enumerable:!1,configurable:!0,writable:!1,value:function(){return t.get(f,null,{virtuals:i(t,"schema.options.toJSON.virtuals",null)})}}),Object.defineProperty(n,"$__isNested",{enumerable:!1,configurable:!0,writable:!1,value:!0}),s(e,n,f,l),this.$__.getters[f]=n}return this.$__.getters[f]},set:function(t){return t instanceof r&&(t=t.toObject({transform:!1})),(this.$__.scope||this).$set(f,t)}}):Object.defineProperty(a,t,{enumerable:!0,configurable:!0,get:function(){return this.get.call(this.$__.scope||this,f)},set:function(t){return this.$set.call(this.$__.scope||this,f,t)}})}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static createProperty(e,t=defaultPropertyDeclaration){// Do not generate an accessor if the prototype already has one, since\n// it would be lost otherwise and that would never be the user's intention;\n// Instead, we expect users to call `requestUpdate` themselves from\n// user-defined accessors. Note that if the...
[ "0.68748796", "0.67906475", "0.6748649", "0.66551924", "0.66551924", "0.6584433", "0.6584433", "0.6584433", "0.65730035", "0.6397988", "0.6397554", "0.6346903", "0.63361025", "0.6328479", "0.6277986", "0.6272427", "0.62479085", "0.62412274", "0.62334985", "0.6225804", "0.6167...
0.0
-1
! The buffer module from node.js, for the browser.
function r(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function typedBuffer() {\n}", "function typedBuffer() {\n}", "function typedBuffer() {\n}", "function typedBuffer() {\n}", "function typedBuffer() {\n}", "function typedBuffer() {\n}", "function createBuffer() {\n var ptr = exports.hb_buffer_create();\n return {\n ptr: ptr,\n /**\n ...
[ "0.72852165", "0.72852165", "0.72852165", "0.72852165", "0.72852165", "0.72852165", "0.72427696", "0.72012025", "0.71085495", "0.7016613", "0.68976957", "0.6876286", "0.679885", "0.6771264", "0.67562115", "0.67562115", "0.67562115", "0.67562115", "0.67562115", "0.67562115", "...
0.0
-1
! ignore /! ignore
function i(t,e){const n=Number(e);if(isNaN(n))throw new r("number",e,t);return n}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ignore() { }", "get Ignore() {}", "set Ignore(value) {}", "function ignore() {\n return null\n}", "function ignore() {\n return null;\n}", "function ignore() {\n return null\n }", "function IGNORE() {\r\n //Do not delete.\r\n }", "function skip(){\n\t\n}", "function ign...
[ "0.8653394", "0.7446816", "0.7386236", "0.7235458", "0.7168867", "0.7022659", "0.67721653", "0.64045095", "0.6191315", "0.6140491", "0.6120082", "0.61128414", "0.6085999", "0.6049541", "0.6046634", "0.6044394", "0.600617", "0.5982768", "0.59775823", "0.59717566", "0.59364134"...
0.0
-1
! Date Query casting.
function u(t){return this.cast(t)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertDate() {\n // x.form['fromday-str'] = x.form['fromday'];\n // x.form['untilday-str'] = x.form['untilday'];\n if (x.form.hasOwnProperty(\"fromday\")) x.form['fromday'] = Math.abs(Date.parse(x.form['fromday']) / 1000);\n if (x.form.hasOwnProperty(\"untilday\")) x.form['untilday'] = Math.a...
[ "0.63135856", "0.60218096", "0.5958362", "0.5782361", "0.56866527", "0.5682221", "0.5674878", "0.5647385", "0.5588356", "0.55665404", "0.5559616", "0.5543852", "0.5538889", "0.5535527", "0.5533", "0.5524248", "0.5521169", "0.55160135", "0.5496343", "0.54722434", "0.5466093", ...
0.0
-1
! Internal helper for update, updateMany, updateOne
function h(t,e,n,r,i,o,c){return t.op=e,u.canMerge(n)&&t.merge(n),r&&t._mergeUpdate(r),s.isObject(i)&&t.setOptions(i),o||c?!t._update||!t.options.overwrite&&0===s.keys(t._update).length?(c&&s.soon(c.bind(null,null,0)),t):(i=t._optionsForExec(),c||(i.safe=!1),n=t._conditions,r=t._updateForExec(),a("update",t._collection.collectionName,n,r,i),c=t._wrapCallback(e,c,{conditions:n,doc:r,options:i}),t._collection[e](n,r,i,s.tick(c)),t):t}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(){}", "update(){}", "update(){}", "async update () {\n\t\t// do the update\n\t\tif (!this.ops) {\n\t\t\tthis.ops = {\n\t\t\t\t$set: this.attributes\n\t\t\t};\n\t\t\tdelete this.ops.$set.id;\n\t\t}\n\t\tthis.updateOp = await this.collection.applyOpById(\n\t\t\tthis.id,\n\t\t\tthis.ops,\n\t\t\t{ version...
[ "0.7033877", "0.7033877", "0.7033877", "0.6674613", "0.65501845", "0.65378743", "0.65124494", "0.6500941", "0.6498702", "0.64758044", "0.64499", "0.6436075", "0.6383846", "0.63816726", "0.6361778", "0.6350804", "0.63317055", "0.6253434", "0.6216551", "0.61959016", "0.6155909"...
0.5818969
85
! Returns the value passed to it.
function i(t){return t}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function value() { }", "get value() {}", "get value() {}", "_get_value() {\n return this._has_value() ? this._value : undefined;\n }", "GetValue()\n\t{\n\t\treturn this.value;\n\t}", "function GetValue(param)\r\n\t{\r\n\r\n\t}", "function getVal() {\n return 5;\n}", "function get(x) { return x; ...
[ "0.74821967", "0.745293", "0.745293", "0.7302565", "0.72826886", "0.6938265", "0.69131595", "0.68675154", "0.6835031", "0.6772233", "0.6737532", "0.67359936", "0.67350465", "0.6734898", "0.6691064", "0.6691064", "0.6691053", "0.6691053", "0.6691053", "0.6691053", "0.6691053",...
0.0
-1
! Ignore /! Removes listeners from parent
function y(t){if(null!=t&&null!=t._parent)for(const e in t._handlers)t._parent.removeListener(e,t._handlers[e])}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeListeners() {}", "removeListeners() {}", "removeListeners() {}", "detachListeners() {\n this.#outInterface.off('line', this.lineListener);\n this.#errInterface.off('line', this.errorListener);\n this.#child.off('exit', this.exitListener);\n this.#child.removeAllListeners('close');\n }", ...
[ "0.7566249", "0.7566249", "0.7566249", "0.73587704", "0.7239737", "0.72362185", "0.70446074", "0.7024819", "0.68826467", "0.68824977", "0.6870223", "0.6862425", "0.6849543", "0.68463", "0.6837777", "0.683191", "0.68318266", "0.68052083", "0.6768219", "0.6766341", "0.67645943"...
0.7062334
6
! ignore /! ignore
function y(t){h||(h=n(70));const e=function(t,e,n){const r=this;this.$parent=n,h.apply(this,arguments),n&&(n.on("save",function(){r.emit("save",r),r.constructor.emit("save",r)}),n.on("isNew",function(t){r.isNew=t,r.emit("isNew",t),r.constructor.emit("isNew",t)}))};(e.prototype=Object.create(h.prototype)).$__setSchema(t),e.prototype.constructor=e,e.schema=t,e.$isSingleNested=!0,e.prototype.toBSON=function(){return this.toObject(p)};for(const n in t.methods)e.prototype[n]=t.methods[n];for(const n in t.statics)e[n]=t.statics[n];for(const t in i.prototype)e[t]=i.prototype[t];return e}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ignore() { }", "get Ignore() {}", "set Ignore(value) {}", "function ignore() {\n return null\n}", "function ignore() {\n return null;\n}", "function ignore() {\n return null\n }", "function IGNORE() {\r\n //Do not delete.\r\n }", "function skip(){\n\t\n}", "function ign...
[ "0.8652147", "0.7446572", "0.73859835", "0.7234087", "0.7167445", "0.70217335", "0.67718285", "0.6404717", "0.61901206", "0.6141006", "0.611969", "0.6112831", "0.60844624", "0.60475874", "0.60462904", "0.60432476", "0.60051274", "0.5981711", "0.5976254", "0.5972818", "0.59356...
0.0
-1
! ignore /! Returns this documents _id cast to a string.
function r(){return null!=this._id?String(this._id):null}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function o(){return null!=this._id?String(this._id):null}", "toString() {\r\n\t\t\treturn 's' + this.idNum;\r\n\t\t}", "function n(){return null!=this._id?String(this._id):null}", "function n(){return null!=this._id?String(this._id):null}", "toString() {\n return this.id();\n }", "getId() {\n ...
[ "0.7108244", "0.7106047", "0.7063738", "0.7063738", "0.6905292", "0.6743027", "0.6708931", "0.6708931", "0.6708931", "0.6708931", "0.6708931", "0.6595603", "0.6582902", "0.6465702", "0.6418251", "0.6397523", "0.6375707", "0.62922573", "0.62424135", "0.6236174", "0.62212014", ...
0.74571913
0
function to generate a JSON web token from the user object we pass in
function generateToken(user) { return jwt.sign(user, process.env.SECRET, { expiresIn : 60*60*24 // in seconds }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createToken(user) {\n\tvar token = jsonwebToken.sign({\n\t\t_id: user._id,\n\t\tname: user.name,\n\t\tusername: user.username\n\t}, secretKey, {\n\t\texpiretesInMinute: 1440\n\t})\n\n\treturn token;\n}", "function generateToken (user) {\n var payload = {\n exp: moment.add(14, 'days').unix(),\n in...
[ "0.7900093", "0.7887839", "0.7876791", "0.7837659", "0.77515906", "0.7744988", "0.76834", "0.76323235", "0.76323235", "0.76162827", "0.76114887", "0.7597723", "0.75809175", "0.75688136", "0.756339", "0.7537657", "0.7534492", "0.7529682", "0.75286126", "0.7499811", "0.74983186...
0.7413354
38
We don't want to use the entire user object to sign our JWTs that's a lot of information to eventually store in a cookie. Plus, we don't want to be returning huge blocks of what could be sensitive user information. We need control. Let's create a function to select the user information we want to pass through
function setUserInfo(request) { return { _id: request._id, username: request.username, email: request.email }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function detectUser(user_data_object) {\n try {\n let [user] = await Admin.query().where({\n id: user_data_object.child_id,\n });\n if (!user) {\n [user] = await moderator.query().where({\n id: user_data_object.child_id,\n });\n if (!user) {\n [user] = await Teache...
[ "0.6256919", "0.6165934", "0.612771", "0.61237", "0.61176735", "0.6079125", "0.60630393", "0.60513335", "0.6019698", "0.6015317", "0.59884596", "0.59785044", "0.59489715", "0.594654", "0.5932744", "0.59269696", "0.5923711", "0.5921045", "0.5908859", "0.590842", "0.5906462", ...
0.0
-1
Verifies if FrameNodes retain and parse their data appropriately.
function test() { let { FrameNode } = devtools.require("devtools/shared/profiler/tree-model"); let { CATEGORY_OTHER } = devtools.require("devtools/shared/profiler/global"); let frame1 = new FrameNode("hello/<.world (http://foo/bar.js:123:987)", { location: "hello/<.world (http://foo/bar.js:123:987)", line: 456, isContent: FrameNode.isContent({ location: "hello/<.world (http://foo/bar.js:123:987)" }) }, false); is(frame1.getInfo().nodeType, "Frame", "The first frame node has the correct type."); is(frame1.getInfo().functionName, "hello/<.world", "The first frame node has the correct function name."); is(frame1.getInfo().fileName, "bar.js", "The first frame node has the correct file name."); is(frame1.getInfo().hostName, "foo", "The first frame node has the correct host name."); is(frame1.getInfo().url, "http://foo/bar.js", "The first frame node has the correct url."); is(frame1.getInfo().line, 123, "The first frame node has the correct line."); is(frame1.getInfo().column, 987, "The first frame node has the correct column."); is(frame1.getInfo().categoryData.toSource(), "({})", "The first frame node has the correct category data."); is(frame1.getInfo().isContent, true, "The first frame node has the correct content flag."); let frame2 = new FrameNode("hello/<.world (http://foo/bar.js#baz:123:987)", { location: "hello/<.world (http://foo/bar.js#baz:123:987)", line: 456, isContent: FrameNode.isContent({ location: "hello/<.world (http://foo/bar.js#baz:123:987)" }) }, false); is(frame2.getInfo().nodeType, "Frame", "The second frame node has the correct type."); is(frame2.getInfo().functionName, "hello/<.world", "The second frame node has the correct function name."); is(frame2.getInfo().fileName, "bar.js#baz", "The second frame node has the correct file name."); is(frame2.getInfo().hostName, "foo", "The second frame node has the correct host name."); is(frame2.getInfo().url, "http://foo/bar.js#baz", "The second frame node has the correct url."); is(frame2.getInfo().line, 123, "The second frame node has the correct line."); is(frame2.getInfo().column, 987, "The second frame node has the correct column."); is(frame2.getInfo().categoryData.toSource(), "({})", "The second frame node has the correct category data."); is(frame2.getInfo().isContent, true, "The second frame node has the correct content flag."); let frame3 = new FrameNode("hello/<.world (http://foo/#bar:123:987)", { location: "hello/<.world (http://foo/#bar:123:987)", line: 456, isContent: FrameNode.isContent({ location: "hello/<.world (http://foo/#bar:123:987)" }) }, false); is(frame3.getInfo().nodeType, "Frame", "The third frame node has the correct type."); is(frame3.getInfo().functionName, "hello/<.world", "The third frame node has the correct function name."); is(frame3.getInfo().fileName, "#bar", "The third frame node has the correct file name."); is(frame3.getInfo().hostName, "foo", "The third frame node has the correct host name."); is(frame3.getInfo().url, "http://foo/#bar", "The third frame node has the correct url."); is(frame3.getInfo().line, 123, "The third frame node has the correct line."); is(frame3.getInfo().column, 987, "The third frame node has the correct column."); is(frame3.getInfo().categoryData.toSource(), "({})", "The third frame node has the correct category data."); is(frame3.getInfo().isContent, true, "The third frame node has the correct content flag."); let frame4 = new FrameNode("hello/<.world (http://foo/:123:987)", { location: "hello/<.world (http://foo/:123:987)", line: 456, isContent: FrameNode.isContent({ location: "hello/<.world (http://foo/:123:987)" }) }, false); is(frame4.getInfo().nodeType, "Frame", "The fourth frame node has the correct type."); is(frame4.getInfo().functionName, "hello/<.world", "The fourth frame node has the correct function name."); is(frame4.getInfo().fileName, "/", "The fourth frame node has the correct file name."); is(frame4.getInfo().hostName, "foo", "The fourth frame node has the correct host name."); is(frame4.getInfo().url, "http://foo/", "The fourth frame node has the correct url."); is(frame4.getInfo().line, 123, "The fourth frame node has the correct line."); is(frame4.getInfo().column, 987, "The fourth frame node has the correct column."); is(frame4.getInfo().categoryData.toSource(), "({})", "The fourth frame node has the correct category data."); is(frame4.getInfo().isContent, true, "The fourth frame node has the correct content flag."); let frame5 = new FrameNode("hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)", { location: "hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)", line: 456, isContent: FrameNode.isContent({ location: "hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)" }) }, false); is(frame5.getInfo().nodeType, "Frame", "The fifth frame node has the correct type."); is(frame5.getInfo().functionName, "hello/<.world", "The fifth frame node has the correct function name."); is(frame5.getInfo().fileName, "baz.js", "The fifth frame node has the correct file name."); is(frame5.getInfo().hostName, "bar", "The fifth frame node has the correct host name."); is(frame5.getInfo().url, "http://bar/baz.js", "The fifth frame node has the correct url."); is(frame5.getInfo().line, 123, "The fifth frame node has the correct line."); is(frame5.getInfo().column, 987, "The fifth frame node has the correct column."); is(frame5.getInfo().categoryData.toSource(), "({})", "The fifth frame node has the correct category data."); is(frame5.getInfo().isContent, false, "The fifth frame node has the correct content flag."); let frame6 = new FrameNode("Foo::Bar::Baz", { location: "Foo::Bar::Baz", line: 456, category: CATEGORY_OTHER, isContent: FrameNode.isContent({ location: "Foo::Bar::Baz", category: CATEGORY_OTHER }) }, false); is(frame6.getInfo().nodeType, "Frame", "The sixth frame node has the correct type."); is(frame6.getInfo().functionName, "Foo::Bar::Baz", "The sixth frame node has the correct function name."); is(frame6.getInfo().fileName, null, "The sixth frame node has the correct file name."); is(frame6.getInfo().hostName, null, "The sixth frame node has the correct host name."); is(frame6.getInfo().url, null, "The sixth frame node has the correct url."); is(frame6.getInfo().line, 456, "The sixth frame node has the correct line."); is(frame6.getInfo().categoryData.abbrev, "other", "The sixth frame node has the correct category data."); is(frame6.getInfo().isContent, false, "The sixth frame node has the correct content flag."); let frame7 = new FrameNode("EnterJIT", { location: "EnterJIT", isContent: FrameNode.isContent({ location: "EnterJIT" }) }, false); is(frame7.getInfo().nodeType, "Frame", "The seventh frame node has the correct type."); is(frame7.getInfo().functionName, "EnterJIT", "The seventh frame node has the correct function name."); is(frame7.getInfo().fileName, null, "The seventh frame node has the correct file name."); is(frame7.getInfo().hostName, null, "The seventh frame node has the correct host name."); is(frame7.getInfo().url, null, "The seventh frame node has the correct url."); is(frame7.getInfo().line, null, "The seventh frame node has the correct line."); is(frame7.getInfo().column, null, "The seventh frame node has the correct column."); is(frame7.getInfo().categoryData.abbrev, "js", "The seventh frame node has the correct category data."); is(frame7.getInfo().isContent, false, "The seventh frame node has the correct content flag."); let frame8 = new FrameNode("chrome://browser/content/content.js", { location: "chrome://browser/content/content.js", line: 456, column: 123 }, false); is(frame8.getInfo().hostName, null, "The eighth frame node has the correct host name."); let frame9 = new FrameNode("hello/<.world (resource://gre/foo.js:123:434)", { location: "hello/<.world (resource://gre/foo.js:123:434)", line: 456 }, false); is(frame9.getInfo().hostName, null, "The ninth frame node has the correct host name."); finish(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hasUnsavedChanges() {\n for (let [key, node] of Object.entries(this._nodesStack)) {\n if (node.hasUnsavedChanges()) {\n return true;\n }\n }\n return false;\n }", "checkAlive() {\n\n\t\tlet currentFrame = this.#_augmentaScene.frame;\n\n\t\tfor(var id i...
[ "0.50392133", "0.49830282", "0.480903", "0.4806113", "0.47843248", "0.4759983", "0.47067067", "0.4679669", "0.46404475", "0.46131605", "0.46005794", "0.45839298", "0.45417598", "0.4516648", "0.45046744", "0.44876117", "0.44876117", "0.44740707", "0.4452664", "0.44363233", "0....
0.4883816
2
vm.createUser = createUser; vm.error = false;
function register(username,password,passwordRepeat) { if(validation(username,password,passwordRepeat)){ UserService .register(username, password) .then( function(response){ var user = response.data; if(user){ $location.url("/user/"+user._id); }else { vm.error = "Cannot register Now!" $("#username").css("background-color", "lightcoral"); $("#username").val("*Username Required"); } }, function (response) { vm.error =response.data; $("#username").css("background-color", "lightcoral"); $("#username").val("*Username Exists"); } ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userController(userService){\n //binding del controlador con el html, solo en el controlador\n var vm = this;\n\n vm.btnadd = true;\n vm.btnedit = false;\n\n vm.getUsers ={};\n\n vm.btnadd = true;\n vm.btnedit = false;\n loadUsers();\n\n function loadUsers(){\n userService....
[ "0.6621564", "0.6533209", "0.65287954", "0.6415041", "0.6400795", "0.639848", "0.6242367", "0.62074", "0.6167305", "0.61491203", "0.61230946", "0.61079973", "0.60985684", "0.6049556", "0.59877026", "0.59850955", "0.59449065", "0.5940444", "0.593028", "0.59275997", "0.5915416"...
0.62028384
8
The load process: Get the value Validate with the schema If upgrade is required, upgrade it
load(dataKey) { return __awaiter(this, void 0, void 0, function* () { const key = `${this.schema}/${dataKey}`; let value = yield this.loadItem(key); if (!value) { return undefined; } const schemaVer = SchemaUtils_1.SchemaUtils.ver(value.version).major; const latestVer = this.schemaRegistry.getLastVersion(this.schema); if (latestVer > schemaVer) { // data upgrade is needed const newValue = yield this.upgradeData(value, schemaVer, latestVer); yield this.saveItem(`${key}.${schemaVer}.bak`, newValue); yield this.saveItem(key, value); // Save back the upgraded value } return value; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get loadType() {}", "set loadType(value) {}", "function validateYupSchema(values,schema,sync,context){if(sync===void 0){sync=false;}if(context===void 0){context={};}var validateData=prepareDataForValidation(values);return schema[sync?'validateSync':'validate'](validateData,{abortEarly:false,context:context});}...
[ "0.51111925", "0.50718504", "0.4980221", "0.49248552", "0.48824722", "0.4878055", "0.48144794", "0.47584155", "0.47560233", "0.47282618", "0.47135982", "0.47014138", "0.46864286", "0.4670959", "0.46695036", "0.46513745", "0.46497405", "0.46280164", "0.46182457", "0.46181858", ...
0.6279358
0
Save process: Validate the value
save(key, val) { return __awaiter(this, void 0, void 0, function* () { this.schemaRegistry.validate(val); yield this.saveItem(key, val); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "save() {\n try{\n validateUserData()\n }catch(err) {\n \n }\n }", "function save() {\n validateFinanceCube();\n }", "function saveValidity()\r\n{\r\n\tupdateGateKpr(arrEntp[gArrayIndex]);\r\n}", "function onSave(type){\r\...
[ "0.68890053", "0.6775445", "0.6526655", "0.649317", "0.6380804", "0.6298428", "0.6252582", "0.6233055", "0.6195486", "0.6144762", "0.61402774", "0.61280507", "0.61095124", "0.6065495", "0.6036816", "0.60298526", "0.6008435", "0.59997404", "0.59970754", "0.5986393", "0.5961827...
0.55448174
70
called when location suggestion is clicked.
setLocation(event){ const get_started = this, updated_params = { zipcode: event.target.dataset.zipcode, suggestion: event.target.dataset.suggestion }; if (get_started.userApiValue('input_changed')) { get_started.showUpdateConfirmation(); const ui = { id: 'update_to_confirm', data: { type: 'location', params: updated_params } }; get_started.props.updateUI(ui); } else { get_started.setLocationConfirmed(updated_params); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onLocationClicked(){}", "onSuggestSelect({ label, location }) {\n this.props.onSuggest(label, location);\n this._geoSuggest.clear();\n }", "function onLocationFound(e) {\n onClick(e)\n}", "function selectedSuggestion(suggestionResult)\n {\n //document.getElementById('printoutPanel').innerHT...
[ "0.76117635", "0.73072565", "0.7094965", "0.6916108", "0.68464005", "0.6751825", "0.6746362", "0.67334753", "0.66997117", "0.6647827", "0.66275346", "0.65293723", "0.6416085", "0.6389459", "0.63424516", "0.6307688", "0.6306134", "0.63004565", "0.62713915", "0.62515354", "0.62...
0.63713294
14
called when input_location input changed.
setLocationSuggestions(event){ if (this.country_mode) return false; let display_location_mode = this.input_location_mode_changed ? this.input_location_mode : 1; let get_started = this, new_location = { input_location_mode: display_location_mode, input_location: event.target.value }; get_started.setState({ input_location: event.target.value, show_location_suggestions: true }); if (get_started.$set_location_suggestions){ clearTimeout(get_started.$set_location_suggestions); } // debounce location suggestions by 500ms. get_started.$set_location_suggestions = setTimeout(()=>{ CalculatorApi.getAutoComplete(new_location) .then((locations)=>{ get_started.setState({ locations: locations, show_location_suggestions: true }); }); }, 500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "LocationSelectChanged() {\n this.fieldsetElement.disabled = false;\n this.timezoneError.textContent = '';\n const value = this.locationSelectElement.options[this.locationSelectElement.selectedIndex].value;\n if (value === NonPresetOptions.NoOverride) {\n this.LocationOverride...
[ "0.6970966", "0.6907091", "0.676796", "0.6675062", "0.6498593", "0.6467904", "0.64392537", "0.6369615", "0.6338772", "0.62636656", "0.6185812", "0.618056", "0.6133366", "0.6103283", "0.61009306", "0.6074133", "0.60611576", "0.6058162", "0.6011542", "0.5968102", "0.59591824", ...
0.58751625
33
Income and Household Size UI
get input_income(){ return this.userApiValue('input_income'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showIncome(n) {\n console.log(\"\\n\"+archive[n].name+\" has generated: \"+(archive[n].price*archive[n].Clients.length)+\" USD\"+\"\\n\");\n}", "function incomeVisibility() {\n 'use strict';\n\n // Earned Income\n FBRun.vis.applyRule($('#p3'), employedInHousehold());\n\n // Pensions Incom...
[ "0.6062576", "0.5844187", "0.5822073", "0.57405657", "0.57292813", "0.57210386", "0.5707514", "0.56934345", "0.56642264", "0.5656131", "0.56139547", "0.56002456", "0.55953586", "0.5580501", "0.5535244", "0.552781", "0.55094194", "0.55021346", "0.55019397", "0.5500624", "0.549...
0.0
-1
Sets the origin so that floorplan is centered
resetOrigin() { var centerX = this.canvasElement.innerWidth() / 2.0; var centerY = this.canvasElement.innerHeight() / 2.0; var centerFloorplan = this.floorplan.getCenter(); this.originX = Dimensioning.cmToPixel(centerFloorplan.x) - centerX; this.originY = Dimensioning.cmToPixel(centerFloorplan.z) - centerY; this.unScaledOriginX = Dimensioning.cmToPixel(centerFloorplan.x, false) - centerX; this.unScaledOriginY = Dimensioning.cmToPixel(centerFloorplan.z, false) - centerY; // this.originX = centerFloorplan.x * this.pixelsPerCm - centerX; // this.originY = centerFloorplan.z * this.pixelsPerCm - centerY; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "recenter(origin = Vector.zero) {\n this.originX = origin.x;\n this.originY = origin.y;\n }", "function moveToOrigin() {\n if (visible) {\n ctx.translate(-((width / 2) - x(viewCenter.x)), -(-y(viewCenter.y) + (height / 2)));\n }\n }", "function setOrigin(ctx, axis) {...
[ "0.6963244", "0.68701035", "0.67081255", "0.65162814", "0.6457855", "0.6382377", "0.6355766", "0.6334865", "0.6326623", "0.624805", "0.6244178", "0.622014", "0.6214292", "0.6188106", "0.61551195", "0.6151244", "0.6120659", "0.61107975", "0.6072131", "0.6060452", "0.6059877", ...
0.81728476
0
Convert from THREEjs coords to canvas coords.
convertX(x) { return Dimensioning.cmToPixel(x - Dimensioning.pixelToCm(this.originX)); // return (x - (this.originX * this.cmPerPixel)) * this.pixelsPerCm; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "canvasToWorldCoordinates(p) {\r\n\t\tlet m = MathTools.inverseMatMul(this.camera.t, [\r\n\t\t\t[p.x-window.innerWidth/2+this.camera.x],\r\n\t\t\t[window.innerHeight-(p.y+window.innerHeight/2)+this.camera.y]\r\n\t\t])\r\n\t\treturn {\r\n\t\t\tx: m[0][0],\r\n\t\t\ty: m[1][0]\r\n\t\t}\r\n\t}", "function geoCoordsTo...
[ "0.6321145", "0.63092566", "0.62364954", "0.6133929", "0.6068068", "0.59580237", "0.5851667", "0.579865", "0.57922256", "0.5734497", "0.56963795", "0.5682346", "0.5590426", "0.55618817", "0.5530158", "0.55102015", "0.5456116", "0.54541487", "0.5451091", "0.5438286", "0.543604...
0.0
-1
Convert from THREEjs coords to canvas coords.
convertY(y) { return Dimensioning.cmToPixel(y - Dimensioning.pixelToCm(this.originY)); // return (y - (this.originY * this.cmPerPixel)) * this.pixelsPerCm; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "canvasToWorldCoordinates(p) {\r\n\t\tlet m = MathTools.inverseMatMul(this.camera.t, [\r\n\t\t\t[p.x-window.innerWidth/2+this.camera.x],\r\n\t\t\t[window.innerHeight-(p.y+window.innerHeight/2)+this.camera.y]\r\n\t\t])\r\n\t\treturn {\r\n\t\t\tx: m[0][0],\r\n\t\t\ty: m[1][0]\r\n\t\t}\r\n\t}", "function geoCoordsTo...
[ "0.6321145", "0.63092566", "0.62364954", "0.6133929", "0.6068068", "0.59580237", "0.5851667", "0.579865", "0.57922256", "0.5734497", "0.56963795", "0.5682346", "0.5590426", "0.55618817", "0.5530158", "0.55102015", "0.5456116", "0.54541487", "0.5451091", "0.5438286", "0.543604...
0.0
-1
Iterates the current array value and yields a binder node for every item.
*[Symbol.iterator]() { const array = this.valueOf(); const ItemModel = this[_ItemModel]; if (array.length !== this.itemModels.length) { this.itemModels.length = array.length; } for (const i of array.keys()) { let itemModel = this.itemModels[i]; if (!itemModel) { const [optional, ...rest] = this.itemModelArgs; itemModel = new ItemModel(this, i, optional, ...rest); this.itemModels[i] = itemModel; } yield getBinderNode(itemModel); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "*[Symbol.iterator]() {\n for (let node = this.first, position = 0; node; position++, node = node.next) {\n yield node.value;\n }\n }", "* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}", "*[Symbol.iterator]() {\n let values = this.values;\n ...
[ "0.59960055", "0.59519696", "0.5868421", "0.5701254", "0.5693932", "0.5630378", "0.5591889", "0.557498", "0.5558848", "0.55200684", "0.550839", "0.5439565", "0.5429936", "0.53422356", "0.5290209", "0.52881205", "0.52828795", "0.52828795", "0.5261787", "0.52565503", "0.5194202...
0.7023833
0
create a function/fuctions that collects the form values appends the values to the list of Adjectives make sure that the adjective is clickable make sure the list of adjectives is updated when a word is clicked on/ removed
function myFunc(event) { event.preventDefault() let word = document.createElement("li") word.textContent = form.field1.value; words.appendChild(word) //dynamic.textContent = form.field1.value; let dynamicWords = document.querySelectorAll("li") dynamicWords.forEach( word => { word.addEventListener("click", () => { dynamic.textContent = word.textContent; words.removeChild(word); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buttonListener()\n{\n event.preventDefault(); //do not reload\n\n //get all fields\n const myAdLib = document.getElementById( \"title_input\" ).value;\n const noun = document.getElementById( \"noun\" ).value;\n const verb = document.getElementById( \"verb\" ).value;\n const adjective = d...
[ "0.6291504", "0.6167496", "0.6037546", "0.6015859", "0.599327", "0.5981399", "0.59106576", "0.5880307", "0.58223295", "0.57768416", "0.57426405", "0.5727314", "0.572152", "0.56488866", "0.5647244", "0.56373197", "0.56308115", "0.55923796", "0.55520326", "0.55425507", "0.55364...
0.63710004
0
Display dog of wisdom
async function renderDog(options) { const styleElement = document.createElement("style"); styleElement.textContent = ` #dog { position: relative; box-shadow: 70px 10px 0 0 rgba(198,134,66,1), 80px 10px 0 0 rgba(198,134,66,1), 100px 10px 0 0 rgba(198,134,66,1), 70px 20px 0 0 rgba(198,134,66,1), 80px 20px 0 0 rgba(198,134,66,1), 90px 20px 0 0 rgba(198,134,66,1), 100px 20px 0 0 rgba(198,134,66,1), 110px 20px 0 0 rgba(198,134,66,1), 80px 30px 0 0 rgba(198,134,66,1), 90px 30px 0 0 #000000, 100px 30px 0 0 rgba(198,134,66,1), 110px 30px 0 0 rgba(198,134,66,1), 120px 30px 0 0 rgba(198,134,66,1), 130px 30px 0 0 #000000, 80px 40px 0 0 rgba(198,134,66,1), 90px 40px 0 0 rgba(198,134,66,1), 100px 40px 0 0 rgba(201,189,189,1), 110px 40px 0 0 rgba(201,189,189,1), 120px 40px 0 0 rgba(201,189,189,1), 130px 40px 0 0 rgba(201,189,189,1), 80px 50px 0 0 rgba(198,134,66,1), 90px 50px 0 0 rgba(201,189,189,1), 100px 50px 0 0 rgba(201,189,189,1), 110px 50px 0 0 rgba(201,189,189,1), 120px 50px 0 0 rgba(201,189,189,1), 80px 60px 0 0 rgba(198,134,66,1), 90px 60px 0 0 rgba(201,189,189,1), 100px 60px 0 0 rgba(201,189,189,1), 110px 60px 0 0 rgba(198,134,66,1), 80px 70px 0 0 rgba(198,134,66,1), 90px 70px 0 0 rgba(201,189,189,1), 100px 70px 0 0 rgba(201,189,189,1), 110px 70px 0 0 rgba(198,134,66,1), 80px 80px 0 0 rgba(198,134,66,1), 90px 80px 0 0 rgba(201,189,189,1), 100px 80px 0 0 rgba(201,189,189,1), 110px 80px 0 0 rgba(198,134,66,1), 80px 90px 0 0 rgba(198,134,66,1), 90px 90px 0 0 rgba(201,189,189,1), 100px 90px 0 0 rgba(201,189,189,1), 110px 90px 0 0 rgba(198,134,66,1), 70px 100px 0 0 rgba(198,134,66,1), 80px 100px 0 0 rgba(198,134,66,1), 90px 100px 0 0 rgba(201,189,189,1), 100px 100px 0 0 rgba(201,189,189,1), 110px 100px 0 0 rgba(198,134,66,1), 70px 110px 0 0 rgba(198,134,66,1), 80px 110px 0 0 rgba(198,134,66,1), 90px 110px 0 0 rgba(201,189,189,1), 100px 110px 0 0 rgba(201,189,189,1), 110px 110px 0 0 rgba(198,134,66,1), 60px 120px 0 0 rgba(198,134,66,1), 70px 120px 0 0 rgba(198,134,66,1), 80px 120px 0 0 rgba(198,134,66,1), 90px 120px 0 0 rgba(201,189,189,1), 100px 120px 0 0 rgba(201,189,189,1), 110px 120px 0 0 rgba(198,134,66,1), 120px 120px 0 0 rgba(198,134,66,1), 130px 120px 0 0 rgba(143,140,140,1), 140px 120px 0 0 rgba(143,140,140,1), 150px 120px 0 0 rgba(143,140,140,1), 30px 130px 0 0 rgba(143,140,140,1), 40px 130px 0 0 rgba(143,140,140,1), 50px 130px 0 0 rgba(143,140,140,1), 60px 130px 0 0 rgba(198,134,66,1), 70px 130px 0 0 rgba(198,134,66,1), 80px 130px 0 0 rgba(198,134,66,1), 90px 130px 0 0 rgba(201,189,189,1), 100px 130px 0 0 rgba(201,189,189,1), 110px 130px 0 0 rgba(198,134,66,1), 120px 130px 0 0 rgba(198,134,66,1), 130px 130px 0 0 rgba(232,232,232,1), 140px 130px 0 0 rgba(232,232,232,1), 150px 130px 0 0 rgba(232,232,232,1), 160px 130px 0 0 rgba(143,140,140,1), 20px 140px 0 0 rgba(143,140,140,1), 30px 140px 0 0 rgba(232,232,232,1), 40px 140px 0 0 rgba(232,232,232,1), 50px 140px 0 0 rgba(198,134,66,1), 60px 140px 0 0 rgba(232,232,232,1), 70px 140px 0 0 rgba(198,134,66,1), 80px 140px 0 0 rgba(232,232,232,1), 90px 140px 0 0 rgba(232,232,232,1), 100px 140px 0 0 rgba(232,232,232,1), 110px 140px 0 0 rgba(198,134,66,1), 120px 140px 0 0 rgba(232,232,232,1), 130px 140px 0 0 rgba(198,134,66,1), 140px 140px 0 0 rgba(201,189,189,1), 150px 140px 0 0 rgba(232,232,232,1), 160px 140px 0 0 rgba(232,232,232,1), 170px 140px 0 0 rgba(143,140,140,1), 10px 150px 0 0 rgba(143,140,140,1), 20px 150px 0 0 rgba(232,232,232,1), 30px 150px 0 0 rgba(232,232,232,1), 40px 150px 0 0 rgba(232,232,232,1), 50px 150px 0 0 rgba(201,189,189,1), 60px 150px 0 0 rgba(232,232,232,1), 70px 150px 0 0 rgba(201,189,189,1), 80px 150px 0 0 rgba(232,232,232,1), 90px 150px 0 0 rgba(232,232,232,1), 100px 150px 0 0 rgba(232,232,232,1), 110px 150px 0 0 rgba(201,189,189,1), 120px 150px 0 0 rgba(232,232,232,1), 130px 150px 0 0 rgba(232,232,232,1), 140px 150px 0 0 rgba(232,232,232,1), 150px 150px 0 0 rgba(232,232,232,1), 160px 150px 0 0 rgba(143,140,140,1), 170px 150px 0 0 rgba(143,140,140,1), 10px 160px 0 0 rgba(143,140,140,1), 20px 160px 0 0 rgba(232,232,232,1), 30px 160px 0 0 rgba(232,232,232,1), 40px 160px 0 0 rgba(232,232,232,1), 50px 160px 0 0 rgba(232,232,232,1), 60px 160px 0 0 rgba(232,232,232,1), 70px 160px 0 0 rgba(232,232,232,1), 80px 160px 0 0 rgba(232,232,232,1), 90px 160px 0 0 rgba(232,232,232,1), 100px 160px 0 0 rgba(232,232,232,1), 110px 160px 0 0 rgba(232,232,232,1), 120px 160px 0 0 rgba(232,232,232,1), 130px 160px 0 0 rgba(232,232,232,1), 140px 160px 0 0 rgba(143,140,140,1), 150px 160px 0 0 rgba(143,140,140,1), 160px 160px 0 0 rgba(232,232,232,1), 170px 160px 0 0 rgba(143,140,140,1), 10px 170px 0 0 rgba(143,140,140,1), 20px 170px 0 0 rgba(232,232,232,1), 30px 170px 0 0 rgba(232,232,232,1), 40px 170px 0 0 rgba(232,232,232,1), 50px 170px 0 0 rgba(232,232,232,1), 60px 170px 0 0 rgba(232,232,232,1), 70px 170px 0 0 rgba(232,232,232,1), 80px 170px 0 0 rgba(232,232,232,1), 90px 170px 0 0 rgba(232,232,232,1), 100px 170px 0 0 rgba(232,232,232,1), 110px 170px 0 0 rgba(232,232,232,1), 120px 170px 0 0 rgba(232,232,232,1), 130px 170px 0 0 rgba(232,232,232,1), 140px 170px 0 0 rgba(232,232,232,1), 150px 170px 0 0 rgba(232,232,232,1), 160px 170px 0 0 rgba(232,232,232,1), 170px 170px 0 0 rgba(143,140,140,1), 10px 180px 0 0 rgba(143,140,140,1), 20px 180px 0 0 rgba(232,232,232,1), 30px 180px 0 0 rgba(232,232,232,1), 40px 180px 0 0 rgba(232,232,232,1), 50px 180px 0 0 rgba(143,140,140,1), 60px 180px 0 0 rgba(232,232,232,1), 70px 180px 0 0 rgba(232,232,232,1), 80px 180px 0 0 rgba(232,232,232,1), 90px 180px 0 0 rgba(232,232,232,1), 100px 180px 0 0 rgba(232,232,232,1), 110px 180px 0 0 rgba(232,232,232,1), 120px 180px 0 0 rgba(232,232,232,1), 130px 180px 0 0 rgba(232,232,232,1), 140px 180px 0 0 rgba(232,232,232,1), 150px 180px 0 0 rgba(232,232,232,1), 160px 180px 0 0 rgba(143,140,140,1), 20px 190px 0 0 rgba(143,140,140,1), 30px 190px 0 0 rgba(143,140,140,1), 40px 190px 0 0 rgba(143,140,140,1), 50px 190px 0 0 rgba(232,232,232,1), 60px 190px 0 0 rgba(232,232,232,1), 70px 190px 0 0 rgba(232,232,232,1), 80px 190px 0 0 rgba(232,232,232,1), 90px 190px 0 0 rgba(232,232,232,1), 100px 190px 0 0 rgba(232,232,232,1), 110px 190px 0 0 rgba(232,232,232,1), 120px 190px 0 0 rgba(232,232,232,1), 130px 190px 0 0 rgba(232,232,232,1), 140px 190px 0 0 rgba(232,232,232,1), 150px 190px 0 0 rgba(232,232,232,1), 160px 190px 0 0 rgba(232,232,232,1), 170px 190px 0 0 rgba(143,140,140,1), 20px 200px 0 0 rgba(143,140,140,1), 30px 200px 0 0 rgba(232,232,232,1), 40px 200px 0 0 rgba(232,232,232,1), 50px 200px 0 0 rgba(232,232,232,1), 60px 200px 0 0 rgba(232,232,232,1), 70px 200px 0 0 rgba(232,232,232,1), 80px 200px 0 0 rgba(232,232,232,1), 90px 200px 0 0 rgba(232,232,232,1), 100px 200px 0 0 rgba(232,232,232,1), 110px 200px 0 0 rgba(232,232,232,1), 120px 200px 0 0 rgba(232,232,232,1), 130px 200px 0 0 rgba(232,232,232,1), 140px 200px 0 0 rgba(232,232,232,1), 150px 200px 0 0 rgba(232,232,232,1), 160px 200px 0 0 rgba(232,232,232,1), 170px 200px 0 0 rgba(143,140,140,1), 30px 210px 0 0 rgba(143,140,140,1), 40px 210px 0 0 rgba(232,232,232,1), 50px 210px 0 0 rgba(232,232,232,1), 60px 210px 0 0 rgba(232,232,232,1), 70px 210px 0 0 rgba(232,232,232,1), 80px 210px 0 0 rgba(143,140,140,1), 90px 210px 0 0 rgba(232,232,232,1), 100px 210px 0 0 rgba(232,232,232,1), 110px 210px 0 0 rgba(232,232,232,1), 120px 210px 0 0 rgba(232,232,232,1), 130px 210px 0 0 rgba(232,232,232,1), 140px 210px 0 0 rgba(232,232,232,1), 150px 210px 0 0 rgba(232,232,232,1), 160px 210px 0 0 rgba(232,232,232,1), 170px 210px 0 0 rgba(143,140,140,1), 30px 220px 0 0 rgba(143,140,140,1), 40px 220px 0 0 rgba(232,232,232,1), 50px 220px 0 0 rgba(232,232,232,1), 60px 220px 0 0 rgba(232,232,232,1), 70px 220px 0 0 rgba(232,232,232,1), 80px 220px 0 0 rgba(143,140,140,1), 90px 220px 0 0 rgba(232,232,232,1), 100px 220px 0 0 rgba(232,232,232,1), 110px 220px 0 0 rgba(232,232,232,1), 120px 220px 0 0 rgba(232,232,232,1), 130px 220px 0 0 rgba(143,140,140,1), 140px 220px 0 0 rgba(232,232,232,1), 150px 220px 0 0 rgba(232,232,232,1), 160px 220px 0 0 rgba(232,232,232,1), 170px 220px 0 0 rgba(143,140,140,1), 40px 230px 0 0 rgba(143,140,140,1), 50px 230px 0 0 rgba(232,232,232,1), 60px 230px 0 0 rgba(232,232,232,1), 70px 230px 0 0 rgba(232,232,232,1), 80px 230px 0 0 rgba(232,232,232,1), 90px 230px 0 0 rgba(143,140,140,1), 100px 230px 0 0 rgba(143,140,140,1), 110px 230px 0 0 rgba(143,140,140,1), 120px 230px 0 0 rgba(143,140,140,1), 130px 230px 0 0 rgba(232,232,232,1), 140px 230px 0 0 rgba(232,232,232,1), 150px 230px 0 0 rgba(232,232,232,1), 160px 230px 0 0 rgba(232,232,232,1), 170px 230px 0 0 rgba(143,140,140,1), 50px 240px 0 0 rgba(143,140,140,1), 60px 240px 0 0 rgba(143,140,140,1), 70px 240px 0 0 rgba(143,140,140,1), 80px 240px 0 0 rgba(143,140,140,1), 90px 240px 0 0 rgba(232,232,232,1), 100px 240px 0 0 rgba(232,232,232,1), 110px 240px 0 0 rgba(232,232,232,1), 120px 240px 0 0 rgba(232,232,232,1), 130px 240px 0 0 rgba(232,232,232,1), 140px 240px 0 0 rgba(232,232,232,1), 150px 240px 0 0 rgba(143,140,140,1), 160px 240px 0 0 rgba(143,140,140,1), 90px 250px 0 0 rgba(143,140,140,1), 100px 250px 0 0 rgba(143,140,140,1), 110px 250px 0 0 rgba(143,140,140,1), 120px 250px 0 0 rgba(143,140,140,1), 130px 250px 0 0 rgba(143,140,140,1), 140px 250px 0 0 rgba(143,140,140,1); height: 10.5px; width: 10.5px; margin-top: 0px; margin-bottom: 300px; margin-left: -10px; } `; document.head.appendChild(styleElement); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDogTemplate(dog) {\n /* This gets the information but does not work for nulls, would have to implement loops and format correctly\n console.log(dog.shows[0].location);\n console.log(dog.shows[0].medals[0].title);\n return `<li>${dog.name} - ${dog.description} - ${dog.breed} - ${dog.shows[0...
[ "0.68896824", "0.668071", "0.66536146", "0.6564212", "0.65638226", "0.64804375", "0.6476078", "0.6460854", "0.645515", "0.6359697", "0.63347614", "0.6293919", "0.6204158", "0.617158", "0.6086753", "0.60790515", "0.6055192", "0.6055192", "0.6045834", "0.6032376", "0.6029511", ...
0.0
-1
Include fade and show method in my library
function ourJquery(elements){ this.elements = elements; this.on = function(eventName, f){ for (let i = 0; i < this.elements.length; i++) { this.elements[i].addEventListener(eventName, f); } return this; } this.addClass = function(name){ for (let i = 0; i < this.elements.length; i++) { this.elements[i].classList.add(name); } return this; } this.removeClass = function(name){ for (let i = 0; i < this.elements.length; i++) { this.elements[i].classList.remove(name); } return this; } this.html = function(html){ if(typeof(html) ==='undefined'){ return this.elements[0].innerHTML; } for (let i = 0; i < this.elements.length; i++){ this.elements[i].innerHTML = html; } return this; } this.fade = function(t, f) { for (let i = 0; i < this.elements.length; i++) { this.elements[i].addEventListener('click', function(){ fade(this, t, f); }); } return this; } this.hide = function(){ for (let i = 0; i < this.elements.length; i++) { this.elements[i].style.display = 'none'; } return this; } this.show = function(){ for (let i = 0; i < this.elements.length; i++) { this.elements[i].style.display = 'block'; } return this; } this.click = function(f) { this.f = f; for (let i = 0; i < this.elements.length; i++) { this.elements[i].addEventListener('click', f); } return this; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function show() {\n\t var time = arguments.length <= 0 || arguments[0] === undefined ? 200 : arguments[0];\n\t\n\t this.transition().duration(time).style('opacity', 1);\n\t }", "show() {\n css(document.body, {\n opacity: 1,\n animation: 'none'\n });\n this....
[ "0.75376755", "0.73079294", "0.7169497", "0.7160678", "0.7085705", "0.70742327", "0.7014087", "0.7000536", "0.6939595", "0.6933693", "0.6855245", "0.68315166", "0.67445904", "0.6693928", "0.6691486", "0.6676829", "0.66531414", "0.66396374", "0.6639126", "0.6634664", "0.661656...
0.0
-1
That metods checks if someone has written obj instanceof Person
static [Symbol.hasInstance](obj) { return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is(type, obj) {\n \treturn objectType(obj) === type;\n }", "function is(obj, type) {\n return typeof obj === type;\n }", "function is(obj, type) {\n return typeof obj === type;\n }", "function is( obj, type ) {\n return typeof obj === type;\n }", "function is( obj, type )...
[ "0.7082793", "0.69942194", "0.69942194", "0.69892055", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614", "0.69667614",...
0.0
-1
Instead of [object Object]
get [Symbol.toStringTag]() { return Person; // Returns [object Person] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function e(A){return null==A?\"\":\"object\"==typeof A?JSON.stringify(A,null,2):String(A)}", "function obj(objec){\nreturn objec;\n}", "function ro(t){return Object.prototype.toString.call(t)===\"[object Object]\"}", "function o(e){return e&&\"object\"==typeof e&&!Array.isArray(e)}", "objd(obj) {\n\n ...
[ "0.66159385", "0.6598941", "0.65987206", "0.655291", "0.6509143", "0.6467227", "0.6466849", "0.64547175", "0.64215934", "0.64211017", "0.6406228", "0.6406228", "0.6406228", "0.63902116", "0.6344434", "0.6344434", "0.63356024", "0.63175327", "0.63175327", "0.6288995", "0.62711...
0.0
-1
When js tries to convert obj to primitive value e.g. String employee + "some string"
[Symbol.toPrimitive]() { return this.sayHello(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function coercePrimitiveToObject(obj) {\n if(isPrimitiveType(obj)) {\n obj = object(obj);\n }\n if(noKeysInStringObjects && isString(obj)) {\n forceStringCoercion(obj);\n }\n return obj;\n }", "function getObjValue(obj){\n\tswitch(getType(obj)){\n\t\tcase \"number\":\n\t\tcase \...
[ "0.7187065", "0.67569697", "0.6425605", "0.6368825", "0.63613397", "0.633806", "0.63107574", "0.62271416", "0.61952853", "0.6169306", "0.6162352", "0.6143464", "0.6143464", "0.60651433", "0.6045882", "0.6045882", "0.6045882", "0.6045882", "0.6045882", "0.6045882", "0.6045882"...
0.0
-1
public method to stop watching all of the instance target elements for visibility changes
destroy() { this.instance.disconnect(); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stopHides(){\n\n\t\t\t// containing element.\n\t\t\tvar sel = this.$refs.hidables || this.$el;\n\t\t\tvar hideElms = sel.querySelectorAll('.hidable');\n\t\t\tif (!hideElms) return;\n\n\t\t\t// remove event listeners.\n\t\t\tfor( let i = hideElms.length-1; i>= 0; i--) {\n\n\t\t\t\tvar h = hideElms[i];\n\n\t\t\t\th....
[ "0.7124831", "0.6957715", "0.65686077", "0.62781113", "0.6217269", "0.6103131", "0.6100018", "0.607912", "0.60761625", "0.60573286", "0.60523576", "0.60389674", "0.6031797", "0.5996578", "0.5996578", "0.5996578", "0.59733784", "0.59409344", "0.59361076", "0.59361076", "0.5915...
0.0
-1
Initialize the typing tutor
function init() { // Get all necessary HTML elements for (var elementID in my.html) { my.html[elementID] = document.getElementById(elementID) } // Get user settings resetSettings() loadSettings() // Initialize the user interface showPracticePanelWrapper() updateUnitFromURL() hideGuide() // Event handlers window.onhashchange = processURLChange my.html.input.onkeyup = updatePracticePane guideLink.onclick = toggleGuide }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initTypedJs() {\r\n new Typed(\".typed\", {\r\n strings: [\"A Coder.\",\"Frontend.\", \"Analytical.\", \"A Web Developer.\", \"A Gamer.\"],\r\n typeSpeed: 85,\r\n loop: true,\r\n });\r\n}", "function init() {\r\n const txtElement = document.querySelector('.txt-type');\r\n co...
[ "0.73594135", "0.71510375", "0.6862224", "0.65771204", "0.62815624", "0.61259204", "0.61259204", "0.61259204", "0.61259204", "0.61259204", "0.61259204", "0.61259204", "0.61259204", "0.61259204", "0.61259204", "0.6108672", "0.609411", "0.6074737", "0.6069408", "0.605327", "0.6...
0.0
-1
Set the logging function to be called to write logs. Argument: logFunction Logging function
function setLogFunction(logFunction) { my.logFunction = logFunction }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setLog(log) {\n module.exports.log = typeof log === 'function' ? log : null;\n }", "log(message) {\n this.loggingFunction(message);\n }", "function log() {\n //log here\n }", "function log()\n {\n if (my.logFunction == null)\n return\n\n var meta = ['...
[ "0.68975186", "0.67589045", "0.6642748", "0.6397973", "0.63949114", "0.6261316", "0.62445617", "0.6176604", "0.61177546", "0.6078538", "0.60657465", "0.59924805", "0.5958662", "0.5945363", "0.58728874", "0.58673686", "0.5862124", "0.58538395", "0.58296937", "0.58278614", "0.5...
0.8587265
0
Write logs via a configured logging function. Arguments: key, value, ... An even number of string arguments
function log() { if (my.logFunction == null) return var meta = ['name', 'QuickQWERTY'] var data = Array.prototype.slice.call(arguments) my.logFunction.apply(this, meta.concat(data)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function log() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i - 0] = arguments[_i];\n }\n if (!args.length) {\n return;\n }\n var id = args[0] + '';\n var fn = logMap[id];\n if (fn) {\n fn.apply(void 0, args.slice(1));\n }\n else {\...
[ "0.67879707", "0.6533823", "0.6361992", "0.6361992", "0.6291028", "0.6206539", "0.619093", "0.61777097", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0.61760527", "0....
0.6722094
1
Reset the user settings in my.settings to default values.
function resetSettings() { my.settings.unit = my.UNIT.MAIN }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetSettings() {\n let ns = Connector.getNamespace().toLowerCase();\n\n let removeSettings = st => {\n let us = st.userSettings;\n if (us) {\n let o = JSON.parse(us);\n delete o[ns];\n st.userSett...
[ "0.77598494", "0.7392073", "0.7301513", "0.7296523", "0.719829", "0.70321774", "0.6965988", "0.67659426", "0.6680002", "0.66172194", "0.66172194", "0.6614615", "0.6613346", "0.6611796", "0.65568125", "0.64913183", "0.64834046", "0.64734983", "0.6391904", "0.6391904", "0.63799...
0.72418845
4
Load settings from local storage to my.settings object.
function loadSettings() { if (typeof localStorage.unit != 'undefined') { my.settings.unit = localStorage.unit } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setFromLocal () {\n _.each(settings, (v, k) => {\n var value = localStorage.getItem(k);\n if (value) {\n settings[k] = JSON.parse(value);\n }\n });\n}", "static load() { return JSON.parse(window.localStorage.getItem('settings')) || {}; }", "function loadSettings()...
[ "0.8117892", "0.7734274", "0.7706927", "0.7586188", "0.73927504", "0.7311781", "0.7292711", "0.7158328", "0.7084832", "0.7049127", "0.691942", "0.67259115", "0.6705844", "0.66738683", "0.66423076", "0.6636781", "0.6593012", "0.65749013", "0.65747625", "0.6559844", "0.65414655...
0.77185714
2
Return unit number m. Argument: m Unit number Return: Unit object
function unit(m) { if (alternateUnitAvailable(m) && my.settings.unit == my.UNIT.ALTERNATE) { return Units.alternate[m - Units.alternateStart] } else { return Units.main[m - 1] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function m(t, n, r) {\n return t.units[n][r];\n }", "get unit () {\n\t\treturn this._unit;\n\t}", "function calculateUnitValue(i) {\n\tif (getUnit(i) === \"in\") return 1;\n\telse if (getUnit(i) === \"cm\") return .3937;\n\telse return 0;\n}", "get unit() {\n\t\treturn this.__unit;\n\t}", "func...
[ "0.70042497", "0.68661445", "0.68420166", "0.6795911", "0.6646663", "0.66201526", "0.6605138", "0.6602586", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6594072", "0.6593717", "0.65248364", "0.65179926...
0.78354245
0
Return true if an alternate unit is available for unit number m. Argument: m Unit number Return: true if an alternate unit is available; false otherwise
function alternateUnitAvailable(m) { if (m >= Units.alternateStart && m < Units.alternateStart + Units.alternate.length) { return true } else { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unit(m)\n {\n if (alternateUnitAvailable(m) &&\n my.settings.unit == my.UNIT.ALTERNATE) {\n return Units.alternate[m - Units.alternateStart]\n } else {\n return Units.main[m - 1]\n }\n }", "metricTypeMatching (unitType, unitTypeTo) {\n switc...
[ "0.7132564", "0.5845576", "0.5764157", "0.5596584", "0.5589817", "0.55570203", "0.5511924", "0.54607326", "0.5388938", "0.53454024", "0.5287075", "0.5208508", "0.519486", "0.51917964", "0.5117975", "0.50865567", "0.50762963", "0.5061085", "0.5053876", "0.50512236", "0.5026597...
0.8651971
0
Display the unit links
function displayUnitLinks() { // Delete all existing unit links var linksDiv = my.html.unitLinks Util.removeChildren(linksDiv) // Create new unit links for (var i = 0; i < Units.main.length; i++) { var label = 'སློབ་མཚན། ' + (i + 1) var selected = (i + 1 == my.current.unitNo) var href = unitHref(i + 1) var divElement = boxedLink(label, selected, href) divElement.id = 'unit' + (i + 1) divElement.title = unit(i + 1).title linksDiv.appendChild(divElement) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySubunitLinks()\n {\n // Delete all existing subunit links\n var linksDiv = my.html.subunitLinks\n while (linksDiv.firstChild &&\n linksDiv.firstChild.className != 'stretch') {\n\n linksDiv.removeChild(linksDiv.firstChild)\n }\n\n // Cre...
[ "0.7937359", "0.7711603", "0.64367145", "0.6167931", "0.614548", "0.61015666", "0.60523754", "0.5939187", "0.5838429", "0.5720863", "0.56588864", "0.55833983", "0.55783045", "0.5575401", "0.55705994", "0.5568032", "0.55376863", "0.55354947", "0.5526451", "0.5490971", "0.54887...
0.89430076
0
Create an HTML div element containing a label if the div element is specified as selected, and/or a hyperlink if the div element is specified as not selected. Arguments: label Label to be displayed inside the div element selected Whether the div element should be marked selected href Fragment identifier for the link to be created clickHandler Function to be invoked when the link is clicked Return: HTML div element with the label and/or link
function boxedLink(label, selected, href, clickHandler) { var divElement = document.createElement('div') if (selected) { var spanElement = document.createElement('span') Util.addChildren(spanElement, label) divElement.appendChild(spanElement) divElement.className = 'selected' } else { var anchorElement = document.createElement('a') anchorElement.href = href Util.addChildren(anchorElement, label) if (typeof clickHandler != 'undefined') { anchorElement.onclick = clickHandler } divElement.appendChild(anchorElement) } return divElement }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formAnchorHtml(href, label) {\r\n\treturn \"<div class='linkContainer'>\" + label + \": <a href='\" + href + \"' target='_blank'>\" + href + \"</a></div>\";\r\n}", "function createLink(label,link){\n var newLink=$(\"<a>\", {\n title: label,\n href: link,\n class: ...
[ "0.6615223", "0.60973525", "0.5916459", "0.58006585", "0.55518717", "0.5511999", "0.5477806", "0.5327929", "0.5247053", "0.52089906", "0.5196766", "0.51823187", "0.51765573", "0.51503855", "0.5128251", "0.5105734", "0.5094164", "0.5088068", "0.5087811", "0.5085603", "0.507770...
0.7782364
0
Return fragment identifier to be used in URL for the specified unit and subunit. Arguments: m Unit number (number) n Subunit number (number) Return value: Fragment identifier to be used in URL (string)
function unitHref(m, n) { if (typeof m == 'undefined') { return '' } else if (typeof n == 'undefined') { return '#' + m } else { return '#' + m + '.' + n } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_fragment( url ) {\n return url.replace( re_fragment, '$2' );\n }", "function updateUnitFromURL()\n {\n // Default lesson is Unit 1.1\n var unitNo = 1\n var subunitNo = 1\n\n // Parse the fragment identifier in the URL and determine the\n // unit\n if ...
[ "0.59477466", "0.593649", "0.5595272", "0.5579261", "0.5552435", "0.5512202", "0.5512202", "0.5512202", "0.5494468", "0.5494468", "0.5205885", "0.51779586", "0.51635396", "0.511326", "0.5038234", "0.49963725", "0.49533242", "0.49533242", "0.4853974", "0.48509097", "0.48320642...
0.6636278
0
Process the current URL and perform appropriate tasks. This function is called automatically when the fragment identifier in the current URL changes.
function processURLChange() { switch(window.location.hash) { case '#restart': currentSubunit() break case '#previous': previousSubunit() break case '#next': nextSubunit() break default: updateUnitFromURL() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processURL() {\n\t\t\tlet urlParams = {};\n\t\t\t// Get URL params - split em up - loop over them - fill urlParams object\n\t\t\twindow.location.search\n\t\t\t\t.replace('?', '')\n\t\t\t\t.split('&')\n\t\t\t\t.forEach(chunks => {\n\t\t\t\t\tlet kv = chunks.split('=');\n\t\t\t\t\turlParams[kv[0]] = kv[1];\n\t\t\t\t...
[ "0.6454162", "0.6398715", "0.61943847", "0.6142036", "0.61398184", "0.6094532", "0.6076581", "0.603019", "0.5881091", "0.5881091", "0.58692473", "0.58692473", "0.58692473", "0.58502096", "0.5821408", "0.5806132", "0.5700259", "0.56412446", "0.5632201", "0.5630265", "0.5624022...
0.67682683
0
Go to current subunit.
function currentSubunit() { var m = my.current.unitNo var n = my.current.subunitNo window.location.href = unitHref(m, n) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheLastSubunit()) {\n if (n == my.current.subunitTitles.length) {\n // If the user is at unit M.L where L is the last\n // subunit of unit ...
[ "0.7053677", "0.6360854", "0.6329819", "0.60506517", "0.59753084", "0.5795796", "0.57329166", "0.570666", "0.5690685", "0.5668464", "0.5607941", "0.5563058", "0.55586433", "0.5523618", "0.55072564", "0.55072564", "0.55072564", "0.55072564", "0.55072564", "0.5503803", "0.54995...
0.75363404
0
Check if the current unit is the first subunit among all the subunits. Return: true if the current subunit is the first subunit; false otherwise
function currentSubunitIsTheFirstSubunit() { return my.current.unitNo == 1 && my.current.subunitNo == 1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function currentSubunitIsTheLastSubunit()\n {\n return my.current.unitNo == Units.main.length &&\n my.current.subunitNo == my.current.subunitTitles.length\n }", "function isFirstChild(subtree){\n var par = subtree.parent;\n if (par.children[0] === subtree) {\n return true;\n }\n}...
[ "0.6750091", "0.59201705", "0.5856817", "0.56979275", "0.5572986", "0.5389489", "0.52738553", "0.5268939", "0.5255774", "0.5230735", "0.5198978", "0.5186373", "0.51727164", "0.51307213", "0.51191735", "0.51138365", "0.5085178", "0.5050002", "0.50461066", "0.5044285", "0.50414...
0.8978072
0
Check if the current subunit is the last subunit among all the subunits. Return: true if the current subunit is the last subunit; false otherwise
function currentSubunitIsTheLastSubunit() { return my.current.unitNo == Units.main.length && my.current.subunitNo == my.current.subunitTitles.length }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function currentSubunitIsTheFirstSubunit()\n {\n return my.current.unitNo == 1 && my.current.subunitNo == 1\n }", "function isLast(idx) {\n const parent = inArr[idx][1];\n for (let i = idx + 1; i < inArr.length; i++) {\n if (inArr[i][1] === parent) {\n return false;\n ...
[ "0.7374074", "0.6813333", "0.6345423", "0.634049", "0.62572867", "0.61544603", "0.60059303", "0.5926182", "0.58705175", "0.57863706", "0.5739082", "0.5722547", "0.56428087", "0.56001955", "0.5597021", "0.55936736", "0.5565375", "0.5556319", "0.5512312", "0.53971046", "0.53872...
0.8845541
0
Go to previous subunit. Do nothing if the user is already at the first subunit of the first unit.
function previousSubunit() { var m = my.current.unitNo var n = my.current.subunitNo if (!currentSubunitIsTheFirstSubunit()) { if (n == 1) { // If the user is at unit M.1, go to unit (M - 1).L // where L is the last subunit of the previous unit. previousUnit = unit(m - 1) var previousSubunitTitles = [] for (var subunitTitle in previousUnit.subunits) { previousSubunitTitles.push(subunitTitle) } m-- n = previousSubunitTitles.length } else { // If the user is at unit M.N, go to unit M.(N - 1) n-- } } window.location.href = unitHref(m, n) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gotoPrevious() {\n\tif(typeof previousInventory !== 'undefined') {\n\t\tnextInventory = currentInventory;\n\t\tcurrentInventory = previousInventory;\n\t\tpreviousInventory = undefined;\n\t}\n}", "function nextSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n ...
[ "0.6854732", "0.6815929", "0.658525", "0.64508104", "0.640415", "0.63642716", "0.63620764", "0.63244075", "0.63183886", "0.62671536", "0.62564474", "0.6256289", "0.62429714", "0.6223968", "0.62040365", "0.61888427", "0.6183852", "0.61303896", "0.6111446", "0.60822654", "0.608...
0.8497916
0
Go to next subunit. Do nothing if the user is already at the last subunit of the last unit.
function nextSubunit() { var m = my.current.unitNo var n = my.current.subunitNo if (!currentSubunitIsTheLastSubunit()) { if (n == my.current.subunitTitles.length) { // If the user is at unit M.L where L is the last // subunit of unit M, then go to unit (M + 1).1. m++ n = 1 } else { // If the user is at unit M.N, then go to unit M.(N + 1). n++ } } window.location.href = unitHref(m, n) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function previousSubunit()\n {\n var m = my.current.unitNo\n var n = my.current.subunitNo\n\n if (!currentSubunitIsTheFirstSubunit()) {\n if (n == 1) {\n // If the user is at unit M.1, go to unit (M - 1).L\n // where L is the last subunit of the prev...
[ "0.7028668", "0.6967198", "0.6539519", "0.6401484", "0.5965367", "0.5732943", "0.5724467", "0.5700484", "0.5699314", "0.5635313", "0.5633174", "0.55105114", "0.545854", "0.54373163", "0.54054415", "0.5392803", "0.5353802", "0.53360796", "0.53306997", "0.53289", "0.53122544", ...
0.8740801
0
Hide typing guide if it is already displayed. Show typing guide if it is hidden.
function toggleGuide() { if (guide.style.display == 'none') { return showGuide() } else { return hideGuide() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hide_hint() {\n if ($scope.game_phase != 'not_yet_started') {\n var e = document.getElementById(\"hint_place\");\n e.style.lineHeight = \"18px\";\n e.innerHTML = '<font size=\"4px\" color=\"silver\"><p style=\"margin-bottom:5px;\">Spell a word that stands for follow...
[ "0.6340579", "0.6127379", "0.60292417", "0.5987002", "0.5872119", "0.586161", "0.5815526", "0.58124846", "0.5804741", "0.57497424", "0.57265455", "0.5712717", "0.570757", "0.56902885", "0.5660071", "0.5658868", "0.5631551", "0.5612249", "0.56083035", "0.55885494", "0.5577206"...
0.596534
4
Parse the current URL and determine the current unit and subunit numbers, and display the determined subunit. The fragment identifier in the URL may contain the current unit and subunit numbers in m.n format where m is the current unit number and n is the current subunit number. If the fragment identifier is absent, then the current unit is 1 and the current subunit is 1. If the fragment identifier is a single integer m only, then the current unit is m and the current subunit is 1. The following is a list of example URLs along with the unit number they translate to. Unit 1.1 Unit 5.1 Unit 5.1 Unit 5.2
function updateUnitFromURL() { // Default lesson is Unit 1.1 var unitNo = 1 var subunitNo = 1 // Parse the fragment identifier in the URL and determine the // unit if (window.location.hash.length > 0) { var fragmentID = window.location.hash.slice(1) var tokens = fragmentID.split('.') unitNo = parseInt(tokens[0]) if (tokens.length > 1) subunitNo = parseInt(tokens[1]) } // Default to unit 1 if unit number could not be parsed // correctly from the URL if (isNaN(unitNo)) { unitNo = 1 } // Default to subunit 1 if unit number could not be parsed // correctly from the URL if (isNaN(subunitNo)) { subunitNo = 1 } setSubunit(unitNo, subunitNo) displayUnitLinks() displaySubunitLinks() displayAlternateUnitLinks() updateNavigationLinks() updateProgressTooltip() displayUnitTitle() displayGuide() resetSubunit() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processURLChange()\n {\n switch(window.location.hash) {\n\n case '#restart':\n currentSubunit()\n break\n\n case '#previous':\n previousSubunit()\n break\n\n case '#next':\n nextSubunit()\...
[ "0.57399017", "0.55339396", "0.55089235", "0.5478526", "0.5245436", "0.52014214", "0.51806206", "0.51796454", "0.51796454", "0.51796454", "0.51796454", "0.5109641", "0.5109641", "0.51018316", "0.5095522", "0.5089784", "0.5089784", "0.5089784", "0.50066376", "0.49780166", "0.4...
0.7518052
0
Update the visibility of the navigation links to the previous and the next subunits. Hide the link to the previous subunit when the user is at the first subunit. Hide the link to the next subunit when the user is already at the last subunit. Display both links otherwise.
function updateNavigationLinks() { if (currentSubunitIsTheFirstSubunit()) { my.html.previousLink.style.visibility = 'hidden' my.html.nextLink.style.visibility = 'visible' } else if (currentSubunitIsTheLastSubunit()) { my.html.previousLink.style.visibility = 'visible' my.html.nextLink.style.visibility = 'hidden' } else { my.html.previousLink.style.visibility = 'visible' my.html.nextLink.style.visibility = 'visible' } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySubunitLinks()\n {\n // Delete all existing subunit links\n var linksDiv = my.html.subunitLinks\n while (linksDiv.firstChild &&\n linksDiv.firstChild.className != 'stretch') {\n\n linksDiv.removeChild(linksDiv.firstChild)\n }\n\n // Cre...
[ "0.6815112", "0.6497733", "0.6421594", "0.63802665", "0.6369621", "0.6159566", "0.59982234", "0.5988072", "0.5962577", "0.5941914", "0.59193903", "0.57708377", "0.5681644", "0.56591916", "0.5647338", "0.5598288", "0.55446005", "0.5538505", "0.5519809", "0.5513127", "0.5512945...
0.8930255
0
Display the number of characters in the current lesson as a tooltip for progress bar and progress percent.
function updateProgressTooltip() { my.html.progress.title = 'This lesson contains ' + my.current.subunitText.length + ' characters.' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getText()\n\t{\n\t\tif (that.showUsed)\n\t\t\treturn \"Tries used: \" + that.current;\n\t\telse\n\t\t\treturn \"Tries left: \" + (that.maximum - that.current);\n\t}", "function progressCounter() {\n return document.getElementById(\"counter\").innerHTML =\n `Score: ${questionCount}/12`;\n}", ...
[ "0.63974106", "0.63857794", "0.6294473", "0.608395", "0.60486114", "0.60395604", "0.60382754", "0.6016912", "0.6004261", "0.5978744", "0.59687585", "0.5904694", "0.589417", "0.5893446", "0.5883062", "0.58821046", "0.5881417", "0.58747065", "0.5828251", "0.5799645", "0.5796174...
0.7974769
0
Display alternate unit links for units which alternate units are available. Display nothing otherwise.
function displayAlternateUnitLinks() { // If alternate unit is not available for the current unit, // hide the alternate links element if (!alternateUnitAvailable(my.current.unitNo)) { alternateUnitLinks.style.visibility = 'hidden' return } // Delete all existing alternate unit links Util.removeChildren(alternateUnitLinks) // Create div elements for the main unit and alternate unit var mainUnitElement = boxedLink(Units.mainLabel, my.settings.unit == my.UNIT.MAIN, '#', toggleUnit) var alternateUnitElement = boxedLink(Units.alternateLabel, my.settings.unit == my.UNIT.ALTERNATE, '#', toggleUnit) alternateUnitLinks.appendChild(mainUnitElement) alternateUnitLinks.appendChild(alternateUnitElement) alternateUnitLinks.style.visibility = 'visible' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayUnitLinks()\n {\n // Delete all existing unit links\n var linksDiv = my.html.unitLinks\n Util.removeChildren(linksDiv)\n\n // Create new unit links\n for (var i = 0; i < Units.main.length; i++) {\n var label = 'སློབ་མཚན། ' + (i + 1)\n var ...
[ "0.77809185", "0.7369583", "0.58161587", "0.5763911", "0.56235474", "0.55743605", "0.54173905", "0.51850575", "0.5181195", "0.51405776", "0.5051855", "0.49769798", "0.4955198", "0.49350837", "0.48927215", "0.4863896", "0.48422644", "0.4814439", "0.48136592", "0.48125017", "0....
0.8933749
0
Toggle between main unit and alternate unit
function toggleUnit() { var newUnit var confirmMessage if (my.settings.unit == my.UNIT.MAIN) { newUnit = my.UNIT.ALTERNATE confirmMessage = Units.alternateConfirmMessage } else { newUnit = my.UNIT.MAIN confirmMessage = Units.mainConfirmMessage } if (!confirm(confirmMessage)) { return false } localStorage.unit = newUnit loadSettings() updateUnitFromURL() return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggle(){this.off=!this.off}", "toggle4() {\r\n }", "doClick( evt ) {\n if( evt.altKey ) {\n let alternate = new CustomEvent( Thermometer.ALTERNATE, {\n detail: {\n status: this.status()\n }\n } );\n this.root.dispatchEvent( alternate );\n } else {\n // Toggl...
[ "0.6337465", "0.63069147", "0.62731224", "0.6251226", "0.6235556", "0.6194663", "0.6177884", "0.6143803", "0.608878", "0.6079503", "0.6077901", "0.602295", "0.5992622", "0.59773976", "0.5958581", "0.5950306", "0.5947523", "0.5947133", "0.59378153", "0.59265465", "0.5925762", ...
0.72000253
0