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
rewrite this! pan + zoom function
function initPanZoom() { var panZoom = map.paper.panzoom(); panZoom.enable() setInterval(function() { $('h1').html(panZoom.currZoom +' x:'+panZoom.currPos.x.toFixed(0)+' y:'+panZoom.currPos.y.toFixed(0)); }, 50); var css = '<style type="text/css">.grabbing { cursor: url(data:image/x-icon;base64,AAACAAEAICACAAcABQAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAAH/AAAB/wAAA/0AAANsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//+AB///wAf//4AH//+AD///yT/////////////////////////////8=), pointer !important; } .map-controls div { cursor:pointer; font-size: 20px; color: #777; font-weight:bold; font-family: Helvetica; line-height: 28px; text-align:center;border: 1px solid #bbb; } .map-controls div:hover { border: 1px solid #999; color: #000; }</style>'; $('body').append(css); // init pan zoom controls var ctrls = $('<div />'), up = $('<div>+</div>'), down = $('<div>-</div>'); ctrls .addClass('map-controls') .css({ position: 'relative', top: -80, left: 30, 'z-index': 1000 }) .append(up).append(down); up.css({ 'border-radius': '14px 14px 0 0', width: 28, height: 28, position: 'absolute', top: 0, left: 0, background: '#fff' }); down.css({ 'border-radius': '0 0 14px 14px', width: 28, height: 28, position: 'absolute', top: 29, left: 0, background: '#fff' }) $('#map').parent().append(ctrls); up.click(function (e) { panZoom.zoomIn(1); e.preventDefault(); }); down.click(function (e) { panZoom.zoomOut(1); e.preventDefault(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zoom(){\n\t//NOT YET\n\t/*var rect = canvas.getBoundingClientRect();\n var mx = panX + (panX - rect.left) / zooms;\n var my = panY + (panY - rect.top) / zooms;\n zooms = document.getElementById(\"za\");\n panX = mx - ((panX - rect.left) / zooms);\n panY = my - ((panY - rect.top) / zooms);\n...
[ "0.7314129", "0.7143018", "0.7032239", "0.7011948", "0.69826597", "0.6962996", "0.6936321", "0.6837072", "0.6791536", "0.676691", "0.6753278", "0.67343026", "0.67177033", "0.67031777", "0.66930425", "0.66316444", "0.66298586", "0.66282594", "0.6600352", "0.6590201", "0.658278...
0.6526144
28
begin timeline at the right time
function klapp_timeline_startpoint() { $('.timecapsule').each(function() { if( $('ol', this).children().length != 0 && $('ol', this).children().is(':visible') ) { var container_margin = $(this).position(); $('.maintain').animate({ 'margin-top': '-' + container_margin.top + 'px' }, 500); return false; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start(){\n timeline.play();\n }", "function start_timeline(time) {\n line_count = setInterval(timer, 33);\n function timer() {\n time += 1;\n time_line.style.width = time + \"px\";\n if (time > 479) {\n clearInterval(line_count);\n }\n }\n}", "function begin() {\n points = 0;\n pa...
[ "0.6834218", "0.6737481", "0.6436609", "0.6418372", "0.6414582", "0.64077926", "0.6360009", "0.63226986", "0.6284321", "0.6269062", "0.6234801", "0.6206289", "0.61557275", "0.6131043", "0.61040974", "0.6079186", "0.6052311", "0.6033709", "0.60205156", "0.6000109", "0.59807914...
0.664933
2
expand events that have a definite ending onload
function klapp_expand_events_onload() { $('.timeline ol').each(function() { $('li', this).each(function() { var event_finish = $(this).attr('data-event-finish'); if( event_finish != undefined && event_finish != false ) { $('a', this).append('<div class="stretch onload"></div>'); var capsule_offset = 0; var event_height = $(this).attr('data-element-height'); var event_stretch = $(this).find('.stretch'); var previous_capsules = $(this).parents('.timecapsule').prevAll(); //get capsule offset if( previous_capsules != undefined && previous_capsules != false ) { $.each(previous_capsules, function(i, item) { capsule_offset = capsule_offset + parseInt( $(item).attr('data-element-height') ); }); } //get event offset var previous_events = $(this).prevAll(); var event_type_odd = false; var event_offset = 0; if( previous_events != undefined && previous_events != false ) { if( $(this).hasClass('odd') ) { event_type_odd = true; } $.each(previous_events, function(i, item) { if( event_type_odd && $(item).is('.odd') ) { event_offset = event_offset + parseInt( $(item).attr('data-element-height') ); } else if ( ! event_type_odd && $(item).is('.odd:not') ) { event_offset = event_offset + parseInt( $(item).attr('data-element-height') ); } }); } if(event_offset > 0) { event_offset = event_offset + 5; } //calculate and set stretch height $('.timecapsule').each(function() { var event_time = $(this).attr('data-event-time'); if( event_time == event_finish ) { var timecapsule_margin = 17; if( ! $(this).hasClass('empty') && ! $(this).hasClass('hide') ) { timecapsule_margin = 27; } var previous_capsules = $(this).prevAll(); var event_total_height = 0; if( previous_capsules != undefined && previous_capsules != false ) { $.each(previous_capsules, function(i, item) { event_total_height = event_total_height + parseInt( $(item).attr('data-element-height') ); }); } var stretch_height = event_total_height - (capsule_offset + event_offset + 1 - timecapsule_margin); $(event_stretch).css({'height': event_height, 'display': 'block', 'top': '0px'}).animate({'height': stretch_height + 'px'}, 1000); return false; } }); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onPreExpandStarted(){}", "onloadend() {}", "onChildrenLoadEnd() {\n if (this._childrenLoadEnd) {\n this._childrenLoadEnd.raise();\n }\n }", "function completeOnTransitionEnd(ev) {\n if (ev.target !== this) return;\n transitionComplete...
[ "0.6560426", "0.63730705", "0.61586577", "0.60685474", "0.60685474", "0.6028648", "0.59488493", "0.58742374", "0.5852475", "0.5846617", "0.5831434", "0.58073586", "0.58062196", "0.576401", "0.5733575", "0.57334316", "0.56999993", "0.5698674", "0.5698674", "0.56640816", "0.565...
0.6265674
2
A method that loops through the array of letters and creates a new instance of Letter for each one
assignLetters() { for (let letter in this.wordArray) { let letterObj = new Letter(this.wordArray[letter]); // Push the new Letter object into the array this.array.push(letterObj); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Word(wordtoGuess) {\n this.lettersArray = wordtoGuess.split(\"\").map(function(char){\n return new Letter(char);\n });\n\n}", "function Word(wordtoGuess) {\n this.lettersArray = wordtoGuess.split(\"\").map(function(char){\n return new Letter(char);\n });\n\n}", "function createAlphabet(){\...
[ "0.67379665", "0.67379665", "0.6594558", "0.6523145", "0.6453985", "0.6391814", "0.631034", "0.6306251", "0.62300676", "0.618791", "0.6148416", "0.609464", "0.60147965", "0.60133266", "0.60072047", "0.5962573", "0.59476125", "0.59463865", "0.59428006", "0.5938534", "0.591436"...
0.77935785
0
This method creates the word that is displayed to the user in the terminal, filled with _ or correctly guessed letters
toString() { let string = ""; // Loop through each letter object in the word array and cocatenate it with the empty string for (let i in this.array) { let LetterObj = this.array[i]; // LetterObj will return an _ if the letter has not been guessed yet string += `${LetterObj} `; } // Display the built out string to the user console.log(string); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateDispWord(){\n dispWord = \"\"; // Reset the displayed string so it can be rebuilt\n for(var i = 0; i < guessWord.length; i++){ //Loop through the current random word\n if(correctGuesses.indexOf(guessWord[i]) > -1){ // If a letter in the random word has been guessed correctly, reveal i...
[ "0.75527847", "0.74378157", "0.7324609", "0.7289476", "0.7242434", "0.7172494", "0.71288604", "0.7101971", "0.7100153", "0.7096851", "0.70688385", "0.70687854", "0.70282364", "0.7003736", "0.6982391", "0.6969807", "0.696273", "0.6940054", "0.6931251", "0.6897483", "0.68843263...
0.0
-1
When the user guesses a letter check every letter object to see if the guess matches one of them
guessCharacter(x) { // A count is used to check if any letter was changed from guessed=false to guessed=true let count = 0; for (let i in this.array) { let LetterObj = this.array[i]; // Calle the guessLetter function of the current letter we are looking at LetterObj.guessLetter(x); // If the current letter matches the user's guess then increase count if (LetterObj.letter.toLowerCase() == x) { count++; } } // If count was increased at all then this method returns true this is used to check if the user guesses the letter // correctly and if we need to lower how many guesses they have left if (count > 0) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkGuessedLetters() {\n //This is checking that if users guess is in alailableLetters\n if(availableLetters.indexOf(this.event.key) > -1) {\n //Looping through guessed letters for the length of word\n for(var i = 0; i < word.length; i++) {\n //If the users guess has alread...
[ "0.7899323", "0.7839297", "0.77726775", "0.7767463", "0.7766113", "0.77641034", "0.7746255", "0.77344704", "0.7715875", "0.7710845", "0.7689169", "0.7672926", "0.765627", "0.7629062", "0.7622974", "0.7579444", "0.7562825", "0.75552756", "0.75468504", "0.7537755", "0.7527801",...
0.7475369
22
This method checks to see if any letter is still hidden or not, used to check if the user has guessed the word
checkLettersForGuessed() { // Initialize a count let count = 0; for (let i in this.array) { let LetterObj = this.array[i]; // If the letter hasn't been guessed yet increase count if (!LetterObj.guessed) { count++; } } // If there are still unguessed letters, return true. If all letters have been guessed return false. if (count > 0) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkForWin() {\n let unsolvedLetters = 0;\n\n for (let i = 0; i < phraseLetters.length; i++) {\n phraseLetters[i].className == `hide letter ${ phraseLetters[i].textContent }` ? \n unsolvedLetters++ : unsolvedLetters = unsolvedLetters;\n }\n\n return unsolvedLe...
[ "0.75704396", "0.75040966", "0.75040174", "0.74393064", "0.73941904", "0.7210228", "0.719771", "0.71723175", "0.71718353", "0.7153414", "0.71518844", "0.7142824", "0.7094757", "0.6987208", "0.69158083", "0.6899759", "0.6856858", "0.6853797", "0.6850085", "0.6830862", "0.68274...
0.0
-1
Tells us, on a nested basis, if objects are the same, or differ at some level
function objectsAreDifferent(dominantObject: Object, slaveObject: Object) : boolean { for (const key:string in dominantObject) { if (!dominantObject.hasOwnProperty(key)) { continue; } const dominantKeyValue: any = dominantObject[key]; const slaveKeyValue: any = slaveObject[key]; if (!slaveKeyValue) { return true; } if (typeof dominantKeyValue === 'object') { return objectsAreDifferent(dominantKeyValue, slaveKeyValue); } if (dominantKeyValue !== slaveKeyValue) { return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deepEqual(obj1, obj2) {\n // Your code here\n for(var prop in obj1) {\n if(typeof obj1[prop] == 'object' && typeof obj2[prop] == 'object') {\n deepEqual(obj1[prop], obj2[prop]);\n }\n else if(obj1[prop] != obj2[prop]) {\n return false;\n }\n }\n return true;\n}", "function isEq...
[ "0.6709001", "0.66702783", "0.6577204", "0.6553737", "0.6525595", "0.6490196", "0.64470214", "0.6367979", "0.6355462", "0.63320917", "0.6313347", "0.63088304", "0.6297473", "0.62272745", "0.6227252", "0.6194476", "0.61818415", "0.6175378", "0.61301684", "0.610225", "0.6099117...
0.60279703
23
compares arrays in a nested basis
function arraysAreDifferent(dominantArray: Array<any>, slaveArray: Array<any>) : boolean { // if array has been `push`ed to, it is different if (slaveArray.length !== dominantArray.length) { return true; } const responseValues = dominantArray.map((dominantIndexValue, index) => { const slaveIndexValue: any = slaveArray[index]; if (Array.isArray(dominantIndexValue)) { return arraysAreDifferent(dominantIndexValue, slaveIndexValue); } else if (typeof dominantIndexValue === 'object') { return objectsAreDifferent(dominantIndexValue, slaveIndexValue); } return dominantIndexValue !== slaveIndexValue; }); return responseValues.indexOf(true) !== -1; } /* * Validates object comparisons and returns the deep nested object that * is unique. * * For example, * if you compared these to objects: * * ```js * { * foo: { bar: 1 } * baz: { bax: 2 } * } * { * foo: { bar: -1 }, * baz: { bax: 2 }, * } * ``` * * These two have the same `baz` value, but unique `foo` values. Thus * our expected result would be to include the foo object. * * ```js * { foo: { bar: -1 } } * ``` */ export default function intersection(dominantObject: Object, slaveObject: Object) : Object { const intersectedObject: Object = {}; for (const key:string in dominantObject) { if (!slaveObject.hasOwnProperty(key)) { continue; } const dominantKeyValue:any = dominantObject[key]; const slaveKeyValue:any = slaveObject[key]; if (Array.isArray(dominantKeyValue)) { if (arraysAreDifferent(dominantKeyValue, slaveKeyValue)) { intersectedObject[key] = dominantKeyValue; } continue; } else if (typeof dominantKeyValue === 'object') { if (typeof dominantKeyValue.then === 'function') { intersectedObject[key] = dominantKeyValue; } else if (objectsAreDifferent(dominantKeyValue, slaveKeyValue)) { // check to see if nested object is different intersectedObject[key] = dominantKeyValue; } continue; } else if (dominantKeyValue !== slaveKeyValue) { intersectedObject[key] = dominantKeyValue; } } return intersectedObject; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function equalArrays(array1, array2) {\n // if the other array is a falsy value, return\n if (!array1 || !array2)\n return false;\n\n // compare lengths - can save a lot of time\n if (array1.length != array2.length)\n return false;\n\n for (var i = 0, l=array1.length; i < l; i++) {\n // Check i...
[ "0.6682006", "0.6682006", "0.6515023", "0.6448402", "0.6402522", "0.6397374", "0.63972235", "0.6390517", "0.63271725", "0.62853885", "0.6281192", "0.6278067", "0.6275068", "0.6248614", "0.6209656", "0.6209656", "0.6206717", "0.6199717", "0.6187762", "0.6187762", "0.61607146",...
0.6831281
0
display default pause button through change in CSS
function displayPauseButton() { toggle_btn.style.borderStyle = "double"; toggle_btn.style.borderWidth = "0vmin 0vmin 0vmin 7vmin"; toggle_btn.style.borderColor = "transparent transparent transparent rgba(183, 0, 0, 1)"; toggle_btn.style.backgroundColor = "transparent"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doPause() {\n PLAY_STATUS = PlayStatus.PAUSED\n pausePlay.innerHTML = 'Resume'\n d3.select(\"#pauseplay\").attr(\"class\", \"btn menu-button\")\n CODE_MIRROR_BOX.setOption(\"theme\", DISABLED_CODE_THEME)\n}", "function startPause() {\r\n let text = this.getAttribute('data-current');\r\n if (te...
[ "0.7353066", "0.7321258", "0.7289142", "0.7280639", "0.72663635", "0.7177744", "0.71488523", "0.7143652", "0.7137813", "0.70337135", "0.70299", "0.6998044", "0.69532764", "0.6929814", "0.6925953", "0.69000095", "0.6887238", "0.68854296", "0.68815404", "0.68787086", "0.6876344...
0.714253
8
display default play button through change in CSS
function displayPlayButton() { toggle_btn.style.borderStyle = "solid"; toggle_btn.style.borderWidth = "7vmin 0vmin 7vmin 14vmin"; toggle_btn.style.borderColor = "transparent transparent transparent rgba(183, 0, 0, 1)"; toggle_btn.style.backgroundColor = "transparent"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onPlayButtonClick() {\n\t\tif ( this.target ) this.target.play();\n\t\tthis.trigger( 'play' );\n\t}", "function onClick () {\n\n play =! play;\n\tif(play){\n\t\tbutton.setFrames(0,0,1);\n\t}else{\n\t\tbutton.setFrames(1,1,0);\n\t}\n}", "function togglePlay() {\n if (elements.video.paused) {\n elements.v...
[ "0.7222774", "0.7209913", "0.71686345", "0.7140184", "0.7135463", "0.71346927", "0.7110338", "0.70711184", "0.7062931", "0.70524645", "0.69814503", "0.6981387", "0.69701654", "0.69685584", "0.6964077", "0.6943242", "0.69379896", "0.6930504", "0.6915746", "0.69070154", "0.6904...
0.6664932
51
Make request in parallel
function task2() { clearTable(); console.clear(); const stop = Math.floor(Math.random() * 10) + 1; getData(1, stop); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getMultiRequest(url, reqArr) {\n const reqParams = []\n reqArr.forEach(item => {\n reqParams.push({\n url,\n param: item,\n method: 'get'\n })\n })\n try {\n const response = await multiRequestWithPromise(reqParams)\n return response\n } catch (err) {\n console.log...
[ "0.72077537", "0.702576", "0.6929929", "0.6904526", "0.6887757", "0.68349904", "0.68101156", "0.6736233", "0.63650185", "0.63639337", "0.6354599", "0.6243562", "0.61289096", "0.60994124", "0.60459554", "0.6026916", "0.60204387", "0.6018343", "0.5992659", "0.59869015", "0.5951...
0.0
-1
Show loading funcion before executing process
showLoading() { var includedTypes = [0, 1, 5, 6]; if (this.showProgress && this.config && includedTypes.includes(this.config.TypeId)) { this.progressBar = Lobibox.progress({ title: flexygo.localization.translate('process.executing'), closeOnEsc: false, closeButton: false, onShow: () => { this.progressTimer = setInterval(() => this.moveLoading(), 500); } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayLoading() {\n console.log(\"Loading...\");\n }", "displayLoading(){\n $.showLoading({\n name: \"line-scale\"\n });\n }", "function loading() {\n}", "function load(){\n\n //Display an optional loading bar\n // g.loadingBar();\n}", "function startLoading() {\...
[ "0.7965677", "0.7477142", "0.7317707", "0.7127413", "0.71128505", "0.702877", "0.69664025", "0.6965194", "0.69629693", "0.6924848", "0.68984205", "0.6857669", "0.6856633", "0.68309104", "0.6818206", "0.67443156", "0.67401177", "0.6736307", "0.6687508", "0.66864556", "0.667340...
0.7089288
5
Move loading funcion during process execution
moveLoading() { if (this.progressBar) { let actVal = this.progressBar.getProgress(); actVal = ((actVal + 1 >= 100) ? 0 : actVal + 1); this.progressBar.setProgress(actVal); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function preLoad() {\n // load something and continue on only when finished\n}", "function loading() {\n}", "function forceLoad() {}", "_loading() {\n }", "async load () {}", "function startLoading() {\n //TODO\n}", "load() {}", "load() {}", "function run() {\r\n\t// Initialize the loader befo...
[ "0.72658396", "0.67664504", "0.6687831", "0.66287416", "0.66158247", "0.6588706", "0.65778196", "0.65778196", "0.6528857", "0.6461724", "0.64147377", "0.6412977", "0.63838995", "0.635878", "0.63469696", "0.63302493", "0.63095295", "0.62852144", "0.62801003", "0.6274061", "0.6...
0.0
-1
Close loading funcion after executing process
closeLoading() { if (this.progressBar) { clearInterval(this.progressTimer); this.progressTimer = null; this.progressBar.destroy(); this.progressBar = null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endProcess()\n{\n\tprocess.exit()\n}", "function closeLoading() {\n setTimeout(function () {\n layer.closeAll('loading');\n }, 100);\n }", "Unload() {}", "end() {\n\t\tif (this.process)\n\t\t\tthis.process.kill()\n\t}", "_dispose() {\n\n delete window.FlowUI['_lo...
[ "0.6348805", "0.6326224", "0.62342507", "0.6222254", "0.6200246", "0.619346", "0.6188804", "0.61431783", "0.60977817", "0.60717237", "0.60084176", "0.5984164", "0.59779596", "0.5975232", "0.5966157", "0.5966157", "0.5964247", "0.59476763", "0.5930602", "0.59293115", "0.592931...
0.6652615
0
Trigger actions with buttons
function startsim1() { //canvas_sim1 = document.getElementById("simulation1"); disableBtn("startsim1"); enableBtn("stopsim1"); let ctx_sim1 = canvas_sim1.getContext("2d"); ctx_sim1.fillStyle = 'rgba(255, 255, 255, .4)'; ctx_sim1.fillRect(0, 0, canvas_sim1.width, canvas_sim1.height); sim1.update(); sim1_chart.update(sim1.hist); sim1_timeout = window.setTimeout(startsim1, 25); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buttonActions() {\n\t\t$(\".button\").on(\"click\", function() {\n\t\t\tvar routeGiven = $(this).attr(\"id\");\n\t\t\tif ($(this).hasClass(\"clicked\")) {\n\t\t\t\t$(this).removeClass(\"clicked\");\n\t\t\t\troutes[routeGiven][\"vRefresh\"] = false;\n\t\t\t\t$(\".route_\" + routeGiven + \",\" + \".path_\" ...
[ "0.6924182", "0.69096863", "0.66520566", "0.6600927", "0.65185404", "0.64350504", "0.6425251", "0.64069057", "0.638229", "0.63747144", "0.6369747", "0.63506067", "0.63238335", "0.6302309", "0.62645614", "0.6259694", "0.62532675", "0.6225584", "0.6220046", "0.6206496", "0.6177...
0.0
-1
make the tetris blocks function
function tetris(){ if(frameCount % 60 === 0) { var tetris = createSprite(200,1,50,50); tetris.x = mario.x tetris.scale = 0.3 tetris.velocityY = tetris.velocityY + 2 var rand = Math.round(random(1,7)); switch(rand) { case 1: tetris.addImage(t1img); break; case 2: tetris.addImage(t2img); break; case 3: tetris.addImage(t3img); break; case 4: tetris.addImage(t4img); break; case 5: tetris.addImage(t5img); break; case 6: tetris.addImage(t6img); break; case 7: tetris.addImage(t7img); break; default: break; } tgroup.add(tetris) }}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createBlocks(){\n\tfor(let j=1; j < 17; j++){\n\t\tif(j%2==0){\n\t\t\tfor(let i=1; i < 25; i++){\n\t\t\t\tif(i%2==0){\n\t\t\t\t\tblockArray.push(new Block((i-1)*50,(j-1)*50,50,50));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function Block(grid, typeOfBlock, squareSize) {\n // public properties\n this.squa...
[ "0.7070012", "0.69896775", "0.6888118", "0.6872745", "0.6872267", "0.6835983", "0.6797661", "0.6775655", "0.6736805", "0.6715255", "0.6683792", "0.66574556", "0.6583374", "0.65765184", "0.65594935", "0.654928", "0.650711", "0.6506277", "0.64943504", "0.6468478", "0.64493924",...
0.6354987
27
LA FONCTION dessinerMonstre LA FONCTION PREND DEUX PARAMETRES: x et y
function dessinerMonstre (x,y) { // LE CORPS fill(0); ellipse(x,y,30,30); // LES YEUX fill(255); ellipse(x-8,y-5,10,10); ellipse(x+8,y-5,10,10); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mursVdessin(tab, nx, pas){\r\n\tfor(i = 0; i < tab.length; ++i){\r\n\t\tcoord = mursVtoCoord(tab[i], nx);\r\n\t\t\r\n\t\tpu(); rt(90); fd(coord.x*pas);\r\n\t\trt(90); fd(coord.y*pas);\r\n\t\tpd(); fd(pas); pu();\r\n\t\tbk(pas); bk(coord.y*pas);\r\n\t\tlt(90); bk(coord.x*pas); lt(90);\r\n\t\tpd();\r\n\t}\r...
[ "0.6515955", "0.61121005", "0.59558", "0.5853352", "0.57912505", "0.5749791", "0.56766474", "0.5664324", "0.5614045", "0.5611793", "0.5610217", "0.5551266", "0.5542541", "0.5510456", "0.5489727", "0.5483785", "0.5483785", "0.5482162", "0.5475941", "0.54691815", "0.54536736", ...
0.55861187
11
CODE A EXECUTER LORSQUE LA FENETRE EST REDIMENSIONNEE
function windowResized() { resizeCanvas(windowWidth, windowHeight); draw(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onresizeAnimaciones() {\n var sec=getUrlVars()['sec'];\n if(sec!=\"gestionProyecto\") { normalSectionElements(); ajustaHeight(); }\n normalAbreNP();\n normalAbrePE();\n}", "function resizedw(){\n\t\n}", "function SizeDependWidth() {\n wImageCur = va.wSlide;\n hImageCu...
[ "0.58799905", "0.5874289", "0.58718127", "0.58690083", "0.58026284", "0.580028", "0.5657156", "0.5630124", "0.5622383", "0.5614363", "0.55978733", "0.5592979", "0.55886674", "0.55863434", "0.55797786", "0.5572748", "0.5571445", "0.5562874", "0.55586463", "0.5545539", "0.55346...
0.0
-1
get the selected base color and color the first div background
function setBaseColor(){ //set the default color to be the picked value let defaultColor = colorPicker.value; console.log(defaultColor); //for testing //style the first div in picked color baseColor.style.backgroundColor = defaultColor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function colorSelCurrent() {\r\n if(nOrU(document.getElementById(ICON_ID + currentDiv))) return;\r\n document.getElementById(ICON_ID + currentDiv).style.backgroundColor = BMDIV_BG_SEL;\r\n document.getElementById(TITLE_ID + currentDiv).style.backgroundColor = BMDIV_BG_SEL;\r\n document.getElementById(URL_ID + ...
[ "0.68651825", "0.6468404", "0.6437869", "0.64103955", "0.63976157", "0.63712305", "0.63007134", "0.628789", "0.62636477", "0.6208685", "0.6199307", "0.6167975", "0.61314017", "0.61178833", "0.6116648", "0.6115207", "0.6112702", "0.6102904", "0.6099102", "0.6094357", "0.609156...
0.70195574
0
create Harmony color style by changing the harmony button
function createHarmony(event){ let color1 = event.target.value; if (color1){ colorOne.style.backgroundColor = "green"; colorTwo.style.backgroundColor = "red"; colorThree.style.backgroundColor = "black"; colorFour.style.backgroundColor = "pink"; console.log("working"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeColorScheme() {\n\n}", "function setDark(button) {\n button.style.background=\"rgb(94, 131, 186)\";\n button.style.color=\"rgb(194, 210, 233)\";\n}", "function changeColor(e){\n if (colorScheme == \"BLACK\"){\n e.target.style.backgroundColor = \"BLACK\";\n e.target.style.opacity =...
[ "0.70218265", "0.69491595", "0.6933238", "0.6742239", "0.6656326", "0.6597753", "0.65559864", "0.6526904", "0.6526904", "0.6488959", "0.6443221", "0.64218557", "0.6407189", "0.637831", "0.637658", "0.6328086", "0.63208467", "0.6315124", "0.6311696", "0.6304723", "0.6300955", ...
0.7001339
1
TODO: We should use the portfolio socket event instead once it's implemented
async watchCurrencies() { if (!this.stopWatchingCurrencies) { this.stopWatchingCurrencies = await fireEvery(async () => { const {price: kmdPriceInUsd} = this.coinPrices.find(x => x.symbol === 'KMD'); let {portfolio: currencies} = await this.api.portfolio(); // TODO(sindresorhus): Move the returned `mm` currency info to a sub-property and only have cleaned-up top-level properties. For example, `mm` has too many properties for just the balance. // Mixin useful data for the currencies currencies = currencies.map(currency => { const {price, percentChange24h} = this.coinPrices.find(x => x.symbol === currency.coin); if (price) { currency.cmcPriceUsd = price; currency.cmcBalanceUsd = currency.balance * price; } else { // We handle coins not on CMC // `currency.price` is the price of the coin in KMD currency.cmcPriceUsd = currency.price * kmdPriceInUsd; currency.cmcBalanceUsd = currency.balance * currency.cmcPriceUsd; } currency.symbol = currency.coin; // For readability currency.name = coinlist.get(currency.symbol, 'name') || currency.symbol; currency.cmcPercentChange24h = percentChange24h; currency.balanceFormatted = roundTo(currency.balance, 8); currency.cmcPriceUsdFormatted = formatCurrency(currency.cmcPriceUsd); currency.cmcBalanceUsdFormatted = formatCurrency(currency.cmcBalanceUsd); return currency; }); if (!_.isEqual(this.state.currencies, currencies)) { this.setState({currencies}); } }, 1000); } return this.stopWatchingCurrencies; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "socket_customEventFromServer(_, payload) {\n console.log(\"customEventFromServer\", payload);\n }", "static listenSocketEvents() {\n Socket.shared.on(\"wallet:updated\", (data) => {\n let logger = Logger.create(\"wallet:updated\");\n logger.info(\"enter\", data);\n\n ...
[ "0.58833224", "0.5867788", "0.5721929", "0.5710225", "0.56489605", "0.5592588", "0.5587047", "0.5574208", "0.5541309", "0.55411273", "0.5540741", "0.55172706", "0.5493239", "0.54896414", "0.54725903", "0.5457013", "0.54412794", "0.544021", "0.54390174", "0.54366565", "0.54355...
0.0
-1
Funzione per creazione oggetto di info addizionali nel array additional info
get_add_infos(movie, five_actors){ let new_id = movie.id; let new_genres = this.get_genres(movie.genre_ids); let new_actors = five_actors let add_info_obj ={ id: new_id, genres: new_genres, main_actors: new_actors }; return add_info_obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createInfo (typeOfContent, title, header, content){\n var id = ((app.info.length) + 1) *4;\n var item ={};\n item.id = id;\n item.title = title;\n item.header = header;\n item.content = content;\n item.typeOfContent = typeOfContent;\n console.log(item, \"new itmeeeee\");\n app.info.push(item);\n ...
[ "0.6497563", "0.62351894", "0.618422", "0.59359396", "0.5831174", "0.5767636", "0.57488537", "0.5730857", "0.5701731", "0.56975406", "0.569095", "0.569095", "0.56055975", "0.55616647", "0.55604917", "0.5535216", "0.55251753", "0.5507636", "0.550194", "0.54817355", "0.5478715"...
0.57898384
5
Funzione per recupero dei generi del film in formato stringa
get_genres(genre_ids){ // Esempio di genre_ids = [ 100 , 45 ] let genres = []; genre_ids.forEach(genre_id => { this.all_genres.forEach((genre, index) => { // Confronta ogni id del film con l array del genere if(genre_id == genre.id){ // Quando trova corrispondenza aggiunge il nome del genre alla stringa genres.push(genre.name); }; }); }); return genres; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildString(movie){\n\tvar results = \"Key Value Pairs - You have \";\n\tif (movie.hasWatched){\n\t\t\tresults += \"watched \\\"\";\n\t\t} else {\n\t\t\tresults += \"not seen \\\"\";\n\t\t};\n\tresults += movie.title\n\tresults += \"\\\" \" + movie.rating + \" stars\"\t\n\treturn results;\n\t}", "functi...
[ "0.61028415", "0.6101329", "0.60713917", "0.60530627", "0.6033109", "0.5989063", "0.5981828", "0.59581035", "0.5859815", "0.57870305", "0.57549006", "0.5647446", "0.56299955", "0.5571663", "0.555399", "0.5549661", "0.55399853", "0.5494202", "0.5488845", "0.547462", "0.547462"...
0.50753057
61
Funzione per la stampa a video dell array dei generi
print_genres_string(id){ let genres_string = ""; for (var i = 0; i < this.additional_infos.length; i++) { if(id == this.additional_infos[i].id){ genres_string = this.additional_infos[i].genres.join(" / "); }; }; return genres_string; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playVideo() {\n playVideoSegments(transcripts)\n}", "function arrVideo(name, emotions, times) {\n this.name = name;\n this.emotions = emotions;\n this.times = times;\n}", "function arrVideo(name, emotions, times) {\n this.name = name;\n this.emotions = emotions;\n this.times = tim...
[ "0.6238002", "0.61796933", "0.61796933", "0.6152342", "0.5983068", "0.59442747", "0.5937449", "0.5928376", "0.59096265", "0.5900606", "0.5887462", "0.58520234", "0.5756241", "0.5737774", "0.57361275", "0.57350826", "0.5717736", "0.5714275", "0.57121336", "0.57121336", "0.5707...
0.0
-1
Stampa a video della stringa di attori
print_actors_string(id){ let actors_string = ""; for (var i = 0; i < this.additional_infos.length; i++) { if(id == this.additional_infos[i].id){ actors_string = this.additional_infos[i].main_actors.join(", "); }; }; return actors_string; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function video(source){\n return '<div style=\"margin-top : 10px;\"><p style=\"font-weight : bold\">Video explicativo</p></div><video width=\"500\" height=\"500\" controls>' + \n '<source src=\"' + source + '\" type=\"video/webm\"> Tu navegador no soporta video' +\n '</video>';\n }", "function playV...
[ "0.6566566", "0.6302902", "0.6218157", "0.6053233", "0.6029902", "0.5943593", "0.5885158", "0.58656824", "0.5847874", "0.5843263", "0.5823236", "0.5821692", "0.57712317", "0.5728013", "0.5727365", "0.57139486", "0.56872654", "0.56702375", "0.5642739", "0.5642739", "0.5626808"...
0.0
-1
Convert numbers to strings of floats so GLSL doesn't barf on "1" instead of "1.0"
function glslifyNumber (n) { return n === (n | 0) ? n + '.0' : n + ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function flow_ecma_string_of_float(num) {\n return caml_new_string(caml_js_from_float(num).toString());\n}", "function float32String(v) {\n return Math.abs(v) > 1e-37 ? v : 0;\n } // Create matrix array for looping", "function float32String(v) {\n return Math.abs(v) > 1e-37 ? v : 0\n}", "function float...
[ "0.67264694", "0.66337025", "0.6623568", "0.6609518", "0.65403897", "0.6378591", "0.6234288", "0.6197407", "0.6197407", "0.61373985", "0.6011263", "0.59416556", "0.5934193", "0.5902741", "0.5873191", "0.58708847", "0.57795316", "0.5747997", "0.5725125", "0.57215285", "0.56994...
0.5983309
11
local node digest function
async function digest (algo, data) { const hash = crypto.createHash(algo) hash.update(data) return new Uint8Array(hash.digest()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function digest() {\n // Pad\n write(0x80);\n if (offset > 14 || (offset === 14 && shift < 24)) {\n processBlock();\n }\n offset = 14;\n shift = 24;\n\n // 64-bit length big-endian\n write(0x00); // numbers this big aren't accurate in javascript anyway\n write(0x00); // ..So just ha...
[ "0.6882936", "0.6882936", "0.6882936", "0.67158175", "0.67158175", "0.67158175", "0.6524656", "0.6487698", "0.6487698", "0.6470773", "0.63964", "0.63439596", "0.6320234", "0.6297155", "0.6297155", "0.6261069", "0.6199223", "0.6140325", "0.60956365", "0.6031878", "0.59764165",...
0.5728765
35
handle an incomming cgi request, making a similar interface to node's http server
async function handleCGI (handler) { const url = new URL(process.env.REQUEST_URI || `${process.env.SCRIPT_NAME}?${process.env.QUERY_STRING}`, `http://${process.env.HTTP_HOST || process.env.SERVER_NAME}/`) url.protocol = process.env.HTTPS ? 'https' : 'http' const request = { method: process.env.REQUEST_METHOD, headers: {}, url } Object.entries(process.env).forEach(([key, value]) => { if (key.startsWith('HTTP_')) { request.headers[key.slice(5).toLowerCase().replace('_', '-')] = value } }) const respond = async (status, headers, body) => { if (!Buffer.isBuffer(body)) body = Buffer.from(body, 'utf-8') const finalHeaders = { Status: status, 'Content-Length': Buffer.byteLength(body), 'Content-Type': 'text/plain; charset=utf-8', ...headers } const write = util.promisify(process.stdout.write).bind(process.stdout) await write(Object.entries(finalHeaders).map(([key, value]) => { return `${key}: ${value}\n` }).join('') + '\n') await write(body) } await handler(request, respond) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handle_incoming_request(req, res) {\r\n // get the path of the file to served\r\n var path = url.parse(req.url).pathname;\r\n // get a query (true makes sure the query string is parsed into an object)\r\n var queryObj = url.parse(req.url,\"true\").query;\r\n if (req.method.toLowerCase() == ...
[ "0.7065143", "0.6951491", "0.6950262", "0.68950486", "0.686603", "0.6852835", "0.6806736", "0.675156", "0.67448664", "0.6742888", "0.66691893", "0.66454566", "0.662783", "0.66045475", "0.6594396", "0.65798134", "0.65416116", "0.65365773", "0.6531683", "0.6531616", "0.6518163"...
0.64108855
38
run the cgibin script
async function handleRequest (request, respond) { const document = new HTMLDocument({ ...signSearchConfig, disable: { javascript: true, analytics: true } }) try { // initialise search engine const engine = new SearchEngine({ vectorLibraryPath: arp.resolve('datasets/cc-en-300-8bit'), searchLibraryPath: arp.resolve('datasets/search-index'), libraryConfig: { fs, digest, webURL: 'datasets/search-index' } }) // load any data needed to make it queryable await engine.load() // grab content from query string that we need const query = document.query = request.url.searchParams.get('query') || '' const offset = parseInt(request.url.searchParams.get('offset')) || 0 if (query.trim() === '') throw new Error('Please enter a search query') // set document query string to fill search box const results = await engine.query(query) if (results.length === 0) throw new Error('No results found') await document.setBody(new ResultsPage({ results, offset, query })) } catch (err) { await document.setBody(new ErrorPage(err.message)) } await respond(200, { 'Content-Type': 'text/html; charset=utf-8' }, document.toHTML().toString()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function main() {\n doCbaam()\n doEcb()\n updateGraphFile()\n}", "function runBrython(cb) {\n exec(BRYTHON_CLI_CMD, {cwd: DIR_APP}, cb)\n}", "function run() {}", "function startRun()\n{\n initCompSyntaxTools();\n initMemVars();\n cleanShell();\n initializeAgain();\n initCanvas();\n cleanCan...
[ "0.6283401", "0.5752504", "0.5603618", "0.55797863", "0.5578637", "0.55252385", "0.55128413", "0.5501874", "0.5476007", "0.5413574", "0.5400769", "0.5263207", "0.5253439", "0.52494496", "0.5249269", "0.5249269", "0.5249269", "0.5249269", "0.5249269", "0.5249269", "0.5249269",...
0.0
-1
Set up connection with signaling server
function connect(failureCB) { failureCB = ((typeof failureCB === 'function') && failureCB) || doNothing; if(typeof(WebSocket) === "undefined") { console.log("您的浏览器不支持WebSocket"); }else { console.log("您的浏览器支持WebSocket"); socket = new WebSocket("ws://"+location.host+"/websocket/" + key); //打开事件 socket.onopen = function () { status = "waiting"; waitingHandler(); // socket.send("这是来自客户端的消息" + location.href + new Date()); }; //获得消息事件 socket.onmessage = function(msg) { console.log(msg.data); // $("#message").val(msg.data) //发现消息进入 开始处理前端触发逻辑 var res = JSON.parse(msg.data); // if messages property exists, then we are connected if (status !== "connected") { // switch status to connected since it is now! status = "connected"; connectedHandler(); } handleMessage(res) }; //关闭事件 socket.onclose = function() { console.log("Socket已关闭"); // $("#close").val("Socket已关闭") }; //发生了错误事件 socket.onerror = function() { failureCB("Socket发生了错误"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "connect() {\n this.hub = signalhub(this.channel, [ CONSTANTS.SIGNAL_SERVER ]);\n this.sw = swarm(this.hub, this.options);\n }", "constructor() {\n this.url = serverLocation + \"/signalr\";\n this.connection = $.hubConnection(this.url, {\n useDefaultPath: false\n });\n ...
[ "0.8081422", "0.6714845", "0.6668794", "0.6519293", "0.64199823", "0.63882166", "0.6302238", "0.6300816", "0.6300783", "0.6300783", "0.6296815", "0.62775517", "0.6276423", "0.624778", "0.62200797", "0.6213121", "0.61652726", "0.6159301", "0.6159301", "0.61510557", "0.6150417"...
0.0
-1
Schedule incoming messages for asynchronous handling.
function handleMessage(msg) { // process message asynchronously setTimeout(function () { messageHandler(msg); }, 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_scheduleSendResponseMessage() {\n\n }", "async triggerOutgoingHandlers() {\n let buffer;\n do {\n if (this.executingOutgoingHandlers >= this.concurrency) {\n return;\n }\n buffer = this.outgoing.shift();\n if (buffer) {\n t...
[ "0.58753175", "0.58669794", "0.58669794", "0.5831426", "0.5799583", "0.5703491", "0.56666535", "0.56146896", "0.56095016", "0.55863136", "0.55809706", "0.5518698", "0.55060315", "0.54944295", "0.546897", "0.5463283", "0.5459955", "0.5459955", "0.5444643", "0.54382133", "0.539...
0.55399084
11
Send a message to the other browser on the signaling channel
function send(msg) { socket.send(JSON.stringify(msg)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendSignalingMessage(message) {\n\t\tdrone.publish({\n\t\t\troom: roomName,\n\t\t\tmessage\n\t\t});\n\t}", "send(message) {\n if (port) {\n port.postMessage(message);\n }\n }", "function send(message)\n{\n //concatenate remote peer username to message\n ...
[ "0.75175416", "0.71476376", "0.7058649", "0.6920187", "0.6827232", "0.67804927", "0.67685634", "0.67452407", "0.6715178", "0.6682236", "0.666454", "0.6664247", "0.6611396", "0.65913737", "0.65722126", "0.65451574", "0.6520098", "0.6508609", "0.6505627", "0.6503864", "0.647770...
0.0
-1
Returns information about the link
static getLinkInfo(link) { let cleanedLink = null; // check if link is wopi frame link if (LinkUtil.isWopiFrameLink(link)) { // extract source link from wopi frame link cleanedLink = LinkUtil._extractWopiFrameSourceLink(link); } else { cleanedLink = LinkUtil._removeQueryParams(link); } if (OfficeFileEnding.isWordFileEnding(cleanedLink)) { return { link: cleanedLink, protocol: 'ms-word', type: 'word' }; } else if (OfficeFileEnding.isExcelFileEnding(cleanedLink)) { return { link: cleanedLink, protocol: 'ms-excel', type: 'excel' }; } else if (OfficeFileEnding.isPowerPointFileEnding(cleanedLink)) { return { link: cleanedLink, protocol: 'ms-powerpoint', type: 'powerpoint' }; } else if (OfficeFileEnding.isVisioFileEnding(cleanedLink)) { return { link: cleanedLink, protocol: 'ms-visio', type: 'visio' }; } else { return { link: cleanedLink, protocol: '', type: '' }; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getLinkInfo(link) {\n let cleanedLink = null;\n // check if link is wopi frame link\n if (LinkUtil.isWopiFrameLink(link)) {\n // extract source link from wopi frame link\n cleanedLink = LinkUtil._extractWopiFrameSourceLink(link);\n } else {\n cleanedLink = LinkUtil._removeQueryPar...
[ "0.7164002", "0.7112374", "0.6892977", "0.67506206", "0.6632081", "0.63378525", "0.63157517", "0.60890627", "0.60579675", "0.60444605", "0.6029982", "0.5952582", "0.59300244", "0.5912", "0.58945805", "0.5888886", "0.58490974", "0.58082294", "0.58074784", "0.58055025", "0.5796...
0.7087711
2
Checks if the given link is relevant for the extension
static isLinkRelevant(link) { // exclude file protocol links -> they are not working with the office URI protocols if (link.startsWith('file://')) { return false; } if (LinkUtil.isWopiFrameLink(link)) { // check if the file ending is relevant let linkInfo = LinkUtil.getLinkInfo(link); return linkInfo.type !== ''; } // only consider segment after last slash const lastSlashSegment = link.substr(link.lastIndexOf('/'), link.length); if (!lastSlashSegment || lastSlashSegment === '') { return false; } // test if it as a link which points to a file const regexResult = lastSlashSegment.match(/(.*\.[a-zA-Z]{3,4})($|\?|#)+/); if (regexResult === null || regexResult.length < 2) { return false; } // test if the link points to an ms office document return new RegExp( `\\.(${OfficeFileEnding.getAllFileEndings().join('|')})(^\\.|([\\?#&].*)|$)` ).test(lastSlashSegment); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static isLinkRelevant(link) {\n // exclude file protocol links -> they are not working with the office URI protocols\n if (link.startsWith('file://')) {\n return false;\n }\n\n if (LinkUtil.isWopiFrameLink(link)) {\n return true;\n }\n // only consider segment after last slash\n cons...
[ "0.77332306", "0.693763", "0.6699203", "0.6681272", "0.6667972", "0.6581005", "0.6490158", "0.6436702", "0.63746285", "0.637371", "0.62824374", "0.621289", "0.61907035", "0.615818", "0.60663325", "0.6042344", "0.5918723", "0.5915121", "0.5910403", "0.5879281", "0.5871354", ...
0.77588123
0
Removes all url query parameters from the given link
static _removeQueryParams(link) { const regexResult = link.match(/(.*\.[a-zA-Z]{3,4})($|\?|#)+/); if (regexResult !== null && regexResult.length > 1) { let matchWithLink = regexResult[1]; if (/[\\?#&]+/.test(matchWithLink)) { throw Error('Link does not match'); } else { return matchWithLink; } } else { throw Error('Link does not match'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeAllURLQueryString() {\n delete this.urlObj.search;\n }", "function removeQS(url, parameter) {\n //prefer to use l.search if you have a location/link object\n var urlparts = url.split('?'); \n if (urlparts.length >= 2) {\n\n var prefix = encodeURIComponent(parameter)+'=';\n var ...
[ "0.75693554", "0.71417236", "0.7094664", "0.7046632", "0.701989", "0.69929963", "0.6969232", "0.69487154", "0.6945759", "0.6942361", "0.6942361", "0.6907091", "0.68087864", "0.6751832", "0.6737145", "0.67225957", "0.6665413", "0.6604238", "0.6602128", "0.6519905", "0.65150905...
0.74867326
2
Functions handeling requests about identified encounters to API server
async function addIdentifiedEncounter(identifiedEncounter) { if (identifiedEncounter) { return HttpService.post( `/api/addIdentifiedEncounter`, identifiedEncounter ).then((res) => res.data.newIdentifiedEncounter); } else { return "no identifiedEncounter data"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(environment, state) {\n /**\n * @category Utility\n */\n this.units = lib_1.units;\n\n const _state = typeof state == \"string\" ? {\n serverUrl: state\n } : state; // Valid serverUrl is required!\n\n\n (0, lib_1.assert)(_state.serverUrl && _state.serverUrl.match(/https?:\\/...
[ "0.5743216", "0.57232094", "0.57105756", "0.5656899", "0.5627413", "0.56088775", "0.56013936", "0.5593822", "0.5537244", "0.54276264", "0.5409418", "0.53995305", "0.5397861", "0.5373579", "0.5351065", "0.53099394", "0.52977055", "0.52706844", "0.5263961", "0.52608764", "0.525...
0.0
-1
Multiple column bar chart
function multiColumnBarPlotter(e) { // We need to handle all the series simultaneously. if (e.seriesIndex !== 0) return; var g = e.dygraph; var ctx = e.drawingContext; var sets = e.allSeriesPoints; var y_bottom = e.dygraph.toDomYCoord(0); // Find the minimum separation between x-values. // This determines the bar width. var min_sep = Infinity; for (var j = 0; j < 1; j++) { var points = sets[j]; for (var i = 1; i < points.length; i++) { var sep = points[i].canvasx - points[i - 1].canvasx; if (sep < min_sep) min_sep = sep; } } var bar_width = Math.floor(2.5 / 3 * min_sep); var fillColors = []; var strokeColors = g.getColors(); for (var i = 0; i < strokeColors.length; i++) { fillColors.push(strokeColors[i]); } for (var j = 0; j < sets.length; j++) { ctx.fillStyle = fillColors[j]; ctx.strokeStyle = strokeColors[j]; for (var i = 0; i < sets[j].length; i++) { var p = sets[j][i]; var center_x = p.canvasx; var x_left = center_x - (bar_width / 2); ctx.fillRect(x_left, p.canvasy, bar_width/1, y_bottom - p.canvasy); ctx.strokeRect(x_left, p.canvasy, bar_width/1, y_bottom - p.canvasy); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function multiColumnBarPlotter(e) {\n function darkenColor(colorStr) {\n // Defined in dygraph-utils.js\n var color = Dygraph.toRGB_(colorStr);\n color.r = Math.floor((255 + color.r) / 2);\n color.g = Mat...
[ "0.7506336", "0.6938817", "0.69080716", "0.68560195", "0.67892677", "0.6706148", "0.66786253", "0.66590834", "0.66461813", "0.65991473", "0.6576051", "0.6533897", "0.65147394", "0.65141284", "0.6512622", "0.64491487", "0.6420126", "0.64126086", "0.64040923", "0.6402658", "0.6...
0.76160324
0
Express = 2 things: 1. Router 2. Middleware that comprises a webframework Req (comes in) MIDDLEWARE > Res(goes out) Middleware function is ANY function that has access to the req,res, next object Req MIDDLEWARE > Res 1. Request comes in: MIDDLEWARE FUNCTIONS 2. We need to validate the user, sometimes. 3. We need to store some things in the DB. 4. If there is data from the user we need to parse it and store it. END OF MIDDLEWARE FUNCTIONS 5. Res
function validateUser(req, res, next) { // get info out of the req object // do some stuff with the DB //locals is property that is prebuilt into express and is attached to response. // every piece of middleware will have access to locals becuase every piece of middleware has access to the response object res.send("<h1>Main Page</h1>"); res.locals.validated = true; console.log("VALIDATED RAN!"); next(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function middleware(request, response, next) {}", "function authenticationMiddleware(req, res, next) {\n //1.check if user sent a token in the headers | body | query \n var token = req.body.token || req.query.token || req.get('Authorization');\n Logger_1.Logger.d(TAG, '=============== Authentication ...
[ "0.76121956", "0.73320854", "0.68383336", "0.6821624", "0.6764039", "0.6735488", "0.6709929", "0.6699704", "0.6683545", "0.667735", "0.66609704", "0.66347325", "0.66323453", "0.6616796", "0.6606897", "0.6598984", "0.6598807", "0.65867764", "0.6585335", "0.65533483", "0.655180...
0.7230972
2
abrir o marker e infowindow corretos de acordo com o evento
openMarker(e) { this.props.markers.forEach(marker => { if (e.target.value === marker.name) { this.props.infoWindows.forEach(infoWindow => { if (marker.name === infoWindow.name) { infoWindow.open(this.props.map, marker); if (marker.getAnimation() !== null) { marker.setAnimation(null); } else { marker.setAnimation(window.google.maps.Animation.BOUNCE); setTimeout(() => {marker.setAnimation(null);}, 300) } } }) } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function klikInfoWindow(id, marker)\n{\n google.maps.event.addListener(marker, \"click\", function(){\n detailmes_infow(id);\n\n });\n\n}", "function clickEventer(event){\n\t\t// get the coordinate of the clicked postion\n\t \tvar coord = getCoordinate(event); \n\t \tif(checkInfoWindow()){ // ch...
[ "0.73777", "0.7315891", "0.7271314", "0.70850956", "0.7066441", "0.705208", "0.69949704", "0.69716126", "0.69589114", "0.6953759", "0.69136107", "0.68817043", "0.6862094", "0.6845678", "0.6803509", "0.67933434", "0.6793215", "0.67822677", "0.67618585", "0.675975", "0.67540044...
0.6589154
41
bonus show circles when loading
function bonus() { let radius = 1; setInterval(function () { // validate the current radius let validation = circle.validateRadius(radius, canvasHTML.height, canvasHTML.width); // if valid - drow circle if (validation === true) { drawer.drowCircle(radius); radius++; } }, 100); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadingCircle() {\n const loading = document.querySelector(\"#loading-circle\");\n loading.classList.add(\"display\");\n setTimeout(() => {\n loading.classList.remove(\"display\");\n }, 15000);\n}", "function showLoading() {\n $B.removeClass(\"js-loaded loaded-reveal\").addClass(\"show-loading...
[ "0.68288267", "0.6773165", "0.67679703", "0.67341626", "0.65690327", "0.6504819", "0.6493884", "0.64534014", "0.6392278", "0.63875353", "0.637661", "0.6375635", "0.6326262", "0.6315794", "0.63055265", "0.62956375", "0.62952054", "0.6270665", "0.626664", "0.6258702", "0.625658...
0.0
-1
not part of the exercise
function getRandomColor() { let r = 0; let b = 255; let g = 0; //Math.round(Math.random()*255); return "rgb(" + r + "," + g + "," + b + ")"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "static private internal function m121() {}", "private public function m246() {}", "function exercise07() {}", "function exercise11() {}", "function solution(s) {\n\n}", "protected internal function m252() {}", "function exercise06() {}", "transient protected i...
[ "0.61473906", "0.60381895", "0.598922", "0.5901573", "0.5889553", "0.5886507", "0.5739726", "0.57042366", "0.55252826", "0.5421095", "0.5411926", "0.5411926", "0.5411926", "0.5411926", "0.5411926", "0.5411926", "0.5411926", "0.5411926", "0.5411926", "0.5411926", "0.5411926", ...
0.0
-1
return null if not exist
getDataFromEntry(entry){ let _item = this.getFromEntry(entry); if(this._isNullItem(_item)) return null; ON_LOG && console.log('getDataFromEntry' , entry, _item); return _item.data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "returnIfExists(obj, objName){\n if(obj === undefined) throw new ResourceNotFoundError;\n else return obj;\n }", "existingTransaction(public_key) {\n //if not found it will return undefined\n return this.transactions.find(t => t.input.address === public_key);\n }", "exist(item, queue) {\n const...
[ "0.64312327", "0.60549015", "0.5884978", "0.5881601", "0.58322734", "0.58243716", "0.57100135", "0.56679565", "0.56560344", "0.5649606", "0.5585518", "0.558171", "0.5577484", "0.55733746", "0.5554513", "0.55503833", "0.55462927", "0.55455405", "0.55378", "0.5533017", "0.55273...
0.0
-1
componentDidMount(): send request to get employees
async componentDidMount() { await this.getEmployeeJobData(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount(){\n this.fetchEmployees();\n }", "componentDidMount() {\n this.fetchEmployeeData();\n }", "componentDidMount() {\n this.props.fetchEmployees();\n }", "componentDidMount() {\n this.getEmployees();\n }", "componentDidMount(){\n this.getEmployees();\...
[ "0.83849853", "0.8193695", "0.8080642", "0.80745906", "0.8037596", "0.7969767", "0.7950717", "0.79181176", "0.7917118", "0.78887147", "0.78495103", "0.78040934", "0.7787226", "0.7764372", "0.77525", "0.77096456", "0.7670477", "0.7670477", "0.7669678", "0.7650656", "0.7638295"...
0.7068158
41
getEmployees(): retrieve employee data from server by ID
getEmployeeData(employeeID) { axios({ method: 'get', url: 'http://157.230.172.148:3000/api/User/' + employeeID }) .then((response) => { console.log(response.data); var joined = this.state.employeeData.concat(response.data); this.setState({ employeeData: joined }); }) .catch((error) => { console.log(error); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmployees(req, res, next) {\n var id = parseInt(req.params.id);\n db.query(\"SELECT * FROM users WHERE id_entreprise = ?\", id, function (error, results, fields) {\n if (error)\n res.status(500)\n .json({\n status: \"ko\",\n d...
[ "0.7647195", "0.7308158", "0.7272167", "0.7231006", "0.7220285", "0.72154903", "0.7209296", "0.7154747", "0.7139743", "0.7137463", "0.71090627", "0.7105582", "0.7092697", "0.706308", "0.70229095", "0.70127225", "0.70068526", "0.6992959", "0.69889885", "0.6962722", "0.69527036...
0.0
-1
getEmployeeJobData(): retrieve employee job data from server
getEmployeeJobData() { axios({ method: 'get', url: 'http://157.230.172.148:3000/api/queries/findJobs?managerID=resource%3Aorg.pow.app.User%23' + uuidv3(store.getState().email, uuidv3.URL) }) .then((response) => { console.log(response); this.populateEmployeeData(response.data); }) .catch((error) => { console.log(error); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function requestJobData(event, callback) {\n\t\n var options = { \n\t method: 'GET',\n url: 'https://api.servicem8.com/api_1.0/job/' + event.eventArgs.jobUUID + '.json',\n auth: {\n bearer: event.auth.accessToken\n }\n };\n\n //Make Request to ServiceM8 API\n request(options, function (e...
[ "0.6471585", "0.63663083", "0.6310343", "0.6196553", "0.61338365", "0.6101689", "0.6099259", "0.60925925", "0.60368615", "0.5956124", "0.5873185", "0.58530164", "0.58358085", "0.5818223", "0.5758793", "0.5676728", "0.56721145", "0.56592", "0.56446093", "0.5621554", "0.5617158...
0.66167104
0
populateEmployeeData(): populate employee data variables from job and user list
async populateEmployeeData(data) { let jobs = []; for (let i = 0; i < data.length; i++){ if (data[i].employee !== 'resource:org.pow.app.User#' + uuidv3(store.getState().email, uuidv3.URL) && typeof(data[i].endDate) === 'undefined') { await this.getEmployeeData(data[i].employee.split('#')[1]); jobs.push(data[i]); } } await this.setState({ employeeJobs: jobs }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillEmployeeList(){\n var divList, division, divName, empList, employee, empName, tempList;\n tempList = [];\n divList = company[0].divisions;\n for(var i = 0, dCount = divList.length; i < dCount; i++) {\n division = divList[i];\n divName = division.divisionName;\n empList...
[ "0.63280034", "0.626249", "0.62357914", "0.6178332", "0.61088705", "0.61025083", "0.6067165", "0.59434354", "0.5899673", "0.5896165", "0.58639866", "0.5827233", "0.58237845", "0.5816457", "0.58132493", "0.58091855", "0.5774632", "0.574736", "0.5734261", "0.5682039", "0.567614...
0.72014844
0
renderEmployees(): render employee data
renderEmployees() { let employees = [] for (let i = 0; i < this.state.employeeJobs.length; i++){ let job = this.state.employeeJobs[i] employees.push( <div key={job.startDate} as="li"> <Card style={{ width: '18rem' }}> <Card.Body> <Card.Title>{job.jobTitle}</Card.Title> <Card.Subtitle className="mb-2 text-muted">{job.company.name}</Card.Subtitle> <Card.Text> {job.description} </Card.Text> <Card.Text> {job.type} </Card.Text> {typeof(job.endDate) !== 'undefined' ? '' : <Button variant="danger" onClick={this.handleTerminate} value={JSON.stringify(job)}>Terminate</Button>} </Card.Body> </Card> </div> ) } return employees; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderEmployeesData () {\n fetch(\"http://localhost:3000/api/employees/getEmployee\").then(res => {\n return res.json()\n }).then(data => {\n data.map(i => {\n const html = `\n <td>${i.id}</td>\n <td>${i.name}</td>\n <td>${i.mail}...
[ "0.76517296", "0.7400849", "0.7249863", "0.7070262", "0.7009761", "0.69917333", "0.6991701", "0.6823743", "0.67636746", "0.6644696", "0.66193485", "0.6584044", "0.6582145", "0.65719664", "0.65155816", "0.65073514", "0.64905083", "0.644651", "0.64399576", "0.6414418", "0.64013...
0.0
-1
initialize instance by generate all operations from operations passed in parameter
constructor(someGeneratorMusaicPcsOperation) { this.operations = Group.buildOperationsGroupByCaylayTable(someGeneratorMusaicPcsOperation) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "generateOperations() {\n if (this._Operations) {\n return;\n }\n\n this._signHeadersList = this._signHeadersList || this.signHeadersList; // backward support\n this._serviceName = this._serviceName || this.serviceName;\n this._serviceVersion = this._serviceVersion || this.serviceVersion;\n\n ...
[ "0.69607323", "0.64687884", "0.64146584", "0.6363052", "0.63026553", "0.6224885", "0.6146677", "0.6074444", "0.60694635", "0.604268", "0.604268", "0.601469", "0.5948372", "0.5782247", "0.578042", "0.5755436", "0.571319", "0.57022375", "0.5697326", "0.5697326", "0.5693193", ...
0.6537328
1
Tipo de dato funcion
function suma(a, b){ return a+b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dataType(){\n\n}", "function tipoDado(dado){\n return typeof dado;\n}", "function whatIsIt(data) { //create the function with a data argument\n return typeof(data) //return the data type\n}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion ...
[ "0.69516695", "0.611898", "0.6067513", "0.5975124", "0.5975124", "0.5975124", "0.5915588", "0.58746064", "0.58746064", "0.58135784", "0.5745509", "0.5688592", "0.5688592", "0.5688592", "0.56532484", "0.56131643", "0.559309", "0.5587066", "0.55825645", "0.55825645", "0.5582564...
0.0
-1
chdir to local module root
function changeDir() { return resolvePackageRoot('package.json').then(root => { /* istanbul ignore if: Situation very hard to reproduce */ if (!root.packageJson) { throw new Error( 'package.json not found!\n' + 'Please run me from within a node module.\n' + 'My working directory is "' + process.cwd() + '".' ) } process.chdir(root.packageRoot) // eslint-disable-next-line no-console console.log("I'm running inside module '" + root.packageJson.name + "' in '" + process.cwd()) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cwd () {\n return cwd;\n }", "function fakeCWD() {\n return cwd() + fake;\n }", "static _getSpaceRoot(){\n return process.cwd(); //path.dirname(module.parent.paths[0])\n }", "function cleanCacheAndChageCwd(dir) {\n delete require.cache[require.resolve('../src/config')];\n delete requi...
[ "0.5836116", "0.575188", "0.5669876", "0.56378925", "0.5604876", "0.55973935", "0.55815053", "0.5512329", "0.54543644", "0.54135144", "0.53214824", "0.5320765", "0.5257048", "0.5249179", "0.52454823", "0.5198909", "0.51855797", "0.5165069", "0.514514", "0.51229924", "0.510361...
0.70959586
0
This function requires the password to already exist and be cached.
retrieveCachedPassword() { if (!this.cachedPassword) { // Obviously some functionality requires the password, but we // don't have it yet. // The best we can do is spawn reading and caching asynchronously, // this will cause the password to be available once the user // retries the current operation. this.ensurePasswordIsCached(); throw new Error("no cached password"); } return this.cachedPassword; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setCachedPassword(pwd){\n cachedPassword = pwd;\n }", "static fromPassword(password) {\n return { generatePassword: false, password };\n }", "checkPassword(pass) {\n // Hash the password and then check against the hash for extra security :^), I, however, ain't doing that here.\n const SECRE...
[ "0.7953601", "0.6386987", "0.62744534", "0.62062234", "0.6166208", "0.6088015", "0.60634387", "0.5940785", "0.5926195", "0.59059215", "0.5888946", "0.5871109", "0.58689463", "0.586162", "0.58497155", "0.58441293", "0.582854", "0.58265686", "0.5818371", "0.58177406", "0.580746...
0.71472275
1
This function may trigger password creation, if necessary
async retrieveOpenPGPPassword() { EnigmailLog.DEBUG("masterpass.jsm: retrieveMasterPassword()\n"); await this.ensurePasswordIsCached(); return this.cachedPassword; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generate_password() {\n base.emit(\"generate-password\", {\n url: document.location.toString(),\n username: find_username(),\n });\n }", "function generatePassword() {\n var pw = mainForm.master.value,\n sh = mainForm.siteHost.value;\n\n // Don't...
[ "0.75292623", "0.7340143", "0.72899485", "0.72534627", "0.7158986", "0.7050893", "0.70213467", "0.6991188", "0.6944373", "0.6922057", "0.6906582", "0.6896474", "0.6896009", "0.6879186", "0.6855292", "0.685135", "0.6849732", "0.6837781", "0.6837404", "0.6835037", "0.6827837", ...
0.0
-1
triggered on various doc ready events
function onReady( event ) { // bail if already triggered or IE8 document is not ready just yet var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete'; if ( docReady.isReady || isIE8NotReady ) { return; } trigger(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ready() {\n if (!readyFired) {\n // this must be set to true before we start calling callbacks\n readyFired = true;\n for (var i = 0; i < readyList.length; i++) {\n // if a callback here happens to add new ready handlers,\n // the docReady() functi...
[ "0.7519627", "0.74466544", "0.74466544", "0.7433517", "0.7413093", "0.7402056", "0.73957306", "0.73957306", "0.7317836", "0.72398555", "0.721288", "0.7160247", "0.7140437", "0.71345466", "0.71240044", "0.7050046", "0.7004576", "0.6997813", "0.6997813", "0.6997813", "0.6997813...
0.6641917
60
Class for managing events. Can be extended to provide event functionality in other classes.
function EventEmitter() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventClass() {}", "function Event() {\n let events = {};\n let last = undefined;\n this.on = function(evt, handler) {\n (events[evt] || (events[evt] = [])).push(handler);\n } \n this.emit = function(evt, ...arg) {\n last = evt;\n for(let item of events[evt])\n item(...
[ "0.74709177", "0.72577137", "0.7088683", "0.6984273", "0.6984273", "0.6937129", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", "0.69335496", ...
0.0
-1
helpers // get a number from a string, not a percentage
function getStyleSize( value ) { var num = parseFloat( value ); // not a percent like '100%', and a number var isValid = value.indexOf('%') === -1 && !isNaN( num ); return isValid && num; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function measureToNumber(str){\n\tvar parts = str.split(\"p\");\n\tvar val = parts[0];\n\tval = Number(val);\n\treturn val;\n}", "function stringToNumber(string) {\r\n // parseXXX interpretiert einen Punkt immer als Dezimaltrennzeichen\r\n var returnValue = \"\";\r\n var percent = false;\r\n // Buchs...
[ "0.7677354", "0.7292998", "0.7140811", "0.7128982", "0.69619435", "0.6959351", "0.69154835", "0.6903902", "0.67870355", "0.67828125", "0.6771369", "0.67198145", "0.67067134", "0.6705655", "0.66444874", "0.6621286", "0.66016775", "0.6593742", "0.6553171", "0.6553171", "0.65531...
0.0
-1
setup vars and functions do it on initial getSize(), rather than on script load For Firefox bug
function setup() { // setup once if ( isSetup ) { return; } isSetup = true; var getComputedStyle = window.getComputedStyle; getStyle = ( function() { var getStyleFn = getComputedStyle ? function( elem ) { return getComputedStyle( elem, null ); } : function( elem ) { return elem.currentStyle; }; return function getStyle( elem ) { var style = getStyleFn( elem ); if ( !style ) { logError( 'Style returned ' + style + '. Are you running this code in a hidden iframe on Firefox? ' + 'See http://bit.ly/getsizebug1' ); } return style; }; })(); // -------------------------- box sizing -------------------------- // boxSizingProp = getStyleProperty('boxSizing'); /** * WebKit measures the outer-width on style.width on border-box elems * IE & Firefox measures the inner-width */ if ( boxSizingProp ) { var div = document.createElement('div'); div.style.width = '200px'; div.style.padding = '1px 2px 3px 4px'; div.style.borderStyle = 'solid'; div.style.borderWidth = '1px 2px 3px 4px'; div.style[ boxSizingProp ] = 'border-box'; var body = document.body || document.documentElement; body.appendChild( div ); var style = getStyle( div ); isBoxSizeOuter = getStyleSize( style.width ) === 200; body.removeChild( div ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initSize(){\n\t\t$this.css({\n\t\t\twidth\t: params.width,\n\t\t\theight\t: params.height\n\t\t});\n\t\t\n\t\t$('body').css({\n\t\t\twidth\t: params.width,\n\t\t\theight\t: params.height\n\t\t});\n\n\t\t$this.find('.lsd-box').each(function(){\n\t\t\t$(this).css({\n\t\t\t\twidth\t: params.width,\n\t\t\t\th...
[ "0.7191545", "0.6806995", "0.6755936", "0.67360145", "0.6707767", "0.6694855", "0.6687263", "0.6654907", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", "0.6627398", ...
0.675789
7
IE8 returns percent values, not pixels taken from jQuery's curCSS
function mungeNonPixel( elem, value ) { // IE8 and has percent value if ( window.getComputedStyle || value.indexOf('%') === -1 ) { return value; } var style = elem.style; // Remember the original values var left = style.left; var rs = elem.runtimeStyle; var rsLeft = rs && rs.left; // Put in the new values to get a computed value out if ( rsLeft ) { rs.left = elem.currentStyle.left; } style.left = value; value = style.pixelLeft; // Revert the changed values style.left = left; if ( rsLeft ) { rs.left = rsLeft; } return value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function curCSS(elem, prop) {\n var value,\n pixel,\n unit,\n rvpos = /^top|bottom/,\n outerProp = [\"paddingTop\", \"paddingBottom\", \"borderTop\", \"borderBottom\"],\n innerHeight,\n parent,\n i = 4; // outerProp.length\n \n if (getComputedStyle) {\n ...
[ "0.7013315", "0.5806784", "0.5796477", "0.5784483", "0.57773995", "0.57736987", "0.5760651", "0.5753687", "0.5753687", "0.5753687", "0.5753687", "0.57495964", "0.5720688", "0.5694006", "0.56810033", "0.56525624", "0.56374526", "0.5634937", "0.5634937", "0.5634937", "0.5634937...
0.5765661
12
query // fall back to using QSA
function query( elem, selector ) { // append to fragment if no parent checkParent( elem ); // match elem with all selected elems of parent var elems = elem.parentNode.querySelectorAll( selector ); for ( var i=0, len = elems.length; i < len; i++ ) { // return true if match if ( elems[i] === elem ) { return true; } } // otherwise return false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "query() { }", "function LQuery() {}", "function LQuery() {}", "function LQuery() {}", "function TQuery() {}", "function TQuery() {}", "function TQuery() {}", "async query(query) {\n\n }", "function ______MA_Query() {}", "function query()\n{\n return query_start(0, -1)\n}", "function LQuery() ...
[ "0.7057861", "0.68653244", "0.68653244", "0.68653244", "0.68376017", "0.68376017", "0.68376017", "0.67666537", "0.67477953", "0.6725346", "0.6719836", "0.6719836", "0.6651606", "0.66207224", "0.6576635", "0.6576635", "0.6576635", "0.65610373", "0.65610373", "0.6498335", "0.64...
0.0
-1
helpers // extend objects
function extend( a, b ) { for ( var prop in b ) { a[ prop ] = b[ prop ]; } return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "extend() {}", "extend() {}", "function extend(a,b){for(var prop in b){a[prop]=b[prop];}return a;}", "function ExtraMethods() {}", "function _extend(){\n\t \n\t\tvar out = {};\n\t\t\n\t\t//Itterate over all objects and copy each property\n\t\t// shallow copy only \n\t\tvar len = arguments.length;\n\t\tfo...
[ "0.65491366", "0.65491366", "0.6241516", "0.6193384", "0.6184945", "0.6184535", "0.6170308", "0.61424136", "0.61262864", "0.61262864", "0.61262864", "0.61212605", "0.60223323", "0.5989742", "0.59867513", "0.59867513", "0.59615767", "0.5882699", "0.5867043", "0.58626276", "0.5...
0.0
-1
turn element or nodeList into an array
function makeArray( obj ) { var ary = []; if ( isArray( obj ) ) { // use object if already an array ary = obj; } else if ( obj && typeof obj.length === 'number' ) { // convert nodeList to array for ( var i=0, len = obj.length; i < len; i++ ) { ary.push( obj[i] ); } } else { // array of single index ary.push( obj ); } return ary; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertToArray(nodes){\n var array = null;\n try {\n array = Array.prototype.slice.call(nodes, 0); //non-IE and IE9+\n } catch (ex) {\n array = new Array();\n for (var i=0, len=nodes.length; i < len; i++){\n array.push(nodes[i]);\n }\n }\n return array...
[ "0.7361989", "0.7308388", "0.7308388", "0.729898", "0.7279939", "0.7265269", "0.72267294", "0.7116159", "0.7040728", "0.7029587", "0.69996554", "0.6957603", "0.6861447", "0.68188804", "0.66965497", "0.6689172", "0.6598793", "0.65931666", "0.6518876", "0.647441", "0.6451992", ...
0.0
-1
masonryDefinition // used for AMD definition and requires
function masonryDefinition( Outlayer, getSize ) { // create an Outlayer layout class var Masonry = Outlayer.create('masonry'); Masonry.prototype._resetLayout = function() { this.getSize(); this._getMeasurement( 'columnWidth', 'outerWidth' ); this._getMeasurement( 'gutter', 'outerWidth' ); this.measureColumns(); // reset column Y var i = this.cols; this.colYs = []; while (i--) { this.colYs.push( 0 ); } this.maxY = 0; }; Masonry.prototype.measureColumns = function() { this.getContainerWidth(); // if columnWidth is 0, default to outerWidth of first item if ( !this.columnWidth ) { var firstItem = this.items[0]; var firstItemElem = firstItem && firstItem.element; // columnWidth fall back to item of first element this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth || // if first elem has no width, default to size of container this.containerWidth; } this.columnWidth += this.gutter; this.cols = Math.floor( ( this.containerWidth + this.gutter ) / this.columnWidth ); this.cols = Math.max( this.cols, 1 ); }; Masonry.prototype.getContainerWidth = function() { // container is parent if fit width var container = this.options.isFitWidth ? this.element.parentNode : this.element; // check that this.size and size are there // IE8 triggers resize on body size change, so they might not be var size = getSize( container ); this.containerWidth = size && size.innerWidth; }; Masonry.prototype._getItemLayoutPosition = function( item ) { item.getSize(); // how many columns does this brick span var remainder = item.size.outerWidth % this.columnWidth; var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil'; // round if off by 1 pixel, otherwise use ceil var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth ); colSpan = Math.min( colSpan, this.cols ); var colGroup = this._getColGroup( colSpan ); // get the minimum Y value from the columns var minimumY = Math.min.apply( Math, colGroup ); var shortColIndex = indexOf( colGroup, minimumY ); // position the brick var position = { x: this.columnWidth * shortColIndex, y: minimumY }; // apply setHeight to necessary columns var setHeight = minimumY + item.size.outerHeight; var setSpan = this.cols + 1 - colGroup.length; for ( var i = 0; i < setSpan; i++ ) { this.colYs[ shortColIndex + i ] = setHeight; } return position; }; /** * @param {Number} colSpan - number of columns the element spans * @returns {Array} colGroup */ Masonry.prototype._getColGroup = function( colSpan ) { if ( colSpan < 2 ) { // if brick spans only one column, use all the column Ys return this.colYs; } var colGroup = []; // how many different places could this brick fit horizontally var groupCount = this.cols + 1 - colSpan; // for each group potential horizontal position for ( var i = 0; i < groupCount; i++ ) { // make an array of colY values for that one group var groupColYs = this.colYs.slice( i, i + colSpan ); // and get the max value of the array colGroup[i] = Math.max.apply( Math, groupColYs ); } return colGroup; }; Masonry.prototype._manageStamp = function( stamp ) { var stampSize = getSize( stamp ); var offset = this._getElementOffset( stamp ); // get the columns that this stamp affects var firstX = this.options.isOriginLeft ? offset.left : offset.right; var lastX = firstX + stampSize.outerWidth; var firstCol = Math.floor( firstX / this.columnWidth ); firstCol = Math.max( 0, firstCol ); var lastCol = Math.floor( lastX / this.columnWidth ); // lastCol should not go over if multiple of columnWidth #425 lastCol -= lastX % this.columnWidth ? 0 : 1; lastCol = Math.min( this.cols - 1, lastCol ); // set colYs to bottom of the stamp var stampMaxY = ( this.options.isOriginTop ? offset.top : offset.bottom ) + stampSize.outerHeight; for ( var i = firstCol; i <= lastCol; i++ ) { this.colYs[i] = Math.max( stampMaxY, this.colYs[i] ); } }; Masonry.prototype._getContainerSize = function() { this.maxY = Math.max.apply( Math, this.colYs ); var size = { height: this.maxY }; if ( this.options.isFitWidth ) { size.width = this._getContainerFitWidth(); } return size; }; Masonry.prototype._getContainerFitWidth = function() { var unusedCols = 0; // count unused columns var i = this.cols; while ( --i ) { if ( this.colYs[i] !== 0 ) { break; } unusedCols++; } // fit container to columns that have been used return ( this.cols - unusedCols ) * this.columnWidth - this.gutter; }; Masonry.prototype.needsResizeLayout = function() { var previousWidth = this.containerWidth; this.getContainerWidth(); return previousWidth !== this.containerWidth; }; return Masonry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeMasonry() {\n window.myMasonry = new Masonry(document.querySelector(`.${CLASSES.MASONRY}`))\n }", "function masonryDefinition( LayoutMode, Masonry ) {\n // create an Outlayer layout class\n var MasonryMode = LayoutMode.create('masonry');\n\n // save on to these methods\n var _g...
[ "0.69669485", "0.6723414", "0.6723414", "0.6723414", "0.6723414", "0.6723414", "0.6715945", "0.66956985", "0.64908195", "0.6481541", "0.6476408", "0.6460429", "0.63886654", "0.63648146", "0.6330003", "0.62155026", "0.6128444", "0.607041", "0.60456526", "0.5989751", "0.5908396...
0.6330003
21
helpers // extend objects
function extend( a, b ) { for ( var prop in b ) { a[ prop ] = b[ prop ]; } return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "extend() {}", "extend() {}", "function extend(a,b){for(var prop in b){a[prop]=b[prop];}return a;}", "function ExtraMethods() {}", "function _extend(){\n\t \n\t\tvar out = {};\n\t\t\n\t\t//Itterate over all objects and copy each property\n\t\t// shallow copy only \n\t\tvar len = arguments.length;\n\t\tfo...
[ "0.65491366", "0.65491366", "0.6241516", "0.6193384", "0.6184945", "0.6184535", "0.6170308", "0.61424136", "0.61262864", "0.61262864", "0.61262864", "0.61212605", "0.60223323", "0.5989742", "0.59867513", "0.59867513", "0.59615767", "0.5882699", "0.5867043", "0.58626276", "0.5...
0.0
-1
masonryDefinition // used for AMD definition and requires
function masonryDefinition( LayoutMode, Masonry ) { // create an Outlayer layout class var MasonryMode = LayoutMode.create('masonry'); // save on to these methods var _getElementOffset = MasonryMode.prototype._getElementOffset; var layout = MasonryMode.prototype.layout; var _getMeasurement = MasonryMode.prototype._getMeasurement; // sub-class Masonry extend( MasonryMode.prototype, Masonry.prototype ); // set back, as it was overwritten by Masonry MasonryMode.prototype._getElementOffset = _getElementOffset; MasonryMode.prototype.layout = layout; MasonryMode.prototype._getMeasurement = _getMeasurement; var measureColumns = MasonryMode.prototype.measureColumns; MasonryMode.prototype.measureColumns = function() { // set items, used if measuring first item this.items = this.isotope.filteredItems; measureColumns.call( this ); }; // HACK copy over isOriginLeft/Top options var _manageStamp = MasonryMode.prototype._manageStamp; MasonryMode.prototype._manageStamp = function() { this.options.isOriginLeft = this.isotope.options.isOriginLeft; this.options.isOriginTop = this.isotope.options.isOriginTop; _manageStamp.apply( this, arguments ); }; return MasonryMode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeMasonry() {\n window.myMasonry = new Masonry(document.querySelector(`.${CLASSES.MASONRY}`))\n }", "function masonryDefinition( LayoutMode, Masonry ) {\n // create an Outlayer layout class\n var MasonryMode = LayoutMode.create('masonry');\n\n // save on to these methods\n var _g...
[ "0.6967798", "0.6717626", "0.66983855", "0.64926636", "0.64823717", "0.6478784", "0.6462467", "0.63906384", "0.63662136", "0.63321126", "0.63321126", "0.63321126", "0.63321126", "0.63321126", "0.63321126", "0.63321126", "0.63321126", "0.62169874", "0.61305934", "0.60737664", ...
0.6724973
5
helpers // extend objects
function extend( a, b ) { for ( var prop in b ) { a[ prop ] = b[ prop ]; } return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "extend() {}", "extend() {}", "function extend(a,b){for(var prop in b){a[prop]=b[prop];}return a;}", "function ExtraMethods() {}", "function _extend(){\n\t \n\t\tvar out = {};\n\t\t\n\t\t//Itterate over all objects and copy each property\n\t\t// shallow copy only \n\t\tvar len = arguments.length;\n\t\tfo...
[ "0.65491366", "0.65491366", "0.6241516", "0.6193384", "0.6184945", "0.6184535", "0.6170308", "0.61424136", "0.61262864", "0.61262864", "0.61262864", "0.61212605", "0.60223323", "0.5989742", "0.59867513", "0.59867513", "0.59615767", "0.5882699", "0.5867043", "0.58626276", "0.5...
0.0
-1
turn element or nodeList into an array
function makeArray( obj ) { var ary = []; if ( isArray( obj ) ) { // use object if already an array ary = obj; } else if ( obj && typeof obj.length === 'number' ) { // convert nodeList to array for ( var i=0, len = obj.length; i < len; i++ ) { ary.push( obj[i] ); } } else { // array of single index ary.push( obj ); } return ary; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertToArray(nodes){\n var array = null;\n try {\n array = Array.prototype.slice.call(nodes, 0); //non-IE and IE9+\n } catch (ex) {\n array = new Array();\n for (var i=0, len=nodes.length; i < len; i++){\n array.push(nodes[i]);\n }\n }\n return array...
[ "0.7361989", "0.7308388", "0.7308388", "0.729898", "0.7279939", "0.7265269", "0.72267294", "0.7116159", "0.7040728", "0.7029587", "0.69996554", "0.6957603", "0.6861447", "0.68188804", "0.66965497", "0.6689172", "0.6598793", "0.65931666", "0.6518876", "0.647441", "0.6451992", ...
0.0
-1
isotopeDefinition // used for AMD definition and requires
function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode ) { // create an Outlayer layout class var Isotope = Outlayer.create( 'isotope', { layoutMode: "masonry", isJQueryFiltering: true, sortAscending: true }); Isotope.Item = Item; Isotope.LayoutMode = LayoutMode; Isotope.prototype._create = function() { this.itemGUID = 0; // functions that sort items this._sorters = {}; this._getSorters(); // call super Outlayer.prototype._create.call( this ); // create layout modes this.modes = {}; // start filteredItems with all items this.filteredItems = this.items; // keep of track of sortBys this.sortHistory = [ 'original-order' ]; // create from registered layout modes for ( var name in LayoutMode.modes ) { this._initLayoutMode( name ); } }; Isotope.prototype.reloadItems = function() { // reset item ID counter this.itemGUID = 0; // call super Outlayer.prototype.reloadItems.call( this ); }; Isotope.prototype._itemize = function() { var items = Outlayer.prototype._itemize.apply( this, arguments ); // assign ID for original-order for ( var i=0, len = items.length; i < len; i++ ) { var item = items[i]; item.id = this.itemGUID++; } this._updateItemsSortData( items ); return items; }; // -------------------------- layout -------------------------- // Isotope.prototype._initLayoutMode = function( name ) { var Mode = LayoutMode.modes[ name ]; // set mode options // HACK extend initial options, back-fill in default options var initialOpts = this.options[ name ] || {}; this.options[ name ] = Mode.options ? extend( Mode.options, initialOpts ) : initialOpts; // init layout mode instance this.modes[ name ] = new Mode( this ); }; Isotope.prototype.layout = function() { // if first time doing layout, do all magic if ( !this._isLayoutInited && this.options.isInitLayout ) { this.arrange(); return; } this._layout(); }; // private method to be used in layout() & magic() Isotope.prototype._layout = function() { // don't animate first layout var isInstant = this._getIsInstant(); // layout flow this._resetLayout(); this._manageStamps(); this.layoutItems( this.filteredItems, isInstant ); // flag for initalized this._isLayoutInited = true; }; // filter + sort + layout Isotope.prototype.arrange = function( opts ) { // set any options pass this.option( opts ); this._getIsInstant(); // filter, sort, and layout this.filteredItems = this._filter( this.items ); this._sort(); this._layout(); }; // alias to _init for main plugin method Isotope.prototype._init = Isotope.prototype.arrange; // HACK // Don't animate/transition first layout // Or don't animate/transition other layouts Isotope.prototype._getIsInstant = function() { var isInstant = this.options.isLayoutInstant !== undefined ? this.options.isLayoutInstant : !this._isLayoutInited; this._isInstant = isInstant; return isInstant; }; // -------------------------- filter -------------------------- // Isotope.prototype._filter = function( items ) { var filter = this.options.filter; filter = filter || '*'; var matches = []; var hiddenMatched = []; var visibleUnmatched = []; var test = this._getFilterTest( filter ); // test each item for ( var i=0, len = items.length; i < len; i++ ) { var item = items[i]; if ( item.isIgnored ) { continue; } // add item to either matched or unmatched group var isMatched = test( item ); // item.isFilterMatched = isMatched; // add to matches if its a match if ( isMatched ) { matches.push( item ); } // add to additional group if item needs to be hidden or revealed if ( isMatched && item.isHidden ) { hiddenMatched.push( item ); } else if ( !isMatched && !item.isHidden ) { visibleUnmatched.push( item ); } } var _this = this; function hideReveal() { _this.reveal( hiddenMatched ); _this.hide( visibleUnmatched ); } if ( this._isInstant ) { this._noTransition( hideReveal ); } else { hideReveal(); } return matches; }; // get a jQuery, function, or a matchesSelector test given the filter Isotope.prototype._getFilterTest = function( filter ) { if ( jQuery && this.options.isJQueryFiltering ) { // use jQuery return function( item ) { return jQuery( item.element ).is( filter ); }; } if ( typeof filter === 'function' ) { // use filter as function return function( item ) { return filter( item.element ); }; } // default, use filter as selector string return function( item ) { return matchesSelector( item.element, filter ); }; }; // -------------------------- sorting -------------------------- // /** * @params {Array} elems * @public */ Isotope.prototype.updateSortData = function( elems ) { // get items var items; if ( elems ) { elems = makeArray( elems ); items = this.getItems( elems ); } else { // update all items if no elems provided items = this.items; } this._getSorters(); this._updateItemsSortData( items ); }; Isotope.prototype._getSorters = function() { var getSortData = this.options.getSortData; for ( var key in getSortData ) { var sorter = getSortData[ key ]; this._sorters[ key ] = mungeSorter( sorter ); } }; /** * @params {Array} items - of Isotope.Items * @private */ Isotope.prototype._updateItemsSortData = function( items ) { // do not update if no items var len = items && items.length; for ( var i=0; len && i < len; i++ ) { var item = items[i]; item.updateSortData(); } }; // ----- munge sorter ----- // // encapsulate this, as we just need mungeSorter // other functions in here are just for munging var mungeSorter = ( function() { // add a magic layer to sorters for convienent shorthands // `.foo-bar` will use the text of .foo-bar querySelector // `[foo-bar]` will use attribute // you can also add parser // `.foo-bar parseInt` will parse that as a number function mungeSorter( sorter ) { // if not a string, return function or whatever it is if ( typeof sorter !== 'string' ) { return sorter; } // parse the sorter string var args = trim( sorter ).split(' '); var query = args[0]; // check if query looks like [an-attribute] var attrMatch = query.match( /^\[(.+)\]$/ ); var attr = attrMatch && attrMatch[1]; var getValue = getValueGetter( attr, query ); // use second argument as a parser var parser = Isotope.sortDataParsers[ args[1] ]; // parse the value, if there was a parser sorter = parser ? function( elem ) { return elem && parser( getValue( elem ) ); } : // otherwise just return value function( elem ) { return elem && getValue( elem ); }; return sorter; } // get an attribute getter, or get text of the querySelector function getValueGetter( attr, query ) { var getValue; // if query looks like [foo-bar], get attribute if ( attr ) { getValue = function( elem ) { return elem.getAttribute( attr ); }; } else { // otherwise, assume its a querySelector, and get its text getValue = function( elem ) { var child = elem.querySelector( query ); return child && getText( child ); }; } return getValue; } return mungeSorter; })(); // parsers used in getSortData shortcut strings Isotope.sortDataParsers = { 'parseInt': function( val ) { return parseInt( val, 10 ); }, 'parseFloat': function( val ) { return parseFloat( val ); } }; // ----- sort method ----- // // sort filteredItem order Isotope.prototype._sort = function() { var sortByOpt = this.options.sortBy; if ( !sortByOpt ) { return; } // concat all sortBy and sortHistory var sortBys = [].concat.apply( sortByOpt, this.sortHistory ); // sort magic var itemSorter = getItemSorter( sortBys, this.options.sortAscending ); this.filteredItems.sort( itemSorter ); // keep track of sortBy History if ( sortByOpt !== this.sortHistory[0] ) { // add to front, oldest goes in last this.sortHistory.unshift( sortByOpt ); } }; // returns a function used for sorting function getItemSorter( sortBys, sortAsc ) { return function sorter( itemA, itemB ) { // cycle through all sortKeys for ( var i = 0, len = sortBys.length; i < len; i++ ) { var sortBy = sortBys[i]; var a = itemA.sortData[ sortBy ]; var b = itemB.sortData[ sortBy ]; if ( a > b || a < b ) { // if sortAsc is an object, use the value given the sortBy key var isAscending = sortAsc[ sortBy ] !== undefined ? sortAsc[ sortBy ] : sortAsc; var direction = isAscending ? 1 : -1; return ( a > b ? 1 : -1 ) * direction; } } return 0; }; } // -------------------------- methods -------------------------- // // get layout mode Isotope.prototype._mode = function() { var layoutMode = this.options.layoutMode; var mode = this.modes[ layoutMode ]; if ( !mode ) { // TODO console.error throw new Error( 'No layout mode: ' + layoutMode ); } // HACK sync mode's options // any options set after init for layout mode need to be synced mode.options = this.options[ layoutMode ]; return mode; }; Isotope.prototype._resetLayout = function() { // trigger original reset layout Outlayer.prototype._resetLayout.call( this ); this._mode()._resetLayout(); }; Isotope.prototype._getItemLayoutPosition = function( item ) { return this._mode()._getItemLayoutPosition( item ); }; Isotope.prototype._manageStamp = function( stamp ) { this._mode()._manageStamp( stamp ); }; Isotope.prototype._getContainerSize = function() { return this._mode()._getContainerSize(); }; Isotope.prototype.needsResizeLayout = function() { return this._mode().needsResizeLayout(); }; // -------------------------- adding & removing -------------------------- // // HEADS UP overwrites default Outlayer appended Isotope.prototype.appended = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; } var filteredItems = this._filterRevealAdded( items ); // add to filteredItems this.filteredItems = this.filteredItems.concat( filteredItems ); }; // HEADS UP overwrites default Outlayer prepended Isotope.prototype.prepended = function( elems ) { var items = this._itemize( elems ); if ( !items.length ) { return; } // add items to beginning of collection var previousItems = this.items.slice(0); this.items = items.concat( previousItems ); // start new layout this._resetLayout(); this._manageStamps(); // layout new stuff without transition var filteredItems = this._filterRevealAdded( items ); // layout previous items this.layoutItems( previousItems ); // add to filteredItems this.filteredItems = filteredItems.concat( this.filteredItems ); }; Isotope.prototype._filterRevealAdded = function( items ) { var filteredItems = this._noTransition( function() { return this._filter( items ); }); // layout and reveal just the new items this.layoutItems( filteredItems, true ); this.reveal( filteredItems ); return items; }; /** * Filter, sort, and layout newly-appended item elements * @param {Array or NodeList or Element} elems */ Isotope.prototype.insert = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; } // append item elements var i, item; var len = items.length; for ( i=0; i < len; i++ ) { item = items[i]; this.element.appendChild( item.element ); } // filter new stuff /* // this way adds hides new filtered items with NO transition // so user can't see if new hidden items have been inserted var filteredInsertItems; this._noTransition( function() { filteredInsertItems = this._filter( items ); // hide all new items this.hide( filteredInsertItems ); }); // */ // this way hides new filtered items with transition // so user at least sees that something has been added var filteredInsertItems = this._filter( items ); // hide all newitems this._noTransition( function() { this.hide( filteredInsertItems ); }); // */ // set flag for ( i=0; i < len; i++ ) { items[i].isLayoutInstant = true; } this.arrange(); // reset flag for ( i=0; i < len; i++ ) { delete items[i].isLayoutInstant; } this.reveal( filteredInsertItems ); }; var _remove = Isotope.prototype.remove; Isotope.prototype.remove = function( elems ) { elems = makeArray( elems ); var removeItems = this.getItems( elems ); // do regular thing _remove.call( this, elems ); // bail if no items to remove if ( !removeItems || !removeItems.length ) { return; } // remove elems from filteredItems for ( var i=0, len = removeItems.length; i < len; i++ ) { var item = removeItems[i]; // remove item from collection removeFrom( item, this.filteredItems ); } }; Isotope.prototype.shuffle = function() { // update random sortData for ( var i=0, len = this.items.length; i < len; i++ ) { var item = this.items[i]; item.sortData.random = Math.random(); } this.options.sortBy = 'random'; this._sort(); this._layout(); }; /** * trigger fn without transition * kind of hacky to have this in the first place * @param {Function} fn * @returns ret * @private */ Isotope.prototype._noTransition = function( fn ) { // save transitionDuration before disabling var transitionDuration = this.options.transitionDuration; // disable transition this.options.transitionDuration = 0; // do it var returnValue = fn.call( this ); // re-enable transition for reveal this.options.transitionDuration = transitionDuration; return returnValue; }; // ----- helper methods ----- // /** * getter method for getting filtered item elements * @returns {Array} elems - collection of item elements */ Isotope.prototype.getFilteredItemElements = function() { var elems = []; for ( var i=0, len = this.filteredItems.length; i < len; i++ ) { elems.push( this.filteredItems[i].element ); } return elems; }; // ----- ----- // return Isotope; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode ) {\n // create an Outlayer layout class\n var Isotope = Outlayer.create( 'isotope', {\n layoutMode: \"masonry\",\n isJQueryFiltering: true,\n sortAscending: true\n });\n\n Isotope.Item = Item;\n Isotope.LayoutMode = Lay...
[ "0.66426724", "0.65913916", "0.6232765", "0.6061513", "0.580566", "0.57968706", "0.57762825", "0.57542247", "0.571722", "0.56825715", "0.5622882", "0.5607108", "0.56070954", "0.55565923", "0.5520914", "0.54793626", "0.54765755", "0.5461874", "0.5448353", "0.5448353", "0.54483...
0.66426724
4
add a magic layer to sorters for convienent shorthands `.foobar` will use the text of .foobar querySelector `[foobar]` will use attribute you can also add parser `.foobar parseInt` will parse that as a number
function mungeSorter( sorter ) { // if not a string, return function or whatever it is if ( typeof sorter !== 'string' ) { return sorter; } // parse the sorter string var args = trim( sorter ).split(' '); var query = args[0]; // check if query looks like [an-attribute] var attrMatch = query.match( /^\[(.+)\]$/ ); var attr = attrMatch && attrMatch[1]; var getValue = getValueGetter( attr, query ); // use second argument as a parser var parser = Isotope.sortDataParsers[ args[1] ]; // parse the value, if there was a parser sorter = parser ? function( elem ) { return elem && parser( getValue( elem ) ); } : // otherwise just return value function( elem ) { return elem && getValue( elem ); }; return sorter; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mungeSorter( sorter ) {\n // if not a string, return function or whatever it is\n if ( typeof sorter !== 'string' ) {\n return sorter;\n }\n // parse the sorter string\n var args = trim( sorter ).split(' ');\n var query = args[0];\n // check if query looks like [a...
[ "0.60570204", "0.60109055", "0.60109055", "0.60109055", "0.60109055", "0.60109055", "0.60109055", "0.60109055", "0.60109055", "0.58911276", "0.58325964", "0.58073056", "0.57278776", "0.57263935", "0.55910444", "0.55197436", "0.55063754", "0.54884624", "0.5462685", "0.5450497", ...
0.59969026
13
get an attribute getter, or get text of the querySelector
function getValueGetter( attr, query ) { var getValue; // if query looks like [foo-bar], get attribute if ( attr ) { getValue = function( elem ) { return elem.getAttribute( attr ); }; } else { // otherwise, assume its a querySelector, and get its text getValue = function( elem ) { var child = elem.querySelector( query ); return child && getText( child ); }; } return getValue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getValueGetter( attr, query ) {\n // if query looks like [foo-bar], get attribute\n if ( attr ) {\n return function getAttribute( elem ) {\n return elem.getAttribute( attr );\n };\n }\n\n // otherwise, assume its a querySelector, and get its text\n return fu...
[ "0.7468154", "0.7468154", "0.7468154", "0.7468154", "0.7468154", "0.7468154", "0.742081", "0.73804647", "0.7353638", "0.7309144", "0.6794398", "0.66687435", "0.65556467", "0.64710164", "0.6337211", "0.63250375", "0.6238788", "0.622035", "0.62196165", "0.62012124", "0.6175201"...
0.74727523
6
returns a function used for sorting
function getItemSorter( sortBys, sortAsc ) { return function sorter( itemA, itemB ) { // cycle through all sortKeys for ( var i = 0, len = sortBys.length; i < len; i++ ) { var sortBy = sortBys[i]; var a = itemA.sortData[ sortBy ]; var b = itemB.sortData[ sortBy ]; if ( a > b || a < b ) { // if sortAsc is an object, use the value given the sortBy key var isAscending = sortAsc[ sortBy ] !== undefined ? sortAsc[ sortBy ] : sortAsc; var direction = isAscending ? 1 : -1; return ( a > b ? 1 : -1 ) * direction; } } return 0; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function GetSortOrder(prop) { \n ...
[ "0.7409723", "0.7409723", "0.7409723", "0.7409723", "0.7340594", "0.72998416", "0.72825414", "0.7168141", "0.7015041", "0.7015041", "0.6978145", "0.6969056", "0.69666415", "0.695595", "0.6939071", "0.69379956", "0.69276094", "0.68985426", "0.6839244", "0.6794043", "0.67714655...
0.0
-1
Set the proper sizes on the containers and animate the content in.
function _showContent(){ $('.pp_loaderIcon').hide(); // Calculate the opened top position of the pic holder projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2)); if(projectedTop < 0) projectedTop = 0; $ppt.fadeTo(settings.animation_speed,1); // Resize the content holder $pp_pic_holder.find('.pp_content') .animate({ height:pp_dimensions['contentHeight'], width:pp_dimensions['contentWidth'] },settings.animation_speed); // Resize picture the holder $pp_pic_holder.animate({ 'top': projectedTop, 'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2), width:pp_dimensions['containerWidth'] },settings.animation_speed,function(){ $pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']); $pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content // Show the nav if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); } if(settings.allow_expand) { if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized $('a.pp_expand,a.pp_contract').show(); }else{ $('a.pp_expand').hide(); } } if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow(); settings.changepicturecallback(); // Callback! pp_open = true; }); _insert_gallery(); pp_settings.ajaxcallback(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateContainers() {\n\n\t\tvar width = editor.duration * scale;\n\n\t\telements.setWidth( width + 'px' );\n\t\t// curves.setWidth( width + 'px' );\n\n\t}", "function update_containersize() {\n $container.css(\"width\", $('.showcase-container').width() + \"px\");\n $contain...
[ "0.7067571", "0.6767865", "0.63932145", "0.63348746", "0.6330082", "0.6145131", "0.6112355", "0.6102201", "0.60916644", "0.6046078", "0.60222137", "0.5977769", "0.5964004", "0.59455013", "0.5906499", "0.5906409", "0.58991355", "0.5882533", "0.5869694", "0.5866514", "0.5862041...
0.0
-1
jquery.mb.components file: jquery.mb.CSSAnimate.min.js Copyright (c) 20012014. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze Italy
function uncamel(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cssAnimate() {\n if (!$html.hasClass('mobile') && !$html.hasClass('tablet') && $deviceWidth > 991){\n $('.css-animate .animated').each(function(){\n var that = $(this);\n if (that.data('time') != undefined){\n var delay...
[ "0.60487944", "0.6037184", "0.59176666", "0.59040475", "0.5879557", "0.5792923", "0.57873374", "0.57873374", "0.57844585", "0.5718775", "0.5712681", "0.57014394", "0.5682254", "0.5651477", "0.5640681", "0.5638695", "0.5625145", "0.5622495", "0.56218684", "0.56032646", "0.5596...
0.0
-1
Get the path of the calling function
function callerPath () { return callsites()[2].getFileName() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCallSite() {\n var _callsite = require('callsite');\n var stack = _callsite();\n return stack[2].getFileName();\n}", "_getCallerFilePath() {\n // we are going to temporarily override this method. Keep for restore\n const originalPrepareStackTrace = Error.prepareStackTrace;\n let cal...
[ "0.74142987", "0.7273654", "0.6920318", "0.67531073", "0.64724183", "0.6460719", "0.6456305", "0.63621545", "0.63621545", "0.63621545", "0.63621545", "0.63621545", "0.63055223", "0.6286492", "0.62777734", "0.6235695", "0.61994344", "0.61994344", "0.61994344", "0.61994344", "0...
0.8576753
0
ISMonkey is an extension manager that sets up the required MutationObservers and serv socket to be used throughout.
constructor() { this.socketEventList = []; this.asyncExtensionList = []; this.extensions = {}; this.setupSocket(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createObservers() {\n // NOTE: We need to wait for Google to bring Proxy to V8\n // if (this.targetElement.__scripts__) {\n // this.scriptsObserver = new MutationObserver((changes) => { this.scriptsObserver(changes) });\n // this.scriptsObserver.observe(this.targetElement.__scripts__, {\n // ...
[ "0.58892566", "0.56777346", "0.5651061", "0.5648696", "0.55705243", "0.55581474", "0.5512674", "0.5470776", "0.54489964", "0.54282284", "0.5424709", "0.53782004", "0.5361406", "0.5340631", "0.5337724", "0.53351724", "0.53039384", "0.5295105", "0.5269418", "0.52634704", "0.526...
0.63114315
0
Wait for socket to initialize and attach to this class
setupSocket() { var self = this; self.sockets = []; const nativeWebSocket = window.WebSocket; window.WebSocket = function(...args){ const socket = new nativeWebSocket(...args); self.sockets.push(socket); return socket; }; let setupThisSocket = setInterval( ()=> { if( self.sockets.length != 0 ){ clearInterval(setupThisSocket); self.sockets[0].addEventListener('message', (e) => self.messageHandler(self, e)); console.log("Attached to socket"); } console.log("waiting for socket ..."); }, 100); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init() {\n // Setup event handlers for the socket\n this._setListeners(() => {\n // Check that connection limit is not exceeded\n if (this._server.options.maxClients && this._server.connections.size > this._server.options.maxClients) {\n return this.send(421, this...
[ "0.68476427", "0.651948", "0.647879", "0.64008003", "0.639745", "0.6349572", "0.62837666", "0.62748325", "0.6223804", "0.6188059", "0.61699563", "0.61507505", "0.61489654", "0.6145473", "0.60656625", "0.6057952", "0.6020551", "0.6012586", "0.60074705", "0.60071814", "0.598991...
0.6243299
8
Message handler for sockets
messageHandler(self, e) { let msg = ( (e.data).match(/^[0-9]+(\[.+)$/) || [] )[1]; if( msg != null ) { let msg_parsed = JSON.parse(msg); let [r, data] = msg_parsed; self.socketEventList.forEach(e=>e.run(self, msg_parsed)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function on_socket_get(message){}", "messageHandler(socket) \n\t{\n \t\tsocket.on('message', message => {\n \t\tconst data = JSON.parse(message);\n \t\t\tswitch(data.type) \n\t\t\t{\n\t\t\t\t//when another user has a more updated chain.\t\n \t\t\tcase MESSAGE_TYPES.chain:\n \t\t\t\tt...
[ "0.7745768", "0.74620575", "0.7308119", "0.72853595", "0.7258418", "0.7257197", "0.72418344", "0.7159801", "0.71552956", "0.70685583", "0.7066578", "0.70626765", "0.6992909", "0.6958702", "0.6953015", "0.68796885", "0.6863429", "0.68510634", "0.68408895", "0.68231964", "0.678...
0.73357785
2
Process the mito genome data for the species
function processGenomeData(data) { // Grab the json object and point to it species = data; // Go through each species and make a link within each gene to the species that have that same gene species.forEach(function(s,i,species){ s.className = s.name.toLowerCase(); s.children = []; s.genes.forEach(function(g,ii, genes){ g.speciesClass = s.className; g.connectedNodes = []; g.className = getGeneClassName(s.name, g.name); s.children.push(g); maxGeneLength = Math.max(g.length, maxGeneLength); if(!geneLinks[g.name]) { geneLinks[g.name] = {name: g.name, orgs:[s], genes:[g]}; } else { geneLinks[g.name].orgs.push(s); geneLinks[g.name].genes.push(g); } }); }); species.forEach(function(s,i,species){ s.links = []; s.genes.forEach(function(g,ii, genes){ var gl = geneLinks[g.name]; if(gl){ for(var o = 0; o < gl.orgs.length; o++){ if(gl.orgs[o] != s){ var link = {type: s.name+"-"+ gl.orgs[o].name+"-link", source: g, target: gl.genes[o]}; g.connectedNodes.push(gl.genes[o]); s.links.push(link); } } } }); }); var selectSpecies = [species[9], species[6], species[2], species[3]]; drawGeneChart(selectSpecies); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function process(data, index) {\n\tvar genusnames = [];\n\tvar genusdata = [];\n\tvar scinames = [];\n\tvar commonnames = [];\n\tvar familynamesorder = [];\n\n\tdata.forEach(function(d, i) {\n\t\tvar genusname = d.Genus;\n\t\tvar speciesname = d.Species;\n\t\tscinames.push(genusname+\" \"+speciesname);\n\t\tcommon...
[ "0.60182375", "0.53649324", "0.51267236", "0.5099687", "0.5051486", "0.5050544", "0.50472206", "0.49357596", "0.4868669", "0.48440567", "0.48330766", "0.4827659", "0.47482184", "0.47293627", "0.46967876", "0.46754628", "0.4672893", "0.46518546", "0.4643247", "0.46176526", "0....
0.6727379
0
Singletons reduce the need for global variables which is particularly important in JavaScript because it limits namespace pollution and associated risk of name collisions. used to limit the instances of an object
function Process (state) { this.state = state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getInstances() {}", "function getGlobalSingleton(name, creator, obj) {\n\t const gbl = (obj || GLOBAL_OBJ) ;\n\t const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});\n\t const singleton = __SENTRY__[name] || (__SENTRY__[name] = creator());\n\t return singleton;\n\t}", "function Singleton4(){\n var ...
[ "0.7317474", "0.67109156", "0.67099917", "0.6657178", "0.66014254", "0.6596127", "0.65407056", "0.65263945", "0.65045744", "0.6471072", "0.6416741", "0.641034", "0.63688946", "0.62925243", "0.6249524", "0.6154226", "0.61505175", "0.61474687", "0.61303204", "0.6113948", "0.611...
0.0
-1
alert("This is utilities."); Create, using random number generation, an objectID that has twenty alpha characters. Each five tuple is separated with a hyphen.
function getObjectID() { var objectID = ""; for ( var i=1; i<21; i++ ) { objectID += String.fromCharCode(Math.floor(Math.random()*26) + 97); if ( i<20 && (i % 5) == 0 ) objectID += "-"; } return objectID; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeid()\r\n{\r\n var text = \"\";\r\n var possibleChar = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\r\n var possibleDigit = \"0123456789\";\r\n\r\n getChar = function(list) {\r\n return list.charAt(Math.floor(Math.random() * list.length));\r\n }\r\n\r\n for( var i=0; i < 3; i++ ) {\r\n t...
[ "0.7247468", "0.7102937", "0.70985705", "0.7086636", "0.70742923", "0.70557064", "0.7053491", "0.705127", "0.7048619", "0.7031226", "0.7028278", "0.70241296", "0.702244", "0.69722724", "0.69617957", "0.6957385", "0.6953451", "0.6920514", "0.68363804", "0.68216544", "0.678737"...
0.76057535
0
Remove apostrophe's from string data. Put &pos; in for each apostrophe
function scrub(targetStr) { var pieces = targetStr.split("'"); return pieces.join("$pos;"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decodeApos(input)\n{\n var decoded= input.replace(/&apos/g, \"'\");\n return decoded;\n}", "function encodeApos (input)\n{\n\n var encoded = input.replace(/'/g, \"&apos\");\n return encoded;\n}", "function cleanUpString(strSpecials) \n{\n strSpecials = stripString(strSpecials, \"%20\", \" \");\...
[ "0.673267", "0.64428586", "0.6187874", "0.6163192", "0.6098955", "0.60353136", "0.6021125", "0.59356993", "0.5935117", "0.5911188", "0.5852808", "0.58519936", "0.5844899", "0.5796042", "0.57919323", "0.5764593", "0.57337195", "0.5731774", "0.57267904", "0.56957114", "0.568411...
0.5829306
13
Remove &pos; and put an apostrophe in it's place.
function deScrub(targetStr) { var pieces = targetStr.split("$pos;"); return pieces.join("'"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encodeApos (input)\n{\n\n var encoded = input.replace(/'/g, \"&apos\");\n return encoded;\n}", "function nombreApostrophe(x) {\n return x.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \"\\'\");\n\n }// Fin fonction nombreApostrophe", "function decodeApos(input)\n{\n var decoded= input....
[ "0.6993814", "0.6514727", "0.64364284", "0.6206697", "0.6002778", "0.59864473", "0.5856786", "0.584421", "0.5826095", "0.5823395", "0.5762392", "0.57186097", "0.5704725", "0.56562454", "0.56387025", "0.56272286", "0.559855", "0.55844283", "0.5533374", "0.55012864", "0.5488313...
0.53425676
39
Look at the named contents of an object.
function viewer(obj) { var names = ""; for ( var name in obj ) names += name + " : " + obj[name]+"\n"; alert(names); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getObjectFromName(person){\n return person.name == nameFilter;\n}", "function accessObject(obj, propsearch,){\n\n return obj[propsearch]\n }", "function getObjectByName(objName) {\n var objFound;\n var runTime = _pGlob !== undefined;\n objFound = runTime ? _pGlob.objCache[objName] : null...
[ "0.60982627", "0.60008705", "0.5816609", "0.58067375", "0.5801168", "0.5764591", "0.57578754", "0.572141", "0.5691657", "0.5662396", "0.5662396", "0.55170155", "0.547605", "0.5464212", "0.545325", "0.5446512", "0.5431314", "0.5430741", "0.5405769", "0.5397522", "0.5395788", ...
0.5653257
11
From Flanagan, Javascript: The Definitive Guide. Creates closures. Will be used for current goal protection.
function makeProperty( obj, name, predicate ) { var value; // this is the property value, current goal in this application. obj["get" + name] = function() { return value; }; obj["set" + name] = function(v) { if ( predicate && !predicate(v)) throw "set" + name + ": invalid value " + v; else value = v; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Closure() {\r\n}", "function makeClosure(names, body, env) {\n return {\n \"names\": names,\n\t\"body\": body,\n\t\"type\": 'closure',\n\t\"*parent\": env\n };\n }", "function closureMaker() {\n var outerVar = 5;\n return function() {\n return outerVar * 2; // V...
[ "0.7527612", "0.71964943", "0.6963913", "0.69183064", "0.68499804", "0.6813076", "0.6786975", "0.67500824", "0.6679287", "0.66312546", "0.65363795", "0.6506293", "0.6467322", "0.64574903", "0.64126235", "0.63645554", "0.63632935", "0.6355544", "0.6337054", "0.6320832", "0.628...
0.0
-1
Remove blanks from either end of a string
function trim( str ) { var len = str.length; var begin = 0; var end = len; while ( str.charAt(begin) == " " ) begin++; while ( str.charAt(end-1) == " " ) end--; return str.slice(begin, end); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeBlanksTwo(str){\n if(typeof str !== \"string\"){\n return 0;\n }\n var arr = [];\n for(var idx = 0; idx < str.length; idx++){\n if(str[idx] != \" \"){\n arr.push(str[idx]);\n }\n }\n return arr.join(\"\");\n}", "function removeLastBlank (str) {\n if (str.substring(str.length-1...
[ "0.7171458", "0.7011805", "0.6888704", "0.68765384", "0.6875653", "0.686164", "0.68577707", "0.6852554", "0.6843471", "0.67992944", "0.6777462", "0.67665887", "0.67292273", "0.6699136", "0.6664825", "0.6654225", "0.66280085", "0.6607912", "0.66030747", "0.658341", "0.6569457"...
0.0
-1
ensures it loops if this sound is the last one
function playNext(i) { if ((currentSound + 1) == soundsCount) { soundManager.play('0'); } else { soundManager.play((currentSound + 1).toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextIntermittentSound() {\n\t\tthat.intermittentSound.play();\n\t}", "function novel_audioLoop()\n{\n novel.audio.currentTime = 0;\n novel.audio.play();\n}", "function playNextShuffled() {\n\n\t\tif (plsShuffledIndex < (plsShuffled.length - 1)) {\n\t\t\tplsShuffledIndex += 1;\n\t\t\tplay(plsShuf...
[ "0.70659846", "0.68028736", "0.6775667", "0.67327964", "0.66567105", "0.6581599", "0.6578006", "0.6558062", "0.64853835", "0.64729416", "0.64686304", "0.6423607", "0.6420766", "0.64138293", "0.63899547", "0.6377827", "0.63648427", "0.6358252", "0.63535523", "0.6276109", "0.62...
0.66651857
4
check() loop through stack and see if it is in decending order
function check(stack){ for(let i = 0; i<stack.length; i++){ if(stack[i.length]>stack[i.length-1]){ } return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isBalanced()\n\t{\n\t\tvar tempStack = [];\n\t\tfor (var i = 0; i < postFixTokens.length; i++)\n\t\t{\n\t\t\tvar type = postFixTokens[i].tokenType;\n\t\t\tif (type === tree.Token.numberType || type === tree.Token.variableType)\n\t\t\t{\n\t\t\t\ttempStack.push(1);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if...
[ "0.63197976", "0.62675774", "0.61428976", "0.6068549", "0.6058617", "0.60350573", "0.59751385", "0.59582645", "0.5871965", "0.5864983", "0.5814298", "0.58098114", "0.58072037", "0.58052045", "0.5791436", "0.57875055", "0.5768824", "0.57061416", "0.57001835", "0.5685482", "0.5...
0.7330473
0
Watch a directory with chokidar.
function watch$(directory, opts) { return Observable.create(observer => { chokidar.watch(directory, opts) .on('all', (event, path) => observer.next({ event, path })) .on('error', error => observer.error(error)); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "watch (path, delay) {\n console.log('Start watching');\n this.watcher = chokidar.watch(path + '/*.csv', {\n followSymlinks: false,\n usePolling: true,\n interval: delay,\n binaryInterval: delay\n });\n this.watcher.on('change', file => this.emit('dirwatcher:changed', fs.realpathSync...
[ "0.72226524", "0.66849107", "0.66472787", "0.6535657", "0.65207285", "0.64339656", "0.6433908", "0.6400857", "0.63197666", "0.6242888", "0.6195221", "0.6151391", "0.6048706", "0.6011174", "0.59751934", "0.5971008", "0.59279495", "0.58923984", "0.5878654", "0.5869194", "0.5862...
0.7454526
0
Your Own Tests (OPTIONAL)
function assert(test, message, test_number) { if (!test) { console.log(test_number + "false"); throw "ERROR: " + message; } console.log(test_number + "true"); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AssertTests() {\n}", "function runTests() {\n\ttestBeepBoop();\n\ttestGetDigits();\n}", "function testRun()\r\n{\r\n}", "function startAllTests(){ \n testGetObjectFromArrays();\n testNormalizeHeader();\n testFillInTemplateFromObject();\n testIsCellEmpty();\n testIsAlnum();\n testIsDigit();\n}"...
[ "0.7311142", "0.7215576", "0.7158614", "0.71497166", "0.71375585", "0.71282643", "0.70235884", "0.6965342", "0.6860747", "0.6740041", "0.66761136", "0.667204", "0.6596801", "0.6586652", "0.6574469", "0.6573143", "0.64901686", "0.64839154", "0.64821684", "0.6464145", "0.645558...
0.0
-1
List all the topics for the currentuser
loadTopics({commit}){ HTTP.get('v1/api/topic', { handlerEnabled: true } ). then(response => response.data). then(topics => { commit('SET_TOPICS', topics) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTopics(callback){\n\t$.ajax({\n\t\turl : \"/CampusTalk/rest/CampusTalkAPI/getTopics\",\n\t\tdatatype:'json',\n\t\ttype: \"post\",\n\t\tcontentType: \"application/json\",\n\t\tdata: JSON.stringify({}),\n\t}).done(function(data){\n\t\tcallback(data);\n\t});\n}", "get topicsInput() {\n return thi...
[ "0.61803305", "0.61785436", "0.61066526", "0.60641915", "0.6008511", "0.60060567", "0.5911542", "0.580387", "0.57592046", "0.57490987", "0.57178676", "0.5697992", "0.5683923", "0.56367725", "0.5634582", "0.5561254", "0.5525573", "0.55104434", "0.54635334", "0.5453716", "0.542...
0.5138801
59
Load Topic based on id
loadTopicById({commit}, topic_id){ HTTP.get('v1/api/topicdetail/' + topic_id + '/', { handlerEnabled: true } ). then(response => response.data) .then(topic => { commit('SET_TOPIC', topic) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTopicById(id, callback, errorCallback) {\n CommonUtil.requestAxios(\n baseServerAxios().get(\n UrlConstant.api.topic.GET_TOPIC_BY_ID.replace('{id}', id)\n ),\n callback,\n errorCallback\n );\n }", "function findTopicById(id) {\n\n $.ajax({\n type: \"GET\",\n ...
[ "0.731427", "0.7195262", "0.6999266", "0.6855958", "0.6639076", "0.6422187", "0.60510576", "0.603818", "0.60175925", "0.59948015", "0.59935004", "0.59297246", "0.5847106", "0.584337", "0.58289504", "0.5776899", "0.57743555", "0.57743555", "0.57743555", "0.57743555", "0.577435...
0.7124647
2
Load Sub Topics by IS
loadSubTopicId ({commit}, sub_topic_id){ HTTP.get('v1/api/subsection/' + sub_topic_id + '/', { handlerEnabled: true } ). then(response => response.data). then(sub_topic => { commit('SET_SUBTOPICS', sub_topic) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadTopicSubTopicTemplate(event, data) {\n var templateID = 'faq-topics-subtopic-content';\n compiledTemplates[templateID] || loadTemplate(templateID);\n var $target = $(event.target);\n var $faqSubTopics=$target.next().next('.catSubtopic');\n\n $targ...
[ "0.6476352", "0.6294281", "0.6278117", "0.6185661", "0.61538047", "0.6110893", "0.58276254", "0.58084935", "0.5701241", "0.5615093", "0.55994296", "0.5522265", "0.5520467", "0.551357", "0.5460598", "0.54537094", "0.543081", "0.53915656", "0.5388251", "0.538819", "0.5387373", ...
0.7039846
0
Method to retrieve state from Stores
function getState( id ) { return { data: PostsStore.getPost( id ) }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getState() {\n return JSON.parse(device.localStorage.getItem(stateKey));\n}", "function getStateFromStores() {\n return {\n // usercontext: UserContextStore.getContext()\n\t\t// data: DeploymentOptionsStore.getData()\n }\n}", "getStores() {\n Service.get(this).getStores(state.get(this).para...
[ "0.7293229", "0.71309334", "0.7038652", "0.70127845", "0.70116407", "0.70116407", "0.6975344", "0.6927295", "0.68934685", "0.6889814", "0.68128955", "0.6798313", "0.6789322", "0.67840683", "0.67840683", "0.6767093", "0.6742998", "0.67277837", "0.6704687", "0.6565206", "0.6564...
0.0
-1
Returns OAuth2 client Arguments: config: hash containing: client, hash containing: base_url: The base URL of the OAuth2 client. Ex: process_login_url: the URL where to the OAuth2 server must redirect the user when authenticated. login_url: the URL where the user must go to be redirected to OAuth2 server for authentication. logout_url: the URL where the user must go so that his session is cleared, and he is unlogged from client. default_redirection_url: default URL to redirect to after login / logout. Optional, default to '/'. crypt_key: string, encryption key used to crypt information contained in the states. This is a symmetric key and must be kept secret. sign_key: string, signature key used to sign (HMAC) issued states. This is a symmetric key and must be kept secret. default_server: which server to use for default login when user access login_url (ex: 'facebook.com'). servers: hash associating OAuth2 server ids (ex: "facebook.com") with a hash containing (for each): server_authorize_endpoint: full URL, OAuth2 server token endpoint (ex: " server_token_endpoint: full url, where to check the token (ex: " client_id: the client id as registered by this OAuth2 server. client_secret: shared secret between client and this OAuth2 server. options: optional, hash associating OAuth2 server ids (ex: "facebook.com") with hash containing some options specific to the server. Not all servers have to be listed here, neither all options. Possible options: valid_grant: a function which will replace the default one to check the grant is ok. You might want to use this shortcut if you have a faster way of checking than requesting the OAuth2 server with an HTTP request. treat_access_token: a function which will replace the default one to do something with the access token. You will tipically use that function to set some info in session. transform_token_response: a function which will replace the default one to obtain a hash containing the access_token from the OAuth2 server reply. This method should be provided if the OAuth2 server we are requesting does not return JSON encoded data.
function createClient(conf, options) { conf.default_redirection_url = conf.default_redirection_url || '/'; options = options || {}; return new OAuth2Client(conf, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function client(config){\n \n var base = this;\n\n //Save the options\n base.config = config;\n \n //Save the oauth client\n base.oa = undefined;\n \n //If we need to take care of refresh tokens\n\t// NO SUPPORT for OAUTH 1.0\n\n\tswitch(base.config.version) {\n\n\t\t//UNTESTED!!\n\t\tca...
[ "0.7330012", "0.66052794", "0.6376369", "0.62960327", "0.62603974", "0.58576924", "0.5753702", "0.5748534", "0.5732481", "0.572979", "0.57250476", "0.57075244", "0.563945", "0.5622259", "0.56221", "0.5609895", "0.5603333", "0.5575321", "0.55725604", "0.5553623", "0.5543349", ...
0.66037315
2
3714 4963 5398 431
function cardNameValidator( id, value ) { cardNamePass = true; cardNameLength = value.length; // Get address line 1 full length if( cardNameLength === 0 ) { // Address line 1 must be present validationFeedback(id,'fail','The name on the card is required'); } if( cardNamePass === true ) { specialCharacterCheck(value); if( specialCharacterResult === true ) { validationFeedback(id,'fail','The name on the card cannot contain special characters'); } } if( cardNamePass === true ) { // If nothing has failed then this is triggered to show success validationFeedback(id,'pass'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function XujWkuOtln(){return 23;/* ZmKsOtS5QoXX lb0mWOp1WF tzmhzECNSsB qvwMOaAT3w 1mLwgX9NX1bK NizTqOptq7c CGhyOP5eVff bLNG5ThH4qcd ezBAl0su8q LavV15CBaCAq IQJaG4JEgL3 bSzagyBcGVWE bCCTwHpxFnQj yPUnNOdpTe2 5tkfhofMpVj fZdI5HFCrYt Kj43mwvd1G1 46uoGhY6DHl Qfu4CFDA5e3 uQ6JljxeeIx ZZZ3BZMAn7T Lju5Vjdj8Rw wjIjRQUUVS IV...
[ "0.631982", "0.62972486", "0.6271759", "0.6257278", "0.6234962", "0.6213121", "0.6213121", "0.6213121", "0.6213121", "0.62082916", "0.61920124", "0.61620265", "0.61458206", "0.61417973", "0.6121508", "0.6118399", "0.60940874", "0.6083118", "0.6062382", "0.6060217", "0.6042763...
0.0
-1
Secondary Sales Header Report
function fnShowProductDetails() { debugger; $.ajax({ type: 'POST', url: '../HiDoctor_Reports/Reports/GetSaleProductsSS', data: 'A', success: function (response) { jsData = eval('(' + response + ')'); $('option', $("#ddlProductName")).remove(); if (jsData.Tables[0].Rows.length > 0) { $('#ddlProductName').append("<option value='0'>-Select Product-</option>"); for (var i = 0; i < jsData.Tables[0].Rows.length; i++) { $("#ddlProductName").append("<option value='" + jsData.Tables[0].Rows[i].Product_Code + "'>" + jsData.Tables[0].Rows[i].Product_Name + "</option>"); } $("#ddlProductName").val('0'); } }, error: function () { fnMsgAlert('info', 'Report', 'Error.'); HideModalPopup("dvloading"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ReportHeader(){}", "function createSalesTableHeader() {\n // Create the first header column\n var trEl = document.createElement('tr'); //create the row\n var thEl = document.createElement('th'); //create the first column cell\n thEl.textContent = 'Location';\n trEl.appendChild(thEl);\n\n // Create...
[ "0.65623784", "0.633425", "0.63253224", "0.6310888", "0.6145618", "0.6137754", "0.59976786", "0.5890791", "0.5888834", "0.5834854", "0.58341676", "0.58234566", "0.5807537", "0.5787972", "0.5787904", "0.578185", "0.57749116", "0.57097954", "0.5703845", "0.5687598", "0.56778944...
0.0
-1
StockistWise UnderOver Stock SS
function fnStockistWiseUnderOverStock() { var startMonth = fngetMonthNumber($('#txtFromDate').val().split('-')[0]); var endMonth = fngetMonthNumber($('#txtToDate').val().split('-')[0]); var startYear = $('#txtFromDate').val().split('-')[1]; var endYear = $('#txtToDate').val().split('-')[1]; if ($("#txtFromDate").val() == "") { fnMsgAlert('info', 'Stockist Wise Under Over Stock', 'Please enter Start month.'); HideModalPopup("dvloading"); return false; } if ($("#txtToDate").val() == "") { fnMsgAlert('info', 'Stockist Wise Under Over Stock', 'Please enter End month.'); HideModalPopup("dvloading"); return false; } var days = daysInMonth(endMonth, endYear); var startDate = "", endDate = ""; if (parseInt(startMonth) >= 10) { startDate = startYear + "-" + startMonth + "-01"; } else { startDate = startYear + "-0" + startMonth + "-01"; } endDate = endYear + "-" + endMonth + "-" + days; var dt1 = new Date(startYear + "/" + startMonth + "/01"); var dt2 = new Date(endYear + "/" + endMonth + "/" + days); if (dt1 > dt2) { fnMsgAlert('info', 'Stockist Wise Under Over Stock', 'Start Month&Year should be less than End Month&Year.'); HideModalPopup("dvloading"); return false; } if ($("#ddlProductName").val() == "0") { fnMsgAlert('info', 'Stockist Wise Under Over Stock', 'Select product.'); HideModalPopup("dvloading"); return false; } var diffMonth = monthDiff(startMonth + "/01/" + startYear, endMonth + "/" + days + "/" + endYear); ShowModalPopup("dvloading"); $.ajax({ type: 'POST', url: '../HiDoctor_Reports/Reports/GetStockistWiseUnderOverStock', data: 'regionCode=' + $('#hdnRegionCode').val() + '&sd=' + startDate + '&ed=' + endDate + '&ProductCode=' + $("#ddlProductName").val(), success: function (response) { jsData = eval('(' + response + ')'); var tableContent = ""; var sales = 0, close = 0, reionTotal = 0, totalsummary = 0; var salesEndMonth = 0, closingEndMonth = 0, noOfDaysStock = 0; var totalSalesEndMonth = 0, totalClosingEndMonth = 0, TotalNoOfDaysStock = 0; var endMonthSales = 0, EndMonthClosing = 0, monthSales = 0; var regionAvg = 0.0, totalAvg = 0.0, avg = 0.0; var isRegionNameBind = true; if (jsData.Tables[0].Rows.length > 0) { tableContent = ""; tableContent += "<table cellspacing='0' cellpadding='0' width='100%' id='tblSalesAndActivity' class='data display datatable' >"; tableContent += "<thead>"; tableContent += "<tr style='display: none;' id='tblTr'>"; tableContent += "<th style='display:none;width: 15%'>User Name</th>"; tableContent += "<th style='display:none;width: 15%'>Employee Name</th>"; tableContent += "<th style='display:none;width: 15%'>Division Name</th>"; tableContent += "<th style='display:none;width: 15%'>Date of Joining</th>"; tableContent += "<th style='display:none;width: 15%'>Manager Name</th>"; tableContent += "<th style='display:none;width: 15%'>Manager Territory name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Territory Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Stockist Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Average Monthly Secondary Sales Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>% To Total Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>Secondary Sales Units for the month - (End Month)</th>"; tableContent += "<th style='text-align:left;width: 15%'>Closing Units for the month - (End Month)</th>"; tableContent += "<th style='text-align:left;width: 15%'>No of Days Stock</th>"; tableContent += "</tr>"; tableContent += "<tr>"; tableContent += "<th style='display:none;width: 15%'>User Name</th>"; tableContent += "<th style='display:none;width: 15%'>Employee Name</th>"; tableContent += "<th style='display:none;width: 15%'>Division Name</th>"; tableContent += "<th style='display:none;width: 15%'>Date of Joining</th>"; tableContent += "<th style='display:none;width: 15%'>Manager Name</th>"; tableContent += "<th style='display:none;width: 15%'>Manager Territory name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Territory Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Stockist Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Average Monthly Secondary Sales Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>% To Total Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>Secondary Sales Units for the month - (End Month)</th>"; tableContent += "<th style='text-align:left;width: 15%'>Closing Units for the month - (End Month)</th>"; tableContent += "<th style='text-align:left;width: 15%'>No of Days Stock</th>"; tableContent += "</tr>"; tableContent += "<tr >"; tableContent += "<th colspan= '13' style='text-align:left' width='15%' ><span id='spnDivToggle' style='text-decoration: underline; cursor: pointer; padding: 5px' onclick='fnToggleTreea()'>Show Filter</span></th>"; tableContent += "</tr>"; var type = '[{ type: "text" }, { type: "text" }, { type: "text" },{ type: "text" }, { type: "text" }, { type: "text" }'; type += ',{ type: "text" }, { type: "text" },{ type: "number-range" }'; type += ', { type: "number-range" }, { type: "number-range" }, { type: "number-range" }, { type: "number-range" }]'; tableContent += "</thead><tbody>"; // Summary Value for (var i = 0; i < jsData.Tables[2].Rows.length; i++) { var dJsonDataH = jsonPath(jsData, "$.Tables[0].Rows[?(@.Region_Code=='" + jsData.Tables[2].Rows[i].Region_Code + "')]"); if (dJsonDataH != false) { for (var j = 0; j < dJsonDataH.length; j++) { var dJsonData = jsonPath(jsData, "$.Tables[1].Rows[?(@.Region_Code=='" + jsData.Tables[2].Rows[i].Region_Code + "' & @.Base_Code=='" + dJsonDataH[j].Customer_Code + "')]"); if (dJsonData != false) { for (var k = 0; k < dJsonData.length; k++) { totalsummary = totalsummary + parseInt(dJsonData[k].Sales); } } } } } if (jsData.Tables[2].Rows.length > 0) { for (var i = 0; i < jsData.Tables[2].Rows.length; i++) { var dJsonDataH = jsonPath(jsData, "$.Tables[0].Rows[?(@.Region_Code=='" + jsData.Tables[2].Rows[i].Region_Code + "')]"); if (dJsonDataH != false) { reionTotal = 0; monthSales = 0; isRegionNameBind = true; for (var j = 0; j < dJsonDataH.length; j++) { var dJsonData = jsonPath(jsData, "$.Tables[1].Rows[?(@.Region_Code=='" + jsData.Tables[2].Rows[i].Region_Code + "' & @.Base_Code=='" + dJsonDataH[j].Customer_Code + "')]"); if (dJsonData != false) { for (var k = 0; k < dJsonData.length; k++) { reionTotal += parseInt(dJsonData[k].Sales); } } } for (var j = 0; j < dJsonDataH.length; j++) { sales = 0, close = 0; tableContent += "<tr>"; if (isRegionNameBind) { var dJsonDataDiv = jsonPath(jsData, "$.Tables[3].Rows[?(@.Region_Code=='" + jsData.Tables[2].Rows[i].Region_Code + "')]"); divisionName = ""; if (dJsonDataDiv != false) { for (var index = 0; index < dJsonDataDiv.length; index++) { divisionName += dJsonDataDiv[index].Division_Name + ","; } if (divisionName != "") { divisionName = divisionName.substring(0, divisionName.length - 1); } } tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].User_Name + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].Employee_Name + "</td>"; tableContent += "<td style='display:none'>" + divisionName + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].DOJ + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].Manager_Name + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].Manager_Region_Name + "</td>"; tableContent += "<td align='left' onclick='fnSecondarySalesDetails(\"" + jsData.Tables[2].Rows[i].Region_Code + "_" + jsData.Tables[2].Rows[i].User_Code + "_" + startMonth + "_" + endMonth + "_" + startYear + "_" + endYear + "_" + $("#ddlProductName").val() + "\")' style='text-decoration:underline;cursor:pointer'>" + jsData.Tables[2].Rows[i].Region_Name + "</td>"; } else { tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].User_Name + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].Employee_Name + "</td>"; tableContent += "<td style='display:none'>" + divisionName + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].DOJ + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].Manager_Name + "</td>"; tableContent += "<td style='display:none'>" + jsData.Tables[2].Rows[i].Manager_Region_Name + "</td>"; tableContent += "<td style='text-align:left'></td>"; } tableContent += "<td align='left' >" + dJsonDataH[j].Customer_Name + "</td>"; isRegionNameBind = false; var dJsonData = jsonPath(jsData, "$.Tables[1].Rows[?(@.Region_Code=='" + jsData.Tables[2].Rows[i].Region_Code + "' & @.Base_Code=='" + dJsonDataH[j].Customer_Code + "')]"); if (dJsonData != false) { for (var k = 0; k < dJsonData.length; k++) { sales += parseInt(dJsonData[k].Sales); //monthSales += parseInt(dJsonData[k].Sales); close += parseInt(dJsonData[k].Closing_Stock); } } endMonthSales = 0; EndMonthClosing = 0; var dJson = jsonPath(jsData, "$.Tables[1].Rows[?(@.Month=='" + endMonth + "' & @.Year=='" + endYear + "' & @.Base_Code=='" + dJsonDataH[j].Customer_Code + "' & @.Region_Code=='" + jsData.Tables[2].Rows[i].Region_Code + "')]"); if (dJson != false) { for (var k = 0; k < dJson.length; k++) { endMonthSales += parseInt(dJson[k].Sales); EndMonthClosing += parseInt(dJson[k].Closing_Stock); } } avg = 0.0; if (sales > 0) { avg = (sales / diffMonth); tableContent += "<td style='text-align:center'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center'>0</td>"; } if (avg > 0) { regionAvg = (parseFloat(reionTotal) / parseFloat(diffMonth)); avg = (avg / regionAvg) * 100; tableContent += "<td style='text-align:center'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center'>0</td>"; } salesEndMonth += endMonthSales; closingEndMonth += EndMonthClosing; tableContent += "<td style='text-align:center'>" + endMonthSales + "</td>"; tableContent += "<td style='text-align:center'>" + EndMonthClosing + "</td>"; if (endMonthSales > 0) { avg = ((EndMonthClosing * 30) / endMonthSales); tableContent += "<td style='text-align:center'>" + Math.round(avg * 100) / 100 + "</td></tr>"; } else { tableContent += "<td style='text-align:center'>0</td>"; } tableContent += "</tr>" } tableContent += "<tr>" tableContent += "<td style='display:none'></td>"; tableContent += "<td style='display:none'></td>"; tableContent += "<td style='display:none'></td>"; tableContent += "<td style='display:none'></td>"; tableContent += "<td style='display:none'></td>"; tableContent += "<td style='display:none'></td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;' ></td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;' >" + jsData.Tables[2].Rows[i].Region_Name + " - Total</td>"; var totalAvg = 0; if (totalsummary > 0) { totalAvg = (reionTotal / diffMonth) tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + Math.round(totalAvg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>0</td>"; } if (totalAvg > 0) { regionAvg = (parseFloat(totalsummary) / parseFloat(diffMonth)); var avg = (totalAvg / regionAvg) * 100; tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>0</td>"; } tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + salesEndMonth + "</td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + closingEndMonth + "</td>"; totalClosingEndMonth += closingEndMonth; totalSalesEndMonth += salesEndMonth; if (salesEndMonth > 0) { var avg = ((closingEndMonth * 30) / salesEndMonth); tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>0</td>"; } tableContent += "</tr>"; salesEndMonth = 0; closingEndMonth = 0; } } tableContent += "<tr>" tableContent += "<th style='display:none' ></th>"; tableContent += "<th style='display:none'></th>"; tableContent += "<th style='display:none'></th>"; tableContent += "<th style='display:none'></th>"; tableContent += "<th style='display:none'></th>"; tableContent += "<th style='display:none'></th>"; tableContent += "<th style='text-align:right'></th>"; tableContent += "<th style='text-align:right'>Total :</th>"; if (totalsummary > 0) { var avg = (totalsummary / diffMonth); tableContent += "<th style='text-align:center'>" + Math.round(avg * 100) / 100 + "</th>"; } else { tableContent += "<th style='text-align:center'>0</th>"; } tableContent += "<th style='text-align:center'></th>"; tableContent += "<th style='text-align:center'>" + totalSalesEndMonth + "</th>"; tableContent += "<th style='text-align:center'>" + totalClosingEndMonth + "</th>"; if (totalSalesEndMonth > 0) { var avg = ((totalClosingEndMonth * 30) / totalSalesEndMonth); tableContent += "<th style='text-align:center'>" + Math.round(avg * 100) / 100 + "</th>"; } else { tableContent += "<th style='text-align:center'>0</th>"; } tableContent += "</tr>"; } tableContent += "</tbody>"; tableContent += "</table>"; } $("#divReport").html(tableContent); $("#divPrint").html(tableContent); var jsonType = eval(type); if ($.fn.dataTable) { $('#tblSalesAndActivity').dataTable({ "sPaginationType": "full_numbers", "bSort": false, "bDestroy": true, "sDom": 'T<"clear">lfrtip', "oTableTools": { "sSwfPath": "/Content/ZeroClipboard.swf" } }).columnFilter({ sPlaceHolder: "head:after", aoColumns: jsonType }); }; if (tableContent != "") { $("#divInput").slideUp(); $("#spnInputToggle").html("Show Input"); } fninializePrint("divPrint", "ifrmPrint", "divReport"); HideModalPopup("dvloading"); }, error: function () { fnMsgAlert('info', 'Stockist Wise Under Over Stock', 'Error.'); HideModalPopup("dvloading"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateStock() {\n\t\t\t\t\t\tupdatedStock = selectedProductDetails.stock_quantity - answer.quantity;\n\t\t\t\t\t}", "valueOfStock()\n {\n return this.numberofshare*this.shareprice\n }", "stockValue()\n {\n return this.numOfShares*this.sharePrice;\n }", "'SELL_STOCK' (state...
[ "0.6275521", "0.6199914", "0.6106506", "0.6090026", "0.6038022", "0.60004884", "0.59265095", "0.588524", "0.5851688", "0.57751787", "0.57673883", "0.5728191", "0.5684483", "0.56737494", "0.5670162", "0.5646045", "0.564056", "0.5631596", "0.56203485", "0.560422", "0.56026167",...
0.0
-1
StockistWise UnderOver Stock SS Product Multi Selection
function fnStockistWiseUnderOverStockReport() { var startMonth = fngetMonthNumber($('#txtFromDate').val().split('-')[0]); var endMonth = fngetMonthNumber($('#txtToDate').val().split('-')[0]); var startYear = $('#txtFromDate').val().split('-')[1]; var endYear = $('#txtToDate').val().split('-')[1]; if ($("#txtFromDate").val() == "") { fnMsgAlert('info', 'Stockist Wise Under Over Stock Report', 'Please enter Start month.'); HideModalPopup("dvloading"); return false; } if ($("#txtToDate").val() == "") { fnMsgAlert('info', 'Stockist Wise Under Over Stock Report', 'Please enter End month.'); HideModalPopup("dvloading"); return false; } var days = daysInMonth(endMonth, endYear); var startDate = "", endDate = ""; if (parseInt(startMonth) >= 10) { startDate = startYear + "-" + startMonth + "-01"; } else { startDate = startYear + "-0" + startMonth + "-01"; } endDate = endYear + "-" + endMonth + "-" + days; var dt1 = new Date(startYear + "/" + startMonth + "/01"); var dt2 = new Date(endYear + "/" + endMonth + "/" + days); if (dt1 > dt2) { fnMsgAlert('info', 'Stockist Wise Under Over Stock Report', 'Start Month&Year should be less than End Month&Year.'); HideModalPopup("dvloading"); return false; } if ($("#ddlProductName").val() == "0") { fnMsgAlert('info', 'Stockist Wise Under Over Stock Report', 'Select product.'); HideModalPopup("dvloading"); return false; } $("#MonthName").html('') var DatePeriod = 'Period :' + $('#txtFromDate').val().split('-')[0] + " " + $('#txtFromDate').val().split('-')[1] + " To " + $('#txtToDate').val().split('-')[0] + " " + $('#txtToDate').val().split('-')[1] + ""; $("#MonthName").html(DatePeriod); var productCodes = ""; if ($("#ddlProductName").val() != null) { for (var index = 0; index < $("#ddlProductName").val().length; index++) { productCodes += "'" + $("#ddlProductName").val()[index] + "',"; } } if (productCodes != "") { productCodes = productCodes.substring(0, productCodes.length - 1); } else { fnMsgAlert('info', 'Stockist Wise Under Over Stock Report', 'Select product.'); HideModalPopup("dvloading"); return false; } var diffMonth = monthDiff(startMonth + "/01/" + startYear, endMonth + "/" + days + "/" + endYear); ShowModalPopup("dvloading"); $.ajax({ type: 'POST', url: '../HiDoctor_Reports/ReportsLevelTwo/GetStockistWiseUnderOverStockReport', data: 'regionCode=' + $('#hdnRegionCode').val() + '&sd=' + startDate + '&ed=' + endDate + '&ProductCode=' + productCodes, success: function (response) { jsData = eval('(' + response + ')'); var tableContent = ""; var sales = 0, close = 0, reionTotal = 0, totalsummary = 0, productWiseSales = 0;; var salesEndMonth = 0, closingEndMonth = 0, noOfDaysStock = 0; var totalSalesEndMonth = 0, totalClosingEndMonth = 0, TotalNoOfDaysStock = 0; var endMonthSales = 0, EndMonthClosing = 0, monthSales = 0; var endMonthProductWiseSales = 0, endMonthProClosing = 0; var regionAvg = 0.0, totalAvg = 0.0, avg = 0.0; var isRegionNameBind = true; if (jsData.Tables[0].Rows.length > 0) { tableContent = ""; tableContent += "<table cellspacing='0' cellpadding='0' width='100%' id='tblSalesAndActivity' class='data display datatable' >"; tableContent += "<thead>"; tableContent += "<tr style='display: none;' id='tblTr'>"; tableContent += "<th style='width: 15%'>User Name</th>"; tableContent += "<th style='width: 15%'>Employee Name</th>"; tableContent += "<th style='width: 15%'>Date of Joining</th>"; tableContent += "<th style='width: 15%'>Manager Name</th>"; tableContent += "<th style='width: 15%'>Manager Territory name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Product Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Territory Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Division Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Stockist Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Average Monthly Secondary Sales Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>% To Total Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>Secondary Sales Units for the month - (" + $('#txtToDate').val().split('-')[0] + "-" + $('#txtToDate').val().split('-')[1] + ")</th>"; tableContent += "<th style='text-align:left;width: 15%'>Closing Units for the month - (" + $('#txtToDate').val().split('-')[0] + "-" + $('#txtToDate').val().split('-')[1] + ")</th>"; tableContent += "<th style='text-align:left;width: 15%'>No of Days Stock</th>"; tableContent += "</tr>"; tableContent += "<tr>"; tableContent += "<th style='width: 15%'>User Name</th>"; tableContent += "<th style='width: 15%'>Employee Name</th>"; tableContent += "<th style='width: 15%'>Date of Joining</th>"; tableContent += "<th style='width: 15%'>Manager Name</th>"; tableContent += "<th style='width: 15%'>Manager Territory name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Product Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Territory Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Division Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Stockist Name</th>"; tableContent += "<th style='text-align:left;width: 15%'>Average Monthly Secondary Sales Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>% To Total Units</th>"; tableContent += "<th style='text-align:left;width: 15%'>Secondary Sales Units for the month - (" + $('#txtToDate').val().split('-')[0] + "-" + $('#txtToDate').val().split('-')[1] + " )</th>"; tableContent += "<th style='text-align:left;width: 15%'>Closing Units for the month - (" + $('#txtToDate').val().split('-')[0] + "-" + $('#txtToDate').val().split('-')[1] + ")</th>"; tableContent += "<th style='text-align:left;width: 15%'>No of Days Stock</th>"; tableContent += "</tr>"; tableContent += "<tr >"; tableContent += "<th colspan= '14' style='text-align:left' width='15%' ><span id='spnDivToggle' style='text-decoration: underline; cursor: pointer; padding: 5px' onclick='fnToggleTreea()'>Show Filter</span></th>"; tableContent += "</tr>"; var type = '[{ type: "text" }, { type: "text" }, { type: "text" },{ type: "text" }, { type: "text" }, { type: "text" }'; type += ',{ type: "text" }, { type: "text" },{ type: "number-range" }'; type += ', { type: "number-range" }, { type: "number-range" }, { type: "number-range" }, { type: "number-range" }]'; tableContent += "</thead><tbody>"; // Summary Value for (var i = 0; i < jsData.Tables[3].Rows.length; i++) { var dJsonDataH = jsonPath(jsData, "$.Tables[1].Rows[?(@.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "')]"); if (dJsonDataH != false) { for (var j = 0; j < dJsonDataH.length; j++) { var dJsonData = jsonPath(jsData, "$.Tables[2].Rows[?(@.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "' & @.Base_Code=='" + dJsonDataH[j].Customer_Code + "')]"); if (dJsonData != false) { for (var k = 0; k < dJsonData.length; k++) { totalsummary = totalsummary + parseInt(dJsonData[k].Sales); } } } } } if (jsData.Tables[3].Rows.length > 0) { for (var i = 0; i < jsData.Tables[3].Rows.length; i++) { var dJsonDataH = jsonPath(jsData, "$.Tables[1].Rows[?(@.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "')]"); if (dJsonDataH != false) { reionTotal = 0; monthSales = 0; for (var j = 0; j < dJsonDataH.length; j++) { var dJsonData = jsonPath(jsData, "$.Tables[2].Rows[?(@.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "' & @.Base_Code=='" + dJsonDataH[j].Customer_Code + "')]"); if (dJsonData != false) { for (var k = 0; k < dJsonData.length; k++) { reionTotal += parseInt(dJsonData[k].Sales); } } } for (var j = 0; j < jsData.Tables[0].Rows.length; j++) { isRegionNameBind = true; productWiseSales = 0; var dJsonDataPro = jsonPath(jsData, "$.Tables[2].Rows[?(@.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "' & @.Product_Code=='" + jsData.Tables[0].Rows[j].Product_Code + "')]"); if (dJsonDataPro != false) { for (var l = 0; l < dJsonDataPro.length; l++) { productWiseSales += parseInt(dJsonDataPro[l].Sales); } } for (var k = 0; k < dJsonDataH.length; k++) { tableContent += "<tr>"; sales = 0.0; close = 0.0; if (isRegionNameBind) { var dJsonDataDiv = jsonPath(jsData, "$.Tables[4].Rows[?(@.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "')]"); divisionName = ""; if (dJsonDataDiv != false) { for (var index = 0; index < dJsonDataDiv.length; index++) { divisionName += dJsonDataDiv[index].Division_Name + ","; } if (divisionName != "") { divisionName = divisionName.substring(0, divisionName.length - 1); } } tableContent += "<td>" + jsData.Tables[3].Rows[i].User_Name + "</td>"; tableContent += "<td>" + jsData.Tables[3].Rows[i].Employee_Name + "</td>"; tableContent += "<td>" + jsData.Tables[3].Rows[i].DOJ + "</td>"; tableContent += "<td>" + jsData.Tables[3].Rows[i].Manager_Name + "</td>"; tableContent += "<td>" + jsData.Tables[3].Rows[i].Manager_Region_Name + "</td>"; tableContent += "<td style='text-align:left'>" + jsData.Tables[0].Rows[j].Product_Name + "</td>"; tableContent += "<td align='left' onclick='fnSecondarySalesDetails(\"" + jsData.Tables[3].Rows[i].Region_Code + "_" + jsData.Tables[3].Rows[i].User_Code + "_" + startMonth + "_" + endMonth + "_" + startYear + "_" + endYear + "_" + jsData.Tables[0].Rows[j].Product_Code + "\")' style='text-decoration:underline;cursor:pointer'>" + jsData.Tables[3].Rows[i].Region_Name + "</td>"; tableContent += "<td style='text-align:left'>" + divisionName + "</td>"; } else { tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td style='text-align:left'></td>"; tableContent += "<td style='text-align:left'></td>"; tableContent += "<td style='text-align:left'></td>"; } tableContent += "<td align='left' >" + dJsonDataH[k].Customer_Name + "</td>"; var dJsonData = jsonPath(jsData, "$.Tables[2].Rows[?(@.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "' & @.Base_Code=='" + dJsonDataH[k].Customer_Code + "' & @.Product_Code=='" + jsData.Tables[0].Rows[j].Product_Code + "')]"); if (dJsonData != false) { for (var index = 0; index < dJsonData.length; index++) { sales += parseInt(dJsonData[index].Sales); close += parseInt(dJsonData[index].Closing_Stock); } } endMonthSales = 0; EndMonthClosing = 0; var dJson = jsonPath(jsData, "$.Tables[2].Rows[?(@.Month=='" + endMonth + "' & @.Year=='" + endYear + "' & @.Base_Code=='" + dJsonDataH[k].Customer_Code + "' & @.Region_Code=='" + jsData.Tables[3].Rows[i].Region_Code + "' & @.Product_Code=='" + jsData.Tables[0].Rows[j].Product_Code + "')]"); if (dJson != false) { for (var index = 0; index < dJson.length; index++) { endMonthSales += parseInt(dJson[index].Sales); EndMonthClosing += parseInt(dJson[index].Closing_Stock); } } avg = 0.0; if (sales > 0) { avg = (sales / diffMonth); tableContent += "<td style='text-align:center'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center'>0</td>"; } if (avg > 0) { regionAvg = (parseFloat(productWiseSales) / parseFloat(diffMonth)); avg = (avg / regionAvg) * 100; tableContent += "<td style='text-align:center'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center'>0</td>"; } salesEndMonth += endMonthSales; closingEndMonth += EndMonthClosing; endMonthProductWiseSales += endMonthSales; endMonthProClosing += EndMonthClosing; tableContent += "<td style='text-align:center'>" + endMonthSales + "</td>"; tableContent += "<td style='text-align:center'>" + EndMonthClosing + "</td>"; if (endMonthSales > 0) { avg = ((EndMonthClosing * 30) / endMonthSales); tableContent += "<td style='text-align:center'>" + Math.round(avg * 100) / 100 + "</td></tr>"; } else { tableContent += "<td style='text-align:center'>0</td>"; } tableContent += "</tr>" isRegionNameBind = false; } // Product Wise tableContent += "<tr>" tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td style='text-align:center;background-color:#D6D8D9;' ></td>"; tableContent += "<td style='text-align:center;background-color:#D6D8D9;'></td>"; tableContent += "<td style='text-align:center;background-color:#D6D8D9;' >" + jsData.Tables[3].Rows[i].Region_Name + " - Total</td>"; tableContent += "<td style='text-align:left;background-color:#D6D8D9;'>(" + jsData.Tables[0].Rows[j].Product_Name + ")</td>"; var totalAvg = 0; if (reionTotal > 0) { totalAvg = (productWiseSales / diffMonth) tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>" + Math.round(totalAvg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>0</td>"; } if (totalAvg > 0) { regionAvg = (parseFloat(reionTotal) / parseFloat(diffMonth)); var avg = (totalAvg / regionAvg) * 100; tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>0</td>"; } tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>" + endMonthProductWiseSales + "</td>"; tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>" + endMonthProClosing + "</td>"; if (endMonthProductWiseSales > 0) { var avg = ((endMonthProClosing * 30) / endMonthProductWiseSales); tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#D6D8D9;'>0</td>"; } tableContent += "</tr>"; endMonthProductWiseSales = 0; endMonthProClosing = 0; } tableContent += "<tr>" tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td></td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;' ></td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;'></td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;' >" + jsData.Tables[3].Rows[i].Region_Name + " - Total</td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;'></td>"; var totalAvg = 0; if (totalsummary > 0) { totalAvg = (reionTotal / diffMonth) tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + Math.round(totalAvg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>0</td>"; } if (totalAvg > 0) { regionAvg = (parseFloat(totalsummary) / parseFloat(diffMonth)); var avg = (totalAvg / regionAvg) * 100; tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>0</td>"; } tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + salesEndMonth + "</td>"; tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + closingEndMonth + "</td>"; totalClosingEndMonth += closingEndMonth; totalSalesEndMonth += salesEndMonth; if (salesEndMonth > 0) { var avg = ((closingEndMonth * 30) / salesEndMonth); tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>" + Math.round(avg * 100) / 100 + "</td>"; } else { tableContent += "<td style='text-align:center;background-color:#C0C0C0;'>0</td>"; } tableContent += "</tr>"; salesEndMonth = 0; closingEndMonth = 0; } } tableContent += "<tr>" tableContent += "<th ></th>"; tableContent += "<th ></th>"; tableContent += "<th ></th>"; tableContent += "<th></th>"; tableContent += "<th ></th>"; tableContent += "<th style='text-align:right'></th>"; tableContent += "<th style='text-align:right'></th>"; tableContent += "<th style='text-align:right'></th>"; tableContent += "<th style='text-align:right'>Total :</th>"; if (totalsummary > 0) { var avg = (totalsummary / diffMonth); tableContent += "<th style='text-align:center'>" + Math.round(avg * 100) / 100 + "</th>"; } else { tableContent += "<th style='text-align:center'>0</th>"; } tableContent += "<th style='text-align:center'></th>"; tableContent += "<th style='text-align:center'>" + totalSalesEndMonth + "</th>"; tableContent += "<th style='text-align:center'>" + totalClosingEndMonth + "</th>"; if (totalSalesEndMonth > 0) { var avg = ((totalClosingEndMonth * 30) / totalSalesEndMonth); tableContent += "<th style='text-align:center'>" + Math.round(avg * 100) / 100 + "</th>"; } else { tableContent += "<th style='text-align:center'>0</th>"; } tableContent += "</tr>"; } tableContent += "</tbody>"; tableContent += "<tbody><tfoot>"; tableContent += "<tr>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th>Total</th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "<th></th>"; tableContent += "</tr>"; tableContent += "</tfoot>"; tableContent += "</tbody>"; tableContent += "</table>"; } $("#divReport").html(tableContent); $("#divPrint").html(DatePeriod + tableContent); var jsonType = eval(type); if ($.fn.dataTable) { $('#tblSalesAndActivity').dataTable({ "sPaginationType": "full_numbers", "fnFooterCallback": function (nRow, aaData, iStart, iEnd, aiDisplay) { var averageMonthly = 0; var toTotalUnits = 0; var startmonth = 0; var endmonth = 0; var no = 0; var totalaverageMonthly = 0; var totaltoTotalUnits = 0; var totalstartmonth = 0; var totalendmonth = 0; var totalno = 0; for (var i = 0; i < aaData.length; i++) { //averageMonthly += parseFloat(aaData[i][4].replace(',', '')); toTotalUnits += parseFloat(aaData[i][5].replace(',', '')); startmonth += parseFloat(aaData[i][11].replace(',', '')); endmonth += parseFloat(aaData[aiDisplay[i]][12].replace(',', '')); no += parseFloat(aaData[aiDisplay[i]][13].replace(',', '')); } var pageTotal_costs = 0; var pageTotal_count = 0; for (var i = iStart; i < iEnd; i++) { // totalaverageMonthly += parseFloat(aaData[aiDisplay[i]][4].replace(',', '')); totaltoTotalUnits += parseFloat(aaData[aiDisplay[i]][5].replace(',', '')); totalstartmonth += parseFloat(aaData[aiDisplay[i]][11].replace(',', '')); totalendmonth += parseFloat(aaData[aiDisplay[i]][12].replace(',', '')); totalno += parseFloat(aaData[aiDisplay[i]][13].replace(',', '')); } var ncell = nRow.getElementsByTagName('th'); //var nCells = nRow.getElementsByTagName('th'); // ncell[4].innerHTML = addCommas(totalaverageMonthly.toFixed(2)) + '<br/>(' + addCommas(averageMonthly.toFixed(2)) + ')'; // ncell[5].innerHTML = '' + addCommas(totaltoTotalUnits.toFixed(2)) + '<br/>(' + addCommas(toTotalUnits.toFixed(2)) + ')'; ncell[11].innerHTML = '' + addCommas(totalstartmonth.toFixed(2)) + '<br/>(' + addCommas(startmonth.toFixed(2)) + ')'; ncell[12].innerHTML = '' + addCommas(totalendmonth.toFixed(2)) + '<br/>(' + addCommas(endmonth.toFixed(2)) + ')'; ncell[13].innerHTML = '' + addCommas(totalno.toFixed(2)) + '<br/>(' + addCommas(no.toFixed(2)) + ')'; }, "bSort": false, "bDestroy": true, "sDom": 'T<"clear">lfrtip', "oTableTools": { "sSwfPath": "/Content/ZeroClipboard.swf" } }).columnFilter({ sPlaceHolder: "head:after", aoColumns: jsonType }); }; $('#dvPrint').remove(); fninializePrint("divPrint", "ifrmPrint", "divReport"); if (tableContent != "") { $("#divInput").slideUp(); $("#spnInputToggle").html("Show Input"); } HideModalPopup("dvloading"); }, error: function () { fnMsgAlert('info', 'Stockist Wise Under Over Stock Report', 'Error.'); HideModalPopup("dvloading"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateStock() {\n\t\t\t\t\t\tupdatedStock = selectedProductDetails.stock_quantity - answer.quantity;\n\t\t\t\t\t}", "function addStock() {\n // USE querySelectorAll()\n var selected = getSelectedRowBoxes();\n \n for (var i = 0; i < selected.length; i++) {\n var status = selected[i].paren...
[ "0.6156648", "0.59130824", "0.58810306", "0.58352894", "0.5791139", "0.57092667", "0.569306", "0.567611", "0.5468476", "0.5462791", "0.5445787", "0.5444624", "0.5438683", "0.5436604", "0.5427043", "0.54136425", "0.54094", "0.5404308", "0.53978354", "0.538168", "0.5357939", ...
0.0
-1
Stargaze Button Click: Open thing, call API (eventually)
function getSGReport(lat, lng){ //https://stargazr-5l7reasoza-uc.a.run.app/?lat_selected=37.75&lng_selected=-122.45 var lat = coords.lat var lng = coords.lng console.log("report at ", lat,lng) sidebar.open('data'); const callEndpoint = async () => { console.log("hey", lat, lng) const response = await fetch(STARGAZR_PROD_ENDPOINT+'?lat_selected='+lat+'&lng_selected='+lng); const response_json = await response.json(); //extract JSON from the http response console.log(response_json) displayData(response_json) // $("#stargaze-conditions").text(response_json) } callEndpoint() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function openSidecar() {\n\tdocument.getElementsByClassName('gitter-open-chat-button')[0].click();\n}", "function clickHappy() {\n window.open(\"serotonine.html\", \"_self\");\n}", "function quickSearchButton_click() {\n //Begin Search Animation\n var $quickSearchResultsListWrapper = $(\"#QuickS...
[ "0.6252752", "0.62203145", "0.62004375", "0.61823237", "0.6119333", "0.6116048", "0.611182", "0.6056714", "0.60427785", "0.60306084", "0.60246575", "0.6019932", "0.6011468", "0.59940505", "0.5964392", "0.5926589", "0.5915833", "0.59109527", "0.5881289", "0.5881289", "0.587773...
0.0
-1
Funzioni per generare numeri random e inserirli in un Array
function rndNumGen(minNum, maxNum) { var rndNum = parseInt((Math.random() * maxNum) + minNum) return rndNum }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CreateLottoValues() {\n for (var i=0; i<randomArray.length; i++) {\n randomArray[i] = array[Math.floor(Math.random() * array.length)]; \n }\n}", "function creaNumeroRandom(array){\n var numero = Math.round(Math.random()*(array.length-1));\n return numero;\n }", "function ran...
[ "0.76776683", "0.765673", "0.76102173", "0.74387664", "0.7307626", "0.72218585", "0.7201954", "0.71847117", "0.7146856", "0.71466297", "0.71260846", "0.70743406", "0.7071478", "0.7066091", "0.70407516", "0.70262", "0.7025843", "0.70238453", "0.7006551", "0.7006138", "0.696755...
0.0
-1
Funzione per mpstrare l'alert
function showNum() { alert("Memorizza questi numeri, hai " + (timeout / 1000) + " secondi: " + rndNumArray.join(" ,")) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "alert(title, message, positiveText){\n alert(title, message, positiveText, () =>{console.log('Possitive Pressed')}, true); \n }", "function __alert($msg) {\r\n __message({type:1, message:$msg, autoclose:3});\r\n}", "alert(title, message, positiveText, positiveOnPress, cancelableFlag){\n A...
[ "0.7618101", "0.761467", "0.74540824", "0.74189574", "0.7416071", "0.73532", "0.7340212", "0.7285451", "0.72660005", "0.72528607", "0.7215831", "0.721515", "0.7211929", "0.71961856", "0.71933305", "0.71932834", "0.71454805", "0.7128469", "0.71102375", "0.71069205", "0.7102604...
0.0
-1