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
Check a DOM element is the descendant of another element
function isDescendant( childElem, parentElem ) { let node = childElem.parentNode; while ( node !== null && node.parentNode !== undefined ) { if ( node === parentElem ) { return true; } node = node.parentNode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isChild( elmtA, elmtB ) {\n var body = document.body;\n while (elmtB && elmtA != elmtB && body != elmtB) {\n try {\n elmtB = elmtB.parentNode;\n } catch (e) {\n return false;\n }\n }\n return elmtA == elmtB;\n }"...
[ "0.7076752", "0.7068795", "0.6885199", "0.672103", "0.67112726", "0.66751826", "0.6652067", "0.66504234", "0.6586208", "0.6564952", "0.6442504", "0.6353298", "0.6342402", "0.63320297", "0.63016945", "0.6299366", "0.6297194", "0.62561", "0.62532884", "0.6239664", "0.6213525", ...
0.71605647
0
Check if a variable is an array and must have at least 1 item.
function isNotEmptyArray( arg ) { return Array.isArray( arg ) && arg.length > 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_array(input) {\n if (Object.prototype.toString.call(input) === \"[object Array]\") {\n return true;\n }\n return false;\n}", "function is_array(x)\r\n{\r\n return Array.isArray(x) ;\r\n}", "function isArray(e){return e!=null&&typeof e==\"object\"&&typeof e.length==\"number\"&&(e.length==0|...
[ "0.74270296", "0.73828596", "0.72974306", "0.7275249", "0.721507", "0.72126776", "0.72126776", "0.72126776", "0.71533084", "0.7086141", "0.7086141", "0.7080596", "0.7048717", "0.69976044", "0.6988608", "0.6950048", "0.69499195", "0.6948361", "0.6945777", "0.6944239", "0.6943"...
0.6732377
93
Get the union results of two arrays of array
function unionArrayOfArray( array1, array2 ) { let union = array2.slice(); for ( let eachArray of array1 ) { let index = findIndexFromArrayOfArray( eachArray, array2 ); if ( index === -1 ) { union.push( eachArray.slice() ); } } re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function union(arrays) {\n\n}", "function union(arr1, arr2){\n return arr1.concat(arr2);\n}", "function union(array1, array2) {\r\n return set(array1.concat(array2));\r\n}", "function union(arrays) {\n return arrays.reduce((acc, curr) => {\n const elements = curr.filter(el => !acc.includes(el));\n ...
[ "0.84664273", "0.8334986", "0.8188485", "0.81235677", "0.80351496", "0.7984868", "0.797514", "0.7944047", "0.79175794", "0.7886362", "0.78862995", "0.78408223", "0.781333", "0.780518", "0.77853316", "0.7777023", "0.77684873", "0.77636343", "0.7752366", "0.7719349", "0.7716493...
0.80255
5
If an item is in the array, then remove it, otherwise add it into the array
function toggleArrayItem( item, array ) { let index = array.indexOf( item ); if ( index === -1 ) { array.push( item ); } else { array.splice( index, 1 ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addItem(array, item) {\n if (!array.contains(item))\n array.push(item);\n }", "function remove(arr,item){if(arr.length){var index=arr.indexOf(item);if(index>-1){return arr.splice(index,1);}}}", "function remove(arr,item){if(arr.length){var index=arr.indexOf(item);if(index>-1){retu...
[ "0.73015845", "0.7238452", "0.7238452", "0.7175644", "0.71744066", "0.71709603", "0.7127615", "0.7126069", "0.70971626", "0.70971626", "0.70971626", "0.70942974", "0.70928603", "0.7088866", "0.70675975", "0.7064073", "0.7058495", "0.704934", "0.7047792", "0.7047792", "0.70477...
0.0
-1
Use JSON methods to copy an object
function JSONCopy( obj ) { return JSON.parse( JSON.stringify( obj ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "copy(obj){\n return JSON.parse(JSON.stringify(obj));\n }", "function copy(obj){\n return (JSON.parse(JSON.stringify(obj))); \n}", "function copy(obj)\n {\n return JSON.parse(JSON.stringify(obj));\n }", "function copy(o) {\n return JSON.parse(JSON.stringify(o));\n}", "funct...
[ "0.7905099", "0.7825792", "0.7755137", "0.7648695", "0.7643306", "0.75896835", "0.7588145", "0.7528356", "0.7294874", "0.7294874", "0.7294874", "0.7283893", "0.7257946", "0.7251487", "0.72382987", "0.7092726", "0.7062846", "0.70500904", "0.7043247", "0.7024398", "0.70205486",...
0.7643488
4
Produce the intersection result of two arrays
function intersectArrays( array, array2 ) { let newArray = array.filter( el => { if ( array2.indexOf( el ) !== -1 ) { return true; } return false; } ); return newArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function intersection(array1, array2) {\n return array1.filter(i => array2.includes(i));\n}", "function intersection(arr1, arr2) {\n return arr1.filter(x => arr2.includes(x));\n}", "intersect(arr1, arr2) {\n function intersection_destructive(a, b) {\n var result = [];\n while (a....
[ "0.81724423", "0.816591", "0.8068635", "0.7925583", "0.785583", "0.7848472", "0.7810613", "0.7785096", "0.7780028", "0.774009", "0.7704409", "0.76858777", "0.76766866", "0.76726305", "0.7641979", "0.76411736", "0.76371443", "0.7631178", "0.76198316", "0.7614394", "0.7585193",...
0.70213073
65
Check a variable that has number content
function isNumber( obj ) { if ( isNaN( obj ) === true ) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hasNumber(variable) {\n\t\t\treturn numberContainRegex.test(variable);\n\t\t}", "function containsNumbers(name) {\n return (/\\d/.test(name));\n }", "function checkForNumber(t) {\n let regex = /\\d/g;\n return regex.test(t);\n}", "function checkForNumber(t) {\n let regex = /\\d/g;\n re...
[ "0.7856236", "0.7418624", "0.73880976", "0.73880976", "0.7298045", "0.7247387", "0.7233088", "0.7220545", "0.7175796", "0.7162025", "0.7090783", "0.7074283", "0.7067226", "0.70661604", "0.70304704", "0.7027442", "0.7020986", "0.6993425", "0.69767565", "0.695014", "0.6944748",...
0.0
-1
Give an array of objects, sort by one of the keys in the object
function sortArrayByObjectKey( options, array ) { let defaultSettings = { type: 'quick', order: 'ascend', objectKey: '', secondObjectKey: '' }; let settings = Object.assign( defaultSettings, options ); let obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sort() {\n var keys = arguments.length <= 0 || arguments[0] === undefined ? [[_const.FIELDS[0], true]] : arguments[0];\n\n var results = [];\n var sort = sortBy(keys);\n return _through22['default'].obj(function (data, env, next) {\n results.push(data);\n next();\n }, function (next) {\n var...
[ "0.7134113", "0.7012079", "0.69787383", "0.69471174", "0.6779645", "0.67246145", "0.6703947", "0.6697346", "0.66877633", "0.6660935", "0.6658773", "0.6629391", "0.660156", "0.659193", "0.6591594", "0.65687484", "0.6552441", "0.65421295", "0.65138215", "0.64921504", "0.6482502...
0.7055709
1
function which prompts the user for what action they should take
function start() { inquirer .prompt({ name: "category", type: "list", message: "Pick a Category", choices: ["Add Departments", "Add Employee", "View Departments", "View Employees", "Update Employe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function UserInputs(action, input) {\n switch (action) {\n case \"concert-this\":\n runBandsInTown(input);\n fixString(input)\n break;\n case \"spotify-this-song\":\n runSpotify(input);\n fixString(input)\n break;\n case \"movie-this\":\n runOmdb(input);\n fixStrin...
[ "0.77564573", "0.74372256", "0.73923296", "0.7361864", "0.73519737", "0.73270017", "0.7200751", "0.7187863", "0.7137887", "0.71224785", "0.70762116", "0.69826204", "0.6961095", "0.695858", "0.6937502", "0.69215536", "0.69117534", "0.6895512", "0.68800056", "0.68800056", "0.68...
0.0
-1
The text to display on collision showing the points earned
function Start () {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayScore() {\n\tctx.font = \"60px sans-serif\";\n\tctx.textAlign = \"end\";\n\tctx.fillStyle = \"white\";\n\tctx.fillText(points, 550, 55);\n}", "printText () {\n\n push();\n\n translate ( this.xCoord, this.yCoord );\n\n fill ( 250, 250, 250 );\n noStroke();\n\n triangle( 0,...
[ "0.7152306", "0.68367124", "0.6792532", "0.6571813", "0.6544211", "0.65257126", "0.651753", "0.6486038", "0.64808816", "0.6476242", "0.64405847", "0.6365597", "0.6364151", "0.6338973", "0.6314061", "0.62894714", "0.6269065", "0.626878", "0.6265702", "0.62622434", "0.62552536"...
0.0
-1
Matches a rule against an input that could be the full or a subset of the comment data.
function _match (rule, cmtData) { var path = rule.subject.split('.'); var extracted = cmtData; while (path.length > 0) { var item = path.shift(); if (item === '') { continue; } if (extracted.hasOwnProperty(item)) { e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function matchRule(s, rule){\n\tvar len = rule ? rule.length: 0; \n\tif (len === 0)\n\t\treturn false;\n\tvar _s = s, idx = 0;\n\tif (!IX.isEmpty(rule[0])){\n\t\tidx = _s.indexOf(rule[0]);\n\t\tif (idx !== 0) \n\t\t\treturn false;\n\t\t_s = _s.substring(rule[0].length);\n\t}\n\tfor (var i=1; i<len; i++){\n\t\tif (...
[ "0.5797891", "0.55764395", "0.5532155", "0.519035", "0.5187758", "0.5142466", "0.51202667", "0.51202667", "0.51202667", "0.51049966", "0.50656015", "0.50515056", "0.50515056", "0.50515056", "0.50489235", "0.50489235", "0.5039636", "0.5020841", "0.5001316", "0.5001316", "0.500...
0.62575525
0
erases the old footer, if any, and regenerates it using data from the table
function writeFooter() { var foot = document.getElementById('storefooter'); //remove old footer content while (foot.firstChild) { //console.log('removing ' + foot.firstChild); foot.removeChild(foot.firstChild); } //get totals of the cells var totals = [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0]; var table = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateFooter() {\n // Get new footer row HTML string\n let newFoot = footer.render();\n // Add new footer row to table footer\n this.footer.appendChild(newFoot);\n }", "function footerLoaded(){\n\tlet footer = document.createElement(\"FOOTER\");\n\tfooter.setAtt...
[ "0.77711576", "0.67264175", "0.6722418", "0.6597431", "0.65138316", "0.6490953", "0.6417827", "0.63799906", "0.63780135", "0.6360833", "0.63033783", "0.62779117", "0.62629074", "0.6253467", "0.6237177", "0.617338", "0.6166853", "0.61484516", "0.61102843", "0.61060107", "0.610...
0.65560347
4
Constructor fn for CookieStore object
function CookieStore(name, min, max, avg) { this.name = name; this.min = min; this.max = max; this.avg = avg; //average cookies sold per customer this.sales = [-1, -1, -1, -1, -1, -1, -1, -1]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n copyKeys(this, cookieStore);\n }", "function _Cookie_store(){\r\n // First, loop through the properties of the Cookie object and\r\n // put together the value of the cookie. Since cookies use the\r\n // equals sign and semicolons as separators, we'll use colons\r\n // and ampers...
[ "0.80573744", "0.72934264", "0.70751977", "0.6818774", "0.6814184", "0.68053365", "0.666147", "0.6592814", "0.6558342", "0.653494", "0.6430329", "0.6424283", "0.6424283", "0.6421889", "0.6414421", "0.63786656", "0.63698477", "0.63685983", "0.63685983", "0.63685983", "0.636859...
0.6273051
31
properties available to the custom element for data binding
static get properties() { return { ...super.properties, /** * If true init rss request. */ auto: { type: Boolean }, /** * The retrieved items array. */ items: { type: Array }, /** * Max number of items to show. If it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get properties() {\n return {\n label: { type: String },\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n elevation: { type: Number },\n active: { type: Boolean, reflect: true },\n comingSoon: { type: Boolean, reflect: true, attribute: \"coming-soon...
[ "0.6685495", "0.64611965", "0.64272714", "0.6226695", "0.6085264", "0.6010597", "0.6001403", "0.5912779", "0.59054023", "0.58841974", "0.58767015", "0.587253", "0.5869116", "0.5867333", "0.58653885", "0.58309346", "0.5821338", "0.5808655", "0.5804194", "0.5802563", "0.5790597...
0.0
-1
Store the tag name to make it easier to obtain directly.
static get tag() { return "rss-items"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTag(tagName) {\n const tag = {\n tag: tagName,\n value: this.__tags[tagName]\n };\n return tag;\n }", "function addTag (name) {\n $('#post_current_tags').val(function () {\n return $(this).val().concat(name, ',')\n })\n $('.current-tags').append(\"<s...
[ "0.6634083", "0.66041034", "0.6557285", "0.6557285", "0.6557285", "0.6557285", "0.65389186", "0.65389186", "0.65389186", "0.65389186", "0.6377864", "0.6283098", "0.626847", "0.62257195", "0.6206882", "0.6186045", "0.6184868", "0.61273026", "0.6070542", "0.6002654", "0.5938993...
0.0
-1
Init ajax request to get rss.
initRequest() { this.shadowRoot.querySelector("#rssajax").generateRequest(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxFeed() {\r\n $.ajax ({\r\n type: \"GET\",\r\n url: \"/feed\",\r\n success: data => {\r\n console.log(data);\r\n },\r\n error: data => {\r\n console.log(data);\r\n }\r\n });\r\n}", "function getNews(feedUrl){\n $.ajax({\n ...
[ "0.6630141", "0.6527377", "0.6431154", "0.6329998", "0.6296591", "0.62515914", "0.62412876", "0.6205052", "0.61689013", "0.60344994", "0.60197955", "0.59706044", "0.596904", "0.5886406", "0.5849651", "0.5832681", "0.5810749", "0.5777315", "0.5773752", "0.57602876", "0.5754183...
0.73305297
0
simple path from a url modifier
pathFromUrl(url) { return url.substring(0, url.lastIndexOf("/") + 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function recuperaPath(url)\n{\n\ttry {\n\t\tvar result = url.match(/[-_\\w]+[.][\\w]+$/i)[0];\n\t}\n\tcatch(err) {\n\t\t//console.log(err);\n\t\tvar result = \" \";\n\t}\n\treturn result;\n}", "getRoute(_path) {\n let path = _path;\n\n path = path.replace(/(^\\/+|\\/+$)/g, \"\");\n path = path.spl...
[ "0.6475773", "0.6439817", "0.6382909", "0.6351244", "0.6309902", "0.6287596", "0.61849827", "0.61309296", "0.6092605", "0.60761654", "0.6045595", "0.5911893", "0.5911466", "0.5832898", "0.58326775", "0.58326775", "0.58326775", "0.58326775", "0.58326775", "0.58326775", "0.5832...
0.59486055
12
life cycle, element is afixed to the DOM
firstUpdated() { this.__ready = true; if (this._x2js) { if (this.auto) { this.shadowRoot.querySelector("#rssajax").auto = this.auto; } else { this.initRequest(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CacheEl() {\n \n }", "element(element){\r\n element.setInnerContent(this.content);\r\n}", "setElement(newElement) {\n this.#element = newElement;\n }", "getElement(){return this.__element}", "setElement(elem) {\n this.element = elem;\n }", "onEnterDOM() {}", "setElement(eleme...
[ "0.661765", "0.6444651", "0.6395563", "0.6393446", "0.63262475", "0.62953603", "0.62876177", "0.6266617", "0.62070847", "0.6180686", "0.6110414", "0.60946435", "0.6075353", "0.6071762", "0.6019709", "0.6018928", "0.60142934", "0.60063964", "0.6001321", "0.5992018", "0.5988584...
0.0
-1
life cycle, element is removed from the DOM
disconnectedCallback() { window.removeEventListener( `es-bridge-${name}-loaded`, this._x2jsLoaded.bind(this) ); super.disconnectedCallback(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "destroy() {\n\t\tthis.element.remove();\n\t}", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "remove() {\n this.element.remove()...
[ "0.80261093", "0.79251516", "0.79251516", "0.79251516", "0.79251516", "0.7852274", "0.77882284", "0.7764013", "0.77335054", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.7705903", "0.770590...
0.0
-1
================== CHANGE HEADER BACKGROUND COLOR ON SCROLL =====================
function scrollHeader() { const header = document.getElementById("header"); // When scroll is greater than 100, add scroll-header class if(this.scrollY >= 100) header.classList.add("scroll-header"); else header.classList.remove("scroll-header"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeHeaderStyle() {\n window.addEventListener('scroll', () => {\n // console.log(window.scrollY);\n if(window.scrollY >= 557) {\n document.getElementById('header').className = 'dark-background-header';\n } else if(window.scrollY < 557 && document.getElementById('header').classList.contain...
[ "0.7171675", "0.6985677", "0.69524044", "0.69524044", "0.67901427", "0.6692366", "0.65269166", "0.649884", "0.6450131", "0.6416283", "0.6411492", "0.6408176", "0.63702935", "0.6337907", "0.63267416", "0.6299213", "0.6256009", "0.62553316", "0.62505364", "0.62473136", "0.62441...
0.0
-1
30 minutes in seconds
function createDecimalToken() { // convert to decimal because it's easier for user to type, get last 30 // digits because first few digits don't have uniform distribution return new BigNumber('0x' + createToken()).toString(10).slice(-30); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ReduceTime() {\n totalSeconds = totalSeconds - 30;\n return totalSeconds;\n }", "EDIT_LAST15MINUTES(s) {\n const date = new Date();\n s.dateTimeStart = interval(date, 15);\n s.dateTimeEnd = date;\n }", "function howManySeconds(num){\...
[ "0.7239559", "0.6682103", "0.65925413", "0.6498586", "0.6402972", "0.63169503", "0.6284231", "0.6273869", "0.62497044", "0.62352896", "0.62282836", "0.6209398", "0.6198425", "0.6198152", "0.6198152", "0.6198152", "0.6198152", "0.6198152", "0.6198152", "0.6198152", "0.61768633...
0.0
-1
lifecycle methods custom methods
render() { let {PrivateRoute} = this; let content = 'test' return ( <div> { content } </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor () {\n this._lifecycleConfig = null;\n }", "onConstructed() {}", "onConstructed() {}", "onInitialize() {}", "onDispose() {}", "consstructor(){\n \n\n }", "postConstruct() {}", "beforeDestroy(){\n //Antes de destruir la instancia\n console.log('beforeDestr...
[ "0.6479435", "0.62272924", "0.62272924", "0.6160871", "0.6073933", "0.6071789", "0.6028415", "0.59819156", "0.59377116", "0.5918955", "0.5918955", "0.59067106", "0.5895516", "0.5885035", "0.58510745", "0.58510745", "0.58510745", "0.58510745", "0.58510745", "0.58510745", "0.58...
0.0
-1
5 HAM KEY 1 2 3 4 5
function trolaicautruoc(){ console.log("Trở lại câu trước."); if (Number(localStorage.caumayEn_SG_1) > 0){ localStorage.caumayEn_SG_1 = Number(localStorage.caumayEn_SG_1) - 1 } doicau(Number(localStorage.caumayEn_SG_1)) localStorage.dang = "cauhoi" $("#nhapdapan").val("").removeAttr("disabled").focus() $(".th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "exampleHashMethod( key ) {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash + key.charCodeAt(i) * i) % this.data.length;\n }\n return hash;\n }", "_hash(key){\r\n let hash = 0;\r\n for(let i = 0; i<key.length; i++){\r\n has...
[ "0.6115453", "0.6038359", "0.60340196", "0.5967721", "0.59243166", "0.59044784", "0.58875126", "0.5882005", "0.585504", "0.5843203", "0.5836245", "0.5761479", "0.5760215", "0.5760215", "0.57369274", "0.571241", "0.5667273", "0.5657739", "0.5655385", "0.56349146", "0.5634342",...
0.0
-1
This function access to the backend and retrieve the information about the user. The my_id variable is the id of the user
function ini_count_stickers(){ my_id = 2; //Made the ajax call to the server to the getUser entrypoint. call = $.ajax({ url:"http://145.92.6.118/medialab-api/user/getUser/"+my_id+"/", type : "GET", contentType:"application/json", dataType:"json", success: function(json){ if(json.response=="SUCCESS"){...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUserById(id){\n return $http.get(url.user + id).then( handleSuccess, handleError);\n }", "getUserById(id){\n return this.auth.get(`/user/${id}`,{}).then(({data})=> data);\n }", "function fetchUser() {\n const userId = document.getElementById('user-id').value\n clie...
[ "0.7036182", "0.70319635", "0.70270103", "0.70070505", "0.6980978", "0.69699633", "0.6910903", "0.6837129", "0.6809723", "0.6806925", "0.67948157", "0.6772054", "0.67161214", "0.66480756", "0.6638601", "0.6615192", "0.6595744", "0.65729195", "0.65651286", "0.65609324", "0.655...
0.0
-1
not overwhelming in number, the algorithms were not be optimized for performance.
function distributeVaccine (vaccineQuantity, mechanism) { switch (mechanism) { // Find the area with maximum infection. Provide that region with the vaccine first. // If some vaccine is left, then find the next area with maximum infection. Provide vaccine there. // So on and so forth. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function number(numbers) { }", "function numbers (){\n memory.map((each,index)=>{\n \n if(d.test(each) && d.test(memory[index+1])){\n memory.splice(index,1)\n memory[index]= each+memory[index];\n ...
[ "0.66708726", "0.6528155", "0.63908046", "0.6369467", "0.6332648", "0.61621827", "0.6144605", "0.6087848", "0.60732275", "0.6056584", "0.60312593", "0.6027259", "0.6024512", "0.60102564", "0.5990539", "0.5982609", "0.5980125", "0.5973999", "0.5953311", "0.5940703", "0.5938536...
0.0
-1
Vaccinate in the order of the region specified
function vaccinateRegionsInOrder (regionDataInOrder, regionNamesInOrder, vaccineQuantity) { var regionVSVaccineQuanitityMap = []; for (var i = 0; i < regionDataInOrder.length; i++) { if (vaccineQuantity > regionDataInOrder[i].numUninfectedPeople) { vaccineQuantity -= regionDataInOrder[i]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SelectionRegion() {}", "function SelectionRegion() {}", "getRegionsInView()\n {\n var bottomLeftPos = this.screenToWorldPos(0, window.innerHeight);\n var bottomLeftRegion = WORLD.getRegionPositionFromWorldPosition(bottomLeftPos.x, bottomLeftPos.y);\n\n var xRegionMax = Math.flo...
[ "0.59509933", "0.59509933", "0.59133834", "0.56622976", "0.5528531", "0.5526671", "0.5511686", "0.5473357", "0.54545295", "0.54366744", "0.540889", "0.54046535", "0.5361932", "0.5315553", "0.5231936", "0.52284384", "0.52227646", "0.52035284", "0.51833653", "0.51770204", "0.51...
0.65695286
0
Vaccinate equitably, according to the number of uninfected people
function vaccinateEquitably (vaccineQuantity) { var regionVSVaccineQuanitityMap = []; var stat = statsStorage[statsStorage.length-1].regionStats; for(var name in stat) { regionVSVaccineQuanitityMap[name] = Math.round(vaccineQuantity * stat[name].numUninfectedPeople / numUninfected...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "interactPerson(person){\n if(this.virus > person.virus){\n let newVal = this.virusSpread(this.virus);\n if(person.virus == VIRUS_NONE && newVal > VIRUS_NONE){\n infectedCount++;\n }\n person.virus = newVal;\n }\n if(person.virus > this.virus){\n newVal = this.virusSpread(pe...
[ "0.6640334", "0.6435416", "0.6086099", "0.6024069", "0.5979319", "0.5875683", "0.58312196", "0.580537", "0.5760407", "0.5727795", "0.5654641", "0.5634264", "0.5617953", "0.55952644", "0.5555157", "0.55344135", "0.5533262", "0.551736", "0.55071914", "0.54631823", "0.546314", ...
0.5814986
7
Calcul du nombre total de likes
calculateLikes() { let resultat = 0; this.media.forEach((media) => { resultat = resultat + media.likes; }) this.totalLikes = resultat; return resultat; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compteurTotal (photographerMediaList) {\n const totalLikes = document.querySelector('.numbers_likes')\n const totalInitial = photographerMediaList.reduce((total, like) => {\n return total + (like.likes)\n }, 0)\n\n totalLikes.innerHTML = totalInitial\n return totalInitial\n}", "getNumLikes() {\n...
[ "0.72464037", "0.7203442", "0.7166671", "0.68699557", "0.68508446", "0.67741925", "0.67712295", "0.6754694", "0.67444557", "0.6717393", "0.6623153", "0.6583083", "0.65428036", "0.6535604", "0.65347713", "0.64847827", "0.63989794", "0.63746154", "0.6357782", "0.63225585", "0.6...
0.74379575
0
Closure = What this means is that an inner function always has access to the vars and parameters of its outer function, even after the outer function has returned.
function accountObject(userName){ "use strict"; var name = userName; var balance = 20; //this is a private var return { getName: function(){ return name; }, showBalance: function(){ return balance; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outerFunction (outerArg) { // begin of scope outerFunction\r\n // Variable declared in outerFunction function scope \r\n var outerFuncVar = 'x'; \r\n // Closure self-invoking function \r\n function innerFunction (innerArg) { // begin of scope innerFunction\r\n // variable declared in...
[ "0.7878644", "0.77102184", "0.74376684", "0.7436877", "0.73926204", "0.73768246", "0.737562", "0.7336699", "0.733155", "0.73294556", "0.73153317", "0.72908944", "0.7269883", "0.7261803", "0.7252451", "0.7211469", "0.720637", "0.71981055", "0.7171951", "0.71566224", "0.7131766...
0.0
-1
console.log(marcinObject.getName()); console.log(marcinObject.showBalance()); //////////////////////////////////////Seeing how bullet proof the code is
function addMachine(){ var num = 1; return { getNumber : function(){ return num; }, addToNumber : function(num2){ return num + num2; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function balance(){\n console.log(\"Your account balance is: \" + personal_account.deposite + \"birr\");\n}", "function accountObject(userName){\n\n \"use strict\";\n var name = userName;\n var balance = 20; //this is a private var\n return {\n getName: function(){\n return name;...
[ "0.6788121", "0.6638386", "0.64086103", "0.63789624", "0.63727677", "0.62328726", "0.62046385", "0.61096936", "0.6070473", "0.60460705", "0.5965972", "0.5964701", "0.59454477", "0.5926677", "0.58979625", "0.5888347", "0.5878429", "0.5870072", "0.58482313", "0.58263606", "0.58...
0.0
-1
renders twice, the first time w/o posts then rerenders with the populated props of posts
componentDidMount() { this.props.fetchPosts(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderPosts() {\n if ( this.props.posts.length > 0 ) {\n return this.props.posts.map( ( post ) => {\n return <div key={ post._id }>{post.title}</div>;\n });\n } else if (!this.props.posts) {\n return <div>No posts found.</div>;\n } else {\n return <div>Loading...</div>\n }\n ...
[ "0.7646613", "0.71695274", "0.7130732", "0.7096118", "0.7061564", "0.7010328", "0.6943909", "0.69408876", "0.6882479", "0.68803537", "0.68598235", "0.6852487", "0.68481207", "0.6775364", "0.67322886", "0.6717727", "0.6676115", "0.6642077", "0.6639217", "0.66064864", "0.660390...
0.6421704
40
Bind IOEvents (focus and keyevents)
function jumpFromTagBoxToGalleryWithTab() { // Jump from search to gallery with tab. $(Tagshot.ui.selectors.tagBox).bind('keydown', 'tab', function (e) { e.stopPropagation(); $(Tagshot.ui.selectors.photoListView_firstImg).click(); return true; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bindEvents() {\n if (this._inputElement) {\n this._inputElement.addEventListener('blur', this.blurEventHandler.bind(this));\n this._inputElement.addEventListener('keyup', this.keyUpEventHandler.bind(this));\n }\n }", "_bindInputHandlers() {\n window.addEventListener(\"ke...
[ "0.7031368", "0.69954836", "0.69817203", "0.6948003", "0.69321084", "0.69060135", "0.6870745", "0.68663704", "0.6782167", "0.67030174", "0.6654919", "0.65627736", "0.6516179", "0.6435141", "0.64329076", "0.6413959", "0.640711", "0.637963", "0.63303137", "0.6297878", "0.629114...
0.0
-1
General dom manipulation helpers
function insertLoadMoreButton(here) { $(here).html( "<ul>" + "</ul>" + "<span id='fix-gallery' class='ui-helper-clearfix'></span>" + "<button id='more'>load more...</button>" ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DOMImplementation() {}", "function DOMImplementation() {}", "function DOMImplementation() {}", "function DOMImplementation() {}", "function DOMImplementation() {\n}", "function DOMImplementation() {\n}", "function RenderableDOMElement() {\n }", "_createDOMElements() {\n\t\tthis.$control =...
[ "0.67176247", "0.67176247", "0.67176247", "0.67176247", "0.6520058", "0.6520058", "0.65099984", "0.6432038", "0.6208265", "0.61343616", "0.61343616", "0.5987556", "0.5982534", "0.5966628", "0.5940572", "0.5917614", "0.5875163", "0.58716017", "0.582915", "0.58200616", "0.58169...
0.0
-1
Copyright 2004present Facebook. All Rights Reserved. Array.prototype.es6
function findIndex(predicate, context) { if (this == null) { throw new TypeError( 'Array.prototype.findIndex called on null or undefined' ); } if (typeof predicate !== 'function') { throw new TypeError('predicate must be a function'); }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Array() {}", "function ArrayUtils() {}", "function taintArray() {\n taintDataProperty(Array.prototype, \"0\");\n taintMethod(Array.prototype, \"indexOf\");\n taintMethod(Array.prototype, \"join\");\n taintMethod(Array.prototype, \"push\");\n taintMethod(Array.prototype, \"slice\");\n taintMethod...
[ "0.76228034", "0.758297", "0.7243002", "0.69859684", "0.6822592", "0.66315854", "0.6563382", "0.652403", "0.65186954", "0.6449971", "0.6449971", "0.6449971", "0.6447953", "0.6385795", "0.6365828", "0.6351559", "0.63457704", "0.63265675", "0.6298709", "0.62269694", "0.6215169"...
0.0
-1
Generate Noise of dim
function genNoise(width, height){ var img, imgData, i, to; img = ctx.createImageData(width, height); imgData = img.data; for (i = 0, to = width * height * 4; i < to; i += 4) { imgData[i] = imgData[i + 1] = imgData[i + 2] = Math.random() >= 0.5 ? 255 : 0; imgData[i + 3] = 255; } return img; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Noise() {}", "function Noise(seed) {\n function Grad(x, y, z) {\n this.x = x; this.y = y; this.z = z;\n }\n\n Grad.prototype.dot2 = function(x, y) {\n return this.x*x + this.y*y;\n };\n\n Grad.prototype.dot3 = function(x, y, z) {\n return this.x*x + this.y*y + this.z*z;\n ...
[ "0.7067359", "0.6673255", "0.6658151", "0.652288", "0.64330465", "0.58987176", "0.5793754", "0.5770487", "0.57215637", "0.5627482", "0.5601216", "0.55867445", "0.5556757", "0.55507594", "0.54645324", "0.5455482", "0.5449784", "0.5439972", "0.54180294", "0.54126126", "0.539057...
0.6597721
3
Returns true if the tile mesh and texture are ready to be used Otherwise, returns false
isReady() { return this._ready; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ready() {\n for (var i = 0; i < preloadTiles.length; i++) {\n var state = layerAbove.textureStore().query(preloadTiles[i]);\n if (!state.hasTexture) {\n return false;\n }\n }\n return true;\n}", "function checkTextures() {\n texturesLoaded++;\n if (texturesLoaded === Object.keys(textu...
[ "0.75157475", "0.69827694", "0.67260104", "0.64410305", "0.63944006", "0.6375284", "0.63543093", "0.6298838", "0.6146879", "0.61347514", "0.61029756", "0.6071613", "0.5990626", "0.59554577", "0.5919879", "0.5877747", "0.5874541", "0.5872235", "0.58360255", "0.58080065", "0.57...
0.0
-1
Request data for the tile
requestTileAsync() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getData() {\n animate();\n \n var url = window.API.getAPIUrl(\"comps\");\n \n //url += \"?env=development\"; //When needed the development branch, for lab.fermat.org\n\n window.API.getCompsUser(function (list){ \n\n window.loadMap(function() {\n\n window.tileManager.Jso...
[ "0.63983315", "0.63983315", "0.6344024", "0.6222638", "0.6129", "0.60575455", "0.6056601", "0.601714", "0.60126513", "0.59109277", "0.5869973", "0.5853315", "0.5852038", "0.5840163", "0.5834659", "0.5798325", "0.57981265", "0.5791888", "0.5732796", "0.5732796", "0.5718894", ...
0.70819974
0
Convert from quadcode to TMS tile coordinates
_quadcodeToTile(quadcode) { var x = 0; var y = 0; var z = quadcode.length; for (var i = z; i > 0; i--) { var mask = 1 << (i - 1); var q = +quadcode[z - i]; if (q === 1) { x |= mask; } if (q === 2) { y |= mask; } if (q === 3) { x |= mask;...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function quadKeyToTileXY( quadKeyString )\n {\n var tileX = 0;\n var tileY = 0;\n var quadKey = quadKeyString.split( '' );\n var levelOfDetail = quadKey.length;\n\n for( var i = levelOfDetail; i > 0; i--)\n {\n var mask = 1 << ( i - 1 );\n switch( ...
[ "0.6971148", "0.6971148", "0.64627373", "0.64627373", "0.5591791", "0.5568267", "0.5564658", "0.55615485", "0.5560585", "0.5539289", "0.54862714", "0.5482353", "0.5472568", "0.5458362", "0.5442787", "0.54248095", "0.54248095", "0.542052", "0.54185873", "0.53936416", "0.538409...
0.76006687
0
Convert WGS84 tile bounds to world coordinates
_tileBoundsFromWGS84(boundsWGS84) { var sw = this._layer._world.latLonToPoint(LatLon(boundsWGS84[1], boundsWGS84[0])); var ne = this._layer._world.latLonToPoint(LatLon(boundsWGS84[3], boundsWGS84[2])); return [sw.x, sw.y, ne.x, ne.y]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_tileBoundsWGS84(tile) {\n var e = this._tile2lon(tile[0] + 1, tile[2]);\n var w = this._tile2lon(tile[0], tile[2]);\n var s = this._tile2lat(tile[1] + 1, tile[2]);\n var n = this._tile2lat(tile[1], tile[2]);\n return [w, s, e, n];\n }", "static TileToWorld(x, y, out = new b2.Vec2()) {\n ...
[ "0.7655127", "0.6509116", "0.6351688", "0.6292593", "0.6251903", "0.6247818", "0.6241002", "0.62005216", "0.6173476", "0.61669827", "0.6156833", "0.61512804", "0.6138871", "0.6119626", "0.6112698", "0.60771483", "0.606308", "0.60629773", "0.6050383", "0.60292244", "0.6002315"...
0.78973174
0
Get tile bounds in WGS84 coordinates
_tileBoundsWGS84(tile) { var e = this._tile2lon(tile[0] + 1, tile[2]); var w = this._tile2lon(tile[0], tile[2]); var s = this._tile2lat(tile[1] + 1, tile[2]); var n = this._tile2lat(tile[1], tile[2]); return [w, s, e, n]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_tileBoundsFromWGS84(boundsWGS84) {\n var sw = this._layer._world.latLonToPoint(LatLon(boundsWGS84[1], boundsWGS84[0]));\n var ne = this._layer._world.latLonToPoint(LatLon(boundsWGS84[3], boundsWGS84[2]));\n\n return [sw.x, sw.y, ne.x, ne.y];\n }", "get bounds() {\r\n\t\treturn {\r\n\t\t\tx: this.origi...
[ "0.8052456", "0.7546562", "0.72013766", "0.7173586", "0.7135906", "0.70573264", "0.7018486", "0.6957003", "0.6957003", "0.69418275", "0.6933473", "0.69067407", "0.6901445", "0.6901445", "0.68149626", "0.6804754", "0.6801688", "0.67414784", "0.6713339", "0.6698869", "0.6676119...
0.85844195
0
1 Rock/ 2 Paper / 3 Scissors
function scoreUpdate(){ var score = document.getElementById('score').innerHTML score ++; document.getElementById('score').innerHTML = score; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rockPaperScissor() {\n let erg = Math.floor(Math.random()*3) + 1\n if (erg === 1) {\n return \"rock\"\n } else if (erg === 2) {\n return \"paper\"\n } else {\n return \"scissors\"\n }\n}", "function computerPlay(){\n let value = Math.floor(Math.random()*3);\n le...
[ "0.74224305", "0.7302321", "0.72543603", "0.72343034", "0.71944773", "0.71759725", "0.71729183", "0.71403617", "0.7123095", "0.7120489", "0.709714", "0.709178", "0.70503205", "0.70487815", "0.70467305", "0.70298123", "0.7027047", "0.70183855", "0.7018001", "0.70000243", "0.69...
0.0
-1
Cleans up the display before exiting.
function onExit () { process.stdout.write( '' + ansi.eraseScreen + ansi.cursorShow) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clean_up() {\n\t\tthis.task.run_sync(\"core\", \"ui_container\", \"clean_up\");\n\t\tglob.document.body.innerHTML = \"\";\n\t}", "static cleanup() {\n Utils.clearSomeControlValueChanged(false);\n if (typeof Kiss !== 'undefined' && typeof Kiss.RadioButtons !== 'undefined')\n Kiss...
[ "0.6843275", "0.67395115", "0.6736891", "0.66158974", "0.6557039", "0.6540825", "0.6474735", "0.64601094", "0.64601094", "0.64601094", "0.64601094", "0.64601094", "0.64585143", "0.64480644", "0.6426908", "0.6415893", "0.6415575", "0.6409695", "0.637044", "0.63631064", "0.6362...
0.6258503
32
rules for the game
function playRound() { const computerSelection = computerPlay() console.log(computerSelection) if (playerSelection === 'rock' && computerSelection === 'rock'){ return youdraw() } else if (playerSelection === 'rock' && computerSelection === 'scissors'){ return youwin(); } else if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameRules(){\n\tif (randomNumber === numberStorage){\n\t\twins++;\n\t\talert('You Win! Nice Work.');\n\t\t$(\"#wins\").html(\" \" + wins);\n\t\t$(\"#numberStorage\").empty(); // reset NumberStorage\n\t\t$(\"#numberStorage\").html(\"Your score is: 0\"); // Placeholder\n\t\tnumberStorage = 0;\n\t\tinitializ...
[ "0.6606839", "0.63739204", "0.634669", "0.63328004", "0.62676704", "0.6243178", "0.61758065", "0.61514515", "0.6078142", "0.60758734", "0.60630935", "0.60515434", "0.5995505", "0.59943146", "0.59572077", "0.5953784", "0.5945427", "0.59269667", "0.5901181", "0.5901181", "0.588...
0.0
-1
AWARDS WINNER AT 5 POINS
function scorecheck() { if (playerscore === 5){ notification.textContent = 'CONGRATULATIONS YOU WIN :)'; youwinlose.appendChild(notification) selectionsarea.remove() } else if (computerscore === 5){ notification.textContent = 'YOU LOST :('; youwinlose.appendChild(notification) selectionsar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function WON()\n{\n moveCounter++;\n pSwitch();\n if(moveCounter>4)\n {\n let winner=winnerCheck();\n if (winner!=null)\n {\n gameOver(winner,line,coordonate);\n } \n }\n}", "function round() {\n const clickedElement = event.target;\n if ((clic...
[ "0.626868", "0.62074375", "0.6092405", "0.60646677", "0.6060002", "0.60081893", "0.599406", "0.5979547", "0.59684086", "0.5936843", "0.5912314", "0.5900963", "0.58920825", "0.5880801", "0.58494544", "0.5830147", "0.58268756", "0.58189327", "0.57915235", "0.57811385", "0.57636...
0.0
-1
endregion region Public Methods
initialize_json(json){ const zip = json[AddressFields.zip]; this._streetAddress.value = json[AddressFields.address]; this._city.value = json[AddressFields.city]; this._state.value = json[AddressFields.state]; this._zipCode.htmlObj.value = (isNaN(zip) || zip === "") ? "" : parseIn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient final protected i...
[ "0.72043663", "0.6921558", "0.6854666", "0.6845967", "0.6845964", "0.67986214", "0.6617045", "0.64063126", "0.63189137", "0.6280429", "0.62178326", "0.62178326", "0.62178326", "0.62178326", "0.62178326", "0.62178326", "0.62178326", "0.62178326", "0.62178326", "0.62178326", "0...
0.0
-1
another way to declare a named function
function sayGoodbye() { console.log("Goodbye!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function NamedFunction() {\n\treturn \"I was called\";\n}", "function AnyName() {}", "function add(num1, num2){// named function\n return num1 + num2;\n}", "\"function name\"(){\n //do thing\n }", "function name() {}", "function funname() {} //literals", "function my_function(name) {\n ...
[ "0.740641", "0.7289073", "0.7280598", "0.72709394", "0.7219483", "0.68307424", "0.6778182", "0.67397904", "0.67212397", "0.6589872", "0.65709925", "0.65381974", "0.6510719", "0.64785665", "0.64252937", "0.6424538", "0.64233255", "0.6421226", "0.6421226", "0.6421226", "0.64212...
0.0
-1
< GRAPH QUERY END / < FUNCTION COMPONENT START
function GetSectorStocks({Sector}){ /* <------------------------------------ **** HOOKS START **** ------------------------------------ */ let history = useHistory() const { loading, error, data } = useQuery(GET_STOCKS, { variables: { Sector:Sector }, }); /* <-----------------------------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LQuery() { }", "function LQuery() { }", "function CustomQuery() {\n\n}", "function LQueries() { }", "function LQueries() { }", "function ______MA_Query() {}", "function LQuery() {}", "function LQuery() {}", "function LQuery() {}", "function LQueries() {}", "function LQueries() {}", "...
[ "0.6018018", "0.6018018", "0.5884603", "0.584392", "0.584392", "0.5833342", "0.5833332", "0.5833332", "0.5833332", "0.56734663", "0.56734663", "0.56734663", "0.557152", "0.5552442", "0.5527159", "0.5493241", "0.5491621", "0.5488012", "0.54256237", "0.5413505", "0.5413172", ...
0.0
-1
route middleware to ensure user is logged in
function isLoggedIn(req, res, next) { if (req.isAuthenticated()) return next(); res.redirect('/'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLoggedIn(req, res, next) {\n\tconsole.log('isLoggedIn middleware');\n if (req.isAuthenticated()) {\n \treturn next();\n } else {\n \tres.redirect('/users');\n }\n}", "function isLoggedIn(req, res, next) {\n if (req.isAuthenticated()) return next();\n else res.redirect('/signin');\n }", "...
[ "0.7830781", "0.78219163", "0.7809984", "0.7780423", "0.77706826", "0.776651", "0.77620107", "0.7753045", "0.7751315", "0.7751259", "0.7750051", "0.77436227", "0.7740583", "0.7735315", "0.7733077", "0.7733077", "0.77306277", "0.7725432", "0.77243286", "0.7714864", "0.7714864"...
0.7648227
69
some logger middleware functions
function methodLogger(request, response, next){ console.log("METHOD LOGGER"); console.log("================================"); console.log("METHOD: " + request.method); console.log("URL:" + request.url); next(); //call next middleware registered }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logger(req, res, next) {\n\n}", "function loggingMiddleware(req, res, next) {\n loggers_1.logger.debug(req.method + \" Request from \" + req.ip + \" to \" + req.path);\n next(); //tells function to move on to next matching piece of middleware\n}", "function middleware(req, res, next) {\n if (re...
[ "0.83580697", "0.7862498", "0.7830248", "0.7518588", "0.74298906", "0.7356729", "0.72864425", "0.7156514", "0.7101718", "0.7088606", "0.7060225", "0.70281136", "0.6966041", "0.6895689", "0.6841469", "0.6828414", "0.67857623", "0.6728829", "0.6591484", "0.65910673", "0.6586426...
0.7134312
8
get a list of current conversations sort by time of latest Message, with the latest Message
async getLatest (userid) { try { return await Conversation.find({ participants: userid }).sort({"updatedAt": -1}).populate({path: 'participants latestMessage'}); } catch (err) { throw err; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortMessagesByDate(conversation) {\n conversation.messages.sort(function (a, b) {\n return (new Date(a.timestamp) - new Date(b.timestamp));\n })\n}", "sortMessages(messages) {\n // first collect a list of all the unique channels\n const channels = []\n messages.forEach((message) =>...
[ "0.71629435", "0.6994193", "0.67155087", "0.66880655", "0.6532517", "0.6526045", "0.6503545", "0.6492046", "0.6395452", "0.63886386", "0.6357375", "0.6336274", "0.62737924", "0.6267955", "0.6215172", "0.61384624", "0.61110926", "0.60973746", "0.60484725", "0.6021688", "0.6010...
0.6290774
12
return a list of messages from a conversation, sorted by create time
async getConversation(conversation){ try { return await Message.find({conversationId: conversation}) .sort({"createdAt": 1}) .populate('author', 'firstName lastName'); } catch (err) { throw err; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortMessagesByDate(conversation) {\n conversation.messages.sort(function (a, b) {\n return (new Date(a.timestamp) - new Date(b.timestamp));\n })\n}", "retrieveMessages() {\n let sender = this.props.pair.sender;\n let receiver = this.props.pair.receiver;\n let messageLis...
[ "0.7420953", "0.6804726", "0.67146605", "0.6685857", "0.66764945", "0.661233", "0.65897506", "0.6456966", "0.6347308", "0.63204694", "0.6267208", "0.6258944", "0.6256605", "0.62554634", "0.62545264", "0.6136484", "0.61151373", "0.6095442", "0.6075604", "0.60567874", "0.604492...
0.6059164
19
make a new conversation from user 1
async createConversation(id1, id2){ Conversation.findOne({"participants": [id1, id2]}, async (err, result) => { // make a new conversation if it does not exist if (result == null) { // create a new conversation in database and save it var newConversation =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createConversation() {\n const conv = document.getElementsByName(\"conv\").item(0).value.trim();\n xhttp(\"POST\", \"create-conversation.php\", { name: conv, private: 0}, (response) => {\n if (isNaN(response)) {\n alert(\"There's a problem creating this conversation.\");\n } else {\n con...
[ "0.6778725", "0.6631244", "0.6538785", "0.6368407", "0.6329621", "0.6320197", "0.6235617", "0.620881", "0.61917925", "0.6188908", "0.6136099", "0.61298", "0.6091931", "0.60622305", "0.60550165", "0.598127", "0.5971458", "0.5933096", "0.59236944", "0.5813296", "0.5798844", "...
0.6748012
1
save the message to Database
saveMessage(convid, msg){ var newMsg = new Message(); newMsg.conversationId = convid; newMsg.msgcontent = msg.msgcontent; newMsg.author = msg.author; newMsg.save((err,msg) => { if (err) { throw err; } console.log(msg); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveMessage() {\n message.save(function(err, savedMessage) {\n if(err) {\n return res.status(500).json({\n title: 'An error occurred',\n error: err\n })\n }\n //Succe...
[ "0.7438243", "0.73762", "0.70862156", "0.6991565", "0.6960114", "0.6932185", "0.6864763", "0.6844765", "0.68334895", "0.6829629", "0.6805765", "0.6800399", "0.67928135", "0.6725091", "0.6707905", "0.66923976", "0.667035", "0.6657188", "0.66426677", "0.659159", "0.65878445", ...
0.6278774
61
get other participant's userid
async getotherid(convid, userid){ try { var conv = await Conversation.findById(convid); } catch (err) { throw err; } return conv.participants[0] == userid ? conv.participants[1] : conv.participants[0]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async participant(parent, args, ctx, info) {\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in to do that!\");\n }\n // TODO check authorization (being an admin or a researcher of the study)\n\n const participant = await ctx.db.query.profile(\n {\n where: {\n ...
[ "0.670275", "0.62718374", "0.625306", "0.6226408", "0.61981034", "0.6157557", "0.61183417", "0.60680985", "0.60674685", "0.60501546", "0.6034978", "0.6032486", "0.60208625", "0.60019493", "0.5998589", "0.59714055", "0.59542024", "0.59477484", "0.59309286", "0.5909285", "0.590...
0.80925995
0
After mounting, asks for user location
componentDidMount () { this.getCurrentLocation() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userLocation() {\n if (navigator.geolocation) {\n //geolocation available\n navigator.geolocation.getCurrentPosition(successfulLookup, console.log);\n }\n}", "function getUserLocation() {\n\tif (navigator.geolocation) {\n\t\tnavigator.geolocation.getCurrentPosition(showUserPosition);...
[ "0.6281777", "0.62415713", "0.6090187", "0.60567886", "0.60421", "0.5996114", "0.59893024", "0.5951969", "0.5925751", "0.5924809", "0.5917816", "0.5893834", "0.58538187", "0.5823492", "0.580493", "0.58018756", "0.5795663", "0.57946", "0.5785038", "0.57780796", "0.57731646", ...
0.5628355
60
Define the factory on the module. Inject the dependencies.
function instance(commonConfig,appConfig) { commonConfig.config.controllerActivateSuccessEvent = appConfig.events.controllerActivateSuccess; commonConfig.config.levels = appConfig.levels; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function factory() {}", "function factory() {}", "function Factory(){}", "function registerModuleFactory(id,factory){var existing=modules.get(id);assertNotExisting(id,existing&&existing.moduleType);modules.set(id,factory);}", "function init() {\n\t\t\tvar library;\n\t\t\tlibrary = factory('amd');\n\t\t\tli...
[ "0.69190514", "0.69190514", "0.67804724", "0.67357755", "0.66068447", "0.6602976", "0.65768355", "0.65577173", "0.6482667", "0.6389191", "0.63530636", "0.6278547", "0.62622523", "0.62622523", "0.62320614", "0.6190346", "0.6190346", "0.6190346", "0.6190346", "0.6190346", "0.61...
0.0
-1
For test const authSecret = "43w_wOVYeF9XzyRyZL3O8g" const publicKey = "BJgVD2cj1pNKNR2Ss3U_8e7P9AyoL5kWaxVio5aO16CvnxP1r7HH8SRbh5tuxaydZ1ky3oO0V40s6t_uN1SdA" const privateKey = "ciQ800G6jyKWf6KKG94g5rCSU_l_rgbHbyHny_UsIM"
function decrypt(raw) { // const converted = raw.toString('utf-8') // for debug const converted = raw.toString('base64') const reciverKey = webPushDecipher.reciverKeyBuilder(publicKey,privateKey,authSecret) var decrypted = webPushDecipher.decrypt(converted,reciverKey,false) return decrypted }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(publickey,privatekey){\n this.publickey = p\n this.privatekey = k\n\n}", "constructor(k,p){\n this.privatekey = k;\n this.publickey = p;\n}", "constructor(pri,pub){\n this.privatekey=pri;\n this.publickey=pub;\n}", "async function main(){\n \n const bobChain = new KeyChain( )\n\n await b...
[ "0.6705444", "0.66989017", "0.66954345", "0.61752367", "0.6110702", "0.6109971", "0.60568815", "0.5991055", "0.5986904", "0.5960209", "0.5960209", "0.5949241", "0.5936863", "0.5936863", "0.5936863", "0.5936863", "0.5936863", "0.5933935", "0.59305406", "0.5917375", "0.59035945...
0.0
-1
Packages an api request into a binary buffer
request(apiOpt, data, buffer, offset, cb) { try { var apiDef = this.apiDef(apiOpt); } catch(err) { cb(err); return false; } let startOffset = offset; try { offset = parser.encode({ apiKey: definitions.getApiKey(apiDef.name), version: apiDef.version, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "encodeAsBinary(obj) {\n const deconstruction = binary.deconstructPacket(obj);\n const pack = this.encodeAsString(deconstruction.packet);\n const buffers = deconstruction.buffers;\n buffers.unshift(pack); // add packet info to beginning of data list\n return buffers; // ...
[ "0.5876346", "0.5835433", "0.5797412", "0.5742074", "0.57278025", "0.5668833", "0.5621724", "0.55859643", "0.5508163", "0.5470757", "0.5468482", "0.54063654", "0.53976995", "0.5380914", "0.53699094", "0.5359017", "0.5354291", "0.5317598", "0.52964014", "0.52424884", "0.523606...
0.6450733
0
Grab responseHandler method for binding to "on data" events on tcp connection
get response() { return this.responseHandler.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_onResponse(msg) {\n let _this = this;\n\n let event = {\n type: msg.type,\n url: msg.body.source,\n code: msg.body.code\n };\n\n if (_this._onResponseHandler) {\n _this._onResponseHandler(event);\n }\n }", "listenForData() {\n this.socket.on(EVENT_DATA, data => this.handle...
[ "0.6632621", "0.6503288", "0.64995474", "0.64679676", "0.6362302", "0.6331452", "0.6292661", "0.6220379", "0.6220379", "0.6220379", "0.6205739", "0.6205739", "0.6195061", "0.6167358", "0.6135357", "0.61226356", "0.6107611", "0.6080461", "0.60765857", "0.60765636", "0.60683644...
0.6275967
7
Called for "on data" event for tcp connection Will invoke callback correlated with response from Kafka broker.
responseHandler(data) { if(this.build) { if(data.length + this.curResponse.accumulated > this.curResponse.size) { throw new Error('Ending response length did match reported size'); } else { this.curResponse.data = Buffer.concat([this.curResponse.data, data]); this.curResponse.acc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onData(data) {\n const callback = packet => {\n // if its the first message we consider the transport open\n if (\"opening\" === this.readyState && packet.type === \"open\") {\n this.onOpen();\n }\n // if its a close packet, we close the ongoing req...
[ "0.66444254", "0.6569085", "0.6522845", "0.6502653", "0.6502653", "0.6432173", "0.6368847", "0.6216045", "0.6146987", "0.6104168", "0.6086137", "0.6062268", "0.6019926", "0.6019926", "0.6019926", "0.5999022", "0.5980901", "0.5956494", "0.59192014", "0.59173405", "0.59043413",...
0.0
-1
this function retrieves data from the foursquare api
function getDataFromFourSquare(query, callback){ const data = { client_id: 'WAAZ1GSY5CM05ZRVSRUXC4JYMM4RRZ5KLOKOMCF4PRYI2XHZ', client_secret: 'P11LXVYDAKPIFOPYMUV1HXCVLAHCAFWP1K1WXLKWTP5ZYZM5', 11: '', near: '', radius: STATE.distance, query: STATE.searchFor, v: '20170801', limit:20 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getData() {\n //URL for the FourSquare explore venues request\n var searchFor = 'food';\n var searchRadius = '200'; //meters\n var client_id = \"JI2X04M51STQLOUGVX0SWEOOSOOSHB2BEMZ0QTPM02TMJGGX\";\n var client_secret = \"4W4IRQJ10E0HKFLK4TFX3KZ4Q25DHQMFKH0IQEYFRG3XDQXQ\"...
[ "0.7487134", "0.73822755", "0.7327154", "0.7280951", "0.7240375", "0.72261995", "0.71716964", "0.71501446", "0.7105178", "0.7098395", "0.7062156", "0.70125973", "0.6985997", "0.6976934", "0.69591534", "0.69421595", "0.6940871", "0.68779266", "0.68565613", "0.6784475", "0.6758...
0.63755864
34
this function renders our results into html
function renderResults(result){ console.log(result); return `<h2>${result.name}<h2>` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderResults(results) {\n\n}", "function outPutDATAtoHTML() {\n let displayResult = STATE.searchResult.map(singleRest => {\n return `<div class=\"col-12\">\n <div class=\"col text-color\">\n <p>Name: ${singleRest.name} </p>\n <p>Address: ${singleRest.address}</p>\n <p> Pr...
[ "0.766834", "0.7314297", "0.724018", "0.7238883", "0.71730685", "0.71148723", "0.7108221", "0.7080793", "0.7040619", "0.7024203", "0.70090884", "0.70062226", "0.69958955", "0.6977501", "0.69581616", "0.695433", "0.69485873", "0.69401866", "0.6930889", "0.69298756", "0.6928191...
0.7242532
2
this function goes through the returned objects
function displayFoursquareData(data){ const results = data.items.map((item,index) => renderResults(items)); $(`.js-options`).html(results); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEachObject(results, callback) {\n Object.find({'_id': results.objectId}, {\n profileId: 1,\n channelObjectId: 1,\n objectTypeId: 1\n }, checkNullObject(callback));\n }", "getObjects(subject, predicate, graph) {\n const resul...
[ "0.63389736", "0.6312445", "0.62303483", "0.6117043", "0.6099475", "0.60451764", "0.5970775", "0.5939226", "0.5891308", "0.5862677", "0.58489543", "0.58440465", "0.5817965", "0.58039623", "0.5803441", "0.5752201", "0.57499874", "0.5749371", "0.5749371", "0.5722163", "0.571027...
0.0
-1
this function listens for the location submit FIXXX
function watchSubmit(){ $(`.js-where`).submit(event =>{ event.preventDefault(); const query = $('.js-otherLocation').val(); //clear input $('.js-otherLocation').val(''); getDataFromFourSquare(query, displayFoursquareData); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleGeolocationClick(e) {\n\t\t\ttheInterface.emit('ui:geolocationRequest');\n\t\t}", "function submitomniFormPath(event,omniFormPath){\n\tconsole.log(event,omniFormPath);\n var fullurl = document.location.href\n \tvar baseurl = document.location.protocol +'//' + document.location.host + document....
[ "0.6253449", "0.6204656", "0.61465734", "0.613377", "0.6055361", "0.60344195", "0.601119", "0.600012", "0.59624296", "0.5942547", "0.59259987", "0.59186214", "0.59073466", "0.5901471", "0.5900557", "0.58925164", "0.58481646", "0.58458513", "0.5797994", "0.57917863", "0.578323...
0.5658782
29
this function sets the searchFor key value in STATE to either wineries or tasting room
function setSearchFor(){ $(`.js-wineries`).on('click',function(){ STATE.searchFor = 'Wineries'; console.log(STATE.searchFor); }); $(`.js-tasteRooms`).on('click',function(){ STATE.searchFor = 'Tasting Rooms'; console.log(STATE.searchFor); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateSearchCreteria(searchCriteria) {\n if (searchCriteria == \"byname\") {\n STATE.searchOption = 1;\n } else if (searchCriteria == \"cuisine\") {\n STATE.searchOption = 2;\n } else if (searchCriteria == \"random\") {\n STATE.searchOption = 3;\n } else if (searchCriteria == \"roulette\") {\...
[ "0.6578052", "0.58892727", "0.5880513", "0.58445746", "0.56867445", "0.5664343", "0.56231076", "0.55498004", "0.55488735", "0.55438924", "0.5514413", "0.5479114", "0.5444053", "0.54329896", "0.54252917", "0.5395966", "0.5369938", "0.5365207", "0.53472334", "0.53419185", "0.53...
0.66562206
0
This function will call functions based on the users' selection and hides the original form
function whatToSearch(){ $(`.js-search`).on('click',function(){ //will eventually ask to allow for location // make an if statement to set a global variable to winerie or taste room depending on which button was pressed. $(`.js-where`).removeClass('hidden') }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectForm(){\n\tif(document.getElementById(\"designComponent\").checked){\n\t\tdocument.getElementById(\"componentForm\").style.display = \"block\";\n\n\t\tdocument.getElementById(\"sequenceForm\").style.display = \"none\";\n\t\tdocument.getElementById(\"backboneForm\").style.display = \"none\";\n\n\t\ts...
[ "0.6927069", "0.6541133", "0.652252", "0.64812154", "0.6477945", "0.64694905", "0.6461405", "0.64229035", "0.6408779", "0.64000046", "0.6375962", "0.6375116", "0.6354709", "0.6342639", "0.6320102", "0.6315697", "0.63113797", "0.6306004", "0.6276401", "0.6272547", "0.62654334"...
0.0
-1
This function updates the distance value
function updateTextInput(val) { document.getElementById('textInput').value=val; STATE.distance = val; console.log(STATE.distance); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set distance(value) {}", "set ['distance'](val){\r\n\t\tthis.d = val * this.shapeOfDif;\r\n\t\tthis.dist = val;\r\n\t\tthis.calculateDiffGradient();\r\n\t}", "set distance(newValue) {\n this.setProperty(\"distance\", newValue);\n }", "function distanceUpdate(distance) {\n document.querySelector(...
[ "0.7898672", "0.76362634", "0.75453514", "0.74075496", "0.72999126", "0.72999126", "0.7089654", "0.7075472", "0.7020362", "0.6897195", "0.67279524", "0.6632142", "0.6600464", "0.6564793", "0.6531251", "0.6508941", "0.649526", "0.6454285", "0.6433415", "0.6344625", "0.6344625"...
0.643816
18
this function will determine the information that will be sent to the APIs, location, and distance.
function whereToSearch(){ console.log('whereToSearch') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapsApiRequest() {\r\n\r\n enteredLocation = 0;\r\n destination = 0; \r\n\r\n enteredLocation = getLocation();\r\n destination = getDestination();\r\n \r\n\r\n checkData(enteredLocation); //You need to make sure you have a good valur and if not display an error\r\n checkData(destination) ;\r\n\r\n getDi...
[ "0.65580857", "0.6330421", "0.62995946", "0.6225197", "0.61989427", "0.6179627", "0.617057", "0.6128333", "0.608812", "0.6070631", "0.60590744", "0.60559523", "0.6051204", "0.602715", "0.600604", "0.5996934", "0.59915054", "0.598604", "0.5971502", "0.596974", "0.59540784", ...
0.0
-1
bring it all together function
function searchWine(){ setSearchFor(); whatToSearch(); watchSubmit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function miFuncion (){}", "function fn() {\n\t\t }", "function wa(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function fun1(){} //toda a função de js retorna alguma coisa", "function _____SHARED_functions_____(){}", "function fm(){}", "function fuctionPani...
[ "0.6094223", "0.59776986", "0.5971642", "0.5904898", "0.5904898", "0.5904898", "0.59045035", "0.56686187", "0.56572324", "0.56443864", "0.56414664", "0.5605262", "0.55337226", "0.5531244", "0.5531244", "0.5531244", "0.5531244", "0.55242497", "0.55242497", "0.55242497", "0.550...
0.0
-1
END. SVG Sprite social networks
function fontsStyle() { let file_content = fs.readFileSync(source + '/scss/fonts.scss'); if (file_content == '') { fs.writeFile(source + '/scss/fonts.scss', '', cb); return fs.readdir(path.build.fonts, function (err, items) { if (items) { let c_fontname; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "star() {\n const context = GameState.current;\n\n Helper.strewnSprite(\n Helper.getMember(GroupPool.star().members),\n { y: context.game.stage.height },\n { y: 3 }\n );\n }", "function OnDrawGizmos() {\n\tGizmos.DrawIcon(transform.position, \"Player_Icon.tif\");\n}", "function drawNati...
[ "0.592256", "0.5555363", "0.54702526", "0.5339006", "0.5309169", "0.5286634", "0.52579343", "0.5252673", "0.52413744", "0.52344674", "0.5226381", "0.52045095", "0.51656693", "0.5164258", "0.51566935", "0.5133898", "0.5097196", "0.5081201", "0.50768876", "0.5067451", "0.506135...
0.0
-1
MYBUYS This is for mybuys page recommendations. This renders recommendations on the page.
function loadzone(zones) { for (zonekey in zones) { try { try { if (typeof zones[zonekey] == 'function') { continue; } } catch(e) { continue; } var zoneDivId = zones[zonekey].divId, zoneDivTitle = zones[zonekey].zoneTitle, zon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayBookRecommendation(data) {\n const results = data.results.map((item, index) => renderInitialResult(item));\n $(`.book-results`).html(results);\n}", "function displayRecommendations(results) {\n\trecommendationsContainer.insertAdjacentHTML('beforeend', \"<h1> Recommendations </h1>\");\n\n\tvar g...
[ "0.63092226", "0.60753137", "0.6046694", "0.58916485", "0.583971", "0.5824865", "0.578702", "0.5775312", "0.5683831", "0.5549033", "0.5524438", "0.5499092", "0.54931635", "0.548919", "0.5475651", "0.5467924", "0.5458544", "0.5449802", "0.5422705", "0.53970546", "0.5368206", ...
0.0
-1
Step advance upon validating form fields
function advanceStep() { formSteps[i][currentStep].fadeOut(500).addClass('hidden').queue(function() { if (currentStep !== maxSteps[i]) { formSteps[i][currentStep + 1].hide().removeClass('hidden').fadeIn(500); } currentStep++; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateNextStep() {\n var parent_fieldset = $(this).parents('fieldset');\n var next_step = true;\n\n parent_fieldset.find('#amount').each(function() {\n var regExpression = new RegExp('\\\\d{1,}').test($(this).val());\n if (!regExpression || $(this).val().length > 10000) {\n $(this).addClas...
[ "0.73352116", "0.7169782", "0.7123624", "0.71016043", "0.71016043", "0.7067772", "0.70344234", "0.6989638", "0.6961849", "0.6879747", "0.6879747", "0.6877291", "0.67590004", "0.67292386", "0.65983784", "0.6518957", "0.6494448", "0.64340484", "0.6395098", "0.63822365", "0.6362...
0.0
-1
The actual plugin constructor
function Plugin(element, options) { this.element = element; this.init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "constructor() {\n\t\t// ...\n\t}", "consructor() {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "init() {\n }", "constructor()\n {\n this.init();\n }", "function contruct() {\n\n ...
[ "0.7422684", "0.7349132", "0.7314277", "0.73003334", "0.7299704", "0.7292701", "0.72775894", "0.72354233", "0.7233936", "0.7181569", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71761876", "0.7157667", "0.71499527", "0.71496284", "0.71496284", "0.7...
0.0
-1
The actual plugin constructor
function Plugin (element, options) { this.element = element; this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "constructor() {\n\t\t// ...\n\t}", "consructor() {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "init() {\n }", "constructor()\n {\n this.init();\n }", "function contruct() {\n\n ...
[ "0.7422684", "0.7349132", "0.7314277", "0.73003334", "0.7299704", "0.7292701", "0.72775894", "0.72354233", "0.7233936", "0.7181569", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71761876", "0.7157667", "0.71499527", "0.71496284", "0.71496284", "0.7...
0.0
-1
Return a grid for Demineur
function DemineurGridBuilder(size, mineNumber) { /** * Constructor * (called at this end of DemineurGridBuilder(...)) */ let Constructor = () => { //getting all coordinate this.coordinates = Coordinate.helperGridCoordinate(size); this.bombCells = []; //placing b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeGrid(){\n\t\tvar startX = 149;\n\t\tvar startY = 119;\n\t\tvar interval = 6;\n\t\tvar nodeArray = [];\n\t\tfor (var i=0; i<660; i+=interval){\n\t\t\tfor (var j=0; j<660; j+=interval){\n\t\t\t\tnodeArray.push({x:startX+i,y:startY+j,city:null});\n\t\t\t}\n\t\t}\n\t\treturn nodeArray;\n\t}", "function ...
[ "0.7011581", "0.6944183", "0.69325674", "0.6912098", "0.6891487", "0.68532443", "0.67679095", "0.6709801", "0.6652364", "0.6636817", "0.65995586", "0.658356", "0.65812904", "0.657662", "0.65652966", "0.6552029", "0.6546951", "0.6544253", "0.65179074", "0.6509204", "0.648433",...
0.0
-1
A cell of the futur Demineur grid
function Cell(coordinate, isBomb) { this.coordinate = coordinate; //x.y this.isBomb = isBomb; //true if this is a bomb cell this.bombNeightbor = []; //array of near cell which are bomb cell (sometimes it can contains the cell itself, but it doesn't matter) /** * Adding a neightbor cell * @par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleCell(x, y, grid) {\n const nextGrid = grid.slice();\n if (nextGrid[y][x] === undefined) {\n nextGrid[y][x] = \"live\";\n } else {\n nextGrid[y][x] = undefined;\n }\n return nextGrid;\n }", "function placeCell() {\n this\n .attr(\"fill\", function(d) { return cellColor(...
[ "0.637504", "0.6371144", "0.6342848", "0.6328713", "0.6317758", "0.62996113", "0.62977225", "0.6242264", "0.6229788", "0.61910367", "0.6186711", "0.6171081", "0.616543", "0.6148006", "0.6141443", "0.61324763", "0.6125067", "0.6099768", "0.6089578", "0.6076902", "0.6071571", ...
0.0
-1
Delete a data file.
delete(directory, fileName, callback) { const theFilePath = getDataStoragePath(directory, fileName); fs.unlink(theFilePath, err => { if (err) return callback(new Error(`Failed to delete file!`), 500); callback(null); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async _remove () {\n try {\n await deleteFile(this.dataPath);\n }\n catch (e) { // eslint-disable-line no-empty\n }\n }", "deleteFile(path) {\r\n // Get the path\r\n path = this.getAbsoluteDataPath(path);\r\n // Make sure the path exists\r\n i...
[ "0.6879972", "0.67001516", "0.6380399", "0.6295899", "0.6259035", "0.6182395", "0.6165895", "0.61545384", "0.6064429", "0.6059932", "0.60560364", "0.60533625", "0.59846294", "0.59826064", "0.598027", "0.59788877", "0.59225154", "0.589172", "0.5848051", "0.58455443", "0.583710...
0.6714552
1
Create whatever is needed to draw this tile.
initTile(tile) { super.initTile(tile); this.renderTile(tile); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "generateView(tile) {\n var piece = document.createElement('div');\n piece.style.backgroundImage = 'url(\\'img/pieces/' + this.color + '/' + this.type + '.svg\\')';\n piece.setAttribute('class', 'piece');\n tile.appendChild(piece);\n }", "createBoard() {\n\t\tfor (let i = 0; i < 6; ...
[ "0.6982842", "0.6729036", "0.6693994", "0.6651736", "0.663792", "0.6598406", "0.6596043", "0.6591187", "0.6548952", "0.6541214", "0.65294975", "0.6480009", "0.6471344", "0.64413047", "0.6433123", "0.639748", "0.63924956", "0.63922936", "0.6383423", "0.6373382", "0.63638914", ...
0.0
-1
Adds information to recreate the track in SVG to the tile
addSVGInfo(tile, x, y, width, height, color) { if (tile.svgData) { tile.svgData.barXValues.push(x); tile.svgData.barYValues.push(y); tile.svgData.barWidths.push(width); tile.svgData.barHeights.push(height); tile.svgData.barColors.push(color); } else { tile.svgData = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_getSVGHandler(e){let root=this,temp=document.createElement(\"div\"),getID=function(element,alt){if(null===element.getAttribute(\"id\"))element.setAttribute(\"id\",alt);return element.getAttribute(\"id\")},setAriaLabelledBy=function(source,target,prefix){// adds title and desc elements to target and sets the aria-...
[ "0.6359364", "0.62952596", "0.6194794", "0.60829645", "0.6051067", "0.5974995", "0.5969296", "0.59442836", "0.5935579", "0.5688734", "0.56467646", "0.558477", "0.5571613", "0.555595", "0.5545693", "0.5543745", "0.5531018", "0.55294275", "0.546645", "0.54612964", "0.54493344",...
0.66303855
0
[CRUD] GET Method to get resource list
fetchResourceList(context) { fetch(`${process.env.VUE_APP_API_URL}/v1/tool`, { method: `GET` }) //=> Fetch API .then(response => !response.ok ? console.log(response) : response.json(response)) //=> Check response .then(async (apiResponse) => await context.commit(`RESOURCELIST`, { data: apiResponse.data })) /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\n }\n return this.rest.get(`${this.baseUrl}/list`, ...params);\n }", "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\...
[ "0.7416089", "0.7416089", "0.73947746", "0.7079378", "0.70171523", "0.6888341", "0.6851834", "0.68355936", "0.6776235", "0.6749077", "0.6736403", "0.6732089", "0.66405475", "0.65732384", "0.6570958", "0.65471274", "0.6521954", "0.65067387", "0.6496497", "0.6474827", "0.645392...
0.6284603
37
[CRUD] GET Method to get resource data from ID
fetchSingleResource(context, id) { fetch(`${process.env.VUE_APP_API_URL}/v1/tool/${id}`, { method: `GET` }) //=> Fetch API .then(response => !response.ok ? console.log(response) : response.json(response)) //=> Check response .then(async (apiResponse) => await context.commit(`SINGLERESOURCE`, { data: apiRespo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get(id) {\n\n }", "getDetail(id) {\n return this.fetch(`${this.api}/${this.resource}/${id}`);\n }", "get(id) {\n return this.rest.get(`${this.baseUrl}/${id}`);\n }", "get(id) {\n return this.rest.get(`${this.baseUrl}/${id}`);\n }", "get(id)\n {\n return this._fetch(this...
[ "0.7416903", "0.72328705", "0.718266", "0.718266", "0.70858335", "0.70778054", "0.70540166", "0.6975945", "0.6850276", "0.68474513", "0.6803977", "0.67861414", "0.6767865", "0.6763066", "0.6731189", "0.67173225", "0.67173225", "0.6716594", "0.67097914", "0.6706541", "0.670017...
0.0
-1
This method changes the allowed extensions dynamically depending on what category the user chosses.
function chooseUploadCategory() { var categories = document.getElementById("categories"); var selectedCategory = categories.options[categories.selectedIndex].value; document.getElementById("allowedExtensions").innerHTML = getAcceptedExtensions(selectedCategory); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listAllowedExt() {\n var\n fileTypes = Y.doccirrus.media.types.fileTypes,\n allowedExt = [],\n i;\n\n for ( i = 0; i < fileTypes.length; i++ ) {\n if ( -1 !== allowCategories.indexOf( fileTypes[i].group ) ) {\n allowedExt.push( fileT...
[ "0.58253306", "0.54378134", "0.5223814", "0.5219645", "0.52114433", "0.5177112", "0.517638", "0.51472545", "0.5117106", "0.50978196", "0.5083714", "0.5017546", "0.4931179", "0.4931179", "0.49148148", "0.4883971", "0.48244393", "0.48067865", "0.48011512", "0.47888672", "0.4786...
0.6658879
0
This method displays an error message if the user has not filled in all the boxes.
function uploadButtonClick() { var author = document.getElementById("author").value; var year = document.getElementById("yearpicker").value; var description = document.getElementById("description").value; var restriction = document.getElementById("restriction").value; var authorInformation = document.getElementByI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkValidity() {\n if (invalidWidgetIds.length > 0) {\n msgService.showInfoRight(localization.getString('emailbuilder.error.unfilledrequiredproperties'));\n } else {\n msgService.hideInfoRight();\n }\n }", "function allFilled() {\n\t\t$userTypeMessage = $(\...
[ "0.6846902", "0.6833743", "0.6688709", "0.6666264", "0.6603161", "0.65529835", "0.6486641", "0.6464624", "0.6399211", "0.6395244", "0.6377697", "0.62967145", "0.6294516", "0.6294223", "0.6224216", "0.6217916", "0.6204859", "0.61985016", "0.6196854", "0.6195814", "0.61919695",...
0.0
-1
function to write README file
function writeToFile(fileName, data) { fs.writeFile(fileName, data, (err) => { if (err) { return console.log(err); } console.log('Success! Your file had been generated') }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeREADME(savefileName, data) {\n fs.writeFile(savefileName, data, () => {});\n \n console.log('Your README has been generated, check the dist folder')\n}", "function writeToFile() {\n fs.writeFile(\"README.md\", \"\", function(err){console.log(err || \"File written successfully!\")})\n}", "func...
[ "0.8015377", "0.7684734", "0.7674064", "0.76685166", "0.76557654", "0.7618611", "0.7577375", "0.7530927", "0.75165516", "0.74807274", "0.7430796", "0.74250484", "0.74225116", "0.7401885", "0.7380425", "0.7353119", "0.7345033", "0.7313819", "0.730648", "0.7302795", "0.7292332"...
0.0
-1
function call to initialize program
function init() { questions() .then(questionsData => { return generateMarkdown('questionsData'); }) .then(writeMarkDown => { return writeFile(writeMarkdown); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupProgram(program) {\n }", "function main(opts){\n return initialize;\n}", "function initProgram() {\n var program = require('commander');\n\n program.option(\n '-p, --probability [number]',\n 'probability of sampling chunk',\n parseFloat\n );\n program.option(\n ...
[ "0.7660775", "0.68602586", "0.6811612", "0.66398007", "0.6591108", "0.6591108", "0.6591108", "0.6591108", "0.6591108", "0.6591108", "0.6591108", "0.6591108", "0.6591108", "0.6591108", "0.6585534", "0.64731014", "0.64731014", "0.64270353", "0.64270353", "0.6407035", "0.6406972...
0.0
-1
return the sum of those two numbers and all numbers between them.
function sumAll(arr) { var largerNum = Math.max(...arr); var smallerNum = Math.min(...arr); var sum = 0; for(var i=smallerNum; i<=largerNum; i++){ sum += i; } return sum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeSumBetween(num1, num2) {\n var rangeArray = [];\n var sumResult = 0;\n\n if (num1 < num2) {\n for (var i = num1; i < num2; i++) {\n rangeArray.push(i);\n }\n\n for (var i = 0; i < rangeArray.length; i++) {\n sumResult += rangeArray[i];\n }\n\n return sumResult;\n\n } el...
[ "0.79078794", "0.7593536", "0.7544563", "0.75071734", "0.7436057", "0.7424866", "0.730096", "0.72688353", "0.72553366", "0.7217791", "0.71901184", "0.7168281", "0.7161941", "0.7155828", "0.715213", "0.7123838", "0.6942924", "0.6942924", "0.6942924", "0.69327533", "0.6924828",...
0.0
-1
addSearch() function adds the HTML for the searchbar.
function addSearch() { const header = document.querySelector('.header'); const searchBar = ` <label for="search" class="student-search"> <span>Search by name</span> <input id="search" placeholder="Search by name..."> <button type="button"><img src="img/icn-search.svg" alt="Search ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addSearch() {\r\n\t\t\tvar id = \"mapsed-search-box-\" + _instance;\r\n\r\n\t\t\t_searchBox = $(\"#\" + id);\r\n\t\t\tif (_searchBox.length > 0)\r\n\t\t\t// already added\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// create the \"search\" box and add to document (in body)\r\n\t\t\tvar so = settings.searchOptions,\r\...
[ "0.75613457", "0.75437903", "0.7187613", "0.7106349", "0.7075514", "0.6920032", "0.6894082", "0.68705493", "0.6762678", "0.6675733", "0.6668433", "0.6653565", "0.6650991", "0.6633739", "0.65868545", "0.6547466", "0.6481682", "0.6459304", "0.64173156", "0.6410556", "0.6334975"...
0.6968978
5
The showPage() function creates the HTML elements that are displayed and dynamically inserts the values for the required objects.
function showPage(list, page) { const startIndex = (page * 9) - 9; const endIndex = page * 9; const studentUL = document.querySelector('.student-list'); studentUL.innerHTML = ''; if (list.length < 1) { const ul = document.querySelector('.student-list'); ul.innerHTML = `<h1>No results found.....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showPage() {\n htmlPage = \"\"; // reset html code in every function calls\n for(let i = start; i <= end; i++){\n generateHTML(objArray[i]); // populate html code with the data\n }\n studentList.innerHTML = htmlPage;\n}", "function createPage() {\n init();\n generateCard();\n makeC...
[ "0.7072698", "0.66296494", "0.66259575", "0.6583753", "0.6499704", "0.6488089", "0.64826024", "0.64789456", "0.6457889", "0.6421871", "0.6385367", "0.6304354", "0.6296259", "0.6265674", "0.6256401", "0.6253396", "0.6250338", "0.6238594", "0.6213465", "0.6200149", "0.61717", ...
0.0
-1
addPagination() Decides how many pages will be needed based on the number of objects in the array, and inserts buttons for switching between pages.
function addPagination(list) { const requiredPages = Math.ceil(list.length / 9); const linkUL = document.querySelector('.link-list'); linkUL.innerHTML = ''; for ( let i = 1; i < requiredPages + 1; i++ ) { const pageLI = ` <li> <button type="button">${i}</button> </li>`; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addPagination() {\n let numberOfPage = Math.ceil(objArray.length / 9); // figuring how many number of page necessary\n linkList.innerHTML = \"\"; // clear list inside studentList\n pageButton = \"\";\n for(let i = 0; i < numberOfPage; i++){ // generate page numbers based on the numberOfPage\n ...
[ "0.7877161", "0.7761452", "0.74285", "0.74034643", "0.73289764", "0.7323295", "0.729499", "0.7274832", "0.72655195", "0.7252303", "0.72253764", "0.7216341", "0.7161346", "0.7156715", "0.7138726", "0.70801175", "0.70538414", "0.70517087", "0.7036534", "0.7024567", "0.7021741",...
0.7220724
11
Search function searches for names that contain string, and calls showPage/addPag' functions with those results.
function search(input, list) { let newList = []; for ( let i = 0; i < list.length ; i++) { const name = `${list[i].name.first} ${list[i].name.last}`; if (input.value.length !== 0 && name.toLowerCase().includes(input.value.toLowerCase()) && input.value !== ' ') { newList.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchNames() {\r\n\r\n Word.run(function (context) {\r\n\r\n // Mettez en file d'attente une commande pour obtenir la selection actuelle, puis\r\n // creez un objet de plage proxy avec les resultats.\r\n var body = context.document.body;\r\n context.load...
[ "0.68505794", "0.6611817", "0.6611348", "0.6500877", "0.64370906", "0.6421471", "0.6369142", "0.63478404", "0.63435096", "0.6259723", "0.6259394", "0.62376946", "0.623305", "0.6192509", "0.61669254", "0.6147992", "0.6130066", "0.6127286", "0.6097969", "0.6039614", "0.6033515"...
0.0
-1
startApp() function calls showPage & addPagination, with default arguments of data and page 1:
function startApp(list, pageNum) { showPage(list, pageNum); addPagination(list); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startApp() {\n //first calls, default dataset? \n }", "function loadApp() {\n console.log(\"loadApp\");\n displayHomePage();\n}", "function AppPage() {\n Page.apply(this, arguments);\n }", "function addPagination(page, data, numToShow) {\n //Quick math to know how many pages the do...
[ "0.64491427", "0.5971215", "0.5890537", "0.5875089", "0.58486074", "0.5838368", "0.5789486", "0.5724245", "0.5712451", "0.5698413", "0.568539", "0.5599344", "0.55915433", "0.5578833", "0.5569302", "0.55102813", "0.5503764", "0.54925627", "0.54896057", "0.5489597", "0.5470669"...
0.80021614
0
END OF QUESTION 5 function to get next random question
function nextQuestion(){ var next = Math.floor(Math.random()*6); console.log(next); var question = $(".pol_questions0"+next); $(".img-circle").addClass("hide_div"); $(".politic:not(question)").addClass("hide_div"); question.removeClass("hide_div"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateRandomQ() {\r\n let randomQuestion = Math.floor(Math.random()*questionsArray.length) + 1;\r\n let questionToAsk = questionsArray[randomQuestion - 1];\r\n\r\n return questionToAsk;\r\n }", "function prepareNextQuestion() {\n // Obtain information about the current board\n var avai...
[ "0.80087304", "0.7882226", "0.7824541", "0.7790121", "0.7745772", "0.76727444", "0.7621707", "0.761711", "0.7556837", "0.75467306", "0.75295115", "0.7468754", "0.7419374", "0.74167734", "0.74111277", "0.7408906", "0.7395064", "0.7373844", "0.7333791", "0.73226374", "0.7314164...
0.71310866
32
for ok button modal
function nextQuestions(){ var previousChild= $('.politics:nth-child(1)') previousChild.addClass("hide_div"); previousChild.hide(); var next = Math.floor(Math.random()*6); console.log(next); var question = $(".pol_questions0"+next); question.removeClass("hide_div"); $(".img-circle")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "okPressed() {\n this.$uibModalInstance.close(this.processingType.specimenProcessing.input);\n }", "function buttonOkClickFunc(){\r\n\t\tself.close(); //关闭对话框\r\n\t\tconsole.log(\"button ok clicked!\");\r\n\t\tif(self.buttonOkCallback!=null){\r\n\t\t\tself.buttonOkCallback();\r\n\t\t}\r\n\t}", "fun...
[ "0.75416666", "0.74797106", "0.72084516", "0.7144695", "0.7041414", "0.6896082", "0.68817717", "0.6826529", "0.67845976", "0.677705", "0.67473537", "0.6718349", "0.6714415", "0.66835415", "0.66764414", "0.66083217", "0.6607659", "0.6587833", "0.656302", "0.656302", "0.6561540...
0.0
-1
FUNCTIONS FOR AUDIO INPUT function for when the correct answer is clicked
function correctSound(){ var Csound = new sound ("audio/correct_score.mp3"); Csound.play(); setTimeout(function() { $(".bg-bubbles").removeClass("hide_div"); }, 20); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function correctAnswer() {\n $(\"#message\").html(\"Your Answer is <span style='color:green';>Correct!! <i class='fa fa-check-square-o' aria-hidden='true'></i></span>\");\n var correctSound = new Audio(\"assets/audio/Correct AnswerIdea Sound Effects.mp3\");\n correctSound.play();\n correct++;\n ...
[ "0.72340673", "0.7115506", "0.7017056", "0.69787294", "0.6967248", "0.69190705", "0.69003594", "0.68431133", "0.68371314", "0.67241216", "0.6707756", "0.66524434", "0.6635154", "0.6620523", "0.66154194", "0.6610403", "0.6601811", "0.65854394", "0.6574452", "0.65659285", "0.65...
0.0
-1
function for when the wrong answer is clicked
function wrongSound(){ var Csound = new sound ("audio/wrong.mp3"); Csound.play(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickedWrong() {\n $(\"#correctInput\").hide();\n $(\"#wrongInput\").show();\n if (clickedWrong) {\n yourScore -=5;\n }; if (yourScore < 0) {\n yourScore=0;\n }\n }", "function clickOn1(){if(goodAnswer == 1){ correctAnswerClick(1); }else{ badAn...
[ "0.75697166", "0.7504019", "0.7495412", "0.7470415", "0.7378531", "0.7306027", "0.7261497", "0.7225069", "0.718296", "0.7142011", "0.71215403", "0.7077263", "0.7070335", "0.70659596", "0.7054566", "0.7053684", "0.7053316", "0.7037552", "0.7018571", "0.7018536", "0.70069563", ...
0.0
-1
function for when the time is up
function TimeUpSound(){ var Csound = new sound ("audio/timeup.mp3"); Csound.play(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timeUp(){\n\t\tif (timer===0){\n\t\talert(\"Sorry...Time's up!\");\n\t\tstop();\n\t\t}\n\t}", "overTime(){\n\t\t//\n\t}", "function upTime(){\n\t\tif(playlist.length>0){\n\t\t\tmpd.send('status', function(r){\n\t\t\t\tconsole.log(mpd.response['time']);\n\t\t\t\tvar stime= mpd.response['time'].split(\"...
[ "0.7361922", "0.7188927", "0.7181946", "0.7128244", "0.7077099", "0.70293075", "0.7027286", "0.7008716", "0.6840396", "0.682768", "0.6752572", "0.6654255", "0.6653299", "0.6648814", "0.6642306", "0.6634609", "0.6604264", "0.65985376", "0.6596435", "0.6595366", "0.65910685", ...
0.0
-1
function for when a player becomes a scholar
function ScholarSound(){ var Csound = new sound ("audio/scholar_sound.mp3"); Csound.play(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userScissors() {\n userChoiceword = \"scissors\";\n if (computerChoiceword == \"scissors\")\n {\n //Function for a user tie result.\n tie();\n resultTied();\n }\n else if (computerChoiceword == \"paper\")\n {\n //Functio...
[ "0.6182185", "0.6028058", "0.59992534", "0.596627", "0.5850421", "0.57868564", "0.5781622", "0.5764845", "0.57516664", "0.57454735", "0.5707484", "0.5704976", "0.5681417", "0.567385", "0.56690806", "0.56643856", "0.5659336", "0.56410944", "0.5633394", "0.56331176", "0.5628862...
0.0
-1
defining the changeBackground function
function changeBackground () { console.log("clicked"); // value in city-type input becomes the city variable // let city = $("#city-type").val(); console.log(city); // if the city is equal to any of these, then chance the css class of body to if (city == "New York City" || "NYC") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function background(param)\n{\n novel_changeBackground(param, false);\n}", "function changeBg() {\r\n\t\r\n\tdocument.body.style.backgroundColor='lightgrey';\r\n\t\r\n}", "function changebackground(){\n\tdocument.body.style.backgroundColor = 'green';\n}", "function changeBackground() {\n \n document...
[ "0.77457297", "0.7416399", "0.73978037", "0.73920286", "0.7391639", "0.73152167", "0.73118263", "0.7303432", "0.7261372", "0.7259575", "0.7229635", "0.7229635", "0.7225255", "0.71684647", "0.7144692", "0.71419543", "0.7141906", "0.71315086", "0.7127573", "0.7111279", "0.71026...
0.0
-1
simulates block constantly falling
function playerDrop(){ player.pos.y++; //if block has reached bottom send it back up if(collide(arena, player)){ player.pos.y--; merge(arena, player); playerReset(); arenaSweep(); updateScore(); } dropCounter = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Burst () {\n\tbursting = true;\n\tfor(var bur : int = 0; bur < 3; bur++){\n\t\tFire ();\n\t\tyield WaitForSeconds (srate);\n\t}\n\tyield WaitForSeconds (.1);\n\tbursting = false;\n}", "function blockFallingRoutine() {\n\n // check if we have full lines, if we have them, remove them\n check...
[ "0.6563737", "0.6532108", "0.63465834", "0.63047546", "0.62376523", "0.61790556", "0.61764777", "0.6153193", "0.61404645", "0.6128369", "0.6119852", "0.6111113", "0.60986006", "0.6088604", "0.607384", "0.604176", "0.6032581", "0.6021164", "0.59863806", "0.59825826", "0.597401...
0.0
-1
prevents from leaving canvas if you keep moving sideways
function playerMove(dir){ player.pos.x += dir; if(collide(arena, player)) player.pos.x -= dir; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "outsideCanvas() {\n if(this.y > 400){\n this.y = 380;\n }\n if(this.x > 400){\n this.x = 400;\n }\n else if(this.x < 0){\n this.x = 0;\n }\n }", "preventMove() {\n this.currentMovePrevented = true;\n }", "function outBounds() {\r...
[ "0.68074256", "0.6732294", "0.66920817", "0.6519656", "0.6486221", "0.64673936", "0.64503235", "0.6375594", "0.63473916", "0.6312818", "0.63090354", "0.62870824", "0.6284817", "0.6274078", "0.6267336", "0.62434536", "0.618338", "0.61633414", "0.6154738", "0.61223936", "0.6121...
0.0
-1