query
stringlengths
9
14.6k
document
stringlengths
8
5.39M
metadata
dict
negatives
listlengths
0
30
negative_scores
listlengths
0
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
stacks and queues / _________________________________________________________________ 3.1 Describe how you could use a single array to implement three stacks _________________________________________________________________
function StacksInSingleArray(){ this.stacksTopIndex = [0,0,0]; this.data = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TripleStack() {\n this._array = [];\n this._lengths=[0, 0, 0];\n}", "function Stack() {\n this.queue1 = [];\n this.queue2 = [];\n}", "function Stack () {\n this.index = 0;\n this.elements = [];\n this.size = function() {\n return this.elements.length;\n };\n this.push = function(item) {\n ...
[ "0.7311114", "0.715496", "0.6816667", "0.67393655", "0.67258054", "0.67002624", "0.6653825", "0.66437507", "0.6627331", "0.65957814", "0.65754735", "0.65540427", "0.6540237", "0.6532985", "0.65271646", "0.65249926", "0.6512283", "0.65016615", "0.64963686", "0.6480274", "0.644...
0.73885435
0
________________________________________________________________pg 118 3.5 Implement a MyQueue class which uses two stacks _________________________________________________________________ Method 1 (By making enQueue operation costly)
function MyQueue1 (){ this.inStack = new Stack(); this.shuffleStack = new Stack(); this.deQueue = function(){ if (this.inStack){ return this.inStack.pop(); } throw new Error("Empty queue."); }; this.enQueue = function(val){ while (this.inStack){ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function MyQueue () {\n this.queue = new Stack();\n\n MyQueue.prototype.enqueue = function(ele) {\n this.queue.array.push(ele);\n }\n\n MyQueue.prototype.dequeue = function() {\n var temp = new Stack();\n while(this.queue.array.length > 0) temp.push(this.queue.array.pop());\n var x = temp.array.pop...
[ "0.8436142", "0.8120191", "0.80825096", "0.75063074", "0.74667627", "0.7340793", "0.71469456", "0.7052712", "0.70276487", "0.69898057", "0.69453484", "0.69393706", "0.6853927", "0.6842905", "0.6817725", "0.6789224", "0.67599815", "0.6739014", "0.66681516", "0.6654006", "0.664...
0.839262
1
TODO: create "addFeedback(element)" method to consolidate "addRelevant()" and "addIrrelevant"
function addFeedback(element, moment_id) { if(momentNotListed(moment_id, element.value)) { if(element.value) { element.value += ", "; } element.value += moment_id; search_button.innerHTML = "update results"; var thumbnails = element.parentNode.getElementsByClassName("thumbnails")[0]; console.log(element...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addFeedback( type, formGroup, icon, text ) {\n removeFeedback( formGroup );\n\n var span = document.createElement( 'span' );\n span.classList.add( 'glyphicon' );\n span.classList.add( 'form-control-feedback' );\n span.classList.add( 'glyphicon-'+icon );\n\n var helpBlock = do...
[ "0.6286543", "0.61186993", "0.6052444", "0.57372564", "0.5670282", "0.54968816", "0.5381628", "0.53597033", "0.5355247", "0.5330188", "0.5262799", "0.522571", "0.52122086", "0.5178993", "0.5114612", "0.5113354", "0.50941616", "0.5075543", "0.5061033", "0.50454205", "0.5037866...
0.65731114
0
interceptor: called in place of form.submit( ) or as a result of submit handler on window (arg: event)
function interceptor(e) { var frm = e ? e.target : this; if (!interceptor_onsubmit(frm)) { return false; } if (intercept_on) { show(frm); return false; } else { HTMLFormElement.prototype.real_submit.apply(frm); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_handleSubmitEvent()\n {\n this.submitForm();\n }", "_submitHandler(ev){\n\t\tev.preventDefault();\n\t\tthis.submitForm();\n\t}", "function submit_original(win) {\n\t\twin.close( );\n\t\tHTMLFormElement.prototype.real_submit.apply(win.form);\n\t}", "function onsubmit (e) {\n e.preventDefault()\n v...
[ "0.7672932", "0.72827476", "0.6849089", "0.68489754", "0.6810475", "0.6736288", "0.6716946", "0.6716946", "0.6712006", "0.6711577", "0.6685102", "0.6669001", "0.66535074", "0.6601986", "0.65938854", "0.6549522", "0.65304565", "0.6504388", "0.6492129", "0.6480001", "0.64585364...
0.7414462
1
cancel submit; just close the Interceptor window
function cancel_submit(win) { win.close( ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cancel() {\n $modalInstance.close(\"cancel\");\n }", "function cancelClicked()\n{\n dwscripts.setCommandReturnValue(\"\");\n window.close();\n}", "function cancelClicked()\n{\n dwscripts.setCommandReturnValue(\"\");\n window.close();\n}", "cancel() {\n this.close();\n ...
[ "0.71385413", "0.71275294", "0.71275294", "0.70956665", "0.6970706", "0.6969345", "0.6967424", "0.69273263", "0.6920148", "0.68825376", "0.6855073", "0.6850994", "0.6829764", "0.6809285", "0.68071747", "0.67913026", "0.67642504", "0.67550296", "0.67444867", "0.6725958", "0.67...
0.8362991
0
style for the interceptor window
function add_window_style( ) { var pi_style_rules = ' \ .post_interceptor { \ margin: 0; padding: 0; \ } \ \ ._ _pi_window { \ background-color: #bfbfff; \ border-color: #000040; \ border-style: solid; \ border-width: 2px; \ /* opacity: .90; */ \ margin: 0px; \ padding: 1px 2px; \ positi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setStyle(){\n\n return {\n margin: this.alertOptions.margin || '',\n top: this.alertOptions.top || '',\n left: this.alertOptions.left || '',\n right: this.alertOptions.right || '',\n bottom: this.alertOptions.bottom || '',\n };\n }", "function redefinirGOOGLE_stylePane(layer)\n ...
[ "0.62038577", "0.6175723", "0.59847003", "0.59451795", "0.5889583", "0.58235765", "0.5781595", "0.5773692", "0.5751927", "0.57395387", "0.57359743", "0.57212585", "0.5690476", "0.5676664", "0.5641027", "0.5637171", "0.5633545", "0.56125796", "0.5610344", "0.5608343", "0.56083...
0.7037678
0
create a constructor function name it SyntaxBird
function SyntaxBird(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Constructor(x) {}", "function Bird() { }", "function Bird() { }", "function ConstructorInvocationStatement() {\n}", "function ninjaConstructor(name) {\n var obj ={};\n obj.name = name;\n obj.cohort = \"\";\n obj.belt = \"Yellow\";\n\n obj.levelUp = function () {\n obj.belt = ...
[ "0.65799534", "0.6566711", "0.6566711", "0.6548403", "0.64998597", "0.6430111", "0.6430111", "0.64079154", "0.6378236", "0.6374447", "0.63667446", "0.6319357", "0.6288678", "0.6284186", "0.6228672", "0.6205826", "0.6205826", "0.6205826", "0.61523753", "0.6146007", "0.61293626...
0.76991916
0
View the next batch of Pokemon
function nextbatch() { setPokebatch(nextPokebatch); setSpriteoffset(spriteoffset + 6); setNofind(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function next() {\n if (Index < games.length - 1) {\n Index++;\n }\n getData(Index);\n}", "function next() {\n console.log('poop');\n index++;\n updateSketch();\n}", "function previous(){\n if (pokedex.count != 0){\n pokedex.index = (pokedex.index - 1 + pokedex.count) % pokedex.count...
[ "0.68192106", "0.63806385", "0.62847745", "0.6106388", "0.60900843", "0.60579765", "0.59785426", "0.59234154", "0.58798003", "0.5875734", "0.585986", "0.5851324", "0.5845423", "0.5843477", "0.5822277", "0.5821071", "0.5816517", "0.57554597", "0.5753542", "0.5751645", "0.57316...
0.7170363
0
the main function: creates a list of packages to operate on, using all registered packages unless the user provides a list.
function tasks(){ let tasks = determineTaskList(args.packages).filter(isRegisteredTask); return tasks; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function main() {\n\tvar fpath;\n\tvar parts;\n\tvar name;\n\tvar opts;\n\tvar pkgs;\n\tvar pkg;\n\tvar i;\n\n\tdebug( 'Searching for packages in %s.', ROOT );\n\topts = {\n\t\t'dir': ROOT,\n\t\t'pattern': '**/package.json'\n\t};\n\tpkgs = findPkgs( opts );\n\tdebug( 'Found %d packages.', pkgs.length );\n\n\tfor (...
[ "0.64374435", "0.5890232", "0.58552706", "0.5730833", "0.56852865", "0.56852865", "0.56012577", "0.557456", "0.5567855", "0.55427307", "0.55144083", "0.5494016", "0.54618305", "0.5440303", "0.5440223", "0.5436694", "0.5434433", "0.5428028", "0.5425753", "0.5404101", "0.539523...
0.5940484
1
go faster when spacebar is down, resume normal speed when spacebar is up
function goFaster() { if(SPACE_BAR_DEPRESSED) { clearInterval(interval); interval = setInterval ( moveSnake, 40 ); //document.getElementById("output").innerHTML += "goFaster"; } SPACE_BAR_SWITCH = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function spacePause(e) {\n if (e.keyCode === 32) {\n pause();\n }\n }", "function onKeyDown(event){\n if(event.key == 'space'){\n pause = !pause;\n }\n}", "function keyUp(e) {\n var keyCode = e.keyCode;\n switch (keyCode) {\n case 37:\n leftKeyDown = false;\n bre...
[ "0.6852683", "0.6550433", "0.65347975", "0.6517468", "0.6508105", "0.6492274", "0.6491194", "0.6458898", "0.6433444", "0.64219177", "0.64013314", "0.6305538", "0.62113476", "0.62043566", "0.61719704", "0.616175", "0.61511743", "0.6143913", "0.6113221", "0.6112312", "0.6102669...
0.7063254
0
Parse graphics instructions Returns a GraphicsInstructions instance
parse() { let gi = new GraphicsInstructions(); this.stmtNum = 1; // statement count for error reporting while (!this.eof()) { let s = this.parseStmt(); // record what graphical operators are attached to the symbol/how much they change the stack gi.addInstruction(s.char, s.operators.map(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseInstruction(data, index, position)\n{\n // Get the instruction at the index passed\n var string = data[index];\n var instruction = string.charAt(0);\n // If the character is lower case then the instruction is\n // relative to the current position\n var relative = !isUpperCase(instru...
[ "0.5338943", "0.52630836", "0.5066707", "0.5046351", "0.5044146", "0.5024873", "0.5018944", "0.4995033", "0.49037093", "0.48478794", "0.48413616", "0.48379844", "0.48202863", "0.47610727", "0.47029072", "0.46805808", "0.46742216", "0.463806", "0.4621615", "0.46152386", "0.459...
0.7159991
0
compute the total stack change of a sequence of operators
totalStackChange(operators) { let total = 0; for (let i = 0; i < operators.length; i++) { total += operators[i].stackChange; } return total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate() {\n // Double press of equals sets stack value to result of calculation.\n if (virtualStack.length>0) {\n updateDisplay('previous', [...stack, '=', ...virtualStack]) // Display full calculation in previous display.\n stack = [...virtualStack] // Finalise calculation with result of calc...
[ "0.60916394", "0.60177636", "0.60000527", "0.5910051", "0.57861024", "0.5762361", "0.5752664", "0.5704581", "0.5657683", "0.56102526", "0.56102526", "0.5563402", "0.55320835", "0.5491358", "0.54520375", "0.54434407", "0.54281944", "0.54281944", "0.5409604", "0.5344281", "0.53...
0.8258775
0
Parse a graphics operator or block of operators Returns a list of closures
parseOperator() { if (this.peek().name == 'block-start') { return this.parseBlock(); } else { return [this.parsePrimOp()]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "parse() {\n let gi = new GraphicsInstructions();\n this.stmtNum = 1; // statement count for error reporting\n\n while (!this.eof()) {\n let s = this.parseStmt();\n\n // record what graphical operators are attached to the symbol/how much they change the stack\n gi.addInstruction(s.char, s.op...
[ "0.69652563", "0.60722053", "0.5916505", "0.5657547", "0.56034034", "0.55809325", "0.5536233", "0.55352664", "0.54585135", "0.5435636", "0.5432861", "0.53983516", "0.539554", "0.5377318", "0.5377318", "0.53667057", "0.5354658", "0.5354658", "0.5354658", "0.5354658", "0.535465...
0.7128049
0
record a char's stack change
addStackChange(char, change) { if (!this.charToStackChange[char]) { this.charToStackChange[char] = change; } else { throw new Error(`Conflicting stack changes for '${char}': ` + `${this.charToStackChange[char]} and ${change}`); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pushCharacter(ch) {\n stack.push(ch);\n}", "clog(str) {\n this.cw(c.ch.storePos);\n\n this.cw(c.ch.resetPos);\n }", "function letterChanges(str) {}", "function letterChanges(str) {}", "function backspace() {\n if (stack.length>0) {\n stack.pop()\n updateDisplay()\n }\n}", "functi...
[ "0.63393575", "0.55915105", "0.54190207", "0.54190207", "0.5332236", "0.5160362", "0.5154364", "0.509064", "0.50676394", "0.5065527", "0.50497633", "0.5038632", "0.50356805", "0.50320715", "0.50149494", "0.5000687", "0.49848214", "0.49714884", "0.49714884", "0.49584895", "0.4...
0.75624
0
Registers an 'elem' (HTML and Local storage), sets elem text to 'msg', and defaults it to 'def'
function registerLocalStorageToggle(elem, msg, def) { // Set defaults if (lsg(elem) == null) { lss(elem, def); } $(elem).text(lsg(elem) == "yes" ? "Hide " + msg : "Show " + msg); // Set the handler $(elem).click(function(e) { // Toggle hiddenGames = lsg(elem) || def; lss(elem, (lsg(elem) == "ye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMessage(element, newMsg)\n{\n PropertiesService.getScriptProperties().setProperties({\n \"msg\":newMsg,\n \"element\":element,\n });\n}", "function newElement( elem ) {\n\n // If the element is part of a form, make sure the placeholder string is\n // not submitted as a value.\n var f...
[ "0.61668485", "0.6048311", "0.6048311", "0.6048311", "0.60326475", "0.5931416", "0.5793411", "0.5774706", "0.57580805", "0.5748527", "0.57451886", "0.57091093", "0.56520784", "0.5646625", "0.5615026", "0.55955523", "0.55792683", "0.55698", "0.5554418", "0.55434656", "0.553711...
0.62780565
0
Gets the diskon penjualan.
function __getDiskon_penjualan(){ var tipe_customer=$('#kd_typecustomer').val() $.getJSON(http+"/spk/diskon/"+tipe_customer,{'k':tipe_customer},function(result){ if(result.length>0){ $.each(result,function(e,d){ $('#diskon').val(parseFloat(d.AMOUNT).toLocaleString()).addClass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get ped() {\n if (!this.computed.ped) {\n this.computed.ped = this.perimeter / Math.PI;\n }\n return this.computed.ped;\n }", "static get cpi() {\n return charactersPerInch(strokeRate, lineSpeed).toFixed(2);\n }", "async getSigningPen() {\n return await Secp256k1Pen.fromMnemonic(awa...
[ "0.55737376", "0.522491", "0.5149091", "0.5124013", "0.5124013", "0.50734395", "0.5045881", "0.5031803", "0.5000081", "0.49938643", "0.49817455", "0.49650693", "0.49417317", "0.49300185", "0.4924907", "0.4905451", "0.49043736", "0.49017596", "0.48957467", "0.48837525", "0.488...
0.5941647
0
Assert fresh state that should exist after init or ADVANCE_ROUND.
function assertFresh (t, state) { t.assert(Array.isArray(state), "State should be an array"); t.equal(state.length, 0, "Length should be 0"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetStateForTest() {\n this.state = SavedAddressStore.initialState();\n }", "initializeState() {}", "test () {\n this.state = State.HalfOpen\n }", "function ensureValidAppState() {}", "function stateContinueFromHere() {\n stateLastGood.set(stateIn);\n tracingFailed = false;\n tracingS...
[ "0.5968", "0.5773559", "0.55026346", "0.54985976", "0.5463913", "0.54583067", "0.5404899", "0.53667665", "0.53091055", "0.5306348", "0.5277053", "0.5276176", "0.52593535", "0.5253084", "0.5243369", "0.52042484", "0.520222", "0.5199672", "0.5198775", "0.51716584", "0.5158095",...
0.6680946
0
Each replay is displayed using the ReactPlayer component
replayItems() { return this.props.replays.map(replay => <List.Item key={replay.id}> <Header as='h2'>Replay: {replay.rname} </Header> <ReactPlayer url={replay.rurl} playing muted controls={true} width='50%' height='50%' /> <DeleteReplay id={replay.id}/> <VoteReplay replay={repl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async replay()\n {\n\n try{\n\n this.view.user = await this.getUser();\n\n // Si l'utilsateur n'est pas connecté on le redirige\n if(!this.view.user){\n return this.redirectTo('/')\n }\n\n const replay = new Replay();\n\n th...
[ "0.6667983", "0.6641436", "0.6632845", "0.65562475", "0.6436288", "0.64036727", "0.6352155", "0.63146985", "0.63076395", "0.6299775", "0.6266029", "0.62311304", "0.6227719", "0.61863387", "0.6182125", "0.61785626", "0.6143434", "0.613459", "0.6134182", "0.61296093", "0.611805...
0.75699645
0
Redirecting to payment page if clicked on Pay Now
function payNow() { window.location.href = 'pay.html'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mypayment() {\n location.href = \"#pay\";\n}", "onPaymentsClick_() {\n Router.getInstance().navigateTo(routes.PAYMENTS);\n }", "function btnPayNow()\n{\n\tif(Amount == 0)\n\t{\n\t\talert(\"The amount is 0. Please wait for the new amount updation.\")\n\t}\n\telse\n\t{\n\t\twindow.location=\"Proj...
[ "0.7347543", "0.72356194", "0.7131847", "0.7128378", "0.7120194", "0.7096152", "0.69412667", "0.69175285", "0.6755446", "0.6697272", "0.6585453", "0.65508884", "0.6530722", "0.6500572", "0.6458563", "0.6434078", "0.6375073", "0.62166923", "0.619729", "0.6171727", "0.6169801",...
0.7926045
0
Redirecting to previous page if clicked on Previous
function previousPage() { window.location.href = 'index.html'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goPrev() {\n window.history.back();\n}", "function goPrev() {\n window.history.back();\n}", "function previousPage() {\n window.history.back();\n}", "previous() {\n const prev = document.referrer;\n if (prev !== ghPagesUrlRedirect(location.origin)) location.assign(prev);\n }", "funct...
[ "0.7593043", "0.75422186", "0.7530941", "0.7477908", "0.74737996", "0.7470553", "0.746545", "0.7380465", "0.7380465", "0.7339894", "0.7315058", "0.72795784", "0.72772366", "0.7276257", "0.72613215", "0.7215616", "0.72146803", "0.7163347", "0.7148704", "0.7111674", "0.7110365"...
0.7762314
0
Handler for all socket events. Calls their appropriate methods. NOTE: Everything is in the scope of the socket.
handleEvents(socket) { socket.on("audio_origin", () => { this.handleOrigin(socket); }); socket.on("audio_join", () => { this.handleJoin(socket); }); socket.on("offer", (id, message) => { this.handleOffer(socket, id, message); }); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function socketConnectionHandler(socket)\n{\n //Listeners within connection\n socket.on('click', socketClickHandler.bind(this, socket));\n socket.on('new', socketNewHandler.bind(this, socket));\n}", "function socketHandler(){\n\treturn function(req, res, next){\n\t\tvar event= req.socketEvent || eventBu...
[ "0.7080356", "0.7034787", "0.70299697", "0.6939169", "0.6912541", "0.6725343", "0.67154944", "0.6655981", "0.6640868", "0.6574241", "0.65658855", "0.65627676", "0.6511637", "0.64972645", "0.64951944", "0.6473347", "0.6473347", "0.647124", "0.646405", "0.64630574", "0.6453499"...
0.73621047
0
An optimized version of getDownloadLinkForHash that checks to see if the image is in the Browser's cache even if the link is no longer valid. If not, attempt to get another blob download ticket from the server.
getImageUrlForHash(hash, cb) { if (typeof document !== 'undefined') { // TODO: long-term persistence if (hash in this._blobUrlCache) { var blob = this._blobUrlCache[hash]; var img = document.createElement('img'); img.onerror = (e) => { this.getDownloadLinkForHash(hash, cb); }; img.onloa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getHash () {\n var hash = window.location.hash.substring(1)\n hash = cleanHash(hash)\n if (hash.length > 0) {\n console.log('New Hash: ' + hash)\n var $holder = $('.holder')\n $holder.css('background', 'no-repeat center url(\"src/css/dashinfinity.gif\")')\n var $instructions = $('.instructi...
[ "0.5954455", "0.5818297", "0.5296112", "0.52534294", "0.5203936", "0.5123224", "0.50688964", "0.50630623", "0.50517935", "0.5046463", "0.50215214", "0.50109005", "0.5004264", "0.48984164", "0.48825735", "0.48789415", "0.48590252", "0.48581517", "0.4857148", "0.48324504", "0.4...
0.6910298
0
Guardar una nueva publicacion
function saveNewPublication(req, res) { var publication = new Publication(); var params = req.body; if (params.text || params.file) { publication.text = params.tex publication.file = null; publication.user = req.user.sub; publication.created_at = moment().unix(); //Fecha de c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "modificarGuardar() {\n let es_valido = this.validarDatos(this.automotor);\n if (es_valido) {\n this.automotores.splice(this.filaAModificar, 1, this.automotor);\n localStorage.setItem(\n \"lista_automotores\",\n JSON.stringify(this.automotores)\n );\n this.lis...
[ "0.5841619", "0.5733997", "0.5687781", "0.56551445", "0.5649357", "0.5597427", "0.55250233", "0.5489021", "0.5481811", "0.54597014", "0.5431129", "0.54207754", "0.5395016", "0.535291", "0.5277501", "0.52533334", "0.52449256", "0.523129", "0.5181627", "0.5168947", "0.5168947",...
0.62398356
0
Get distance between two balls
static getDistance(ball1, ball2) { return Math.sqrt(Math.pow(ball1.x - ball2.x, 2) + Math.pow(ball1.y - ball2.y, 2)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function distance(a,b) {\r\n var dx,dy;\r\n dx=b.x-a.x;\r\n dy=b.y-a.y;\r\n return Math.sqrt( dx*dx + dy*dy );\r\n}", "function distance(a, b){\n\treturn Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));\n}", "function distance(a, b) {\n var dx = a.x - b.x;\n var dy = a.y - b.y;\n return...
[ "0.7119529", "0.7102789", "0.70994943", "0.709351", "0.709351", "0.70924157", "0.707505", "0.70216733", "0.70001614", "0.6972074", "0.6950955", "0.6938026", "0.69171315", "0.6894718", "0.6872814", "0.6856269", "0.67937326", "0.67365444", "0.6698125", "0.667701", "0.66733974",...
0.8410395
0
Model and draw collision between two balls.
static collision(ball1, ball2) { // Getting both intersection points between overlapping circles. const dist = Ball.getDistance(ball1, ball2); const disc = Math.sqrt(2 * (ball1.r * ball1.r + ball2.r * ball2.r) / (dist * dist) - 1) / 2; const x1 = (ball1.x + ball2.x) / 2 + disc * (ball2.y - ball1.y); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Ball() {\n\n this.initialize = function() {\n this.on = true;\n this.vMin = -5;\n this.vMax = -2;\n this.x = random(width + 200, width + 600);\n this.y = random(0, height);\n this.vx = random(this.vMin, this.vMax);\n this.vy = random(-2, 2);\n this.vr = 1;\n this.r = this.vr * ...
[ "0.71311694", "0.70312774", "0.7009042", "0.6995732", "0.68740463", "0.6808185", "0.68030375", "0.6785344", "0.6762537", "0.67302006", "0.66935295", "0.6666648", "0.6666648", "0.66586643", "0.6637943", "0.662306", "0.66116375", "0.6590619", "0.6585824", "0.65779406", "0.65642...
0.7228045
0
Returns a list of credit cards from Stripe. The default credit card to use is also returned.
async function getCreditCards(req, res) { try { const stripeCustomerId = req.user.organization.stripeCustomerId; const customer = await Stripe.getCustomer(stripeCustomerId); const stripeCreditCards = await Stripe.getCreditCards(stripeCustomerId); const creditCards = []; // Return a subset of fiel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getCardList() {\n return fetch(this._baseUrl + '/cards', {\n headers: this._headers\n })\n .then(res => res.ok ? res.json() : Promise.reject('Error! ' + res.statusText))\n }", "function getAllCards() {\n const url = `${process.env.REACT_APP_BACK_ROUTE}/cards/getAllCards`;\n const opt...
[ "0.66575617", "0.6540846", "0.6132792", "0.6120637", "0.60905504", "0.59766465", "0.5965258", "0.5961595", "0.59506255", "0.59506255", "0.5923249", "0.57885677", "0.57836944", "0.5729255", "0.56763786", "0.5633123", "0.5631032", "0.5628999", "0.5570547", "0.5566278", "0.55294...
0.7417589
0
Returns a customer's upcoming invoice
async function getUpcomingInvoice(req, res) { try { const stripeInvoice = await Stripe.getUpcomingInvoice( req.user.organization.stripeCustomerId ); const items = []; for (let item of stripeInvoice.lines.data) { items.push({ description: item.description }); } // Re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@computed get currentInvoice() {\n return this.invoicesList[this.invoiceIndex];\n }", "static async getUpcomingItem () {\n const data = await fetch('https://fortnite-public-api.theapinetwork.com/prod09/upcoming/get')\n .then(res => res.json())\n .catch(() => null)\n if (data === null) t...
[ "0.58734995", "0.5184685", "0.5141092", "0.5122717", "0.5101455", "0.508922", "0.5083586", "0.50211287", "0.5020997", "0.5015705", "0.49936378", "0.49848816", "0.49734914", "0.49607736", "0.49433634", "0.49154466", "0.4904474", "0.48407176", "0.48239955", "0.4821395", "0.4818...
0.75127023
0
Updates a credit card in Stripe. The cardholder name, expiration date can be updated. The payment method can also be set as the default.
async function updateCreditCard(req, res) { try { const stripeCustomerId = req.user.organization.stripeCustomerId; // Set payment method as default if requested if (req.body.setDefaultSource) { Stripe.setDefaultPaymentSource(stripeCustomerId, req.body.id); } const creditCard = await Stripe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "modifyCard(id, field, value, doNotUpdate) {\n\t\t\n\t\tlet oldValue = this.cardData[field];\n\t\tif (!doNotUpdate) this.cardData[field] = value; \n\n\t\treturn this.$http.post(this.cardUrls.modifyCard, {id, field, value})\n\t\t.then((response) => {\n\t\t\tif (response.status !== 200 && !doNotUpdate) {\n\t\t\t\t//T...
[ "0.61333007", "0.5974337", "0.59100527", "0.5802308", "0.57047075", "0.5674418", "0.5666746", "0.5635311", "0.56319505", "0.55924577", "0.54917777", "0.54343027", "0.5384751", "0.5366693", "0.5356762", "0.5224635", "0.5192032", "0.517274", "0.51705056", "0.51629364", "0.51610...
0.74309844
0
the function will loop to find the person siblings and output the results
function getPersonSiblings(person, people) { var zero = 0; var one = 1; var siblingsName; var personParentsArray = person.parents; var siblings = [] for (var i = 0; i < personParentsArray.length; i++) { var temporarySiblings = searchForPersonSiblings(personParentsArray[i], siblings, pers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchForPersonSiblings(personParentsArray, siblings, person, people) {\n var zero = 0;\n var one = 1;\n var personId = person.id;\n var temporarySiblings = people.filter(function(element){\n if(personParentsArray === element.parents[zero] || personParentsArray === element.parents[one])...
[ "0.68968433", "0.68466395", "0.6186287", "0.60317594", "0.5943966", "0.5889132", "0.5884948", "0.5713699", "0.56717277", "0.55960196", "0.5594376", "0.5559022", "0.5548161", "0.54684514", "0.54459", "0.54291064", "0.5416574", "0.5398421", "0.5392192", "0.53742176", "0.5361165...
0.74492675
0
The function will loop to find the person siblings and return the results
function searchForPersonSiblings(personParentsArray, siblings, person, people) { var zero = 0; var one = 1; var personId = person.id; var temporarySiblings = people.filter(function(element){ if(personParentsArray === element.parents[zero] || personParentsArray === element.parents[one]) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPersonSiblings(person, people) {\n var zero = 0;\n var one = 1;\n var siblingsName;\n var personParentsArray = person.parents;\n var siblings = []\n for (var i = 0; i < personParentsArray.length; i++) {\n var temporarySiblings = searchForPersonSiblings(personParentsArray[i], si...
[ "0.76418424", "0.669697", "0.65155214", "0.6056852", "0.5881243", "0.5792743", "0.5745992", "0.5737444", "0.56844354", "0.56425893", "0.56246847", "0.55691445", "0.5529409", "0.55157864", "0.5514722", "0.5512243", "0.5505892", "0.54898214", "0.54705715", "0.5426234", "0.53696...
0.74410796
1
The function will output the person's siblings
function outputPersonSiblings(siblings) { var zero = 0; var siblingsName = ""; if (siblings.length !== zero) { siblingsName = getNames(siblings); } else { siblingsName = "Person doesn't have siblings"; } return siblingsName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPersonSiblings(person, people) {\n var zero = 0;\n var one = 1;\n var siblingsName;\n var personParentsArray = person.parents;\n var siblings = []\n for (var i = 0; i < personParentsArray.length; i++) {\n var temporarySiblings = searchForPersonSiblings(personParentsArray[i], si...
[ "0.7352385", "0.63137656", "0.585755", "0.58046824", "0.57638854", "0.5755584", "0.5754436", "0.5732917", "0.5707959", "0.5690874", "0.5682063", "0.56413037", "0.5614328", "0.5595325", "0.5582852", "0.5582852", "0.5555655", "0.55207515", "0.5514025", "0.5431432", "0.5423209",...
0.7747704
0
The function will test if the person has a sopouse and loop to find the spounse then output the results.
function getPersonCurrentSpouse(person, people) { var isNull = null; var personSpouse = person.currentSpouse; var spouseName = ""; var spouse; if (personSpouse !== isNull) { spouse = people.filter(function(element){ if (personSpouse === element.id) { return true; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSpouse(person){\n for (var i = 0; i < dataObject.length; i++){\n if (person.id == person.currentSpouse){\n return 'This person is married to themself.';\n }\n else if (person.id == dataObject[i].currentSpouse){\n return dataObject[i];\n }\n }\n /...
[ "0.66203713", "0.644962", "0.59374356", "0.5550784", "0.54606485", "0.5440682", "0.54079694", "0.53499645", "0.5346714", "0.52904016", "0.52713245", "0.5265363", "0.52473086", "0.52316195", "0.52203834", "0.520361", "0.5166324", "0.5146572", "0.5144239", "0.5140362", "0.51180...
0.64661574
1
The function will loop to find if the person has any children and output the results
function getPersonChildren(person, people) { var zero = 0; var one = 1; var personId = person.id; var childrenNames = ""; var children = people.filter(function(element){ if (personId === element.parents[zero] || personId === element.parents[one]) { return true; } else { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findChildren(searchResults, people){ //wait on descendents \n let children = people.filter(function(person){\n if(searchResults[0].id === person.parents[0]||searchResults[0].id === person.parents[1]){\n return true;\n }\n else{\n return false;\n }\n });\n return children\n}", "function pri...
[ "0.7452922", "0.6816414", "0.65669835", "0.6429727", "0.62203", "0.6079053", "0.595467", "0.5943821", "0.59129614", "0.5857483", "0.5826303", "0.5778302", "0.5774508", "0.5750109", "0.5667763", "0.5657779", "0.5649006", "0.56350034", "0.5613941", "0.5608253", "0.5608253", "...
0.69492024
1
Formatea un objeto de fecha a DATETIME de SQL
function formatDateToDB(dateObject) { return format(dateObject, "yyyy-MM-dd HH:mm:ss"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sql_datetime(dat)\r\n{\r\n var year = dat.getFullYear();\r\n var mon = dat.getMonth();\r\n mon++; mon = (mon<10)?'0'+mon:mon;\r\n var day = dat.getDate(); day = (day<10)?'0'+day:day;\r\n var hh = dat.getHours(); hh = (hh<10)?'0'+hh:hh;\r\n var mi = d...
[ "0.65711385", "0.61151636", "0.61040497", "0.60526025", "0.599027", "0.5971978", "0.5971978", "0.5954831", "0.58576274", "0.58502644", "0.5846903", "0.57878417", "0.5767144", "0.574031", "0.5735755", "0.5719098", "0.5677207", "0.5675838", "0.56680554", "0.5645333", "0.5644499...
0.6210557
1
Get date for next day
static getNextDay() { let date = new Date(); date.setDate(date.getDate() + 1); let dd = ("0" + (date.getDate())).slice(-2); let mm = ("0" + (date.getMonth() + 1)).slice(-2); let yyyy = date.getFullYear(); date = yyyy + '-' + mm + '-' + dd ; return date; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextDate(){\n date.setDate(date.getDate()+1);\n return thisDate();\n }", "function nextDay(date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1)\n}", "function nextDay(date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);\n}", "fu...
[ "0.8402894", "0.8187375", "0.81865406", "0.80158883", "0.78112954", "0.7782888", "0.75787157", "0.746343", "0.74310684", "0.7319298", "0.7236894", "0.7184215", "0.71709585", "0.70801634", "0.7051157", "0.69862473", "0.6915752", "0.68631256", "0.6794294", "0.67872393", "0.6768...
0.8315946
1
Get number of days until signing deadline
getDaysTillDeadline(selectedDate) { let todayDate = new Date(); let dateInput = new Date(selectedDate); let diffTime = Math.abs(dateInput - todayDate); let expirationInfo = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); return expirationInfo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getElapsedDays() {\r\n const then = new Date(countData.launchDate);\r\n const now = new Date();\r\n return parseInt((now.getTime() - then.getTime()) / 86400000, 10);\r\n}", "function daysUntilNow() {\n var begin = new Date(YEAR_TODAY, 0).getTime();\n var end = Date.now();\n\n return Math....
[ "0.6969938", "0.67017215", "0.6386636", "0.6309003", "0.6293407", "0.6239275", "0.61890125", "0.61720455", "0.61652046", "0.60916466", "0.60763496", "0.6021849", "0.59970576", "0.5923053", "0.5912583", "0.59118927", "0.59051067", "0.58815414", "0.58728486", "0.5867918", "0.57...
0.6784126
1
get window's size and set mainContainer size
function getWindowsSize() { mainWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; mainHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; // set window's size to mainContainer div ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "adjustSize() {\n document.body.style.margin = document.body.style.padding = this.parentC.style.margin = this.parentC.style.padding = \"0px\";\n var winWidth = parseInt(this.width)+30;\n var winHeight = parseInt(this.height)+90;\n\n window.moveTo((parseInt(screen.width)-winWidth)/2, (parseInt(sc...
[ "0.7146251", "0.70799106", "0.70768625", "0.70332736", "0.69720846", "0.69720846", "0.6944789", "0.69091445", "0.6883669", "0.6872275", "0.68714225", "0.6864803", "0.6839825", "0.6808356", "0.68057626", "0.67969704", "0.6767307", "0.6758271", "0.67492664", "0.6740125", "0.673...
0.7565471
0
show the finish screen of given id
async function showIdFinishScreen(id) { hideTitle(); // ? // get finish screen of given id try { var fs = await getFSFromId(id); } catch (error) { // dev // console.error(error); window.alert(translate(problemText)); } // and save it to reuse it when resizing th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showScreen(id) {\n //\n // Remove the active state from all screens. There should only be one...\n let active = document.getElementsByClassName('active');\n for (let screen = 0; screen < active.length; screen++) {\n active[screen].classList.remove('active');\n ...
[ "0.65678954", "0.6317399", "0.62385833", "0.6221201", "0.61414385", "0.60671073", "0.59693885", "0.5909446", "0.59028536", "0.588231", "0.58703434", "0.5855024", "0.5841431", "0.58378804", "0.5770482", "0.57594186", "0.57517326", "0.57314306", "0.57241243", "0.5709386", "0.56...
0.7845262
0
III. Functions for hanlding the needle and the hays 1. Creation
function createNeedle() { // create the DOM component createNeedleDOM($("#mainContainer")); // prepare to record it in the begin screen beginScreen["#needle"] = new HayOrNeedle(); // move it to a random position (TODO : enlever la moitié de sa taille pour que ça soit bien visible) moveNeedleTo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawNeedle(cents) {\n const { ctx, dimensions } = this;\n const { height, width } = dimensions;\n // Draw the needle\n ctx.rotate(degreesToRadians(90 * 2 * cents/100 ));\n ctx.moveTo(0,0);\n ctx.lineTo(0, - (height/2 - 20) );\n ctx.stroke();\n }", "function animateNeedleDrop(needle, circle,...
[ "0.60741216", "0.5892646", "0.5746696", "0.57226396", "0.5679906", "0.5675924", "0.56381094", "0.5605815", "0.5597198", "0.5594595", "0.5575646", "0.55567044", "0.55446416", "0.55286217", "0.547124", "0.5466272", "0.5457438", "0.5439476", "0.5428308", "0.5426986", "0.54259574...
0.6227162
0
to display time nicely from a ms sum
function timeDisplay(time) { var timeList = timeCalculation(time); return timeList["h"] + ":" + timeList["m"] + ":" + timeList["s"] + "." + timeList["ms"]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GiveTimeStringTotal(theMilliseconds) {\r\n var secs = Math.floor(theMilliseconds / 1000);\r\n return \"Total: \"\r\n + Math.floor(secs / 3600) + \" Hours \"\r\n + Math.floor(secs / 60) % 60 + \" Minutes \"\r\n + secs % 60 + \" Seconds \";\r\n}", "function formatMS(time_ms) {\n\n let MS = t...
[ "0.72469175", "0.7211531", "0.71873224", "0.71701086", "0.7115072", "0.70755833", "0.70393085", "0.7035937", "0.70212454", "0.70169437", "0.6997603", "0.6983997", "0.6972527", "0.693396", "0.68934566", "0.6875628", "0.6875179", "0.6874711", "0.68739617", "0.68323135", "0.6829...
0.7548057
0
to identify if touch or mouse event and get pageX and pageY from it
function getPageXY(event) { var type = event.type; var page = { x: 0, y: 0 }; if (type === "touchstart" || type === "touchend" || type === "touchmove" || type === "touchcancel") { page = { x: event.changedTouches[0].pageX, y: event.changedTouches[0].pageY }; } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_getPointerPositionOnPage(event) {\n const scrollPosition = this._getViewportScrollPosition();\n const point = isTouchEvent(event) ?\n // `touches` will be empty for start/end events so we have to fall back to `changedTouches`.\n // Also note that on real devices we're guarantee...
[ "0.7848065", "0.7848065", "0.7848065", "0.7742498", "0.7742498", "0.75332886", "0.74676406", "0.74033135", "0.74029756", "0.7379755", "0.73246616", "0.7322278", "0.73047966", "0.7220129", "0.72201204", "0.72201204", "0.7214232", "0.71923447", "0.71913695", "0.7145506", "0.713...
0.7940795
0
to disable window resizing while playing
function disableResizing() { $(window).resize(function () { getWindowsSize(); if (mainHeight == gameMainHeight && mainWidth == gameMainWidth) { $(".antiresize").hide(); $("#mainContainer").show(); } else { // hide mainContainer $("#mainContaine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resize(){\n\t\t\tif(window.innerWidth <= 650){\n\t\t\t\tif(that.state.player){\n\t\t\t\t\tcanvas.removeEventListener('mousemove', getRightMouse);\n\t\t\t\t\tcanvas.addEventListener('mousemove', getRightMouse);\n\n\t\t\t\t} else {\n\t\t\t\t\tcanvas.removeEventListener('mousemove', getLeftMouse);\t\n\t\t\t\...
[ "0.7083575", "0.68153703", "0.6773156", "0.6749833", "0.67417294", "0.67411464", "0.67164564", "0.67164564", "0.66850764", "0.66850764", "0.66850764", "0.66850764", "0.66850764", "0.66850764", "0.66850764", "0.6669764", "0.6639549", "0.65819865", "0.6569347", "0.65661275", "0...
0.6832454
1
calculate hay number from density and window area
function calculateHayNumber() { var area = mainHeight * mainWidth; return Math.ceil(area * HAY_DENSITY); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_getDensity() {\n\t\tlet density = this.element_count / this.elements.length;\n\t\treturn density;\n\t}", "function surface(A) {\n\n let maxVal= 0;\n let base = 0\n for (let t=0; t<A.length; t++) {\n if (Math.max(...A[t])>maxVal) {\n maxVal = Math.max(...A[t]);\n }\n base...
[ "0.5848676", "0.57905287", "0.56480753", "0.54745626", "0.54692143", "0.5424267", "0.5353955", "0.5353245", "0.5345888", "0.53402656", "0.53276795", "0.5325963", "0.52562886", "0.52542794", "0.52487123", "0.52447546", "0.52013814", "0.5196066", "0.5186694", "0.5151937", "0.51...
0.6095568
0
get2, set2 and saveSlot are helpers for accessing elements over two arrays.
function get2(a, b, index) { return index < a.length ? a[index] : b[index - a.length]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get2(a, b, index)\n{\n\treturn index < a.length\n\t\t? a[index]\n\t\t: b[index - a.length];\n}", "function get2(a, b, index)\n{\n\treturn index < a.length\n\t\t? a[index]\n\t\t: b[index - a.length];\n}", "function get2(a, b, index)\n{\n\treturn index < a.length\n\t\t? a[index]\n\t\t: b[index - a.lengt...
[ "0.57484734", "0.57484734", "0.57484734", "0.57484734", "0.57484734", "0.57484734", "0.57484734", "0.56587505", "0.5636748", "0.56237555", "0.558202", "0.55672354", "0.54876053", "0.54825187", "0.5464391", "0.5432277", "0.54200333", "0.5403752", "0.53976315", "0.5330148", "0....
0.57602936
0
The Element constructor takes an ID of an element and and array of mixin functions. Each element is only retrieved from the DOM when it is first accessed.
function Element(id, mixins) { Object.defineProperty(this, "element", { get: function () { delete this.element; return this.element = document.getElementById(id); }, configurable: true }); for (var i = 0; i < mixins.length; i++) { mixins[i](this);...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(el) {\n super(el);\n\n // Elements\n this.el = el;\n }", "constructor(element) {\n\t\tthis.element = element\n\t}", "function Element(a, b) {\n this.a = a;\n this.b = b;\n}", "constructor(el) {\n this.el = el;\n\n this.init();\n }", "function BaseElement(){}", "function Ele...
[ "0.6799534", "0.6796987", "0.66344905", "0.6497265", "0.6461511", "0.63969046", "0.63491386", "0.63491386", "0.63447344", "0.6302253", "0.62859553", "0.6278274", "0.6278274", "0.62162554", "0.6168866", "0.6164416", "0.61523116", "0.6134975", "0.61330354", "0.61260015", "0.607...
0.7971762
0
The show mixin requires the value for the display CSS property. As such, it is actually a function which returns a mixin.
function show(display) { return function (element) { Object.defineProperty(element, "show", { value: function () { this.element.style.display = display; } }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "show() { this.display = \"block\"; }", "show(val) {\n this._show = val;\n return this;\n }", "get show() {\n return this.hasAttribute('show')\n }", "function show() {\n this.toggle(true);\n}", "show () {}", "show() {\n this._visible = true;\n }", "show() {\n if (this.hasAttr('hidde...
[ "0.64860094", "0.63870734", "0.63446355", "0.63045305", "0.6275743", "0.6249902", "0.624812", "0.6187208", "0.61644846", "0.61580986", "0.6137134", "0.6125095", "0.61091757", "0.610659", "0.60772324", "0.6074522", "0.607302", "0.60551864", "0.59995246", "0.59331554", "0.59243...
0.74071056
0
The fillInner mixin sets the elements width and height to the inner width and height of the client.
function fillInner(element) { Object.defineProperty(element, "fillInner", { value: function () { if (this.element.width !== window.innerWidth || this.element.height !== window.innerHeight) { this.element.width = window.innerWidth; this.elem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function StretchCell(inner, width, height) {\n this.inner = inner;\n this.width = width;\n this.height = height;\n}", "function setInnerStripSize(innerSize){\n\n\t\tif(g_isVertical == false)\n\t\t\tg_objStripInner.width(innerSize);\n\t\telse\n\t\t\tg_objStripInner.height(innerSize);\n\t\t\t\n\t\tg_sizes.strip...
[ "0.56191784", "0.53114027", "0.5105566", "0.5078195", "0.5076953", "0.49744436", "0.49491417", "0.49174023", "0.48865774", "0.48405817", "0.4837796", "0.47990853", "0.47758728", "0.4751954", "0.47370914", "0.4730633", "0.46438813", "0.46253008", "0.4625136", "0.4620237", "0.4...
0.6757926
0
Badge Input: Number of Comments
function updateComments(){ let numberOfComments = 0; for (let index = 0; index < posts.length; index++) { const post = posts[index]; for (let j = 0; j < post['comments'].length; j++) { const element = post['comments']; numberOfComments += 1; } } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "numberCommentsRisk() {\n const commentsNum = this.props.ticket.comments;\n\n if (commentsNum.length >= 3) {\n return 5;\n }\n return 0;\n }", "function updateCommentCounter(){\n\t\tvar commentCounterOriginal = document.getElementsByClassName(\"commentCount\")[0].innerHTML;\n\t\tvar splitString ...
[ "0.69115955", "0.6885814", "0.6450441", "0.643165", "0.642517", "0.6352467", "0.63306785", "0.6304101", "0.61748195", "0.6066681", "0.6060484", "0.60595185", "0.6049355", "0.60049236", "0.59993035", "0.5987003", "0.5986381", "0.59774995", "0.59155834", "0.5901631", "0.5896123...
0.6973619
0
Get an existing Cluster resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
static get(name, id, state, opts) { return new Cluster(name, state, Object.assign(Object.assign({}, opts), { id: id })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getState(id) {\n return id ? state[id] : state;\n }", "static get(name, id, state, opts) {\n return new SshKey(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id, state, opts) {\n return new SshKey(name, state, Object.assign(Object.a...
[ "0.55377865", "0.53176105", "0.53176105", "0.53165346", "0.5257431", "0.52416193", "0.5194664", "0.5123399", "0.50706434", "0.49466825", "0.49053064", "0.48827738", "0.48816204", "0.48697296", "0.48629227", "0.48205736", "0.4779048", "0.47598866", "0.47598866", "0.47413674", ...
0.64982766
1
Returns true if the given object is an instance of Cluster. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Cluster.__pulumiType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isCluster() {\n // Must have more than one node\n return this.clusterNodes && this.clusterNodes.length > 1;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === NetworkAclRule.__pulumiType;...
[ "0.72626877", "0.6131605", "0.60546505", "0.59669966", "0.5962008", "0.59461653", "0.5882034", "0.5881667", "0.5834202", "0.582437", "0.5810962", "0.5801219", "0.5800604", "0.57809615", "0.57809615", "0.5774143", "0.5765418", "0.5757766", "0.5732394", "0.5731409", "0.5692342"...
0.74008
1
Internal: sets `key` to `value` in `result` as needed. Takes arrays into consideration.
function setResult (result, key, value, options) { if (has(options.array, key)) { if (result[key]) { result[key].push(value) } else { result[key] = [value] } } else { delete result[key] result[key] = value } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function keyValueArraySet(keyValueArray, key, value) {\n var index = keyValueArrayIndexOf(keyValueArray, key);\n\n if (index >= 0) {\n // if we found it set it.\n keyValueArray[index | 1] = value;\n } else {\n index = ~index;\n arrayInsert2(keyValueArray, in...
[ "0.64530796", "0.64303136", "0.64254564", "0.6407826", "0.6355295", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.6309121", "0.62996316", "0.61636806", "0.61612326", "0.5927812", "0.5799829...
0.754657
0
function: generateSessionKey info: This function returns a cryptographically secure key for a session. parameters: none returns: string, a cryptographically secure key for a session
function generateSessionKey() { return cryptoRandomString( 32 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createSecKey() {\n let key = \"\";\n for (let i = 0; i < 16; i++) {\n const j = Math.floor(Math.random() * kSecChars.length);\n key += kSecChars[j];\n }\n return btoa(key);\n }", "function generateKey (){\n var key = keygen._({\n length: 16\...
[ "0.7022586", "0.696522", "0.6702862", "0.6702203", "0.66492414", "0.65922403", "0.65377927", "0.6472793", "0.6463159", "0.64219236", "0.6396523", "0.63940346", "0.6385826", "0.63612235", "0.63512266", "0.62278295", "0.61755246", "0.61710966", "0.61582786", "0.615223", "0.6134...
0.807971
0
function: pathFromSessionKey info: this function returns the path to the session file for the key given. parameters: key, string, the session key returns: string, the path to the session file for the key given
function pathFromSessionKey( key ) { return "./session/" + encodeURIComponent( key ) + ".json"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function session_exists( sessionKey )\n{\n if ( sessionKey == undefined )\n {\n return false;\n }\n var sessionFilePath = pathFromSessionKey( sessionKey );\n return ( fs.existsSync( sessionFilePath ) );\n}", "function getFile(key) {\n var dirSvc =\n Components.classes[\"@mozilla.org/...
[ "0.60914606", "0.6067646", "0.5974821", "0.5928014", "0.58777505", "0.5849019", "0.572836", "0.5714384", "0.5695048", "0.5590155", "0.55670214", "0.5565142", "0.54774284", "0.539099", "0.53837216", "0.53803045", "0.53575295", "0.5272743", "0.52364254", "0.52359325", "0.523593...
0.8377148
0
function: session_start info: Creates a session file on the server and returns the session key parameters: none returns: string, the key for the newly created session creates a new session
function session_start() { var sessionKey = generateSessionKey(); var sessionFilePath = pathFromSessionKey( sessionKey ); if ( fs.existsSync( sessionFilePath ) ) { throw new Error( "SESSION ALREADY EXISTS: " + sessionKey ); } fs.writeFileSync( sessionFilePath, "{}" , 'utf-8' ); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateSessionKey()\n{\n return cryptoRandomString( 32 );\n}", "function generateSession() {\n const session = Lemonade.Mirror.generateID() + Lemonade.Mirror.generateID() + Lemonade.Mirror.generateID();\n return session;\n}", "function createSession(name, description, group_id) {\n\t//Call o...
[ "0.64790666", "0.6441036", "0.63219994", "0.6031095", "0.6026804", "0.6014806", "0.60054564", "0.59807247", "0.5967431", "0.5888112", "0.58606786", "0.5722664", "0.5703476", "0.56922644", "0.5672096", "0.5663079", "0.56442016", "0.56268746", "0.56068486", "0.5589911", "0.5573...
0.8211615
0
function: session_exists info: Can be used to check whether a session with the key given is valid. parameters: sessionKey, string, the key identifying a session returns: boolean, true if session with key exists or false otherwise
function session_exists( sessionKey ) { if ( sessionKey == undefined ) { return false; } var sessionFilePath = pathFromSessionKey( sessionKey ); return ( fs.existsSync( sessionFilePath ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "doesGameSessionExist(sessionName) {\n sessionName = sessionName.toLowerCase();\n if (sessionName === undefined) return false;\n return this._gameSessions.has(sessionName);\n }", "sessionExists (sessionId) {\n if (!sessionId) return false; // eslint-disable-line curly\n return sessionId === this.s...
[ "0.72966397", "0.7168865", "0.71220934", "0.6513654", "0.6238877", "0.6184996", "0.6048161", "0.59799206", "0.58723116", "0.58554685", "0.5844982", "0.5842515", "0.5834908", "0.58269894", "0.5825174", "0.57348704", "0.5733144", "0.57238895", "0.5709965", "0.5705628", "0.57056...
0.8502841
0
function: session_write info: Writes the sessionData given to the session file for the session with key given. parameters: sessionKey, string, the key for the session to be updated. sessionData, object, gets converted to json and output to the session file. returns: nothing
function session_write( sessionKey, sessionData ) { var sessionFilePath = pathFromSessionKey( sessionKey ); fs.writeFileSync( sessionFilePath, JSON.stringify( sessionData ), 'utf-8' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveToSessionFile() {\n\tfs.writeFile(dataFile, JSON.stringify(data), function (err) {\n\t\tif (err) {\n\t\t\tconsole.log(\"ERROR: could not save to session.json (\" + err + \")\");\n\t\t}\n\t});\n}", "function SetSessionData (key, value) {\n sessionStorage.setItem(key, value);\n return 'Data Stor...
[ "0.7744378", "0.6419318", "0.59124166", "0.5911014", "0.5888661", "0.5802584", "0.5781355", "0.57324034", "0.57108027", "0.5671418", "0.56343335", "0.5633306", "0.56206053", "0.559301", "0.55838704", "0.55610824", "0.5541", "0.55370927", "0.55227363", "0.5519127", "0.5510812"...
0.88724726
0
function: session_destroy info: this function deletes the file for the session given parameters: sessionKey, string, the key for the session to be destroyed. returns: nothing
function session_destroy( sessionKey ) { var sessionFilePath = pathFromSessionKey( sessionKey ); fs.unlinkSync( sessionFilePath ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dropSession ( session ) {\n}", "removeItem(key) {\n sessionStorage.removeItem(key);\n }", "closeSession( session ) {\n session = {\n authenticated: false\n };\n deleteCookie( this.accessTokenCookieName );\n deleteCookie( this.refreshTokenCookieName );\n...
[ "0.6195358", "0.6022506", "0.5944895", "0.59397805", "0.5897617", "0.5875809", "0.585248", "0.57925665", "0.5735963", "0.5713065", "0.5711434", "0.56773335", "0.5667912", "0.5648164", "0.5581348", "0.55684316", "0.5538385", "0.5517807", "0.5499596", "0.54973465", "0.5462883",...
0.8804203
0
function: session_read info: this function reads the data from the session file belonging to the key given. it then returns the data as an object parameters: sessionKey, string, the key for the session to be read returns: object, the parsed object from the json within the session file
function session_read( sessionKey ) { var sessionFilePath = pathFromSessionKey( sessionKey ); return JSON.parse( fs.readFileSync( sessionFilePath, 'utf-8' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetSessionData (key) {\n return sessionStorage.getItem(key);\n}", "function getSessionData(uuid, cb) {\n const { url } = generateJob('session', {\n id: uuid,\n });\n getData(redis, url, (err, body) => {\n if (err) {\n return cb(err, null);\n }\n const { session } = body;\n cons...
[ "0.6482623", "0.6343987", "0.63223153", "0.62041175", "0.6200688", "0.61598426", "0.6042254", "0.5977085", "0.5933611", "0.58641595", "0.5771102", "0.57417625", "0.57270336", "0.5712774", "0.56925946", "0.56601816", "0.56544226", "0.55626726", "0.55622226", "0.5539205", "0.55...
0.855968
0
Opens the HTML in an Oxygen editor.
function openHTMLInOxygen() { helper.open(window.location.href) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toolsEditor() {\n var features = \"width=800,height=700,status=no,resizeable=yes,\"+\n \"scrollbars=yes\";\n var editorWin = window.open(\"/editor\", IDEVICE_EDITOR, features);\n}", "async function open() {\n let editor = atom.workspace.getActiveTextEditor()\n if (!editor) {\...
[ "0.6565876", "0.6505726", "0.64207596", "0.636472", "0.6274121", "0.6196409", "0.61736876", "0.61232156", "0.6107892", "0.6067676", "0.6040397", "0.6033199", "0.59537387", "0.5947374", "0.59023076", "0.5888408", "0.5881396", "0.5873111", "0.5849131", "0.5824554", "0.5800519",...
0.7969259
0
Adds a new paragraph inside the document by using Oxygen's API.
function addPara() { // Create the fragment. var fragment = "<p>A new paragraph inserted from Javascript.</p>"; // We insert the fragment before the context element. var currentPage = pluginWorkspace.getCurrentEditorAccess(0).getCurrentPage(); var ctrl = currentPage.getDocumentController(); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertParagraph(doc) {\n var session = new DocumentSession(doc);\n var change = session.transaction(function(tx) {\n var body = tx.get('body');\n var id = uuid();\n tx.create({\n id: id,\n type: 'paragraph',\n content: '0123456789'\n });\n body.show(id);\n });\n return ch...
[ "0.7062197", "0.6813341", "0.672947", "0.6558446", "0.65460986", "0.6467719", "0.6461366", "0.6411114", "0.6347412", "0.63469046", "0.6282632", "0.6188357", "0.6184117", "0.6137462", "0.61223173", "0.6117801", "0.6110752", "0.6107576", "0.6101532", "0.60644335", "0.6043364", ...
0.73639876
0
convert postagger flags to simpler partofspeech tags for big huge thesaurus api
function simplifyPos(tag) { if ( tag === 'NN' || tag === 'NNS') { return 'noun'; } else if ( tag === 'VB' || tag === 'VBD' || tag === 'VBG' || tag === 'VBN' || tag === 'VBP' || tag === 'VBZ') { return 'verb'; } else if ( tag === 'JJ' || tag === 'JJR' || tag === 'JJS') { return 'adjective'; } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "tagConvert(tags){\r\n\r\n var formatedTags = []\r\n var i;\r\n for (i = 0; i < tags.length; i++) {\r\n formatedTags.push({id:\"default\", text: tags[i]});\r\n }\r\n return formatedTags;\r\n }", "function PostWebSlotTagging(MSSFDecodeResult, query, matchDataArray) ...
[ "0.5290939", "0.50979173", "0.5053408", "0.50250363", "0.50126225", "0.5002027", "0.496862", "0.49564877", "0.49276823", "0.49106714", "0.4876357", "0.48730826", "0.4859762", "0.4830811", "0.48279768", "0.48245722", "0.4816773", "0.4808166", "0.48019877", "0.47907403", "0.475...
0.512224
1
on success: 1. clear interval 2. return resolved promise
function _success() { clearInterval(interval); resolve(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function launchInterval() {\n console.log('launching interval');\n timerInterval = $interval(function(){\n $scope.expireTasks()\n }, 1000);\n }", "function resetInterval(resp) {\n if (resp.error) {\n console.log(resp.error);\n }\n else {\n console.log('Successfully pushed to S3');\...
[ "0.59173095", "0.5851753", "0.5755021", "0.56693816", "0.56658155", "0.55922735", "0.5517932", "0.5505886", "0.54591507", "0.5408152", "0.54015785", "0.5350697", "0.53362626", "0.52853185", "0.5279472", "0.527241", "0.5255163", "0.52416813", "0.52317274", "0.5225392", "0.5217...
0.75264555
0
on fail: 1. build fail message 2. clear interval 3. return rejected promise with failed message
function _failure(msg) { const fullMsg = logPrefix + ' Failed' + (msg ? ': ' + msg : ''); clearInterval(interval); if (msg && // eslint-disable-next-line @typescript-eslint/quotes (msg.includes("The submitted information didn't contain changes") || ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fail(){\n\t\t\tdeferred.reject();\n\t\t}", "async fail (message) {\n this.log.error(message)\n this.status.error = true\n this.status.message = message\n // wait 1 second for error logging to write to file\n await waitOneSecond()\n await Promise.all([\n this.uploadOtpRunnerLogs(),...
[ "0.618267", "0.60428303", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.58664894", "0.57220036", "0.5666958", "0.5633389", "0.558341", "0.5560448", "0.5554476", "0.5539743", "0.54...
0.62848973
0
Function for filtering publications by year and type
function yearTypeFilter() { if (yearSelection == "All years" && typeSelection == "All types") { var filtered = data; } else if (yearSelection == "All years" && typeSelection !== "All types") { var filtered = data.filter(function(d) { return d.t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterbasedOnBirthyear(data) {\n\n}", "function yearFilter(value) {\r\n return (value.Year == display_year);\r\n}", "function filterByYear (citations, year) {\n return citations.filter (function (citation) { return hasYear (citation, year); });\n}", "function yearFilter(value){\n\treturn (value....
[ "0.72141594", "0.6989343", "0.69790846", "0.6602588", "0.6525458", "0.6409083", "0.63846296", "0.6285122", "0.62417823", "0.5954364", "0.59300125", "0.5911123", "0.5890563", "0.5890563", "0.58499974", "0.581251", "0.5796016", "0.5747186", "0.5722474", "0.5711342", "0.5700286"...
0.77210325
0
Function for filtering publications by keyword
function keywordFilter(keyword) { keywords = [keyword] var filtered = data.filter(function(pub) { return pub.keywords.some(function(tag) { return keywords.includes(tag); }); }); data2 = filtered; previousYear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterArticles(articles, keyword) {\n const filteredArticles = articles.filter(function(article) {\n if (article.text.search(keyword) >= 0 || \n article.author.search(keyword) >= 0)\n return true;\n return false;\n });\n return filteredArticles;\n}", "functio...
[ "0.697598", "0.68196964", "0.66175675", "0.66023755", "0.65930176", "0.63741946", "0.6341186", "0.62329096", "0.618101", "0.6038585", "0.6001614", "0.5968792", "0.594483", "0.592805", "0.5917585", "0.590652", "0.58769995", "0.58727", "0.58157337", "0.58116925", "0.5808158", ...
0.77927285
0
function currentWeather makes open weather api call with whatever valid city name it is passed
function currentWeather(city) { // querry url for open weather api call var queryURL = "https://api.openweathermap.org/data/2.5/weather?q=" + city + "&units=imperial" + "&appid=" + key; // ajax call to the open weather api - fetch(queryURL) may also be used for this pourpose $.ajax({ async: tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getWeather() {\n\tvar city = \"\";\n\tgetCurrentWeatherConditions(city);\n}", "function getCurrentWeather(city) {\n var url = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${appID}`;\n $.ajax({\n url: url,\n method: \"GET\",\n }).then(function (response) {\n ad...
[ "0.7952439", "0.7882107", "0.7855858", "0.7784332", "0.77623314", "0.7757794", "0.7747406", "0.77090245", "0.76771814", "0.76664627", "0.75435495", "0.75191957", "0.7509097", "0.7481038", "0.74516493", "0.74413466", "0.74310255", "0.74289554", "0.742365", "0.7408339", "0.7400...
0.78998035
1
function oneCall creates a new open weather instance to get current weather, and 7 day forecast w/ uv index, and adds the previous call's city name value to the new object structure
function oneCall(r) { // querry url for open weather one-call api - uses lat and lon form previous api call response structure var queryURL = "https://api.openweathermap.org/data/2.5/onecall?" + "&appid=" + key + "&lat=" + r.coord.lat + "&lon=" + r.coord.lon + "&units=imperial&exclude=hourly,minutely"; //...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function callWeather(city){\n var currentWeatherData = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}&units=imperial`);\n var weatherJSON = await currentWeatherData.json();\n \n var lattitude = weatherJSON.coord.lat;\n var longitude = weatherJSON.coord.lon;\n \n ...
[ "0.7073581", "0.6864082", "0.6811212", "0.6763712", "0.65471596", "0.65304404", "0.64677525", "0.64173657", "0.63615954", "0.6255521", "0.6188895", "0.61782646", "0.61758083", "0.6164711", "0.61603266", "0.61055624", "0.6073665", "0.60725373", "0.6061646", "0.60554826", "0.60...
0.74195874
0
function isJSONcity validates if the expression "local storage key value equals city name value (in its corresponding structure)" can be evaluated for each ittertion through localstorage
function isJSONcity(i) { try { // if local storage key value is equal to the city name (in its corresponding structure) is evaluated, then return true JSON.parse(localStorage.getItem(localStorage.key(i))).name == localStorage.key(i); return true; } catch (error) { //...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchSearchedCity() {\n var data = localStorage.getItem(\"searchedCity\");\n if (data) {\n return JSON.parse(data);\n } else {\n return {};\n }\n}", "function validateCity(text) {\n return true;\n }", "function loadSavedCities() {\n var str = localStorage.getItem('cities...
[ "0.60662305", "0.6055473", "0.5986784", "0.5828396", "0.58199626", "0.5756044", "0.5731016", "0.56524205", "0.5635207", "0.5595142", "0.55873734", "0.5577738", "0.556256", "0.55511296", "0.55403787", "0.55363977", "0.5533177", "0.5527054", "0.5491257", "0.5474416", "0.5468796...
0.87086153
0
R2: The ability to update the content (answer text) of an existing Q&A from existing persistent store (QA.json)
updateAnswer(id, newAnswer) { let qaArray = new Array(); fs.readFile('./QA.json', function(err, data) { if (err) { console.log("Failed to open QA file."); } else { console.log("Reading QA.json..."); qaArray = JSO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update_question(){\n\tget_current_question().then((question)=>{\n\t\tset_question(question[\"question\"][\"intitule\"]);\n\t\tset_reponses(question[\"list_reponse\"]);\n\t})\t\n}", "function updateQuiz (tutorial, lesson, data) {\n const lessonId = lesson.formattedId\n const newFileContent = `\n/* esli...
[ "0.6543273", "0.5945897", "0.5928679", "0.5892452", "0.588061", "0.5840307", "0.58004117", "0.57576764", "0.573842", "0.5724303", "0.56585926", "0.55937445", "0.5579516", "0.5576214", "0.5574077", "0.55685514", "0.5554135", "0.55284107", "0.5527807", "0.5526708", "0.5515941",...
0.6165086
1
Rearranges original data from promise so that it zips the 3 arrays into 1
function rearrangeData(data) { let japanese = data[0]; let romaji = data[1]; let english = data[2]; let rearranged = japanese.map(function(e, index) { return [japanese[index], romaji[index], english[index]]; }); return rearranged; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepareData() {\n const pureData = getDataWithTime(whenToTransition)\n const initialStarting = generateInitialStartingPos()\n const detailedData = generateDestinationsDataInitial(initialStarting, pureData, transitionToDuration)\n const transformedData = transformDataStructureForTransitionTo(detailedDa...
[ "0.59853816", "0.57323265", "0.5559495", "0.5552547", "0.554107", "0.55349773", "0.5457874", "0.54577494", "0.5435164", "0.5412179", "0.5381563", "0.53525907", "0.53019404", "0.5276289", "0.5269577", "0.5252395", "0.5244127", "0.52342933", "0.5227192", "0.5212808", "0.5208127...
0.6521019
0
Fills a selected column with tiles and cards attached to a poem
function fillColumn(data, columnNumber) { var col = d3.select(`#col${columnNumber}`); let t = d3.transition().duration(300); let cards = col.selectAll(".card") .data(data) .enter() .append("div") .attr("class", "tile is-child card") .attr("id", (d, i) => i + 25 * columnNumber); let tabs = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateBoard() {\n // make sure board is empty\n $board.empty();\n for (var row = 1; row <= totalRows; row++) {\n for (var col = 1; col <= totalCols; col++) {\n var $tile = createTileTemplate(row, col);\n $board.append($tile);\n }\n }\n}", "setPile(row,co...
[ "0.60400146", "0.60352415", "0.60288614", "0.600622", "0.60060734", "0.56963664", "0.56932855", "0.5622302", "0.5608125", "0.55264366", "0.5507448", "0.5506374", "0.54820114", "0.5479675", "0.5475345", "0.54485476", "0.544736", "0.5446658", "0.54445636", "0.54265577", "0.5419...
0.6956916
0
Helper function to get language option from poemlanguageoption radio buttons Returns a dictionary of options
function getChosenLanguage() { let languageOptions = d3.selectAll(".poem-language-option")._groups[0]; let options = {}; for (let i = 0; i < languageOptions.length; i++) { let el = languageOptions[i]; if (el.checked) { options[el.name] = el.value; } } return options; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchLanguages() {\n for (const key in language) {\n const ELEMENT_CREATE_OPTION = document.createElement('option');\n ELEMENT_CREATE_OPTION.value = key;\n ELEMENT_CREATE_OPTION.text = language[key];\n ELEMENTS.ELEMENT_SELECT_LANGUAGE.appendChild(ELEMENT_CREATE_OPTION);\n ...
[ "0.61734957", "0.6120849", "0.60848135", "0.6084233", "0.6023193", "0.59928703", "0.5986463", "0.5886612", "0.58751553", "0.5824187", "0.5768739", "0.57615733", "0.571524", "0.5711662", "0.56996477", "0.5646338", "0.5518911", "0.5505292", "0.5471694", "0.54554737", "0.5441791...
0.77088785
0
Helper function to get correct type of poem based on the language option chosen Returns the index of poemLanguages that corresponds to the chosen language
function getPoemsByLanguageIndex() { let activeTab = getChosenLanguage()["poem-type"]; return poemLanguages.indexOf(activeTab); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "findLangCode(language){\n // loops through array to identify language - then associates that index with the index in Language Codes array\n for (let i=0; i < this.supportedLanguages.length; i++) {\n if (this.supportedLanguages[i] === language) return this.supportedLanguageCodes[i];\n ...
[ "0.6426682", "0.6099387", "0.5950696", "0.5949884", "0.5785243", "0.5533901", "0.5533901", "0.5504871", "0.5488723", "0.54478747", "0.5424418", "0.5424418", "0.5424418", "0.5424418", "0.5424418", "0.5424418", "0.5424418", "0.5424418", "0.5424418", "0.5424418", "0.5424418", ...
0.7777308
0
logs as 10 / 110 Conditionals Create a function that takes two numbers. If the first number is bigger than the second number, return `"The first number was bigger!"`. If the second number is bigger than the first number, return `"The second number was bigger!"`. If the numbers are the same, return `"The numbers are the...
function greaterThanConditional(num1,num2){ if (num1 > num2){ return "The first number was bigger!" } else if (num1 < num2){ return "The second number was bigger!" } else { return "The numbers are the same!" } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function greaterNum(num1,num2){\n if(num1 > num2){\n console.log(\"The greater number is \" + num1);\n }else if(num2 > num1){\n console.log(\"The greater number is \" + num2);\n }else{\n console.log(\"The numbers are equal\");\n };\n}", "function numberCompare(num1, num2){\n if (num1 === num2){\n ...
[ "0.7982812", "0.79533434", "0.7941325", "0.7910054", "0.78677076", "0.7864397", "0.78607035", "0.7851881", "0.78472877", "0.7744247", "0.77402407", "0.77061135", "0.77049845", "0.7624268", "0.7622183", "0.76168054", "0.76079583", "0.7606654", "0.7505933", "0.746963", "0.74586...
0.8038374
0
return "The numbers are the same!" / 120 Arrays Create a function that takes in an array. Add up the first and last values in the array.
function firstAndLast(array) { return array[0] + array[array.length - 1]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arraySummer(numbers){\n let result = 0;\n\n function sumHelp(i){\n if(i > numbers.length - 1){\n return;\n }\n result += numbers[i];\n sumHelp(i+1);\n }\n sumHelp(0);\n return result;\n}", "function luckyNumbers (array) {\n // your code here\n return array.reduce(function(previou...
[ "0.676457", "0.65846515", "0.6525454", "0.6501818", "0.6480638", "0.64498115", "0.642779", "0.6414945", "0.63086015", "0.6288786", "0.6286282", "0.62710756", "0.6244565", "0.6231838", "0.6223032", "0.6222176", "0.6207001", "0.6205489", "0.6177242", "0.61545485", "0.6145969", ...
0.6614488
1
extend one array with contents of another array only adds items from source array not already present in target array
function extendArray(target, source) { var a = target && target.slice() || []; for (var i = 0, l = source.length; i < l; i++) { if (a.indexOf(source[i]) === -1) { a.push(source[i]); } } return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extend(first, second) {\n for (var i = 0, n = second.length; i < n; ++i) {\n var item = second[i];\n if (item)\n first.push(item);\n }\n }", "function arrayMerge(destination,source){return source;}", "function extend(array1,...
[ "0.7487766", "0.7416262", "0.716479", "0.71611595", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "0.6933266", "...
0.7572198
0
Find all books based on a property genre We could also add functions to find books based on other individual properties.
function findGenre (genre){ return library.filter(function(book){ return book.genre === genre; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMoviesByGenre(movies, genre) {\n return movies.filter(function(movie) {\n return movie.genre.includes(genre); \n });\n}", "getMoviesOfGenre(genre, movies) {\n return movies.filter((movie) => movie.genre.includes(genre));\n }", "searchGenre(genreKey, page) {\n var genreUrl = \"https:...
[ "0.7063827", "0.68914115", "0.65671414", "0.65543824", "0.6482981", "0.6281507", "0.6209381", "0.61298966", "0.587685", "0.5854374", "0.5838909", "0.580944", "0.5808952", "0.5776223", "0.5729021", "0.57153916", "0.5710594", "0.5681986", "0.5672528", "0.5663178", "0.56545824",...
0.7365341
0
Find all books based on a combination of properties genre and author
function findGenreAuthor (genre, author){ return library.filter(function(book) { return (book.genre === genre && book.author === author); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function booksByAuthor(author) {\n let books = []\n\n for(let category of booksByCategory) {\n for(let book of category.books) {\n if(book.author.includes(author)) {\n books.push(book.title)\n }\n }\n }\n\n console.log(`Livros de ${author}: `, books)\n...
[ "0.69655854", "0.6575348", "0.6510633", "0.6502003", "0.6314792", "0.63051367", "0.6237551", "0.6081062", "0.59321797", "0.59139043", "0.5746352", "0.56893647", "0.56732273", "0.56578255", "0.56388843", "0.56388843", "0.5611843", "0.5611023", "0.5575923", "0.5532957", "0.5532...
0.68505853
1
Loads a record into the data store
async loadRecord(record) { throw new Error("Cannot call abstract method. Implement loadRecord in derrived class."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async loadRecord(record) {\n\n if (this.documentsProcessed % 100 === 0) {\n this.logger.debug(`InventoryLoader: Processed ${this.documentsProcessed}, queued: ${this.documentsQueued}, loaded: ${this.totalIndexed}, Skipped: ${this.documentsSkipped}`)\n }\n this.documentsProcessed = th...
[ "0.6577494", "0.6139636", "0.59446603", "0.5893293", "0.58373713", "0.57558876", "0.575216", "0.5721977", "0.5690826", "0.56883293", "0.5630093", "0.56017786", "0.5580128", "0.55719495", "0.55458957", "0.55458957", "0.55400825", "0.5532394", "0.5514809", "0.5497566", "0.54952...
0.6898821
0
This endpoint is where Shopify will request rates / We create a function that takes in a price, and spits out two rates. Standard and express which is 2x standard. You could add variables here for things like currency, location, service code etc
function generateRates(price) { var rates = { "rates": [{ "service_name": "Standard", // Title shown to the customer "description": "Delivered in 5 days", // Description shown to the customer "service_code": "abc1", // Shipping code. Not shown to customer "currency": "A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleRate(req, res) {\n const weight = Number(req.query.weight);\n console.log(weight);\n\n const mailType = req.query.mailType;\n console.log(mailType);\n\n calculateRate(res, weight, mailType);\n}", "getExchangeRates() {\r\n return this.getUnsignedRequestPromise('GET', '/exchange/api/v2/...
[ "0.68100953", "0.68085", "0.6726744", "0.6709344", "0.66780216", "0.6652562", "0.6611733", "0.6555893", "0.65359324", "0.6535563", "0.6534388", "0.6510113", "0.64979905", "0.6473015", "0.6420062", "0.64124906", "0.64113134", "0.6386801", "0.6380532", "0.6378458", "0.63741297"...
0.76283175
0
Returns list item description string for the given entry, according to app settings.
function getEntryDescription(entry) { switch (Qt.kpb.appSettings.entryListDetail) { case 0: // None return ""; case 1: // User name return entry.userName; case 2: // Password return entry.password; case 4: // URL return entry.url; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SiteCatalyst_GetDescriptionById(itemId)\n{\n var description = new String(\"\");\n \n // Loop through the shopping list items.\n for(var index = 0; index < mSiteCatalystShoppingListItems.length; index++)\n {\n // Get the shopping list info.\n var shoppingListItemInfo = mSite...
[ "0.6110477", "0.5819762", "0.5814192", "0.576254", "0.57580006", "0.5656142", "0.56345564", "0.55843246", "0.54941475", "0.5455409", "0.5449255", "0.5390993", "0.5389844", "0.53875303", "0.5369604", "0.5369604", "0.53535956", "0.5337312", "0.52898407", "0.5289747", "0.5265469...
0.7810544
0
Returns localized text describing the given quick unlock type.
function getQuickUnlockTypeDescription(quickUnlockType) { switch (quickUnlockType) { case Settings.QUICK_UNLOCK_FIRST_3: return qsTr("First 3 symbols of the password", "One of the possible values of the Quick Password setting. Will be displayed as 'Quick Password First 3 symbols of the password'"); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getrollmodeString(type){\n let lookup = {\n \"-1\": game.i18n.localize(\"C5ETRAINING.Disadvantage\"),\n \"0\": game.i18n.localize(\"C5ETRAINING.Normal\"),\n \"1\": game.i18n.localize(\"C5ETRAINING.Advantage\")\n }\n return lookup[type] || \"???\";\n }", "function stringForLexemeTy...
[ "0.5645461", "0.5616469", "0.561631", "0.54261", "0.53961116", "0.5207413", "0.51974887", "0.5165924", "0.5128035", "0.5084562", "0.5079289", "0.5078325", "0.507619", "0.5069144", "0.5032608", "0.5004042", "0.4951985", "0.49496606", "0.4943105", "0.49288896", "0.4901363", "...
0.8128257
0
Returns a nice humanreadable file path. Basically, it just cuts off the prefix, such as "/accounts/1000/shared" "/accounts/1000/removable" "/accounts/1000enterprise/shared" "/accounts/1000enterprise/removable"
function prettifyFilePath(path) { return path.split('/').slice(4).join('/'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shortDisplayFilename(fullyQualifiedFilename) {\n\t\texpect(fullyQualifiedFilename, 'String');\n\t\t\n\t\tvar leadingPart = this.instructionPfile.getPath();\n\t\tif (fullyQualifiedFilename.indexOf(leadingPart) == 0)\n\t\t\treturn fullyQualifiedFilename.substr(leadingPart.length + 1);\n\t\t\n\t\twhile (leadingPart.i...
[ "0.6417589", "0.63610315", "0.6353419", "0.62353957", "0.615799", "0.60508895", "0.59951234", "0.5983533", "0.5912914", "0.589039", "0.58694094", "0.5833979", "0.57925797", "0.5744918", "0.57307327", "0.5696115", "0.56593096", "0.56406057", "0.56406057", "0.56355363", "0.5628...
0.6917529
0
Deletes the given entry (with backup) and saves the database.
function deleteEntry(entry) { Qt.kpb.app.restartWatchdog(); entry.moveToBackup(); // also updates timestamps Qt.kpb.database.save(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteEntry(entry) {\n return db.none(`\n DELETE FROM blog_entries\n WHERE id = $1\n `, entry)\n }", "function _deleteEntry() {\n\t\ttry {\n\t\t\t//Get the Request Body\n\t\t\tvar oBody = JSON.parse($.request.body.asString());\n\n\t\t\t//Get the Database connection\n\t\t\tvar oConnection =...
[ "0.66308403", "0.6398533", "0.6339424", "0.6077076", "0.60589486", "0.60365087", "0.6023313", "0.60170746", "0.5915348", "0.5841516", "0.5739153", "0.5650889", "0.5618728", "0.5618404", "0.5605741", "0.5559818", "0.5544701", "0.5509281", "0.55062646", "0.548198", "0.5475265",...
0.74994636
0
Deletes the given group (with backup) and saves the database.
function deleteGroup(group) { Qt.kpb.app.restartWatchdog(); group.moveToBackup(); // also updates timestamps Qt.kpb.database.save(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteGroup (group, callback) {\n Alerts.confirmAlert({\n title: 'Deleting review model ' + group.name,\n text: 'Are you sure that you want to delete the review model. You will lose all the review model and all the annotations done with this review model in all the documents.',\n alertType: Alert...
[ "0.73192835", "0.6817077", "0.6519404", "0.6414144", "0.61490697", "0.6104646", "0.6084299", "0.6081255", "0.60309625", "0.60055053", "0.59687096", "0.55852896", "0.5517282", "0.55046976", "0.5471911", "0.54508984", "0.54453635", "0.54117745", "0.5387869", "0.53618616", "0.53...
0.82462484
0
Performs MultiCopy function, optionally showing info dialog first.
function performMultiCopy(entry, suppressInfo) { if (Qt.kpb.appSettings.multiCopyFirstUse && !suppressInfo) { Qt.kpb.multiCopyInfoDialog.entry = entry; Qt.kpb.multiCopyInfoDialog.show(); } else { Qt.kpb.app.prepareMultiCopy(entry.userName, entry.password); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _continue_multipom_copy()\r\n{\r\n\tcloseMsgBox();\r\n\tvar htmlAreaObj = _getAreaObjByDocView('12702');\r\n\tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n\tsectionName = objAjax.getDivSectionId();\r\n\tvar url = \"copy\";\r\n\t\r\n\tif(objAjax && objHTM...
[ "0.65013075", "0.64999574", "0.6499687", "0.6329818", "0.6309075", "0.6199153", "0.6199153", "0.6026071", "0.6009846", "0.5906013", "0.5893954", "0.5836296", "0.5836296", "0.5767415", "0.5758264", "0.56849235", "0.56836325", "0.5656858", "0.5636365", "0.55896354", "0.5548789"...
0.7846825
0
Checks if all the standard entry fields are empty strings.
function isAllStandardFieldsEmpty(entry) { return (entry.userName.length == 0) && (entry.password.length == 0) && (entry.url.length == 0) && (entry.notes.length == 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function empty(quote, fields) {\n\t\tfor (var i = 0; i < fields.length; i++) {\n\t\t\tvar val = quote[fields[i]];\n\t\t\tif (typeof val != \"undefined\") return false;\n\t\t}\n\t\treturn true;\n\t}", "checkInputs() {\n\t\tfor (let item in this.data) {\n\t\t\tif (this.data[item] == '') {\n\t\t\t\treturn false;\n\...
[ "0.7030762", "0.6909026", "0.6865019", "0.66742766", "0.66605073", "0.66382873", "0.66358423", "0.6606438", "0.6587613", "0.65712935", "0.65439314", "0.64889383", "0.6478583", "0.6478389", "0.6477401", "0.64722", "0.6470048", "0.6467723", "0.64573985", "0.6449221", "0.6408147...
0.8325432
0
Checks if a V4 entry has only extra fields filled
function hasOnlyExtraFields(entryV4) { return (isAllStandardFieldsEmpty(entryV4) && (entryV4.extraSize > 0)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isAllStandardFieldsEmpty(entry) {\n return (entry.userName.length == 0) && \n (entry.password.length == 0) && \n (entry.url.length == 0) && \n (entry.notes.length == 0); \n}", "allFieldsChecked() {\n const { name, author, instructions } = this.state;\n ...
[ "0.63981014", "0.59499466", "0.5875012", "0.58530974", "0.57484436", "0.56917673", "0.5627407", "0.5618375", "0.5598552", "0.5569682", "0.5537973", "0.5535116", "0.5514297", "0.5482522", "0.5475884", "0.5419527", "0.5411783", "0.53947604", "0.53661966", "0.5317979", "0.530043...
0.8373866
0
Create the HeliumCalendar persistence object.
function HeliumCalendar() { "use strict"; this.DEFAULT_VIEWS = ["month", "agendaWeek", "agendaDay", "list"]; this.DONE_TYPING_INTERVAL = 500; this.QTIP_SHOW_INTERVAL = 250; this.QTIP_HIDE_INTERVAL = 500; this.loading_div = null; this.ajax_calls = []; this.last_view = null; this.ed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNewCalendar () {\r\n setCalendar(calendarData);\r\n chrome.storage.local.set({calendar: {date: currentDate.toString(), data: calendarData,\r\n hijriMonths: currentHijriMonths}});\r\n }", "function initStorage() {\n localStorage.setItem('calendarHours', JSON.stringify(calendarHours));\n...
[ "0.62209696", "0.5642641", "0.55864453", "0.55026907", "0.5483261", "0.54814976", "0.547071", "0.5379961", "0.53739566", "0.5359594", "0.530052", "0.52811867", "0.5265304", "0.52591556", "0.52310497", "0.5209762", "0.51462126", "0.5130536", "0.51247996", "0.5071126", "0.50351...
0.58350533
1
destroys time line graph, so we can recreate it
function destroyTimeLine() { var element = document.getElementById("timeLine"); if (element !== null) { element.remove(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetTempGeom() {\r\n var ctx = this.modal_ctx;\r\n\r\n for (var dl of this.drawlines) {\r\n dl.remove();\r\n }\r\n\r\n this.drawlines.length = 0;\r\n }", "function timeLineDestroy() {\n var element = document.getElementById(\"timeLine\");\n if (element !== null) {\n element.remove...
[ "0.6616801", "0.6492067", "0.6451243", "0.6419432", "0.6364102", "0.6323037", "0.6285784", "0.61470044", "0.61378235", "0.61342895", "0.6126912", "0.60857207", "0.6082207", "0.60710317", "0.60256845", "0.60157096", "0.60005015", "0.59890217", "0.5966879", "0.5962326", "0.5949...
0.65581465
1
Escapes values by putting backslashes before line breaks
function escapeValue(value) { return value.replace(/(\r|\n)/g, '\\$1'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function esc(v) { return \"\\\"\" + v.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\") + \"\\\"\"; }", "function esc(v) { return \"\\\"\" + v.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\") + \"\\\"\"; }", "function esc(v) { return \"\\\"\" + v.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/...
[ "0.7219103", "0.7219103", "0.7219103", "0.68818116", "0.6655183", "0.6601859", "0.657112", "0.6542253", "0.6542253", "0.65388197", "0.65388197", "0.65388197", "0.6529374", "0.6529374", "0.65039086", "0.65039086", "0.65039086", "0.65039086", "0.65039086", "0.65039086", "0.6503...
0.8184538
0
Unescapes escaped values by removing backslashes before line breaks
function unescapeValue(value) { return value.replace(/\\(\r|\n)/g, '$1'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unescape(value) {\n var prev = 0\n var index = value.indexOf(backslash)\n var escape = ctx[key]\n var queue = []\n var character\n\n while (index !== -1) {\n queue.push(value.slice(prev, index))\n prev = index + 1\n character = value.charAt(prev)\n\n // If the followi...
[ "0.726481", "0.7066393", "0.7059241", "0.7059241", "0.7059241", "0.7059241", "0.7059241", "0.7059241", "0.69562876", "0.66876537", "0.6273454", "0.62613606", "0.62391436", "0.62153745", "0.60449505", "0.60186315", "0.6010037", "0.5980848", "0.58868176", "0.58459324", "0.57727...
0.7574868
0
This function returns an added text string
function get_added_text(){ var textpart1 = "This project "; var textpart2 = "is almost fun!"; var added_text = textpart1 + textpart2; return added_text; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addText() {\n\tvar text = arguments[0];\n\tvar result = {\n\t\tto: function() {\n\t\t\tvar ta = arguments[0];\n\t\t\tta.value += text;\n\t\t\tta.scrollTop = ta.scrollHeight;\n\t\t}\n\t};\n\treturn result;\n}", "function addText() {\n\tvar text = arguments[0];\n\tvar result = {\n\t\tto: function() {\n\t\...
[ "0.6860522", "0.6860522", "0.6715432", "0.6694259", "0.6656954", "0.659532", "0.65893203", "0.65808505", "0.65649784", "0.650552", "0.64334315", "0.64295065", "0.64229435", "0.6389143", "0.6331005", "0.6325868", "0.63250744", "0.629849", "0.62771153", "0.62558514", "0.6201242...
0.8333408
0
main logic: fetch hashFile + its signature verify signature compare hash with update hash throw if any step fail.
async function verify() { const [hashFile, hashFileSignature, key] = await Promise.all([ getHashFile(), getHashFileSignature(), getNextKey(), ]); await verifyHashFileSignature(hashFile, hashFileSignature, key); await compareHash(hashFile); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function verifyHashFileSignature(hash, sigContent, pubKey) {\n try {\n await sslHelper.verify(hash, sigContent, pubKey);\n } catch (err) {\n try {\n const nextPubKey = await getNextPubKey(pubKey);\n await verifyHashFileSignature(hash, sigContent, nextPubKey);\n } catch (err...
[ "0.6911836", "0.63390565", "0.62811583", "0.6019952", "0.59768367", "0.5975081", "0.58646756", "0.58136183", "0.5712094", "0.5661892", "0.56019545", "0.5545106", "0.5518065", "0.548473", "0.5458789", "0.5449754", "0.5405386", "0.540372", "0.5397391", "0.5388707", "0.5387814",...
0.73648834
0
compute the update hash and compare it to the hash located in hash file
async function compareHash(hashFile) { const computedHash = await computeHash(); const hashFromFile = extractHashFromHashFile(hashFile, filename); if (hashFromFile !== computedHash) { throw new UpdateIncorrectHash(computedHash); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUpdateHash(filename)\r\n{\r\n var stream = getStream(filename);\r\n if (stream)\r\n return getSHA256ForStream(stream);\r\n}", "function computeHash(filename, algo, callback) {\n\t var crypto = __webpack_require__(36);\n\t var fs = __webpack_require__(33);\n\n\t var chksum = cryp...
[ "0.7623364", "0.68597806", "0.67648554", "0.6709586", "0.65679693", "0.6518929", "0.6494842", "0.6449184", "0.63979137", "0.6394778", "0.63395596", "0.6324314", "0.63121253", "0.6303222", "0.6283388", "0.6256018", "0.622266", "0.6155208", "0.6155208", "0.611414", "0.6105975",...
0.7519859
1
fetch the next pubkey based on the previous key fingerprint also fetch signature, and verify against previous pubkey
async function getNextPubKey(pubKey) { const fingerprint = await sslHelper.getFingerprint(pubKey); const nextPubKey = await getNextKey(fingerprint); const nextPubKeySignature = await getNextKeySignature(fingerprint); await sslHelper.verify(nextPubKey, nextPubKeySignature, pubKey); return nextPubKey;...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNextPubKey() {\n schedule = Buffer.from(fs.readFileSync(PUBLIC_KEYPATH + 'pk_schedule')).toString();\n \n if (schedule != \"\") {\n schedule = schedule.split('\\n');\n new_line = schedule[0].split(',');\n\n from = new Date(new_line[0]);\n to = new Date(new_line[1]);...
[ "0.6907773", "0.6401681", "0.61134255", "0.59877425", "0.5787845", "0.57870585", "0.5772071", "0.57653284", "0.57381964", "0.570722", "0.5677012", "0.5662367", "0.56297356", "0.5625649", "0.55954206", "0.55786246", "0.5574596", "0.5574596", "0.5570409", "0.5515992", "0.550683...
0.7553152
0
a hash file looks like: " \n " we only need the hash for the given filename
function extractHashFromHashFile(hashFile, filename) { let hash; hashFile.split("\n").find(r => { const row = r.split(/\s+/); hash = row[1] === filename ? row[0] : ""; return !!hash; }); return hash; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hash_file_name(fname){\n\n}", "function getFileHash(filename) {\n const data = fs.readFileSync(filename, { encoding: 'utf8' });\n const hash = crypto.createHash('md5');\n hash.update(data);\n\n return hash.digest('hex');\n}", "function hashFile(filename, callback) {\n var fd = fs.createReadStre...
[ "0.72866905", "0.70658034", "0.6606574", "0.65686935", "0.64673156", "0.6450464", "0.64447194", "0.6438653", "0.64313674", "0.62715095", "0.6084394", "0.6032465", "0.5997866", "0.5972293", "0.5863376", "0.58380574", "0.5724243", "0.5692683", "0.56317663", "0.562395", "0.55334...
0.7417427
0
service worker and manifest refrence by htmlwebpackplugin
function refrenceByHWP(options, htmlPluginData) { const manifestLink = { tagName: 'link', voidTag: true, attributes: { rel: 'manifest', href: `/${options.manifestFilename}`, }, }; const serviceWorkerScript = { tagName: 'script', voidTag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "registerServiceWorker() {\r\n if (!navigator.serviceWorker) return;\r\n navigator.serviceWorker.register('./sw.js').then(reg => {});\r\n }", "getPrerenderManifest() {\n return nonWebpackRequire_1.default(path_1.join(process.cwd(), this.distDir, 'prerender-manifest.json'));\n }", "fun...
[ "0.6440624", "0.64131075", "0.6375818", "0.6230419", "0.62270105", "0.6174978", "0.6143864", "0.6114516", "0.6031007", "0.60120744", "0.59487885", "0.59408176", "0.5903557", "0.5886591", "0.584923", "0.5806179", "0.5782331", "0.5770419", "0.5762711", "0.57527304", "0.5746252"...
0.7123645
0
creates tick button, task can be marked as done
function tickBtn() { let td = document.createElement("td") let button = document.createElement("button") button.setAttribute("type", "button") button.classList.add("btn", "btn-sm", "tick") let i = document.createElement("i") i.classList.add("fas", "fa-check") button.appendChild(i) butto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createCompletedButton () {\n const button = helper.newDiv(\"id\",\"show-completed\");\n const text = helper.newDiv();\n text.textContent = \"Completed\";\n const caret = helper.newDiv(\"class\",\"caret\");\n const caretIcon = helper.newIcon(\"fas fa-caret-right\");\n caret.appendChild(ca...
[ "0.65823597", "0.6321474", "0.6181478", "0.6097465", "0.60884804", "0.60569775", "0.6045303", "0.59213364", "0.5909675", "0.5896727", "0.58872753", "0.58643514", "0.5842313", "0.5832203", "0.57854414", "0.5774252", "0.5769425", "0.5740048", "0.5714263", "0.57088464", "0.56893...
0.7275197
0
Takes in number of miles and miles per gallon as arguments to calculate the total cost of a commute
function computeCost(miles, mpg) { // Number of gallons of gas needed for commute (round up) const gallons = Math.ceil(miles/mpg); // return cost of commute rounded to 2 decimal places return (gallons * gasPriceAvg).toFixed(2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function perMileOperatingCosts(gasPrice, mpg, maint, tires) {\n return (gasPrice / mpg) + maint + tires;\n }", "function calcMiles(game) {\n\n var oxen = game.oxen;\n var healthPenalty = 0;\n\n var pace = game.pace;\n\n var progress;\n\n // one mile penalty per current ai...
[ "0.6821592", "0.66574305", "0.64248943", "0.63476866", "0.6325988", "0.62922925", "0.62886727", "0.6236103", "0.6096246", "0.6077468", "0.5952975", "0.5951837", "0.59343433", "0.5924972", "0.59098065", "0.59059876", "0.5905093", "0.5898196", "0.58610374", "0.5782953", "0.5779...
0.7582848
0