Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Render a success TwiML and optionally sends notifications To notify via SMS: req.query.notify = sms:4081234567 req.query.notify = 4081234567 To notify via yo: req.query.notify = yo:recipient:apikey
function renderSuccess(req, res, identifier) { var notifyQuery = req.query.notify || ''; var notify = notifyQuery.split(':'); var protocol = notify[0]; var successParams = parseNotify(req, identifier); return res.render('success', successParams); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendNotification() {\n // overrides default that no notifs will show when app is in foregruond\n Notifications.setNotificationHandler({\n handleNotification: async () => ({\n shouldShowAlert: true\n })\n });\n\n N...
[ "0.5794008", "0.5759697", "0.55709374", "0.55594426", "0.55066866", "0.5472384", "0.5464021", "0.54527056", "0.54133725", "0.5389886", "0.5381415", "0.5357388", "0.533699", "0.5305945", "0.5287527", "0.5271591", "0.52711457", "0.52659965", "0.52626544", "0.5260453", "0.522230...
0.6763276
0
Output: the number of valleys traversed constraints: the number of steps will be more than 1 and less than or equal to 10^6 Edge Cases: After going down, when you go back up, the number of valleys increases by one if previous direction is "D" and current direction is "U" increment valleys by one
function countingValleys(steps, path) { // create an altitude variable representing sea level and equal to zero let altitude = 0; // create a previousAlt variable equal to zero let previousAlt = 0; // create a valleys variable let valleys = 0; // iterate over the path string for (let i = 0; i < path.length; i++) { // previousAlt equals altitude let previousAlt = altitude; // if the current value is U increment sea level, if the value is D decrement the value if (path[i] === "U") { altitude++; } else { altitude--; } // if previousAlt < 0 && altitude === 0 then increment valleys if (previousAlt < 0 && altitude === 0) { valleys++; } } // return valleys return valleys; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countingValleys(steps, path) {\n let map = {\n D: -1,\n U: 1,\n };\n let counter = 0;\n let initial = 0;\n let tempArr = [];\n let index = [];\n let result = 0;\n while (counter <= steps) {\n if (initial == 0 && path[counter - 1]) {\n index.push(counter - 1);\n }\n initial += m...
[ "0.6984388", "0.691723", "0.66361725", "0.6502837", "0.64528304", "0.63422596", "0.6294426", "0.6286671", "0.5958027", "0.58783156", "0.58524394", "0.5809789", "0.57957804", "0.57602507", "0.5732075", "0.5691815", "0.5675534", "0.5654533", "0.5646687", "0.5598278", "0.5582963...
0.6450738
5
computations : calculations on store
get isValidLogin() { return !!this.userName && !!this.password }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate(){}", "function maintCalc(dataStore) {}", "function maintCalc(dataStore){\n\n}", "compute() {\n let result;\n let lastnum = parseFloat(this.lastOperand);\n let currnum = parseFloat(this.currOperand);\n if (isNaN(lastnum) || isNaN(currnum)) {\n return;\n }\n switch (t...
[ "0.70780784", "0.6922537", "0.675253", "0.64578205", "0.64027846", "0.6395897", "0.63805926", "0.62794995", "0.6271258", "0.6236262", "0.6226813", "0.6190717", "0.6182904", "0.61458254", "0.61312705", "0.61271846", "0.61223537", "0.61117136", "0.6070157", "0.6038322", "0.5995...
0.0
-1
retunrs to the customer overview state
_cancel(){ this.state.go('customer-overview'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewcustomer(a) {\n $(\".inventorydisp .unactivate\").toggleClass(\"deactivate unactivate\");\n $(\"#customer-list .deactivate\").toggleClass(\"deactivate\");\n /*$(\".customerdisp .unactivate\").toggleClass(\"deactivate\")*/\n $(\"li.actparent\").toggleClass(\"actparent\");\n if ($(\".inve...
[ "0.674723", "0.63421756", "0.63407016", "0.62649995", "0.61854523", "0.59932137", "0.5991928", "0.58703834", "0.5868765", "0.57848847", "0.57763255", "0.57411873", "0.5737792", "0.5700536", "0.5678702", "0.56628174", "0.5587754", "0.5583161", "0.55756086", "0.5559265", "0.555...
0.56434107
16
saves th customer to the localstorage and rettturns customer overview state
_saveCustomer(){ if (Object.keys(this.customer).length === 7) { this.storage.setData('customers', this.customer, this.formState); this._cancel(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getCustomer(){\n return(\n this.formState ?\n this.storage.getItem('customers', this.customerId) : {}\n )\n }", "function CustomerLocal(customer){\n localStorage.clear();\n localStorage.setItem(\"customerId\", parseInt(customer.id));\n localStorage.setItem(\"custom...
[ "0.7025117", "0.6902631", "0.68171936", "0.67184013", "0.66212994", "0.6575759", "0.6474541", "0.64126784", "0.63545185", "0.6304186", "0.62972", "0.6262501", "0.6237662", "0.6190239", "0.6167383", "0.6164728", "0.6147107", "0.61382836", "0.6115855", "0.6076733", "0.6071015",...
0.7455452
0
if formState is true we are editing the customer and gets the data form the local storage. else we are creating new customer.
getCustomer(){ return( this.formState ? this.storage.getItem('customers', this.customerId) : {} ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_saveCustomer(){\n if (Object.keys(this.customer).length === 7) {\n this.storage.setData('customers', this.customer, this.formState);\n this._cancel();\n }\n }", "getCustomerData() {\n const newCustomer = {\n id: $.uuid(),\n name: customerNameIn...
[ "0.73254466", "0.64708704", "0.6376936", "0.6292517", "0.62639695", "0.6226702", "0.622496", "0.6151249", "0.6150682", "0.614703", "0.61087084", "0.6080229", "0.60107684", "0.59823847", "0.5976923", "0.59622717", "0.59557474", "0.5948932", "0.5936509", "0.59264094", "0.591996...
0.7083344
1
NOTE: Remember > devs <3 PropTypes. Built in documentation/guides!
constructor(props) { super(props); this.state = { text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem Loremlorem Lorem ' }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get propTypes() { \n return {\n error: PropTypes.bool,\n title: PropTypes.string,\n stats: PropTypes.number,\n statsSymbol: PropTypes.string,\n footerInfo: PropTypes.object,\n }; \n }", "static get propTypes() {\n return {\n c...
[ "0.7431138", "0.7074378", "0.696054", "0.6659031", "0.64007896", "0.6125638", "0.6125638", "0.6125638", "0.6125638", "0.6125638", "0.6125638", "0.6125638", "0.6125638", "0.6125638", "0.6125638", "0.597449", "0.59094316", "0.59094316", "0.59094316", "0.59094316", "0.59094316",...
0.0
-1
NOTE: 'value' on textarea makes it a Controlled Component NOTE '::' operator is equivalent to a .bind() transferrence of 'this' scope, just use bind for now
render() { return( <div className='container' style={{ marginTop: '50px' }}> <div className='col-lg-8 col-lg-offset-2 form-group'> <textarea value={this.state.text} onChange={this.updateText.bind(this)} className='form-control' style={{ height: '500px', resize: 'none' }}> </textarea> </div> <ReadingTime text={this.state.text} className='col-lg-2 well' /> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleTextInput() {\n this.value = this.control.value;\n }", "handleChangeTextArea(event) {\n this.setState({content: event.target.value});\n }", "addToTextArea(value){\n let field = document.getElementById('formControlTextarea');\n this.insertAtCursor(field, value);\n }", "handleTextAreaVa...
[ "0.7079677", "0.70782715", "0.6841276", "0.66888994", "0.652561", "0.6497197", "0.64825594", "0.647295", "0.6469688", "0.6380233", "0.63799286", "0.63118094", "0.62782794", "0.62708354", "0.62551993", "0.6216273", "0.62078184", "0.6200425", "0.6187997", "0.61474484", "0.61442...
0.0
-1
Create a nonreversible reaction
function notRevStep(substrate, product, enzyme, firstRectMidX, firstRectMidY, ctx, moduleNumber) { //create starting protein ctx.closePath(); ctx.beginPath(); ctx.rect(firstRectMidX - 100, firstRectMidY - 25, 100, 50); ctx.fillStyle = calculateColor(moduleNumber, 1); ctx.fill(); ctx.closePath(); ctx.beginPath(); //create arrow to second protein ctx.moveTo(firstRectMidX, firstRectMidY); ctx.arcTo(firstRectMidX + 50, firstRectMidY, firstRectMidX + 50, firstRectMidY + 50, 50); ctx.arcTo(firstRectMidX + 50, firstRectMidY + 100, firstRectMidX, firstRectMidY + 100, 50); ctx.lineTo(firstRectMidX + 10, firstRectMidY + 90); ctx.moveTo(firstRectMidX + 10, firstRectMidY + 110); ctx.lineTo(firstRectMidX, firstRectMidY + 100); ctx.stroke(); //create second protein ctx.closePath(); ctx.beginPath(); ctx.rect(firstRectMidX - 100, firstRectMidY + 75, 100, 50); ctx.fillStyle = calculateColor(moduleNumber, 0); ctx.fill(); ctx.closePath(); ctx.beginPath(); //create arrow for other substrates (inputs) into the reaction (such as ATP) ctx.moveTo(firstRectMidX + 100, firstRectMidY); ctx.arcTo(firstRectMidX + 50, firstRectMidY, firstRectMidX + 50, firstRectMidY + 50, 50); ctx.arcTo(firstRectMidX + 50, firstRectMidY + 100, firstRectMidX + 100, firstRectMidY + 100, 50); ctx.lineTo(firstRectMidX + 90, firstRectMidY + 90); ctx.moveTo(firstRectMidX + 90, firstRectMidY + 110); ctx.lineTo(firstRectMidX + 100, firstRectMidY + 100); ctx.fillStyle = "black"; ctx.stroke(); //create enzyme at center of reaction ctx.beginPath(); ctx.font = "12px Arial"; var fontMeasures = ctx.measureText(enzyme); var xCoord = firstRectMidX + 45 - (fontMeasures.width / 2); ctx.moveTo(xCoord, firstRectMidY + 50); ctx.bezierCurveTo( xCoord, firstRectMidY + 30, xCoord + fontMeasures.width + 10, firstRectMidY + 30, xCoord + fontMeasures.width + 10, firstRectMidY + 50); ctx.bezierCurveTo( xCoord + fontMeasures.width + 10, firstRectMidY + 70, xCoord, firstRectMidY + 70, xCoord, firstRectMidY + 50); ctx.fillStyle = "white"; ctx.fill(); //Label the proteins(rectangles) and enzyme(oval) ctx.font = "20px Arial"; ctx.fillStyle = "white"; ctx.fillText(substrate, firstRectMidX - 90, firstRectMidY + 5); ctx.fillText(product, firstRectMidX - 90, firstRectMidY + 105); ctx.stroke(); ctx.closePath(); ctx.beginPath(); ctx.fillStyle = "black"; ctx.font = "12px Arial"; ctx.fillText(enzyme, firstRectMidX + 50 - fontMeasures.width / 2, firstRectMidY + 54); ctx.fillText("ATP", firstRectMidX + 110, firstRectMidY + 5); ctx.fillText("ADP", firstRectMidX + 110, firstRectMidY + 105); ctx.stroke(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reactionReverse () {\n direction = -direction; // Stromrichtung umkehren\n reset(); // Ausgangsstellung\n }", "function pattern_7_reaction() {\n return choice([\"OKAY\", \"YEAH\", \"WHAT\"]) + '!';\n}", "get reaction ...
[ "0.6013368", "0.5889261", "0.52746946", "0.5261357", "0.5240431", "0.52135736", "0.51607203", "0.50808424", "0.50796956", "0.5034377", "0.5014683", "0.50125504", "0.49696535", "0.49422157", "0.49413106", "0.49381098", "0.4935085", "0.49172214", "0.49086636", "0.4901203", "0.4...
0.0
-1
create a reversible reaction
function revStep(firstText, secondText, enzyme, firstRectMidX, firstRectMidY, nextX, nextY, ctx, moduleNumber) { //create first protein ctx.closePath(); ctx.beginPath(); ctx.font = "20px Arial"; //color = yourFunction(max) ctx.rect(firstRectMidX - 100, firstRectMidY - 25, 100, 50); ctx.fillStyle = calculateColor(moduleNumber, 1); ctx.fill(); ctx.closePath(); ctx.beginPath(); //draw arrows between proteins if (nextX) { if (nextX === firstRectMidX) { //reactions are formatted normally ctx.moveTo(firstRectMidX - 65, firstRectMidY + 35); ctx.lineTo(firstRectMidX - 55, firstRectMidY + 25); ctx.lineTo(firstRectMidX - 55, firstRectMidY + 75); ctx.moveTo(firstRectMidX - 45, firstRectMidY + 25); ctx.lineTo(firstRectMidX - 45, firstRectMidY + 75); ctx.lineTo(firstRectMidX - 35, firstRectMidY + 65); ctx.stroke(); ctx.closePath(); ctx.beginPath(); //create second protein ctx.rect(firstRectMidX - 100, firstRectMidY + 75, 100, 50); ctx.fillStyle = calculateColor(moduleNumber, 0); ctx.fill(); ctx.closePath(); ctx.beginPath(); } else { if (nextY === firstRectMidY) { //reactions horizontally connected ctx.moveTo(firstRectMidX + 10, firstRectMidY - 15); ctx.lineTo(firstRectMidX, firstRectMidY - 5); ctx.lineTo(firstRectMidX + 50, firstRectMidY - 5); ctx.moveTo(firstRectMidX, firstRectMidY + 5); ctx.lineTo(firstRectMidX + 50, firstRectMidY + 5); ctx.lineTo(firstRectMidX + 40, firstRectMidY + 15); ctx.stroke(); ctx.closePath(); ctx.beginPath(); ctx.rect(firstRectMidX + 50, firstRectMidY - 25, 100, 50); ctx.fillStyle = calculateColor(moduleNumber, 0); ctx.fill(); ctx.closePath(); ctx.beginPath(); } else { //reactions diagonally connected ctx.moveTo(firstRectMidX - 55, firstRectMidY + 25); ctx.lineTo(firstRectMidX - 55, firstRectMidY + 50); ctx.lineTo(firstRectMidX - 130, firstRectMidY + 75); ctx.moveTo(firstRectMidX - 55, firstRectMidY + 50); ctx.lineTo(firstRectMidX + 20, firstRectMidY + 75); ctx.moveTo(firstRectMidX - 45, firstRectMidY + 25); ctx.lineTo(firstRectMidX - 45, firstRectMidY + 50); ctx.lineTo(firstRectMidX - 120, firstRectMidY + 75); ctx.moveTo(firstRectMidX - 45, firstRectMidY + 50); ctx.lineTo(firstRectMidX + 30, firstRectMidY + 75); ctx.stroke(); ctx.closePath(); ctx.beginPath(); ctx.rect(firstRectMidX - 175, firstRectMidY + 75, 100, 50); ctx.rect(firstRectMidX - 25, firstRectMidY + 75, 100, 50); ctx.fillStyle = calculateColor(moduleNumber, 0); ctx.fill(); ctx.closePath(); ctx.beginPath(); } } } else { ctx.moveTo(firstRectMidX - 65, firstRectMidY + 35); ctx.lineTo(firstRectMidX - 55, firstRectMidY + 25); ctx.lineTo(firstRectMidX - 55, firstRectMidY + 75); ctx.moveTo(firstRectMidX - 45, firstRectMidY + 25); ctx.lineTo(firstRectMidX - 45, firstRectMidY + 75); ctx.lineTo(firstRectMidX - 35, firstRectMidY + 65); ctx.stroke(); ctx.closePath(); ctx.beginPath(); //create second protein ctx.rect(firstRectMidX - 100, firstRectMidY + 75, 100, 50); ctx.fillStyle = calculateColor(moduleNumber, 0); ctx.fill(); ctx.closePath(); ctx.beginPath(); } //Enzyme ctx.beginPath(); ctx.font = "12px Arial"; var fontMeasures = ctx.measureText(enzyme); var xCoord; var yCoord; if (nextX && (nextY === firstRectMidY)) { xCoord = firstRectMidX + 20 - (fontMeasures.width / 2); yCoord = firstRectMidY; } else { xCoord = firstRectMidX - 55 - (fontMeasures.width / 2); yCoord = firstRectMidY + 50; } ctx.moveTo(xCoord, yCoord); ctx.bezierCurveTo( xCoord, yCoord - 20, xCoord + fontMeasures.width + 10, yCoord - 20, xCoord + fontMeasures.width + 10, yCoord); ctx.bezierCurveTo( xCoord + fontMeasures.width + 10, yCoord + 20, xCoord, yCoord + 20, xCoord, yCoord); ctx.fillStyle = "white"; ctx.fill(); ctx.fillStyle = "white"; ctx.font = "20px Arial"; ctx.stroke(); ctx.closePath(); ctx.beginPath(); //add label to first protein ctx.fillText(firstText, firstRectMidX - 90, firstRectMidY + 5); if (!nextY) { //add label to second protein ctx.fillText(secondText, firstRectMidX - 90, firstRectMidY + 105); } ctx.stroke(); ctx.closePath(); ctx.beginPath(); ctx.fillStyle = "black"; ctx.font = "12px Arial"; ctx.fillText(enzyme, xCoord + 5, yCoord + 4); //draw everything to the screen ctx.stroke(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reactionReverse () {\n direction = -direction; // Stromrichtung umkehren\n reset(); // Ausgangsstellung\n }", "function pattern_7_reaction() {\n return choice([\"OKAY\", \"YEAH\", \"WHAT\"]) + '!';\n}", "get reaction ...
[ "0.6685052", "0.5935338", "0.567256", "0.5375779", "0.5348552", "0.5331727", "0.53048503", "0.5301419", "0.5293033", "0.5282614", "0.5271819", "0.5253171", "0.52515167", "0.51860505", "0.5145787", "0.513109", "0.51273644", "0.5119652", "0.5095795", "0.5095581", "0.50791943", ...
0.0
-1
Calculates the xvalue of a point on a circle (of radius 50) given the y value
function calculateX(y, centerX, centerY) { var x; x = centerX + Math.sqrt(-1 * Math.pow((y - centerY), 2) + 2500); if (Number.isNaN(x)) { return centerX; } else { return x; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCircleXFromY(y, circCenterX, circCenterY, radius){\n return Math.round(Math.sqrt(Math.pow(radius, 2) - Math.pow(y - circCenterY, 2))) + circCenterX;\n}", "function getPointG (center, radius) {\n var x = center[0];\n var y = center[1];\n \n \n y += Math.round(2 * radius * .8660)\n\n ...
[ "0.7047785", "0.6958386", "0.6789834", "0.6564481", "0.6501087", "0.6461052", "0.6357566", "0.63481045", "0.63356435", "0.6303281", "0.6290927", "0.6277553", "0.618971", "0.618327", "0.6173892", "0.61531365", "0.61375463", "0.609539", "0.60839355", "0.60332036", "0.60160303",...
0.6621343
3
Calculate the x value of the molecule in the reaction. The height changes by a consistent value each time but the horizontal position can change if it is following a nonreversible reaction
function getDotPos(moduleNumber) { //find whether module is reversible //find module start and end positions //if irreversible: //semicircular path //else: //if startX == endX: //vertical path //else: //if startY == endY: //horizontal path //else: //weird path var startX = xCoords[moduleNumber]; var startY = yCoords[moduleNumber]; var endX; var endY; var x; var y; if (moduleNumber === xCoords.length - 1) { endX = xCoords[moduleNumber]; endY = yCoords[moduleNumber] + 1; } else { endX = xCoords[moduleNumber + 1]; endY = yCoords[moduleNumber + 1]; } var revMod = revList[moduleNumber]; if (revMod.toLowerCase() === "irreversible") { var currSlider = document.getElementById(enzymeList[moduleNumber]); var irrPositionChange = positionChange * (parseInt(currSlider.value) / 50) * (Math.PI / 2); checkRatio(moduleNumber); if (rxnDir[moduleNumber] === 1) { directions[moduleNumber] = 1; } if (dotPositions[moduleNumber][0] <= (startX * 75 + canvas.clientWidth / 2 + 50)) { if (dotPositions[moduleNumber][1] === startY * 100) { dotPositions[moduleNumber][0] += directions[moduleNumber] * irrPositionChange; } else { dotPositions[moduleNumber][0] -= directions[moduleNumber] * irrPositionChange; } } else { dotPositions[moduleNumber][1] += directions[moduleNumber] * irrPositionChange; dotPositions[moduleNumber][0] = calculateX(dotPositions[moduleNumber][1], (startX * 75 + canvas.clientWidth / 2 + 50), startY * 100 + 50); } if (dotPositions[moduleNumber][1] >= endY * 100 && dotPositions[moduleNumber][0] < (endX * 75) + canvas.clientWidth / 2) { //if reaches end of reaction prodSubValues[moduleNumber][0] += 1; prodSubValues[moduleNumber][1] -= 1; if (moduleNumber != prodSubValues.length - 1) { prodSubValues[moduleNumber + 1][1] += 1; } if (moduleNumber != 0) { prodSubValues[moduleNumber - 1][0] -= 1; } dotPositions[moduleNumber] = [startX*75+canvas.clientWidth/2, startY*100]; checkRatio(moduleNumber); if (rxnDir[moduleNumber] != 1) { directions[moduleNumber] = 0; } } } else { if (startX === endX) { //vertical dotPositions[moduleNumber][1] += directions[moduleNumber] * positionChange; if (dotPositions[moduleNumber][1] >= endY * 100) { prodSubValues[moduleNumber][0] += 1; prodSubValues[moduleNumber][1] -= 1; if (moduleNumber != prodSubValues.length - 1) { prodSubValues[moduleNumber + 1][1] += 1; } if (moduleNumber != 0) { prodSubValues[moduleNumber - 1][0] -= 1; } checkRatio(moduleNumber); if (rxnDir[moduleNumber] === 0 || rxnDir[moduleNumber] === -1) { directions[moduleNumber] = -1; } else { dotPositions[moduleNumber][0] = startX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][1] = startY * 100; directions[moduleNumber] = 1; } } else if (dotPositions[moduleNumber][1] <= startY * 100) { prodSubValues[moduleNumber][0] -= 1; prodSubValues[moduleNumber][1] += 1; if (moduleNumber != prodSubValues.length - 1) { prodSubValues[moduleNumber + 1][1] -= 1; } if (moduleNumber != 0) { prodSubValues[moduleNumber - 1][0] += 1; } checkRatio(moduleNumber); if (rxnDir[moduleNumber] === 0 || rxnDir[moduleNumber] === 1) { directions[moduleNumber] = 1; } else { dotPositions[moduleNumber][0] = endX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][1] = endY * 100; directions[moduleNumber] = -1; } } } else { if (startY === endY) { //horizontal var currPosChange = (3/2) * positionChange dotPositions[moduleNumber][0] += directions[moduleNumber] * currPosChange; if (dotPositions[moduleNumber][0] >= (endX * 75) + canvas.clientWidth / 2) { prodSubValues[moduleNumber][0] += 1; prodSubValues[moduleNumber][1] -= 1; if (moduleNumber != prodSubValues.length - 1) { prodSubValues[moduleNumber + 1][1] += 1; } if (moduleNumber != 0) { prodSubValues[moduleNumber - 1][0] -= 1; }checkRatio(moduleNumber); if (rxnDir[moduleNumber] === 0 || rxnDir[moduleNumber] === -1) { directions[moduleNumber] = -1; } else { dotPositions[moduleNumber][0] = startX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][1] = startY * 100; directions[moduleNumber] = 1; } } else if (dotPositions[moduleNumber][0] <= (startX * 75) + canvas.clientWidth / 2) { prodSubValues[moduleNumber][0] -= 1; prodSubValues[moduleNumber][1] += 1; if (moduleNumber != prodSubValues.length - 1) { prodSubValues[moduleNumber + 1][1] -= 1; } if (moduleNumber != 0) { prodSubValues[moduleNumber - 1][0] += 1; } checkRatio(moduleNumber); if (rxnDir[moduleNumber] === 0 || rxnDir[moduleNumber] === 1) { directions[moduleNumber] = 1; } else { dotPositions[moduleNumber][0] = endX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][1] = endY * 100; directions[moduleNumber] = -1; } } } else { //weird var midPoint = (yCoords[moduleNumber] * 100) + 50; var botMidPoint = midPoint + 25; if (dotPositions[moduleNumber][2] === 'undefined') { //If the reaction has not reached the midpoint before dotPositions[moduleNumber].append(0); dotPositions[moduleNumber].append(0); } if (dotPositions[moduleNumber][1] >= midPoint) { dotPositions[moduleNumber][1] += directions[moduleNumber] * positionChange; if (dotPositions[moduleNumber][1] < botMidPoint) { dotPositions[moduleNumber][0] = (startX*75+canvas.clientWidth/2) + directions[moduleNumber] * 3 * (dotPositions[moduleNumber][1] - midPoint); } dotPositions[moduleNumber][3] = dotPositions[moduleNumber][1]; if (dotPositions[moduleNumber][3] < botMidPoint) { dotPositions[moduleNumber][2] = (startX*75+canvas.clientWidth/2) - directions[moduleNumber] * 3 * (dotPositions[moduleNumber][1] - midPoint); } } else { dotPositions[moduleNumber][0] = startX*75+canvas.clientWidth/2; dotPositions[moduleNumber][1] += directions[moduleNumber] * positionChange; dotPositions[moduleNumber][2] = startX*75+canvas.clientWidth/2; dotPositions[moduleNumber][3] = dotPositions[moduleNumber][1]; } if (dotPositions[moduleNumber][1] >= endY * 100 && dotPositions[moduleNumber][0] >= (endX * 75) + canvas.clientWidth / 2) { prodSubValues[moduleNumber][0] += 1; prodSubValues[moduleNumber][1] -= 1; if (moduleNumber != prodSubValues.length - 1) { prodSubValues[moduleNumber + 1][1] += 1; } if (moduleNumber != 0) { prodSubValues[moduleNumber - 1][0] -= 1; } checkRatio(moduleNumber); if (rxnDir[moduleNumber] === 0 || rxnDir[moduleNumber] === -1) { directions[moduleNumber] = -1; } else { dotPositions[moduleNumber][0] = startX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][1] = startY * 100; dotPositions[moduleNumber][2] = startX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][3] = startY * 100; directions[moduleNumber] = 1; } } else if (dotPositions[moduleNumber][1] <= startY * 100 && dotPositions[moduleNumber][0] <= (startX * 75) + canvas.clientWidth / 2) { prodSubValues[moduleNumber][0] -= 1; prodSubValues[moduleNumber][1] += 1; if (moduleNumber != prodSubValues.length - 1) { prodSubValues[moduleNumber + 1][1] -= 1; } if (moduleNumber != 0) { prodSubValues[moduleNumber - 1][0] += 1; } checkRatio(moduleNumber); if (rxnDir[moduleNumber] === 0 || rxnDir[moduleNumber] === 1) { directions[moduleNumber] = 1; } else { dotPositions[moduleNumber][0] = endX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][1] = endY * 100; dotPositions[moduleNumber][2] = startX * 75 + canvas.clientWidth / 2; dotPositions[moduleNumber][3] = startY * 100; directions[moduleNumber] = -1; } } } } } if (moduleNumber === 0) { prodSubValues[moduleNumber][1] += 1; if (prodSubValues[moduleNumber][1] >= 5) { prodSubValues[moduleNumber][1] = 5; } } if (moduleNumber === prodSubValues.length - 1) { prodSubValues[moduleNumber][0] -= 1; if (prodSubValues[moduleNumber][0] <= 1) { prodSubValues[moduleNumber][0] = 1; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeX (x) {\n const mag = me.magnification / 100\n return decimalRound((x - (me.element.el.offsetLeft) - (me.width / 2)) / mag, 2)\n }", "__calculateX(position) {\n\t\treturn (gap + (tileSize + gap) * (position % dimensions));\n\t}", "get x()\n\t{\n\t\tif (this._x != null)\n\t\t\treturn this...
[ "0.6942843", "0.6788376", "0.6713449", "0.6618212", "0.65846956", "0.6520419", "0.6485787", "0.6457284", "0.6424767", "0.6369828", "0.63597876", "0.63123393", "0.630894", "0.625941", "0.6236537", "0.6217541", "0.6217541", "0.6217541", "0.62071896", "0.6202116", "0.6194544", ...
0.0
-1
specifies which steps of the pathway to draw and draws them
function render() { var ctx = canvas.getContext("2d"); ctx.clearRect(0, 0, canvas.clientWidth, canvas.clientHeight); var varList = document.getElementsByClassName("inner-flex-horiz"); //Draw each step of the pathway, including reversible and non-reversible steps for (var i = 0; i < enzymeList.length; i++) { getDotPos(i); //set speed if (i === 0) { firstRectMidX = xCoords[i] * 75 + (canvas.clientWidth / 2 + 50); firstRectMidY = yCoords[i] * 100; } if (revList[i].toLowerCase() === "reversible") { var nextX; var nextY; if (i != enzymeList.length) { nextX = xCoords[i+1] * 75 + (canvas.clientWidth / 2 + 50); nextY = yCoords[i+1] * 100; } else { nextX = xCoords[i] * 75 + (canvas.clientWidth / 2 + 50); nextY = yCoords[i] * 100; } revStep(substrateList[i][0], productList[i][0], enzymeList[i], xCoords[i] * 75 + (canvas.clientWidth / 2 + 50), yCoords[i] * 100, nextX, nextY, ctx, i); } else { notRevStep(substrateList[i][0], productList[i][0], enzymeList[i], xCoords[i] * 75 + (canvas.clientWidth / 2 + 50), yCoords[i] * 100, ctx, i); } if (varList[i].getAttribute("drawRect") === "true") { ctx.beginPath(); ctx.rect(highlightRects[i][0], highlightRects[i][1], highlightRects[i][2], highlightRects[i][3]); ctx.stroke(); } } ctx.stroke(); ctx.closePath(); ctx.beginPath(); ctx.fillStyle = "blue"; for (var i = 0; i < dotPositions.length; i++) { ctx.moveTo(dotPositions[i][0] + 5, dotPositions[i][1]); ctx.arc(dotPositions[i][0], dotPositions[i][1], 5, 0, 2 * Math.PI); if (dotPositions[i].length === 4) { ctx.moveTo(dotPositions[i][2] + 5, dotPositions[i][3]); ctx.arc(dotPositions[i][2], dotPositions[i][3], 5, 0, 2 * Math.PI); } } ctx.fill(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "debug( draw, steps=10, inc_dxdy=false, inc_dxdy2=false ){\r\n let prev = new Vec3();\r\n let pos = new Vec3();\r\n let dev = new Vec3();\r\n let t;\r\n\r\n // Draw First Point\r\n this.at( 0, prev );\r\n draw.pnt( prev, \"yellow\", 0.05, 1 );\r\n\r\n for( l...
[ "0.70697945", "0.67920697", "0.67242545", "0.67022383", "0.6664862", "0.66017634", "0.6601743", "0.65780336", "0.65537614", "0.6550907", "0.6531512", "0.6468508", "0.6457658", "0.6450764", "0.6445439", "0.6426784", "0.64162934", "0.64034486", "0.6393927", "0.6391958", "0.6381...
0.6842936
1
resets values of sliders on page (re)load
function reset() { var varList = document.getElementsByClassName("inner-flex-horiz"); document.getElementById("clearModelButton").addEventListener("submit", function() {window.reload(true)}); for (var i=0; i<db_modules.length; i++) { if (db_modules[i].modelID_id === modelNum) { if (db_modules[i].reversible.toLowerCase() === 'irreversible') { var enSlider = document.getElementById(db_modules[i].enzymeAbbr); enSlider.value = "50"; var numId = db_modules[i].enzymeAbbr + "Value"; enSlider.oninput = function() { var sliderId = convertTextToId(this.id) + "Value"; document.getElementById(sliderId).innerHTML = this.value; } } var currModuleIndex = enzymeList.indexOf(db_modules[i].enzymeAbbr) highlightRects.push([db_modules[i].xCoor*75+canvas.clientWidth/2-130, db_modules[i].yCoor*100-30, 260, 160, false]); var indexAttrib = document.createAttribute("drawRect"); indexAttrib.value = "false"; varList[currModuleIndex].setAttributeNode(indexAttrib); varList[currModuleIndex].addEventListener("mouseenter", function(event) { this.setAttribute("drawRect", "true"); }, false); varList[currModuleIndex].addEventListener("mouseenter", function(event) { this.setAttribute("drawRect", "false"); }, false) dotPositions.push([db_modules[i].xCoor * 75 + (canvas.clientWidth / 2), db_modules[i].yCoor * 100]) directions.push(1); rxnDir.push(1); if (enzymeList.indexOf(db_modules.enzymeAbbr) == 0) { prodSubValues.push([10.0, 13.0]); } else { prodSubValues.push([10.0, 10.0]); } kValues.push(calculateK(i)); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetSlider() {\r\n slider.value = 0;\r\n}", "function resetSlider(bins){\n document.getElementById(\"theSlider\").value = bins;\n }", "function resetValues(){\r\n document.getElementById(\"localOnly\").checked = DEFAULT_VALUES.local_only;\r\n document.getElementById(\"spf_slider\").value = ...
[ "0.7628209", "0.7251419", "0.72083306", "0.71073145", "0.70902073", "0.6980939", "0.69463676", "0.6939594", "0.6917399", "0.69089", "0.6896507", "0.6841375", "0.6782023", "0.67698926", "0.67694366", "0.6759647", "0.67298335", "0.6695782", "0.6692537", "0.66919786", "0.6686274...
0.0
-1
Assumes that there are at least one substrate, at least one product, exactly one enzyme, and exactly one boolean for reversible/irreversible
function parseThrough(stringToParse) { //on chrome the wrong information is being stored as an enzyme try { var tmpArr = stringToParse.split(">"); } catch (e) { return null } var newArr = tmpArr[1].split("<"); var evenNewer = newArr[1].split(";"); // fullArr now contains // [0]: substrates (inputs) // [1]: enzyme // [2]: products (outputs) // [3]: reversible? (boolean) fullArr = [tmpArr[0], newArr[0], evenNewer[0], evenNewer[1]]; subsArr = fullArr[0].split("+"); prodArr = fullArr[2].split("+"); return [subsArr, fullArr[1], prodArr, fullArr[3]] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isValidReaction(substrates, enzyme, products, reactionNumber) {\n //check for repeated enzymes\n for(var i = 0; i < reactionNumber; i++) {\n //compare the name of the current enzyme to that of every enzyme in the pathway already\n if(enzyme[0] == addedReactions[i]['enzyme'][0]) {\n ...
[ "0.6213341", "0.54942197", "0.5459085", "0.54088247", "0.533806", "0.5333266", "0.5298011", "0.51978403", "0.5173167", "0.5103893", "0.51030356", "0.5089114", "0.508357", "0.5047671", "0.50438696", "0.5035032", "0.5032203", "0.50259626", "0.4997766", "0.49776268", "0.49700266...
0.0
-1
It's good to catch errors too!
function loading_error(error, filename, lineno) { console.log("Dosyaları yüklerken hata meydana geldi: " + error); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleError(err) {\n\tif (err) throw err;\n}", "onerror() {}", "onerror() {}", "function check(err) {\n\tif (!err) { return }\n\tconsole.log(\"ERROR\", err)\n\tthrow err\n}", "function processErrors(data){\n \n}", "function VeryBadError() {}", "error(error) {}", "onError() {}", "function ...
[ "0.59385294", "0.581563", "0.581563", "0.5746083", "0.573184", "0.56300646", "0.5618805", "0.5577255", "0.5524662", "0.5503805", "0.5482381", "0.5459402", "0.5452459", "0.54508334", "0.5431298", "0.54085106", "0.5382868", "0.53779244", "0.53649485", "0.5357745", "0.53238857",...
0.0
-1
jquery ajax call to read user details by Id to populate in edit user page
function getUser(userId) { hideErrorPanel(); if (userId === 0) return; $.ajax({ type: "POST", url: "ManageUserApi.aspx/GetUserById", data: '{userId: "' + userId + '" }', contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccess, failure: function (response) { alert(response.d); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function editUser(id) {\n $('#user_id').val(id);\n $.ajax({\n headers: {\n 'X-CSRF-TOKEN': $('meta[name=\"csrf-token\"]').attr('content')\n },\n url: '/user/edit/' + id,\n type: 'get',\n success: function (data) {\n console.log(data[0]['role_id']);\n ...
[ "0.7342261", "0.7317639", "0.7226027", "0.719276", "0.7174116", "0.71403193", "0.7123165", "0.7114405", "0.70381266", "0.70235425", "0.69719696", "0.6926111", "0.6906576", "0.6870825", "0.68420905", "0.67962474", "0.6795686", "0.67580247", "0.67285454", "0.67253226", "0.67163...
0.6680759
22
Jquery ajax call to get roles & populate role dropdown
function getRoles(userId) { $("#ddlrole").empty(); $("#ddlrole").append($("<option></option>").val("").html("")); if (roles.length === 0) { $.ajax({ type: "POST", url: "ManageUserApi.aspx/GetRoles", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { roles = data.d; $.each(roles, function (key, value) { $("#ddlrole").append($("<option></option>").val(value.RoleId).html(value.Description)); }); getUser(userId); }, failure: function (response) { alert(response.d); } }); } else { $.each(roles, function (key, value) { $("#ddlrole").append($("<option></option>").val(value.RoleId).html(value.Description)); }); getUser(userId); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillRoles() {\n $(\"select[name='RoleId']\").empty();\n $.ajax({\n url: \"/Employee/Roles/\" + $('select[name=\"DepartmentId\"]').val(),\n dataType: \"Json\",\n type: \"Get\",\n data: {},\n success: function (response) {\n ...
[ "0.7696604", "0.76254886", "0.7573151", "0.7380626", "0.73712444", "0.7306547", "0.7224069", "0.7114847", "0.7094175", "0.7090697", "0.7025095", "0.69665056", "0.6868839", "0.68439126", "0.6810113", "0.68028665", "0.68014115", "0.6794497", "0.6732222", "0.6713366", "0.6709205...
0.779096
0
When the user clicks on the button, toggle between hiding and showing the dropdown content
function myFunction() { document.getElementById("myDropdown").classList.toggle("show"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dropDownShowClick(){\n document.getElementById(\"forDropDown\").style.display=\"block\";\n document.getElementById(\"dropDownShowBtn\").style.display=\"none\";\n document.getElementById(\"dropDownHideBtn\").style.display=\"block\";\n}", "function btn_show() {\n document.getElementById(\"drop...
[ "0.78093", "0.76717645", "0.74911606", "0.73892653", "0.7350426", "0.7345268", "0.73321265", "0.72640365", "0.7261712", "0.72435963", "0.72117734", "0.721041", "0.7174757", "0.71715814", "0.71538645", "0.71487767", "0.7144623", "0.71222985", "0.7102956", "0.70976174", "0.7093...
0.66838235
88
makes a function to compare the object values from the specified compare operation callback
function makeCompare (fn) { return function (value, key) { return hasOwn(this, key) && fn(value, this[key]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeCompare(callback) {\n\t return function(value, key) {\n\t return hasOwn(this, key) && callback(value, this[key]);\n\t };\n\t }", "compare(obj1, obj2) {}", "function compareFunc(a, b) {\n return a - b;\n }", "function createComparisonFunction(propertyName) {\nretur...
[ "0.7037844", "0.65462464", "0.62693125", "0.61836326", "0.61425954", "0.61234903", "0.604885", "0.59872276", "0.5949225", "0.5945417", "0.5897636", "0.58276486", "0.58276486", "0.573866", "0.5713657", "0.5699451", "0.55556554", "0.55544084", "0.55366373", "0.55366373", "0.551...
0.5828478
11
checks if two objects have the same keys and values
function equals (a, b, fn) { fn = fn || is if (!isObject(a) || !isObject(b)) return fn(a, b) return (every(a, makeCompare(fn), b) && every(b, checkProperties, a)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sameProps(objA, objB) {\n var keysA = Object.keys(objA)\n var keysB = Object.keys(objB)\n\n if (keysA.length !== keysB.length)\n return false\n\n for (var i = 0; i < keysA.length; i++) {\n if (keysA[i] !== keysB[i])\n return false\n }\n\n return true\n}", "function objectsEqual(a, b) {\...
[ "0.8013424", "0.7922329", "0.78702384", "0.7755975", "0.7740629", "0.7725208", "0.77179056", "0.76664144", "0.7625233", "0.76183486", "0.76128155", "0.7566404", "0.7561876", "0.74780506", "0.7444955", "0.74410534", "0.7413393", "0.74128354", "0.7396042", "0.73921454", "0.7367...
0.0
-1
This background script watch changes in the active tab, or extension options, and update the extension icon to show if it is enabled on the current page
async function init() { let options = await loadOptions(); // Watch navigation, to enable/disable content script depending on URL changes. // NOTE: This is the only reliable method that I could find, which works for SPA as well. // For example, content scripts cannot monkey patch history.pushState because of XRay vision, which prohibits the use of modules like `url-listener` browser.webNavigation.onHistoryStateUpdated.addListener(async () => { const activeTabs = await browser.tabs.query({ currentWindow: true, active: true }); activeTabs.forEach(tab => { browser.tabs.sendMessage(tab.id, 'hyper-gwent/history-changed'); }); }); updateBrowserActionIcon(options); browser.tabs.onActivated.addListener(() => { updateBrowserActionIcon(options); }); browser.tabs.onUpdated.addListener(() => { updateBrowserActionIcon(options); }); browser.storage.onChanged.addListener(async () => { options = await loadOptions(); updateBrowserActionIcon(options); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateState () {\n if (!chrome.tabs) return;\n\n let iconState = 'active';\n\n if (!isExtensionEnabled) {\n iconState = 'disabled';\n } else if (httpNowhereOn) {\n iconState = 'blocking';\n }\n\n chrome.browserAction.setTitle({\n title: 'HTTPS Everywhere' + ((iconState === 'active') ? '' : ...
[ "0.70542467", "0.67835164", "0.66792893", "0.66670823", "0.65563774", "0.6525256", "0.65088236", "0.6497703", "0.6475679", "0.6462442", "0.64540935", "0.6454076", "0.6453169", "0.6416888", "0.6347589", "0.6312389", "0.6304168", "0.6301714", "0.62764335", "0.62544423", "0.6250...
0.5791304
44
pulls out the individual items url and passes it to the stage2
async function urlCall(url){ await fetch(url) .then(res => res.json()) .then(res => { let arrMain = res.results let k=0; arrName = arrMain.map(i => { return( <div key={k = k+1} className="wholeResults"> {stage2(i.url)} </div> ) }); }) .catch(err => {return( <div> <p>{`An Ancient Red Dragon aproaches: ${err}`}</p> </div> )}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateURLS() {\n urls.push('https://s3.amazonaws.com/limbforge/' + this.specs.design + \"/Ebe_forearm_\" + this.specs.hand + \"/forearm_\" + this.specs.hand + \"_C4-\" + this.specs.c4 + \"_L1-\" + this.specs.l1+ '.stl');\n // add on terminal device adaptor\n if (this.specs.design == \"EbeArm\")...
[ "0.6131586", "0.61009526", "0.59177846", "0.5895998", "0.5758906", "0.5726094", "0.5720176", "0.5716799", "0.5701246", "0.5695924", "0.5656167", "0.5628179", "0.5604636", "0.5594808", "0.55755186", "0.5560021", "0.55516213", "0.5546018", "0.5545255", "0.55382776", "0.55195844...
0.0
-1
prepares interactions for desktop and tablet
function initDesktop() { ReactDOM.render(<App />, document.getElementById('root')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function desktopSetUp () {\n $('.hiddenMobile').show()\n $('.viewMobile').hide()\n }", "function setDesktop () {\n desktopStartUp()\n $('.desktopVersion').show()\n $('.mobileVersion').hide()\n $('.pasajeros-vuelo-mobile').hide()\n pintarTabla('.plane-seats')\n }", "function deviceControl...
[ "0.7200166", "0.678459", "0.6781289", "0.67512316", "0.668738", "0.65261626", "0.65133005", "0.64897096", "0.6486596", "0.6385893", "0.63152725", "0.6298428", "0.62740064", "0.6202469", "0.6202469", "0.6193803", "0.61922544", "0.61870843", "0.61564577", "0.61528003", "0.61263...
0.0
-1
get the column width per unit. an item may be multiple units tall or wide, but we need to figuire out the unit dynamically on resize
function getUnitWidth() { var width; if ($(".visible-phone").is(":visible")) { width = $isocontainer.width() / 2; } else if ($(".visible-tablet").is(":visible")) { width = $isocontainer.width() / 3; } else { width = $isocontainer.width() / 5; } return width; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function measureWidth(item) {\n context.font = font(item);\n return measure(textValue(item));\n}", "function measureWidth(item) {\n context.font = font(item);\n return measure(textValue(item));\n}", "function measureWidth(item) {\n context.font = font(item);\n return measure(textValue(item));\n}", "fun...
[ "0.710544", "0.710544", "0.710544", "0.7054905", "0.6993674", "0.6966061", "0.6966061", "0.6963236", "0.68726414", "0.6849493", "0.68465996", "0.68254834", "0.67767936", "0.67084086", "0.66919035", "0.668741", "0.6685058", "0.6622089", "0.6568174", "0.65379703", "0.65379703",...
0.69718623
5
set all the widths to the elements
function setWidths() { var unitWidth = getUnitWidth() - 20; // adjust for padding. for padding:0, make this 1 $isocontainer.children(":not(.width2)").css({ width: unitWidth }); $isocontainer.children(".width2").css({ width: (unitWidth * 2) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setOrigWidth()\n{\n\tfor(var i=0; i < hdr.length; i++)\n\t{\n\t\thdr[i].width = hWidth[i];\n\t}\n\t\n\tfor(var i=0; i < drow1.length; i++)\n\t{\n\t\tdrow1[i].width = dWidth[i];\n\t}\n\t\n}", "function _increaseWidth(){\n layout.changeWidth(1);\n }", "function setWidths() {\n\t\t\t$t.find( 't...
[ "0.7077539", "0.7010517", "0.6996412", "0.6984562", "0.698392", "0.6913587", "0.69069856", "0.6885303", "0.6835429", "0.6812564", "0.67487574", "0.6721842", "0.66989815", "0.66989815", "0.66935444", "0.6677265", "0.6660298", "0.6651036", "0.6651036", "0.6651036", "0.66369313"...
0.80272555
0
destroys any obstacles it collides with
function OnTriggerEnter(other : Collider){ if(other.transform.root.tag == "obstacle"){ other.SendMessageUpwards("destroy"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DestroyObstacle(){\r\n ObstacleGroup[0].destroy();\r\n SlideButton.hide();\r\n \r\n }", "function removeOutOfBoundObj() {\n gameState.enemies.getChildren().forEach(enemy => {\n if (enemy.x > config.width + HALF_OBJ_PIXEL || enemy.x < -HALF_OBJ_PIXEL) {\n gameState...
[ "0.7106927", "0.70738465", "0.6981923", "0.69375134", "0.6893872", "0.68643934", "0.68277365", "0.68128926", "0.67983896", "0.6796574", "0.6729785", "0.6705601", "0.66639745", "0.6629364", "0.6625992", "0.6619795", "0.65761125", "0.65520173", "0.6551509", "0.6465414", "0.6465...
0.6375352
26
implement with reference to
function levenshtein(fst, snd, { logDPMatrix } = {}) { const dp = zeros([fst.length + 1, snd.length + 1]) for (let i = 0; i <= fst.length; i++) { dp[i][0] = i } for (let j = 0; j <= snd.length; j++) { dp[0][j] = j } for (let i = 1; i <= fst.length; i++) { for (let j = 1; j <= snd.length; j++) { if (fst[i - 1] === snd[j - 1]) { dp[i][j] = dp[i - 1][j - 1] } else { dp[i][j] = Math.min( dp[i - 1][j - 1], // substitute dp[i][j - 1], // insert dp[i - 1][j] // delete ) + 1 } } } if (logDPMatrix) { logDPMatrix(dp) } return dp[fst.length][snd.length] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sref() {\r\n}", "obtain(){}", "static initialize(obj, ref) { \n obj['ref'] = ref;\n }", "__previnit(){}", "private public function m246() {}", "get reference () {\r\n\t\treturn this._reference;\r\n\t}", "constructor(address_of_reference) {\n this.address_of_reference = address_o...
[ "0.64171064", "0.62759817", "0.61395156", "0.601989", "0.5964374", "0.594174", "0.59136206", "0.5910013", "0.5856616", "0.5842973", "0.5842973", "0.5770093", "0.5732735", "0.56527615", "0.5641524", "0.5641524", "0.5605609", "0.5601305", "0.55937845", "0.5554333", "0.5544299",...
0.0
-1
implement with reference to
function shortestEditScript(fst, snd, { logDPMatrix, logSES } = {}) { const dp = _lcsDp(fst, snd) if (logDPMatrix) { logDPMatrix(dp) } const ses = _getSES(dp, fst, snd) if (logSES) { logSES(ses) } return ses }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sref() {\r\n}", "obtain(){}", "static initialize(obj, ref) { \n obj['ref'] = ref;\n }", "__previnit(){}", "private public function m246() {}", "get reference () {\r\n\t\treturn this._reference;\r\n\t}", "constructor(address_of_reference) {\n this.address_of_reference = address_o...
[ "0.64171064", "0.62759817", "0.61395156", "0.601989", "0.5964374", "0.594174", "0.59136206", "0.5910013", "0.5856616", "0.5842973", "0.5842973", "0.5770093", "0.5732735", "0.56527615", "0.5641524", "0.5641524", "0.5605609", "0.5601305", "0.55937845", "0.5554333", "0.5544299",...
0.0
-1
The function should find the first pair, where the sum is 0. Return an array that includes both values that sum to zero or undefined if a pair does not exist.
function sumZero(arr) { // initialize variables for left and right let left = 0; let right = arr.length - 1; // loop over array while (right > left) { let sum = arr[left] + arr[right]; // check if sum is 0 if (sum === 0) { // return pair return [arr[left], arr[right]]; } // if sum is greater than 0, increase the right by 1 if (sum > 0) { right--; } // else increase the left by 1 else { left++; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumZero(arr){\n // we are itterating the array\n for(var i=0; i<arr.length;i++){\n for(var j=i+1; j<arr.length; j++){\n // here we checking a pair of numbers the resultant sum should be zero\n if(arr[i] + arr[j] === 0){\n // if the condition is satisfied, w...
[ "0.78718275", "0.76035357", "0.7556289", "0.7542015", "0.7536655", "0.75199014", "0.7514735", "0.7514735", "0.75113475", "0.7509873", "0.74946254", "0.7484444", "0.7474569", "0.7411543", "0.73846877", "0.73542506", "0.7290935", "0.7225764", "0.7219887", "0.7194324", "0.715865...
0.7078697
21
var gStartPos const gTouchEvs = ['touchstart', 'touchmove', 'touchend']
function addMouseListeners() { gElCanvas.addEventListener('mousemove', onMove) gElCanvas.addEventListener('mousedown', onDown) gElCanvas.addEventListener('mouseup', onUp) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function e(){var e,t={},i=[\"touchstart\",\"touchmove\",\"touchend\"],n=document.createElement(\"div\");try{for(e=0;e<i.length;e++){var r=i[e];r=\"on\"+r;var s=r in n;s||(n.setAttribute(r,\"return;\"),s=\"function\"==typeof n[r]),t[i[e]]=s}return t.touchstart&&t.touchend&&t.touchmove}catch(a){return!1}}", "funct...
[ "0.7243683", "0.7212225", "0.71088994", "0.6880552", "0.68432915", "0.67745405", "0.6766479", "0.6712462", "0.67077667", "0.66906124", "0.6627603", "0.6618286", "0.66029423", "0.6602247", "0.6599169", "0.659905", "0.6591762", "0.6589915", "0.65894437", "0.6588183", "0.6574261...
0.0
-1
Ajax Call for Username Forgot Page.
function UsernameAjaxMethod() { var user = $("#usernameCheck").val(); $.ajax({ type: "POST", url: "Login.aspx/UsernameForgotPageMethod", data: "{Forgotuser: '" + user + "'}", dataType: "json", contentType: "application/json; charset=utf-8", success: function (response) { $('.UsernameCheck').fadeOut(function () { $('.ContactCheck').fadeIn(700); }); }, error: function () { if (user == "") { $('#ErrorUser').text("Username is Empty"); $('#ErrorUser').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('#ErrorUser').addClass('animated shake'); return false; } else { $('#ErrorUser').text("Username is incorrect, if you have forgot your username, you are not able to go forward, you can contact from the Website Owner (+923159382193) regarding you account's unlock."); $('#ErrorUser').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '2', 'font-size': '15px' }); $('#ErrorUser').addClass('animated shake'); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset_password()\n{\n\tvar username=$('#username').val();\n\tif(username=='')\n\t{\n\t\talert('please enter email id');\n\t}\n\telse\n\t{\n\t\t$.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl:\"http://codeuridea.net/kidssitter/resetting/send-email\",\n\t\t\t\tdata:{'username':$('#username').val()},\n\t\t\t\...
[ "0.6690176", "0.66683954", "0.6453761", "0.6408495", "0.63641775", "0.62688625", "0.62679505", "0.6256149", "0.622892", "0.6155679", "0.6136436", "0.6123072", "0.6092463", "0.6090744", "0.604611", "0.6017466", "0.6014703", "0.6010808", "0.60059583", "0.60032654", "0.59902346"...
0.6906878
0
Ajax Call for Username PasswordOne Forgot Page.
function UsernamePasswordCheckAjaxMethod() { var user = $("#usernameCheck").val(); var pwd1 = $('#PasswordOneCheck').val(); $.ajax({ type: "POST", url: "Login.aspx/UsernameAndPasswordOneCheckForgotPageMethod", data: "{userCheck:'" + user + "', pwdCheck:'" + pwd1 + "'}", dataType: "json", contentType: "application/json; charset=utf-8", success: function () { $('.ContactCheck').fadeOut(function () { $('.AllisGood').fadeIn(700); }); }, error: function () { if(pwd1 == "") { $('#ErrorPwd1').text("Password is Empty"); $('#ErrorPwd1').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('#ErrorPwd1').addClass('animated shake'); return false; } else $('#ErrorPwd1').text("Password is Incorrect"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vpb_request_password_link()\n{\n\tvar ue_data = $(\"#ue_data\").val();\n\t\n\tif(ue_data == \"\")\n\t{\n\t\t$(\"#ue_data\").focus();\n\t\t$(\"#this_page_errors\").html('<div class=\"vwarning\">'+$(\"#empty_username_field\").val()+'</div>');\n\t\t$('html, body').animate({\n\t\t\tscrollTop: $('#ue_data').of...
[ "0.6752373", "0.6686341", "0.6642696", "0.6616043", "0.65920216", "0.6571524", "0.64384824", "0.64013284", "0.6300028", "0.62794584", "0.6274058", "0.6269336", "0.62321967", "0.62024707", "0.61994916", "0.61882734", "0.6170588", "0.6151968", "0.61137325", "0.61052376", "0.608...
0.6674794
2
Ajax Call for username and PasswordTwo Forgot page.
function UsernamePasswordTwoCheckAjaxMethod() { var user = $("#usernameCheck").val(); var pwdTwo = $("#PasswordTwoCheck").val(); $.ajax({ type: "POST", url: "Login.aspx/UsernameAndPasswordTwoCheckForgotPageMethodAjax", data: "{userCheck:'" + user + "', pwdCheck:'" + pwdTwo + "'}", dataType: "json", contentType: "application/json; charset=utf-8", success: function () { $('.PasswordCheck').fadeOut(function () { $('.AllisGood').fadeIn(700); }); }, error: function () { if (pwdTwo == "") { $('#ErrorPwd2').text("Password is Empty"); $('#ErrorPwd2').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('#ErrorPwd2').addClass('animated shake'); return false; } else $('#ErrorPwd2').text("Password is Incorrect"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function UsernamePasswordCheckAjaxMethod() {\n var user = $(\"#usernameCheck\").val();\n var pwd1 = $('#PasswordOneCheck').val();\n $.ajax({\n type: \"POST\",\n url: \"Login.aspx/UsernameAndPasswordOneCheckForgotPageMethod\",\n data: \"{userCheck:'\" + user + \"', pwdCheck:'\" + pwd1 ...
[ "0.67950946", "0.6754989", "0.6718557", "0.66401005", "0.65080565", "0.6493332", "0.64481765", "0.64315546", "0.6399592", "0.63384277", "0.62695366", "0.6263902", "0.62500465", "0.6236251", "0.6214668", "0.62064695", "0.6189092", "0.6146866", "0.61059314", "0.60973126", "0.60...
0.71463114
0
Ajax Call for Username and Security Question Answer Forgot Page.
function UsernameSecurityCheckAjaxMethod() { var user = $("#usernameCheck").val(); var security = $('#Securty').val(); var answer = $('#AnswerCheck').val(); $.ajax({ type: "POST", url: "Login.aspx/UsernameAndPasswordTwoCheckForgotPageMethod", data: "{userCheck: '" + user + "', security: '" + security + "', answer: '" + answer + "'}", dataType: "json", contentType: "application/json; charset=utf-8", success: function () { $('.SecurityCheck').fadeOut(function () { $('.AllisGood').fadeIn(700); }); }, error: function () { if (security == "Choose Security Question") { $('#SecurityError').text("Please select Security Question."); $('#SecurityError').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('#SecurityError').addClass('animated shake'); return false; } else if (answer == "") { $('#SecurityError').text("Please give Answer."); $('#SecurityError').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('#SecurityError').addClass('animated shake'); return false; } else $('#SecurityError').text("It is not Correct."); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitForgotUsername(){\n\ttry{\n\t\tvar license = $.txtfieldLicense.value;\n\t\tlicense = license.replace(/&(?!amp;)/g, '&amp;'​);\n\t var\tmail = $.txtfieldMail.value;\n\t var\temiratesid = $.txtfieldEmirateId.value.replace(/[-]/gi, \"\");\n\t Ti.API.info('emiratesid '+emiratesid);\n\t var\t...
[ "0.6795515", "0.67907023", "0.6316873", "0.63139737", "0.62242573", "0.61049604", "0.60875", "0.60468954", "0.604207", "0.6031355", "0.602438", "0.5985128", "0.59655863", "0.59634167", "0.59096146", "0.59095967", "0.5880554", "0.5871657", "0.58649457", "0.58588123", "0.585648...
0.66275233
2
Ajax Call for Admin Login.
function LoginAjaxMethod() { var Myuser = $("#UsernameLogin").val(); var Mypwd1 = $("#PasswornOneLogin").val(); var Mypwd2 = $("#PasswordTwoLogin").val(); $.ajax({ type: "POST", url: "Login.aspx/LoginMethod", data: "{user: '"+ Myuser +"', pwd1: '"+Mypwd1+"', pwd2: '"+Mypwd2+"'}", dataType: "json", contentType: "application/json; charset=utf-8", success: function (response) { window.location = "Dashboard.aspx"; }, error: function () { if (Myuser == "") { $('.ShowMsg').text("Username is Empty"); $('.ShowMsg').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('.ShowMsg').addClass('animated shake'); return false; } else if (Mypwd1 == "") { $('.ShowMsg').text("Password 1 is Empty"); $('.ShowMsg').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('.ShowMsg').addClass('animated shake'); return false; } else if (Mypwd2 == "") { $('.ShowMsg').text("Password 2 is Empty"); $('.ShowMsg').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' }); $('.ShowMsg').addClass('animated shake'); return false; } else { $('.ShowMsg').hide(); $('#ErrorMsg').text("Username or Password is incorrect"); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loginAjax() {\n let username = $('input#username').val();\n let pwd = $('input#pwd').val();\n if(username===\"\" || pwd===\"\") {\n loginResponse({status:-1});\n return false;\n }\n sendAjax('login',{\n 'username': username,\n 'password': sha256(pwd)\n });\n ...
[ "0.77463824", "0.76949036", "0.75663894", "0.75431514", "0.7522045", "0.738181", "0.7259551", "0.72570896", "0.7255773", "0.7247751", "0.721198", "0.72076225", "0.71325356", "0.71182096", "0.7102611", "0.7014031", "0.70127445", "0.6989394", "0.6987867", "0.69605565", "0.69368...
0.0
-1
the controlsmodel stores and manages all values of the input sliders
function ControlsModel ( initialValues ) { if ( ! ( this instanceof ControlsModel ) ) { return new ControlsModel( initialValues ); } var self = this; var publishers = addPublishers( self, [ 'update' ] ); var limits = getLimits( initialValues ) || { }; var values = getValues( initialValues ) || { }; function updateValues ( newValues ) { if ( newValues ) { newValues = objectHelper.getCopy( newValues ); var referenceValue; var newValue; for ( var key in newValues ) { limit = limits[key]; newValue = newValues[key]; if ( typeof limit !== 'undefined' && typeof newValue === 'number' && ! isNaN( newValue ) && newValue >= limit.min && newValue <= limit.max && values[key] !== newValue ) { values[key] = newValue; publishers.update.dispatch( key, values[key] ); } } } return self; } function setValue ( key, newValue ) { if ( typeof values[key] === 'number' && typeof newValue === 'number' && ! isNaN( newValue ) ) { values[key] = newValue; publishers.update.dispatch( key, values[key] ); } return self; } function randomizeValues () { var randomValues = { }; for ( var key in limits ) { randomValues[key] = parseInt( Math.random() * ( limits[key].max - limits[key].min ) + limits[key].min, 10 ); } updateValues( randomValues ); return self; } function getValues ( vals ) { var result = { }; vals = vals || values; for ( var key in vals ) { if ( typeof vals[key].value === 'number' ) { result[key] = vals[key].value; } else { result[key] = vals[key]; } } return objectHelper.getCopy( result ); } function getLimits ( vals ) { var result = { }; for ( var key in vals ) { result[key] = { min: vals[key].min, max: vals[key].max }; } return objectHelper.getCopy( result ); } self.randomizeValues = randomizeValues; self.setValue = setValue; self.getValues = getValues; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateAll(){refreshSliderDimensions();ngModelRender();}", "function matchFormToModel() {\n maxspdslider[0].value = tsdParams.maxspdslider;\n\t scaleslider[0].value = tsdParams.scaleslider;\n }", "addSliders() {\n this.sliders = this.config.map(function createSlider(obj) ...
[ "0.66982645", "0.6648741", "0.6488644", "0.6488358", "0.64777166", "0.64699554", "0.6463922", "0.64283025", "0.6360858", "0.6199315", "0.6187508", "0.61853683", "0.6131914", "0.612976", "0.61178917", "0.61038005", "0.6069274", "0.60461164", "0.60283965", "0.6019593", "0.60164...
0.55402553
71
open create feed modal
function openModal() { document.getElementById("backdrop").style.display = "block"; document.getElementById("createFeedModal").style.display = "block"; document.getElementById("createFeedModal").classList.add("show"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function presentAddFeedModal( langs_data ) {\n lang_manually_selected = false;\n\n // create the modal with the `modal-page` component\n $doc.trigger('open-modal', [\n await modalController.create({\n component: 'modal-add-feed',\n componentProps: {\n 'langs' : langs_data...
[ "0.6724323", "0.66195625", "0.65281814", "0.64307797", "0.6426467", "0.63692313", "0.6278521", "0.6218954", "0.6203398", "0.6180852", "0.61529016", "0.6109897", "0.61042184", "0.60975003", "0.6051817", "0.6046268", "0.6046268", "0.6036808", "0.6020912", "0.60057884", "0.59905...
0.630624
6
close create feed modal
function closeModal() { document.getElementById("backdrop").style.display = "none"; document.getElementById("createFeedModal").style.display = "none"; document.getElementById("createFeedModal").classList.remove("show"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeCreatePostModal() {\r\n\t\r\n\tvar modalBackdrop = document.getElementById('modal-backdrop');\r\n\tvar createPostModal = document.getElementById('create-post-modal');\r\n\r\n\tmodalBackdrop.classList.add('hidden');\r\n\tcreatePostModal.classList.add('hidden');\r\n\r\n\t// This function is defined bel...
[ "0.6863503", "0.6671225", "0.6381248", "0.6369099", "0.6344691", "0.6299557", "0.626921", "0.626921", "0.62435544", "0.6240885", "0.61899865", "0.61791176", "0.61532605", "0.61532605", "0.6139722", "0.6077376", "0.60741377", "0.6056354", "0.6052493", "0.60463095", "0.6042145"...
0.6841656
1
hide add button if it's not current logged in users own profile
function toggleAddButton() { const loggedInUserId = document.querySelector(".logged-in-user-id").innerHTML; const profileId = document.querySelector(".current-profile-id").innerHTML; if (loggedInUserId !== profileId) { document.querySelector(".new-feed-button").classList.add("d-none"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkToShowAddButton() {\n const hasResult = this.hasQuery && (! this.hasUsers && ! this.hasDepartment);\n\n this.setShowAddButton( hasResult );\n }", "function handleClick() {\n setShowUserProfile((!showUserProfile))\n }", "function toggleAddButton() {\n const loggedI...
[ "0.6933118", "0.6854732", "0.67922974", "0.675933", "0.64543074", "0.6411886", "0.6378024", "0.6368346", "0.6321812", "0.6281145", "0.6266627", "0.6223535", "0.6173657", "0.61585486", "0.61256045", "0.6111671", "0.6039487", "0.6028034", "0.60268646", "0.6011177", "0.6006853",...
0.72641385
0
node is actually a single node, or an array of nodes
render(createElement) { var component; const { node, param, token } = this; if (token && token[0]!=='$') { component= "mk-plain-text"; } else if (Array.isArray(node)) { // note: we could look at "param.repeats" but param is used for both the array slot // and the array elements component= "mk-repeater-ctrl"; } else if (node) { const { itemType } = node; if (itemType) { // search for a template particular to the item's underlying type. const name= itemType.name.replace("_","-"); component= `mk-${name}-ctrl`; // if not, use a generic control based on item's role. if (!(component in Vue.options.components)) { component= `mk-${itemType.uses}-ctrl`; } } } return component && createElement( component, { key: node&& node.id, // can be empty for repeats... props: { node, param, token, } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function node(){}", "function isNode(x) {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\";\n}", "function isNodeOneOf(elem,nodeTypeArray){if(nodeTypeArray.indexOf(elem.nodeName)!==-1){return true;}}", "function one(node) {\n if (node.type === type) {\n call...
[ "0.6788143", "0.6619972", "0.6597402", "0.65255964", "0.6362091", "0.6353505", "0.62837636", "0.6240099", "0.6135778", "0.6124065", "0.6124065", "0.6124065", "0.6124065", "0.6090811", "0.6090811", "0.6090811", "0.6090811", "0.6090811", "0.6090811", "0.60847723", "0.6072363", ...
0.0
-1
ez hax>take c code convert to js / Helper functions
function standard_24h_time_validp() { // TODO do validation for realizies---use regexp? return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toJs(v) { return v; } //D: compatibilidad con rt_java ", "function Ze(){if(ea)t.innerHTML=ha;else if(ia)t.innerHTML=ia;$e();eb&&hb.call(window,eb);nb();eb=-1;bb=[];cb={};ac=j;Zb=0;$b=[];w.Cc();Bb=0;Cb=[];document.documentElement.className=\"js no-treesaver\";document.documentElement.style.display=\"bloc...
[ "0.57438844", "0.5740238", "0.5717855", "0.5543924", "0.5498265", "0.5478171", "0.5478171", "0.5473743", "0.54596794", "0.5441342", "0.53987074", "0.5384454", "0.5363836", "0.53620183", "0.5354402", "0.5353347", "0.534806", "0.5344531", "0.5340452", "0.53318995", "0.5325146",...
0.0
-1
I stole this from grafanazabbix, err, I mean, I was inspired by grafanazabbix ;)
function getMetricNames(scope, metricList) { return _.uniq(_.map(scope.metric[metricList], 'name')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "static final private internal function m106() {}", "function test_host_tagged_crosshair_op_vsphere65() {}", "protected internal function m252() {}", "static private internal function m121() {}", "static private protected intern...
[ "0.6002249", "0.5818521", "0.54014605", "0.5398038", "0.53063804", "0.5233309", "0.5224012", "0.5172193", "0.5108844", "0.50725836", "0.50518954", "0.49987754", "0.4975756", "0.4943721", "0.4905448", "0.49024722", "0.48846832", "0.4861071", "0.48471314", "0.48334852", "0.4815...
0.0
-1
given restrictions provided, make a reduced list of products prices should be included in this list, as well as a sort based on price
function restrictListProducts(prods, restriction, organic) { restricted_prods = []; for (let i=0; i<prods.length; i+=1) { if ((restriction["nut-free"] == true && restriction["lactose-free"] == false) && (prods[i].nut == false)){ _organicCheck(prods[i],organic); } else if ((restriction["lactose-free"] == true && restriction["nut-free"] == false) && (prods[i].lactose == false)){ _organicCheck(prods[i],organic); } else if((restriction["lactose-free"] == true && restriction["nut-free"] == true) && (prods[i].lactose == false && prods[i].nut == false)) { _organicCheck(prods[i],organic); } else if(restriction["none"] == true){ _organicCheck(prods[i],organic); } } return restricted_prods; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction == \"lactose\") &&(prods[i].LactoseFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"noix\") && (prods[i].noixfree == true)){\n\t\t...
[ "0.7482795", "0.74501616", "0.73814726", "0.73162377", "0.7304043", "0.71559083", "0.7155139", "0.69967884", "0.6921019", "0.6907436", "0.6877552", "0.6857144", "0.6806587", "0.6663314", "0.6643377", "0.6575873", "0.6495819", "0.6343532", "0.6343085", "0.6339936", "0.6249249"...
0.62000644
24
Is the final check for organicness, before adding to array, to be used in RestrictListProducts function
function _organicCheck(item, organicBool){ if(organicBool.checked && item.organic == true){ restricted_prods.push(item); } else if (!(organicBool.checked)) { restricted_prods.push(item); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restrictListProducts(prods, restriction, organic) {\n\tvar product_information = [];\n if (organic){\n\n for (let i=0; i<prods.length; i+=1) {\n if ((restriction == \"lactosenutfree\") && (prods[i].lactosefree) && (prods[i].nutfree) && (prods[i].organic)){\n product_in...
[ "0.64424646", "0.6329203", "0.6263789", "0.6247003", "0.6152083", "0.6087974", "0.59763646", "0.59583944", "0.5938998", "0.59161246", "0.57905895", "0.57601166", "0.5672675", "0.5606312", "0.5566219", "0.55474746", "0.5512951", "0.5480384", "0.54802597", "0.54764855", "0.5463...
0.6496614
0
Calculate the total price of items, with received parameter being a list of products
function getTotalPrice(chosenProducts) { totalPrice = 0; for (let i=0; i<products.length; i+=1) { if (chosenProducts.indexOf(products[i].name) > -1){ totalPrice += products[i].price; } } return Math.round((totalPrice * 100)) /100; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateTotalPrice(orderedItems) {\n let totalPrice = 0;\n // Пиши код ниже этой строки\n\n \n\n orderedItems.forEach(function( orderedItems, index,){\n \ttotalPrice += orderedItems;\n }); \n // Пиши код выше этой строки\n return totalPrice;\n}", "function calcTotalPrice(products) {\n\t// YOUR CODE...
[ "0.78249115", "0.78034604", "0.7787222", "0.7775861", "0.7759844", "0.7598756", "0.74956566", "0.7429122", "0.7429122", "0.7429122", "0.7429122", "0.7429122", "0.7429122", "0.7429122", "0.7429122", "0.7429122", "0.7429122", "0.74073166", "0.737139", "0.737139", "0.737139", ...
0.761731
5
Sends response messages via the Send API
function callSendAPI(sender_psid, response) { // Construct the message body let request_body = { recipient: { id: sender_psid, }, message: response, }; // Send the HTTP request to the Messenger Platform request( { uri: 'https://graph.facebook.com/v6.0/me/messages', qs: { access_token: process.env.FB_PAGE_TOKEN }, method: 'POST', json: request_body, }, (err, res, body) => { if (!err) { // console.log('message sent!'); } else { console.error('Unable to send message:' + err); } } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendResponse(senderID , jsonData, lastStopRequested) {\n var messageData = {\n recipient: {\n id: senderID\n },\n message: {\n text: jsonData\n }\n }\n callSendAPI(messageData, lastStopRequested);\n}", "static postReponse() {\n const reqMessage = JSON.parse(this.req.chunk...
[ "0.75831354", "0.73205674", "0.71146065", "0.68773854", "0.6876641", "0.6871221", "0.68392235", "0.68295956", "0.6826784", "0.67966646", "0.679027", "0.67901593", "0.67826563", "0.6779545", "0.67753196", "0.6773598", "0.67704296", "0.6745146", "0.67447704", "0.66966933", "0.6...
0.6667788
24
map our sessionActions to class props
function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(sessionActions, dispatch) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_registerToActions(action) { \n switch(action.actionType) {\n case ActionTypes.CLASSES_FETCHED:\n this._setClasses(action.payload);\n break;\n case ActionTypes.CLASS_CREATED:\n ClassActions.fetchClasses();\n break;\n ...
[ "0.5642977", "0.55315065", "0.55312365", "0.5512893", "0.55089194", "0.5462351", "0.54150105", "0.5411497", "0.5410926", "0.54068655", "0.53695333", "0.5351256", "0.53392726", "0.53357464", "0.5313728", "0.53108215", "0.53049886", "0.5302996", "0.5293588", "0.5250595", "0.524...
0.6616551
0
render the children of this component the children of this component is an arrow function that takes the count and inrementCount and renders the original component and passes the count and inrementCount to it
render() { return ( <div> {this.props.children(this.state.count, this.incrementCount)} </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n return (\n <Child handleClick={() => this.updateCount()} count={this.state.count}>\n Count\n </Child>\n );\n }", "render() { \n console.log(\"props\",this.props)\n return ( \n <div>\n <div className=\"title m-2\">{this.props.children}</...
[ "0.6643785", "0.66287214", "0.65983915", "0.658134", "0.65642995", "0.6360201", "0.62864524", "0.62839437", "0.62774336", "0.62731767", "0.6217829", "0.62085485", "0.61763597", "0.61495376", "0.61429685", "0.6142749", "0.6121322", "0.60920495", "0.6079362", "0.6040119", "0.60...
0.7884897
0
================== ACTIONS ========================== function that displays questions on the page
function renderQuestion() { // display $(".list-group-item").removeClass("correct").removeClass("incorrect"); // allows options to be selected $(".option-list").on("click", ".list-group-item", answerSelected); // checks to make sure there are still questions left (if not, proceed to end page) if (questionIndex <= (questionArr.length - 1)) { // clears default timer so game doesn't explode clearTimeout(defaultTimer); // lets user see answer and proceed to next question without clicking anything defaultTimer = setTimeout(function() { // turns option event off to prevent excess clicking $(".option-list").off("click", ".list-group-item", answerSelected); // shows answer to user showAnswerDefault(); console.log("Timeout expired", questionIndex); }, 25000); // display $("#question-panel").text(questionArr[questionIndex].text); $("#o-a .opt").text(questionArr[questionIndex].options[0]); $("#o-b .opt").text(questionArr[questionIndex].options[1]); $("#o-c .opt").text(questionArr[questionIndex].options[2]); $("#o-d .opt").text(questionArr[questionIndex].options[3]); console.log("Game is still going!"); } else { // turns option event off to prevent excess clicking $(".option-list").off("click", ".list-group-item", answerSelected); // display $("#question-panel").text("Show's over, cheapskate! Play again?"); $(".o-label").css("display", "none"); $("#o-c").css({"opacity": "0", "cursor": "default"}); $("#o-d").css({"opacity": "0", "cursor": "default"}); $("#o-a .opt").text("Correct answers... " + correctA); $("#o-b .opt").text("Incorrect answers... " + incorrectA); $(".reset-button").css("display", "inline-block"); console.log("Show's over, cheapskate!"); // allows reset button to be pressed $(".reset-button").on("click", resetGame); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestion() {\n let question = STORE.questions[STORE.currentQuestion];\n updateScoreAndQuestionCounter();\n\n $(\"main\").html(generateQuestionTemplate(question.question));\n showOptions();\n $(\"#next\").hide();\n}", "function displayQuestion() {\n\t\t\tstartTime30();\t\n\t\t\t$(\"#question\...
[ "0.78059906", "0.7672959", "0.7589917", "0.7530256", "0.75223494", "0.75202847", "0.7515317", "0.7488949", "0.7477396", "0.74604034", "0.74456733", "0.7399057", "0.73940265", "0.7370937", "0.7369974", "0.73157674", "0.73124075", "0.73123854", "0.73001903", "0.7297335", "0.728...
0.0
-1
function that displays correct answer when user clicks option; moves onto next q
function showAnswer(clicked){ // if answer is correct if (clicked.attr("id") === questionArr[questionIndex].answer[0]) { correctA++; // display $("#question-panel").html("CORRRRRECT! The answer is... " + "<em>" + questionArr[questionIndex].answer[1] + "</em>"); clicked.addClass("correct"); console.log("Plankton voice: CORRRREECT!"); } // if answer is false else { incorrectA++; // display $("#question-panel").html("Tartar sauce! The correct answer was... " + "<em>" + questionArr[questionIndex].answer[1] + "</em>"); clicked.addClass("incorrect"); $("#" + questionArr[questionIndex].answer[0]).addClass("correct"); console.log("Dwight Schrute voice: FALSE!"); } // delay on next question so you have time to read answer setTimeout(function() { questionIndex++; renderQuestion(); console.log("Answer displayed", questionIndex); }, 3500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextQuestion(){\n var n = Math.floor(Math.random() * q.length);\n q[n].display1();\n var ans = prompt('Please select the correct answer. (tap \\'exit\\' to exit)');\n \n if (ans !== 'exit'){\n q[n].checkAnswer(parseInt(ans),keepScore);\n nextQuestio...
[ "0.784939", "0.76016074", "0.7574467", "0.7516448", "0.74989897", "0.74818283", "0.74133205", "0.7406794", "0.7386207", "0.73774666", "0.7353476", "0.7315085", "0.73085976", "0.72649455", "0.72552776", "0.7246592", "0.7236547", "0.72318804", "0.72290313", "0.72008705", "0.719...
0.0
-1
function that displays correct answer when user doesn't press anything; moves onto next q
function showAnswerDefault () { incorrectA++; // display $("#question-panel").html("Fish paste! The correct answer was... " + "<em>" + questionArr[questionIndex].answer[1] + "</em>"); $("#" + questionArr[questionIndex].answer[0]).addClass("correct"); console.log("Dwight Schrute voice: NO ANSWER GIVEN!"); // delay on next question so you have time to read answer setTimeout(function() { questionIndex++; renderQuestion(); }, 3500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextQuestion(){\n var n = Math.floor(Math.random() * q.length);\n q[n].display1();\n var ans = prompt('Please select the correct answer. (tap \\'exit\\' to exit)');\n \n if (ans !== 'exit'){\n q[n].checkAnswer(parseInt(ans),keepScore);\n nextQuestio...
[ "0.775944", "0.7193659", "0.7093905", "0.7076989", "0.7073653", "0.69933707", "0.69909817", "0.69753826", "0.69733995", "0.69618833", "0.6952267", "0.6949442", "0.6943399", "0.69044816", "0.69042665", "0.6892609", "0.68921375", "0.6881337", "0.68490577", "0.68313956", "0.6816...
0.66410434
41
function to modify the yaxis ticks
function modifyYaxisName(z){ var notation =[]; for (var i= 0; i<z.length; i++){ notation.push(`OTU ${z[i]}`) } return notation;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function customYAxis( g ) {\n\t\t// move axis to align properly with the bottom left corner including tick values\n\t\tchart.attr( \"transform\", \"translate(\" + ( -chart_margins.left / 2 ) + \", 0)\" )\n\t\tchart.call( yAxis );\n\t\tchart.select( \".domain\" );\n\t\tchart.attr( \"text-anchor\", \"end\" );\n\t\tc...
[ "0.7569453", "0.7556463", "0.74414724", "0.7293451", "0.7286599", "0.72845596", "0.72440237", "0.7234491", "0.7220298", "0.7209505", "0.71976674", "0.71720177", "0.71532005", "0.7120985", "0.7065339", "0.70631766", "0.7059973", "0.705938", "0.70574737", "0.70571864", "0.70549...
0.0
-1
function to shorten the labels' text
function modifyLabels(name) { var shortLabels = []; for (var i = 0; i < name.length; i++) { var stringName = name[i].toString(); var splitLabels = stringName.split(";"); if (splitLabels.length > 1) { shortLabels.push(splitLabels[splitLabels.length - 1]); } else { shortLabels.push(splitLabels[0]); } } return shortLabels; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function label(label) {\n return function(s) {\n var delta = s.length - label.length;\n return strRepeat (' ', Math.floor (delta / 2)) + label +\n strRepeat (' ', Math.ceil (delta / 2));\n };\n }", "function setBigLabelsProperties(label, text){\n label.style.backgroundColor = \"#4...
[ "0.6853646", "0.6770334", "0.66363716", "0.65640783", "0.6360337", "0.6358234", "0.6248246", "0.6202889", "0.619546", "0.6188341", "0.61338395", "0.61211383", "0.6109526", "0.6108328", "0.6087851", "0.6076325", "0.60602385", "0.6060108", "0.6048226", "0.604727", "0.60344946",...
0.6129448
11
Working with erase form.
function select_session_for_logout(session_id){ document.getElementById('user_sessions_logout_data').value = ''; document.getElementById('user_sessions_logout_data').value = session_id; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function eraseFun(evt){\n if(evt.target.id === 'backspace'){ \n num = num.substring(0, num.length -1);\n screen.value = num;\n }\n // The CE button clears the entire string\n if(evt.target.id === 'clearNum'){\n num = '';\n screen.value = runningTotalInt;\n }\n // The C...
[ "0.65362966", "0.64395463", "0.64105535", "0.62217593", "0.6209199", "0.60521364", "0.6039817", "0.6035422", "0.6007958", "0.6007324", "0.59783643", "0.5971119", "0.5965625", "0.5953932", "0.5936535", "0.5925425", "0.59030104", "0.58825594", "0.5875108", "0.58619374", "0.5837...
0.0
-1
for some reason, the interaction between the random seed and the webgl pseduorandom function produces unpleasant looking artifacts (i.e. diagonal and occasionally horizontal lines) for certain values of the random seed the main cause seems to be when the random seed is less than 0.27 or so this fix doesn't 100% solve the problem (as there seems to be other causes as well), but it is rare enough to be acceptable for now
function generateRandomSeed(){ return Math.random() * 0.73 + 0.27; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function random () {\n\t\n\tseed = 312541332155 * (4365216455 + seed) % 7654754253243312;\n\t\n\treturn 0.0000001 * (seed % 10000000);\n\t\n}", "function srandom() {\n randomSeed = (randomSeed * 9301 + 49297) % 233280;\n return randomSeed / 233280;\n}", "function rnd() \n{\n\t\t\n rnd.seed = (rnd.seed...
[ "0.6522048", "0.6380164", "0.6356211", "0.6312801", "0.6273608", "0.6235491", "0.61811876", "0.6104483", "0.60932875", "0.60890627", "0.6079582", "0.607377", "0.6056277", "0.6053681", "0.6040202", "0.59780675", "0.5958687", "0.59291494", "0.59094006", "0.5903984", "0.5903626"...
0.6948111
0
Create a RomanNumerals helper that can convert a roman numeral to and from an integer value. The class should follow the API demonstrated in the examples below. Multiple roman numeral values will be tested for each helper method. Modern Roman numerals are written by expressing each digit separately starting with the left most digit and skipping any digit with a value of zero. In Roman numerals 1990 is rendered: 1000=M, 900=CM, 90=XC; resulting in MCMXC. 2008 is written as 2000=MM, 8=VIII; or MMVIII. 1666 uses each Roman symbol in descending order: MDCLXVI. Examples: RomanNumerals.toRoman(1000); // should return 'M' RomanNumerals.fromRoman('M'); // should return 1000
function RomanNumeralsHelper() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static toRoman(num) {\n \n // Copy the input to a variable called \"int.\"\n var int = num;\n \n // Initialize empty array to hold the roman numerals that will be used in the solution.\n var convert = [];\n \n // Initialize a dictionary for all combinations of roman numerals...
[ "0.7701473", "0.7673229", "0.7652371", "0.7606942", "0.74909365", "0.7477582", "0.7460199", "0.73037314", "0.7275474", "0.7255527", "0.72379744", "0.7234946", "0.7206486", "0.7188408", "0.715548", "0.711843", "0.7118097", "0.70999044", "0.7031964", "0.70021874", "0.69848704",...
0.7541177
4
This is called when you click on the map. Go and try click now.
handleMapClick(event) { let { markers } = this.state; markers = update(markers, { $push: [ { position: event.latLng, defaultAnimation: 2, key: Date.now(), // Add a key property for: http://fb.me/react-warning-keys }, ], }); this.setState({ markers }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _mapClick() {\n infoBoxManager.turnOffInfoBoxStates();\n infoBoxManager.updateInfoBoxState(_overMarker, 0);\n}", "function clickMap(event) {\n u('#introduction').remove();\n clickTimer = setTimeout(function () {\n if (swallowClick) {\n swallowClick = false;\n return;\n }\n swallow...
[ "0.77199215", "0.740433", "0.723734", "0.716919", "0.69429654", "0.6904967", "0.6897565", "0.6871738", "0.6833234", "0.6832017", "0.6821699", "0.67967635", "0.67821723", "0.67805374", "0.67613673", "0.6750715", "0.6687423", "0.66783965", "0.66772765", "0.66548586", "0.6640811...
0.0
-1
Find student by name and english within (min,max)
function find() { var str = prompt("Tìm theo thên sinh viên: "); var min = parseFloat(prompt("Min Điểm Anh Văn: ")); var max = parseFloat(prompt("Max Điểm Anh Văn: ")); var found = []; for(var i=0; i<list.length; i++) { var logic = list[i].name.includes(str) && (min <= list[i].english) && (list[i].english <= max); //var logic = (list[i].name == name && min<= list[i].english && list[i].english <=max); if (logic) { found.push(list[i]); } } if(!found.length) { console.log("Không tìm thấy !"); return; } console.log(`Các sinh viên có tên '${name}' mà điểm tiếng Anh nằm trong khoảng (${min}, ${max})`); console.table(found); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findBestStudent(sortA,h){\n //read each object inside of Array.\n var x;\n var txt = \"\";\n var arrayBestStudent;\n for (i=0; i < sortA.length;i++){\n var alu = sortA[i];\n for (x in alu) {\n if(alu.grade >= h){\n txt ...
[ "0.53605336", "0.5236415", "0.52123845", "0.52116615", "0.51960886", "0.51480806", "0.5130726", "0.51219517", "0.5118432", "0.5090784", "0.5089608", "0.5087221", "0.4942091", "0.49295577", "0.49284372", "0.4927867", "0.4925993", "0.4876195", "0.48691663", "0.48641905", "0.486...
0.6514899
0
Constructor method for initializing the state
constructor(props) { super(props); //Generating tiles data and initializing tile properties //{0:{letter:'D',status:'hide',count:0},1:{...},....} let tilesGenerated = this.getInitialTiles() this.state = {tileData: tilesGenerated}; // Attribution http://ccs.neu.edu/home/ntuck/courses/2019/09/cs5610/notes/05-react/ this.handleClick = this.handleClick.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { \r\n super();\r\n this.state = {};\r\n }", "constructor() {\n\n // we use the super keyword and method to call the constructor of a parent class\n // this gives us access to the properties of the parent class. It MUST \n // be used BEFORE the 'this' keyword\n...
[ "0.7974465", "0.7888749", "0.77192265", "0.768085", "0.76338804", "0.7605623", "0.7566743", "0.75522894", "0.7388755", "0.7381028", "0.7376605", "0.7364394", "0.7355025", "0.7338865", "0.7338865", "0.7338865", "0.7338865", "0.7338865", "0.73156303", "0.7313952", "0.73010826",...
0.0
-1
This method serves the purpose of updating any tile detail i.e changing state based on given params data : state object, ids : ids of tiles to be modified, status : status with which tiles should be updated incrementCount : to increment or not increment count
updateTiles(data, ids, status, incrementCount = false) { //Iterating through provided ids _.map(ids, function (id) { //Updating status of given ids with given state data[id]['status'] = status //For complete this is will result in additional score point to prevent it we have this condition if (status != 'complete' && incrementCount) { data[id]['count']++ } }) //Handling for complete case if (status == 'complete' && incrementCount) { data[ids[1]]['count']++ } //Updating the state with updated information this.setState({tileData: data}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleClick(id) {\n //taking the state object in another variable\n let data = this.state.tileData;\n //Getting the currently active tiles\n let currentActive = _.filter(data, {'status': 'active'})\n //To prevent actions during delay\n if (currentActive.length < 2) {\n ...
[ "0.6142494", "0.57734376", "0.5750621", "0.57186747", "0.5547951", "0.5534367", "0.55251896", "0.5505066", "0.5447544", "0.5415714", "0.5391554", "0.5390321", "0.53763944", "0.5337144", "0.5305733", "0.53017634", "0.5288924", "0.52837616", "0.5274543", "0.5256012", "0.5255083...
0.84763926
0
This method is to handle the click of tiles. Based on the state of game, the new state will be generated here.
handleClick(id) { //taking the state object in another variable let data = this.state.tileData; //Getting the currently active tiles let currentActive = _.filter(data, {'status': 'active'}) //To prevent actions during delay if (currentActive.length < 2) { //For matched tiles nothing is to be done if (data[id]['status'] != 'complete') { //Finding the active tile index/key let activeKey = _.findKey(data, {'status': 'active'}) //Clicking on currently active tile again if (activeKey != id) { //If this is the second active tile check for next scenario i.e match or not if (activeKey != undefined) { //For match condition if (data[activeKey]['letter'] == data[id]['letter']) { this.updateTiles(data, [activeKey, id], 'complete', true) } else { //For not match condition //First show the selected tiles as active this.updateTiles(data, [id], 'active', true) //Update state after the delay setTimeout(() => { this.updateTiles(data, [activeKey, id], 'hide') }, 1000); } } else { //For first active tile update the state with active this.updateTiles(data, [id], 'active', true) } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tileClick() {\n\tvar position = parseInt(this.dataset.position);\n\tif (board.isValidMove(position)) {\n\t\tboard.placeTile(current, position);\n\t\tthis.getElementsByClassName('tile-image')[0].src = current.img;\n\t\tif (board.isWinningState(current, position)) {\n\t\t\tend(current);\n\t\t} else if (boar...
[ "0.7156538", "0.70725775", "0.69551", "0.6948739", "0.69445723", "0.689793", "0.68488145", "0.6846115", "0.6833589", "0.6792237", "0.6714962", "0.6714962", "0.6707241", "0.6697729", "0.6674949", "0.6587558", "0.65588075", "0.65304506", "0.65228873", "0.6517864", "0.6499317", ...
0.7425664
0
For resetting or restarting the game
reset() { let tilesGenerated = this.getInitialTiles() this.setState({tileData: tilesGenerated}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restart(){\n myGameArea.reset();\n}", "function restart() {\n game.state.restart();\n}", "function actionOnResetClick () {\n gameRestart();\n }", "function restartGame()\n{\n\tSnake.reset();\n\tMouse.changeLocation();\n\tScoreboard.reset();\n\t\n\tenterState(\"countdown...
[ "0.84975654", "0.8480572", "0.84599066", "0.84312546", "0.8280107", "0.82531106", "0.8194695", "0.8164885", "0.8139179", "0.81295276", "0.8114399", "0.8091073", "0.80888987", "0.80799156", "0.80610657", "0.8055116", "0.8008426", "0.79855466", "0.79724264", "0.79675543", "0.79...
0.0
-1
Utility to get score for the game
getScore() { let score = 0; //loop through all the data and get total score _.map(this.state.tileData, function (key, value) { score += key['count']; }); return score; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getScore() {\n\treturn parseInt(currentScore);\n}", "function getScore(){\n return score\n}", "function pGetScore () { //private (pName) functions - not accessible anywhere but in here\n return score;\n }", "function score() {\n\treturn `Human: ${playerPoints} Computer: ${computerPoints}`;\n}...
[ "0.81512415", "0.7906938", "0.7752494", "0.7547123", "0.7482738", "0.7304744", "0.72017646", "0.71558285", "0.7147191", "0.71316445", "0.71222734", "0.70741534", "0.7069578", "0.7051748", "0.70471334", "0.70044404", "0.7001239", "0.6986462", "0.69627994", "0.6961488", "0.6961...
0.7016804
15
Utility to get game status
fetchGameStatus(STATUS) { //Get the number of tiles completed let completedTiles = _.filter(this.state.tileData, {'status': 'complete'}) //Game 0 implies not started case if (this.getScore() == 0) { return STATUS.BEGIN; } else if (completedTiles.length == 16) { //All tiles matched case return STATUS.COMPLETE; } return STATUS.INPROGRESS; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getGameStatus() {\n this.setMethod('GET');\n this.setPlayerId();\n return this.getApiResult(`${Config.PLAY_API}/${this.playerId}/status`);\n }", "function status() {\n console.log(`Active : ${game.active}`)\n console.log(`Points : ${game.points}`)\n console.log(`Strikes : ${game.strike...
[ "0.8152759", "0.7751369", "0.72937876", "0.7205052", "0.6953415", "0.6897468", "0.67789555", "0.67669314", "0.6752943", "0.6713045", "0.6713045", "0.67113835", "0.6671745", "0.66654474", "0.6644915", "0.66004276", "0.6592144", "0.6548108", "0.65450794", "0.6535144", "0.652914...
0.7580793
2
Render utility to generate tiles
generateGridRows() { // Object to store the tiles let grid_rows = [] let grid_ind = 1 // For each row for (let row = 1; row <= 4; row++) { let col_grids = [] //For each column for (let col = 1; col <= 4; col++) { // Referred to reactjs documentation for handle click let id = grid_ind++ // To assign class based on state // Useful for styling let classVar = this.state.tileData[id]['status'] == 'hide' ? '' : 'tile-' + this.state.tileData[id]['status'] col_grids.push(<td key={id} id={id} className={'column column-25 tile ' + classVar} onClick={() => { this.handleClick(id) }}>{this.state.tileData[id]['status'] != 'hide' ? this.state.tileData[id]['letter'] : ''}</td>) } grid_rows.push(<tr key={row} className="row">{col_grids}</tr>) } return grid_rows }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderTiles() {\n removeChildren(tilesContainer);\n for (var i = 0, length = tiles.length; i < length; ++i) {\n tilesContainer.appendChild(tiles[i].elem);\n }\n}", "function render() {\n renderRegistry();\n renderDirectory();\n renderOverride();\n}", "function createTiles(){\n\t\n\t\n ...
[ "0.6797765", "0.63694143", "0.63594025", "0.6326712", "0.6325823", "0.63210016", "0.6267395", "0.6267395", "0.6267395", "0.62603503", "0.6249606", "0.62444717", "0.6240857", "0.6232201", "0.6211645", "0.6190961", "0.6168772", "0.61627746", "0.6161931", "0.6124037", "0.6110909...
0.0
-1
Utility to get the game instruction/reset/restart button based on game status
renderInstructionSection(gameStatus, STATUS) { if (gameStatus == STATUS.BEGIN) { return <span className="game-instruction">Click on any tile to begin the game</span> } else { let buttonLabel = (gameStatus == STATUS.COMPLETE) ? " Restart Game " : " Reset Game " let button = <button className="gameplay-btn" onClick={this.reset.bind(this)}>{buttonLabel}</button> return button } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getButtonStatusText(challenge) {\n const [CCSTB, CCFB] = [this.Constants.STARTED.BUTTONS, this.Constants.FINISHED.BUTTONS];\n\n const uScore = this.getUser(challenge).score;\n const oScore = this.getOpponent(challenge).score;\n\n let statusTxt = null;\n\n if (ChallengeUtils.isNewCha...
[ "0.6413001", "0.6261465", "0.62492067", "0.6249016", "0.6231306", "0.62172127", "0.6195295", "0.6194462", "0.61833894", "0.6174551", "0.61691624", "0.61605155", "0.6137381", "0.61365545", "0.61361325", "0.6135666", "0.6132148", "0.61310554", "0.6119435", "0.6119396", "0.61192...
0.68386793
0
Utility for score rendering area. Not to display before the game begin
renderScoreArea(gameStatus, STATUS) { if (gameStatus != STATUS.BEGIN) { //When game completes let scoreLabel = (gameStatus == STATUS.COMPLETE) ? "Final Score" : "Score" let score = <span className="column column-100"><h1><u>{scoreLabel}</u></h1><h2>{this.getScore()}</h2></span>; return score } return <span></span> }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scoreRender(){ \n scoreDiv.html(\"You got \" + score + \"/10 correct!\");\n}", "function render(){\n renderScores();\n adjustTurn();\n getWinner();\n clearSelection();\n}", "function renderScoreGraphics () {\n var originalFont = SI.game.Renderer.getScene().getContext().font;\n var o...
[ "0.7573157", "0.7391558", "0.7367558", "0.73445344", "0.72942644", "0.7290855", "0.7253499", "0.7232288", "0.7207954", "0.72028106", "0.71698767", "0.71345186", "0.71263814", "0.71216327", "0.71057963", "0.70842415", "0.7072993", "0.7070774", "0.70565134", "0.7042944", "0.700...
0.67100775
45
================================================================================ Prepares the view for displaying the results. ================================================================================
function prepareView() { //loadScript(); resultTap(1); drawCrater(-1);//-1 as nothing has been selected yet. /////////////// lang = getParameterByName("lang"); if (lang == "") lang = "English"; var param = getParameterByName("dist"); if (param == "" ) dist = 0; else dist = parseInt(param); param = getParameterByName("diam"); if (param == "") diam = 0; else diam = parseInt(param); param = getParameterByName("trag") if (param == "") traj = 90; else traj = parseInt(param); param = getParameterByName("velo"); if (param == "") velo = 0; else velo = parseInt(param); param = getParameterByName("pjd"); if (param == "") pjd = 0; else pjd= parseInt(param); param = getParameterByName("tjd") if (param == "") tgd = 0; else tgd = parseInt(param); //else tgDens++; param = getParameterByName("wlvl"); if (param == "") wlvl = 0; else wlvl = parseInt(param); /////////////// /* $.ajaxSetup({ cache: false }); $.ajax({ type: "GET", url: "lang/" + lang +".xml", dataType: "xml", success: parseXml }); */ var browserHeight = $(window).height(); if( browserHeight < 600) { document.getElementById('header').style.display = 'none' document.getElementById('footer').style.display = 'none'; } }//================================================================================
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initializeResults() {\n resultsContainer.empty();\n var restaurantsToAdd = [];\n for (var i = 0; i < restaurants.length; i++) {\n restaurantsToAdd.push(createResults(restaurants[i]));\n }\n resultsContainer.append(restaurantsToAdd);\n }", "function displa...
[ "0.6344768", "0.6292762", "0.5986847", "0.59257215", "0.59213674", "0.5910389", "0.58190703", "0.5777775", "0.57730466", "0.57617235", "0.5760622", "0.57475954", "0.56855047", "0.56663126", "0.5661669", "0.56513184", "0.5636928", "0.56290144", "0.5624522", "0.56067926", "0.55...
0.60822725
2
Normalizes the tile URL so that tiles repeat across the x axis (horizontally) like the standard Google map tiles.
function getHorizontallyRepeatingTileUrl(coord, zoom, urlfunc) { var y = coord.y; var x = coord.x; // tile range in one direction range is dependent on zoom level // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc var tileRange = 1 << zoom; // don't repeat across y-axis (vertically) if (y < 0 || y >= tileRange) { return null; } // repeat across x-axis if (x < 0 || x >= tileRange) { x = (x % tileRange + tileRange) % tileRange; } return urlfunc({x:x,y:y}, zoom) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getHorizontallyRepeatingTileUrl(coord, zoom, urlfunc) {\n var y = coord.y;\n var x = coord.x;\n \n // tile range in one direction range is dependent on zoom level\n // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc\n var tileRange = 1 << zoom;\n \n // don't repeat acr...
[ "0.6843974", "0.61374843", "0.58517843", "0.56534225", "0.55879474", "0.556825", "0.5466736", "0.5306864", "0.5253604", "0.52235794", "0.516368", "0.5154958", "0.51505864", "0.5102653", "0.51008755", "0.5099507", "0.5058561", "0.5058543", "0.5027266", "0.50181586", "0.5017844...
0.6820857
1
Use regular expressions to extract the parameters by name
function getParameterByName(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.search); if(results == null) return ""; else return decodeURIComponent(results[1].replace(/\+/g, " ")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "extractParameters(url, routePattern) {\n var result = {};\n let names = routePattern.trimAll(\"/\").split(\"/\");\n let values = url.trimAll(\"/\").split(\"/\");\n\n for (var i=0; i<names.length; i++) {\n var name = names[i];\n if ((new RegExp(\"<.+?>\")).test(name...
[ "0.6831164", "0.65833646", "0.64589727", "0.6265143", "0.62453675", "0.62131315", "0.61607796", "0.6096688", "0.5997581", "0.59180355", "0.5914052", "0.58954144", "0.5886781", "0.5879769", "0.5852887", "0.5850394", "0.5848297", "0.58256835", "0.5807743", "0.57947236", "0.5784...
0.0
-1
========================================================================================== Called when the go back button is pressed. ==========================================================================================
function goBack() { window.location = "input.html?lang=" + lang +"&dist=" + dist +"&diam=" + diam + "&trag=" + traj + "&velo=" + velo + "&pjd=" + pjd + "&tjd=" + tgd + "&wlvl=" + wlvl + "&planet=" + planet; }//=========================================================================================
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onBack() {\n resetPageState();\n }", "function goBack() {\n\t\t\t$window.history.back();\n\t\t}", "function goBack() {\n\t\ttogglePage();\n\t\tdisposeThrownShurikens();\n\t\tupdateThrownShurikenCount();\n\t\tcleanBelt();\n\t}", "function onBackKeyDown() {\n\t//alert(\"Back Pressed\");\n\tg...
[ "0.85363877", "0.81332374", "0.8117902", "0.809075", "0.80466723", "0.79605484", "0.7934213", "0.7921901", "0.7905417", "0.78705794", "0.78627366", "0.7856675", "0.78442496", "0.783533", "0.783533", "0.783533", "0.7789205", "0.77861273", "0.776468", "0.7760706", "0.77428174",...
0.0
-1
================================================================================== Adds a crater on the map at the selected location to the calculated size. ==================================================================================
function addCrater(location_) { var location1 = location_; dataProvider.setCbSelectDepthObject(parseInt(selectedBuilding)); var lat = location1.lat(); var lng = location1.lng(); dataProvider.setLatitude(parseFloat(lat)); dataProvider.setLongitude( parseFloat(lng)); dataProvider.setCbLocation(parseInt(cmbLocation)); lox = location_; //if crater exists remove from map. if (crater != null ) crater.setMap(null); var zoom = map.getZoom(); var lat = lox.lat(); var lng = lox.lng(); /* if (planet=='Earth') { var imageBounds = new google.maps.LatLngBounds ( new google.maps.LatLng(lat-0.09,lng-0.15), new google.maps.LatLng(lat+0.09,lng +0.15) ); crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds); } else if (planet=='Moon') { var imageBounds = new google.maps.LatLngBounds ( new google.maps.LatLng(lat-0.45,lng-0.75), new google.maps.LatLng(lat+0.45,lng +0.75) ); crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds); } else if (planet=='Mars') { var imageBounds = new google.maps.LatLngBounds ( new google.maps.LatLng(lat-0.45,lng-0.75), new google.maps.LatLng(lat+0.45,lng +0.75) ); crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds); } */ var imageBounds = craterBounds(lat,lng, dataProvider.impactor.crDiam); crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds); // //Add new ground overlay for the crater. crater.setMap(map); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function increaseSize() {\n\tif (selectedShape) {\n\t\tselectedShape.resize(5);\n\t\tdrawShapes();\n\t}\n}", "radiusResized() {\n\t\tif( this.searchRadius.getRadius() > locsearch.map_attributes.max_radius * 1000 ) {\n\t\t\tthis.searchRadius.setRadius( locsearch.map_attributes.max_radius * 1000 );\n\t\t}\n\t\tthi...
[ "0.5915427", "0.590992", "0.5751164", "0.57064664", "0.57052106", "0.5687674", "0.5662098", "0.5610895", "0.55383986", "0.5504745", "0.54977345", "0.5489173", "0.5481716", "0.54469305", "0.5397067", "0.5388447", "0.5388419", "0.5376396", "0.5376353", "0.5343446", "0.5329552",...
0.6280322
0
================================================================================= =================================================================================== Calculate the crater bounds. ===================================================================================
function craterBounds(lat_, lon_ ,craterDiameter){ var lat1 = lat_; var lon1 = lon_; var d = Math.SQRT2*craterDiameter/2.0; var R = 6370000; var brng1 = 45*Math.PI/180; var brng2 = 225*Math.PI/180; lat1 = lat1*Math.PI/180; lon1 = lon1*Math.PI/180; var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng1) ); var lon2 = lon1 + Math.atan2(Math.sin(brng1)*Math.sin(d/R)*Math.cos(lat1), Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2)); var lat3 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng2) ); var lon3 = lon1 + Math.atan2(Math.sin(brng2)*Math.sin(d/R)*Math.cos(lat1), Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2)); lat2 = lat2/(Math.PI/180); lon2 = lon2/(Math.PI/180); lat3 = lat3/(Math.PI/180); lon3 = lon3/(Math.PI/180); var bound = new google.maps.LatLngBounds( new google.maps.LatLng(lat3, lon3), new google.maps.LatLng(lat2,lon2)); return bound; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get bounds() {}", "function bounds() {\n return {\n start: conductor.displayStart(),\n end: conductor.displayEnd(),\n domain: conductor.domain().key\n };\n }", "get boundsValue() {}", "get localBounds() {}", "...
[ "0.681576", "0.6706417", "0.660061", "0.63839865", "0.63708615", "0.6307134", "0.62913907", "0.6281191", "0.61922103", "0.6177425", "0.6169913", "0.6135824", "0.6122678", "0.6122418", "0.6114216", "0.60479003", "0.6044865", "0.59958386", "0.59903866", "0.5989155", "0.5986858"...
0.7160708
0
======================================================================================= ====================================================================================== Scroll the map to a predefined location on the map ======================================================================================
function selectLocation(location) { cmbLocation = location; //if (map == null) return; // map = new google.maps.Map(document.getElementById('map_canvas'),mapOptions); if (map == null) initialize(); switch (location.selectedIndex) { case 1: map.setCenter(new google.maps.LatLng(51.390209,-3.179855), 11);//Cardiff break; case 2: map.setCenter(new google.maps.LatLng(51.495065,-0.282898), 11);//London break; case 3: map.setCenter(new google.maps.LatLng(48.767957,2.272797), 11);//Paris break; case 4: map.setCenter(new google.maps.LatLng(40.720201,-73.755341), 11);//New York break; case 5: map.setCenter(new google.maps.LatLng(34.988941,-110.99556), 11);//Berringer Meteor Crater, Arizona break; case 6: map.setCenter(new google.maps.LatLng(19.120841,19.267273), 11);//Aorounga, Chad , Africa break; case 7: map.setCenter(new google.maps.LatLng(19.093335,19.242731), 11);//Wolfe Creak, Austrailia break; case 8: map.setCenter(new google.maps.LatLng(-27.722436,16.369629), 11);//Roter Kamm, Namibia break; case 9: map.setCenter(new google.maps.LatLng(55.920354,-63.199539), 11);//Mistastin Lake, Canada break; case 10: map.setCenter(new google.maps.LatLng(6.50431,-1.378098), 11);//Bosumtwi, Ghana break; case 11: map.setCenter(new google.maps.LatLng(39.03572,73.464203), 12);//Kara-Kul, Tajikstan break; }//end switch }//=========================================================================================
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gotoMap() {\n $anchorScroll('map-canvas');\n }", "function scrollMapTo(x, y) {\n\t\tvar scl = eval(x) / this.minimap.xRate;\n\t\tvar sct = eval(y) / this.minimap.yRate;\n\t\tdocument.getElementById(MAP).scrollLeft = scl;\n\t\tdocument.getElementById(MAP).scrollTop = sct;\n\t}", "function scrol...
[ "0.8091349", "0.7295453", "0.6643882", "0.62716085", "0.62675714", "0.62139004", "0.6201851", "0.6195447", "0.6162689", "0.61540633", "0.61435235", "0.60954684", "0.6071221", "0.6055957", "0.60186976", "0.60186976", "0.60186976", "0.59974647", "0.59974647", "0.59974647", "0.5...
0.0
-1
============================================ Parse the XML for this page =============================================
function parseXml(xml) { console.log('parsing xml'); //var x = $(xml).find("btStart").text(); var x = $(xml).find("result").text(); $("#Crater_Size_Title").html(x); $("#Crater_Depth_Title").html(x); $("#Data_Title").html(x); x = $(xml).find("lblImpactVal").text(); $("#InputValues_Title").html(x); x = $(xml).find("htParameter").text(); $("#Thead_param").html(x); $("#Thead_param1").html(x); $("#Thead_param3").html(x); $("#Thead_param4").html(x); x = $(xml).find("htValue").text(); $("#Thead_value").html(x); $("#Thead_value1").html(x); $("#Thead_value3").html(x); $("#Thead_value4").html(x) x = $(xml).find("lblSelect").text(); $("#SelectLM_Title").html(x); $("#cpp_0").html(x); $("#cpl_0").html(x); x = $(xml).find("lblSphinx").text(); $("#cpl_1").html(x); x = $(xml).find("lblBen").text(); $("#cpl_2").html(x); x = $(xml).find("lblEiffel").text(); $("#cpl_3").html(x); x = $(xml).find("lblEmpireSt").text(); $("#cpl_4").html(x); x = $(xml).find("lblCN").text(); $("#cpl_5").html(x); x = $(xml).find("lblBurj").text(); $("#cpl_6").html(x); x = $(xml).find("lblClickMap").text(); $("#MapInst").html(x); x = $(xml).find("btBack").text(); $("#BT_Back").html(x); x = $(xml).find("cvsData").text(); $("#BT_Data").html(x); $("#Data_Title").append(" - " + x); x = $(xml).find("cvsDepth").text(); $("#BT_CraterDepth").html(x); $("#Crater_Depth_Title").append(" - " + x); x = $(xml).find("cvsSize").text(); $("#BT_CraterPlace").html(x); $("#Crater_Size_Title").append(" - " +x); x = $(xml).find("lblLandmark").text(); $("#LB_SelectLandmark").html(x); x = $(xml).find("lblInVals").text(); $("#LB_InpactValues").html(x); x = $(xml).find("damage1").text(); damage1 = x; $("#LB_Damage").html(x); x = $(xml).find("damage2").text(); damage2 = x; $("#LB_Damage").append( " " + x + " " + x); x = $(xml).find("lblImpEnergy").text(); $("#LB_InputEnergy").html(x); x = $(xml).find("lblWhatImpactor").text(); $("#LB_Impactor").html(x); x = $(xml).find("lblFireball").text(); $("#LB_Fireball").html(x); //////////////////////////// onLoadComplete(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseXML(xml) {\r\n\r\n \"use strict\";\r\n\t$(\"#loading\").hide();\t\t\t\t//hide the loading animation\r\n /*------------------------------------------------------------------------------------\r\n HTML Head:\r\n \r\n Any content that is suitable for the head will be parsed in this sectio...
[ "0.62727344", "0.6039646", "0.58391625", "0.5662551", "0.56107163", "0.56022674", "0.5525346", "0.5497171", "0.5448213", "0.54243463", "0.53641415", "0.5303763", "0.5303763", "0.52939785", "0.5283942", "0.52834886", "0.52475715", "0.5243695", "0.52159095", "0.5197498", "0.519...
0.5849096
2
============================================== =============================================== Once loadinf is complete calculate results. ===============================================
function onLoadComplete() { ////////////////////////////// //Pass values to data provider ////////////////////////////// //Values from prev screen. dataProvider.setSelected_language(lang); dataProvider.setImpactDist(parseInt(dist)); dataProvider.setProjDiam(parseInt(diam)); dataProvider.setProjAngle(parseInt(traj)); dataProvider.setProjVel(parseInt(velo)); dataProvider.setCbPjDens(parseInt(pjd)); dataProvider.setCbTgDens(parseInt(tgd)); dataProvider.setSlTgDepth(parseInt(wlvl)); //////////////// //DO THE CALCS //////////////// if (planet == 'Earth'){ calcs = new CraterCalcs(); //Do calculation calcs.getData(dataProvider);//From CraterCalcs.js } else if (planet == 'Moon'){ calcs = new MoonCraterCalcs(); calcs.getData(dataProvider);//From CraterCalcs.js } else if (planet == 'Mars'){ calcs = new MarsCraterCalcs(); //Do calculation calcs.getData(dataProvider);//From CraterCalcs.js } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calcResults() {\n\t\trbAge.innerText = parseInt(currentAge)+parseInt(yearsToRetirement);\n\t\trbIncome.innerText = rawNestAmount*targetRetirementIncomePercentage;\n\t\trbInterest.innerText = (rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))*targetInterestRateToNest;\n\t\trbBalance.innerText...
[ "0.6200246", "0.609149", "0.599732", "0.5809741", "0.57185394", "0.56791586", "0.56481415", "0.56407535", "0.562759", "0.5609229", "0.559741", "0.5574983", "0.5541299", "0.55378187", "0.5537791", "0.55166173", "0.55135787", "0.549209", "0.54906905", "0.54644746", "0.5454024",...
0.0
-1
============================================== ================================================================================== Once the calc is complete put the results on the UI. ==================================================================================
function onCalcComplete() { //////////////////////////////// //Display Results //////////////////////////////// //The data on the map screen. setImpactValues(dataProvider.getDgOutputs()); //The inputValues setInputValues(dataProvider.getDgInputs()); //The damage table setDamage(dataProvider.getTxtDamage()); //Set Impact Energy Table setEnergyValues(dataProvider.getDgEnergy()); //Get the what happenes to the impactor text. setImpactorText(dataProvider.getTxtImpactor()); // get fireball dats. setFireballSeen(dataProvider.getDgFirevall()); drawScale(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calcResults() {\n\t\trbAge.innerText = parseInt(currentAge)+parseInt(yearsToRetirement);\n\t\trbIncome.innerText = rawNestAmount*targetRetirementIncomePercentage;\n\t\trbInterest.innerText = (rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))*targetInterestRateToNest;\n\t\trbBalance.innerText...
[ "0.74880457", "0.7394863", "0.7280815", "0.72197276", "0.7156501", "0.70714635", "0.7022014", "0.679462", "0.67822", "0.6777992", "0.6716648", "0.6692626", "0.664951", "0.6634787", "0.65943533", "0.6565198", "0.65605116", "0.65293264", "0.6506112", "0.65058047", "0.6497893", ...
0.7548231
0
================================================================================= ================================================================================== Sets the output array that falls on the map screeen. ==================================================================================
function setImpactValues(dgOutputs) { var impTbl = document.getElementById("ImpactValuesTable"); //var impTbl2 = document.getElementById("InputValuesTable"); //impTbl2.innerHTML = ' '; var keys = dgOutputs.keys() var values = dgOutputs.values(); var tableData = ""; for (var i = 0; i < keys.length;i++) { if (i % 2 && i != 0) tableData = tableData + "<tr><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; else tableData = tableData + "<tr class=\"alt\"><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; }//end for $('#ImpactValuesTable').html(tableData); //impTbl.innerHTML = tableData; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setOut() {\n this.geometricMidpoint = this.setGeometricMidpoint();\n this.out.push(this.geometricMidpoint);\n const idxs = [0, 1, 2];\n idxs.forEach((idx) => {\n this.out.push({\n X: this.coordinates[0][idx * 2],\n Y: this.coordinates[0][idx * 2 + 1],\n });\n });\n }", "ma...
[ "0.6829723", "0.61194986", "0.6066655", "0.5905527", "0.5863855", "0.5723339", "0.54406995", "0.5427648", "0.5398958", "0.5349373", "0.5337629", "0.53175473", "0.5316674", "0.52756673", "0.5221366", "0.5201397", "0.51880044", "0.51838624", "0.5145826", "0.5142385", "0.5121246...
0.0
-1
================================================================================= ================================================================================== Sets the iinput array that is the first table in the Data View. ==================================================================================
function setInputValues(dgInputs) { var impTbl = document.getElementById("InputValuesTable"); //impTbl.innerHTML = ""; var keys = dgInputs.keys() var values = dgInputs.values(); var tableData = ""; for (var i = 0; i < keys.length;i++) { if (i % 2 && i != 0) tableData = tableData + "<tr><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; else tableData = tableData + "<tr class=\"alt\"><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; }//end for $('#InputValuesTable').html(tableData); //impTbl.innerHTML = tableData; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SetColumnsInput() {\n\n var result = new Array();\n for (var i = 0; i < tcoarray.length; i++) {\n\n var item = tcoarray[i];\n result.push({ field: item.name, title: item.name, width: item.width, sortable: true });\n }\n var res1 = new Array();\n res1[0] = result;\n tablecol...
[ "0.66464937", "0.5747155", "0.55513084", "0.5484419", "0.5442783", "0.54144645", "0.538421", "0.5348664", "0.53399223", "0.53295785", "0.5257918", "0.52497333", "0.5238922", "0.51434535", "0.5138845", "0.5135278", "0.5120294", "0.51098764", "0.5088115", "0.5075356", "0.507514...
0.47337204
76
================================================================================= ================================================================================== Sets the damage text which is the second table of the data view are. ==================================================================================
function setDamage(txtDamage) { $("#LB_Damage").text( damage1 + " " + dist +" km "+ damage2); var impTbl = document.getElementById("DamageInfo"); $('#DamageInfo').html(txtDamage); //impTbl.innerHTML = txtDamage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setDeniseText() {\n var textToApplyDenise = \"\";\n if (houseUpgrades.upgrades[1].owned == 0) { textToApplyDenise = \"We Need a BED to sleep in\"; }\n else if (houseUpgrades.upgrades[2].owned == 0) { textToApplyDenise = \"I wish I had a CHEST to put stuff.\"; }\n else if (house...
[ "0.58480114", "0.5510582", "0.5442686", "0.5438436", "0.54304445", "0.54039335", "0.5368918", "0.51778656", "0.51649284", "0.51649284", "0.50955313", "0.50470734", "0.5015801", "0.5010383", "0.49946755", "0.49886534", "0.49717358", "0.4961141", "0.49541914", "0.4941081", "0.4...
0.67597437
0
================================================================================== =================================================================================== Sets the data for the energy table which is the third table of the data view. ====================================================================================
function setEnergyValues(dgEnergy) { var impTbl = document.getElementById("InputEnergyTable"); //impTbl.innerHTML = ""; var keys = dgEnergy.keys() var values = dgEnergy.values(); var tableData = ""; for (var i = 0; i < keys.length;i++) { if (i % 2 && i != 0) tableData = tableData + "<tr><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; else tableData = tableData + "<tr class=\"alt\"><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; }//end for $('#InputEnergyTable').html(tableData); //impTbl.innerHTML = tableData; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setData(data) {\n this.dataAgents.map((d, idx) => d.setData(data[idx]));\n this.sheet.table.render();\n }", "function setDataTbl(){\n var currentIndex = 1;\n var tablegroup = \"datagrpRestriction\";\n setTable(currentIndex, tablegroup, this.grid.getPrimaryKeysForRow(this));\t\n}", "function set...
[ "0.61513656", "0.6063266", "0.60035765", "0.591022", "0.58577436", "0.5847947", "0.58167595", "0.58074325", "0.57826096", "0.5726791", "0.5700324", "0.56770486", "0.56290007", "0.56025475", "0.5591837", "0.5583447", "0.5567965", "0.5562535", "0.550695", "0.5494547", "0.549329...
0.6096933
1
=================================================================================== ==================================================================================== Sets the impactor text which is the fours data table in the data view. ====================================================================================
function setImpactorText(impactorText) { var impTbl = document.getElementById("ImpactorInfo"); $('#ImpactorInfo').html(impactorText); //impTbl.innerHTML = impactorText; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rowSetText(text) {\n rowClear();\n currentRow.append('div').classed('tbar-row-text', true)\n .text(text);\n }", "function datasetText(dataset) {\r\n\treturn dataset;\r\n}", "function _setDisplayText(oController) {\r\n\t\tvar oTextReader = oController.getView...
[ "0.5730968", "0.5560151", "0.5478787", "0.5443164", "0.5415416", "0.5345215", "0.5345215", "0.532174", "0.5284046", "0.5278402", "0.5278402", "0.52751315", "0.52326137", "0.52229834", "0.5205857", "0.5204834", "0.5188104", "0.5175853", "0.51694655", "0.51694655", "0.51572", ...
0.74685097
0
================================================================================== =================================================================================== Sets if a fireball has been seen which is the final table of the data view. ===================================================================================
function setFireballSeen(fireArray) { var impTbl = document.getElementById("FireballTable"); //impTbl.innerHTML = ""; var keys = fireArray.keys() var values = fireArray.values(); var tableData = ""; //if dist is 0 do not display the exposure, the last value in the fire array. var display_exposure = dist == 0? 1: 0; for (var i = 0; i < keys.length - display_exposure;i++) { if (i % 2 && i != 0) tableData = tableData + "<tr><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; else tableData = tableData + "<tr class=\"alt\"><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>"; }//end for $('#FireballTable').html(tableData); //impTbl.innerHTML = tableData; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function markFlag() {\n let $td = $(this)\n if (unclickable(this)) {\n return false;\n }\n let id = $td.attr(\"id\")\n let cell = game.getCellByID(id);\n if (!cell.hasRevealed) {\n if (cell.hasFlag) {\n cell.hasFlag = false\n flagCount--\n } else {\n ...
[ "0.5634471", "0.5581494", "0.55257374", "0.5500357", "0.5315188", "0.530258", "0.5281695", "0.52091527", "0.5147832", "0.51279825", "0.5124307", "0.5118517", "0.51015556", "0.50693595", "0.5052583", "0.50250953", "0.501962", "0.501859", "0.5016423", "0.5005908", "0.5004938", ...
0.69569063
0
=================================================================================== ====================================================================================== Resets a canvas clearing any path lines or images presented. Any transforms are cleared then restored so that the clearRect command does not itself become transformed. ========================================================================================
function canvasReset (ctx, canvas) { // Store the current transformation matrix ctx.save(); // Use the identity matrix while clearing the canvas ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.beginPath(); // Restore the transform ctx.restore(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetCanvas(){\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n // Restore the transform\n ctx.restore(); // Clears the specific canvas completely for new drawing\n}", "clearCanvas() {\n const ctx = this.canvas.current.getContext('2d');\n\n ctx.save();\n ctx.setTransfo...
[ "0.8228816", "0.8068358", "0.80327857", "0.80312836", "0.80312836", "0.7982094", "0.7921436", "0.79042906", "0.7899253", "0.7893375", "0.77249813", "0.7724206", "0.77025366", "0.76904345", "0.76793796", "0.76742107", "0.7654978", "0.7649348", "0.7646588", "0.7636256", "0.7605...
0.7852864
10
======================================================================================= ========================================================================================= Called when the building comobo box is selected on the crater screen =========================================================================================
function drawCrater(building) { selectedBuilding = building; var c=document.getElementById("Crater_Area"); var ctx=c.getContext("2d"); var craterBaseThickness = 29; canvasReset (ctx, c); if (building.selectedIndex > 0) { resetSizes(); var cd = dataProvider.impactor.crDepth; var _loc1 = cd / 92; switch (building.selectedIndex) { case 1: mc_1._height = mc_1._height / _loc1; mc_1._width = mc_1._width / _loc1; ctx.drawImage(spynx,c.width/2.0 - mc_1._width/2.0 , c.height -(craterBaseThickness + mc_1._height) ,mc_1._width,mc_1._height); //ctx.drawImage(spynx, mc_1._width/2.0-42/2.0,mc_1._height-(20+craterBaseThickness)) //ctx.drawImage(spynx, c.width/2.0-42/2.0,c.height-(20+craterBaseThickness)); break; case 2: mc_2._height = mc_2._height / _loc1; mc_2._width = mc_2._width / _loc1; //ctx.drawImage(spynx,c.width/2.0 - mc_1._width/2.0 , c.height -(20+craterBaseThickness) ,mc_1._width,mc_1._height); ctx.drawImage(bigBen,c.width/2.0 - mc_2._width/2.0 , c.height -(craterBaseThickness + mc_2._height) ,mc_2._width,mc_2._height); break; case 3: mc_3._height = mc_3._height / _loc1; mc_3._width = mc_3._width / _loc1; ctx.drawImage(eifelTower,c.width/2.0 - mc_3._width/2.0 , c.height -(craterBaseThickness + mc_3._height) ,mc_3._width,mc_3._height); break; case 4: mc_4._height = mc_4._height / _loc1; mc_4._width = mc_4._width / _loc1; ctx.drawImage(empireState,c.width/2.0 - mc_4._width/2.0 , c.height -(craterBaseThickness + mc_4._height) ,mc_4._width,mc_4._height); break; case 5: mc_5._height = mc_5._height / _loc1; mc_5._width = mc_5._width / _loc1; ctx.drawImage(cn_tower, c.width/2.0 - mc_5._width/2.0 , c.height -(craterBaseThickness + mc_5._height) ,mc_5._width,mc_5._height); //ctx.drawImage(cn_tower,0,0, 77,554, c.width/2.0 - mc_5._width/2.0 , c.height -(craterBaseThickness + mc_5._height) ,mc_5._width,mc_5._height); break; case 6: mc_6._height = mc_6._height / _loc1; mc_6._width = mc_6._width / _loc1; ctx.drawImage(burj,c.width/2.0 - mc_6._width/2.0 , c.height -(craterBaseThickness + mc_6._height ) ,mc_6._width,mc_6._height); break; }//end switch }//end if ctx.drawImage(craterImg,(c.width-716.0)/2.0,c.height-121.0); if(typeof dataProvider.impactor != 'undefined') drawScale(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onBuildingSourceBuildingsSelected() {\n setVisibilityOfDivForKey('buildings', true);\n povertyBuildingsDiv.hide();\n setExplanationSpanTextForColumn(NODAMAGE_COLUMN_INFO);\n setExplanationSpanTextForColumn(NODAMAGE_VALUE_INFO);\n maybeShowNoDamageValueItem();\n}", "selectBuilding(building) {\n ...
[ "0.6502922", "0.6286745", "0.6154702", "0.6135843", "0.6132017", "0.60685027", "0.60309154", "0.5955211", "0.5889281", "0.5853974", "0.58066285", "0.5790804", "0.5790804", "0.5773918", "0.57621455", "0.57621455", "0.57617515", "0.57617515", "0.57452387", "0.5745179", "0.57335...
0.0
-1
===================================================================================== ======================================================================================= draw the scale line beneath the crater. =======================================================================================
function drawScale() { var c=document.getElementById("Crater_Area"); var ctx=c.getContext("2d"); ctx.font = '10pt Arial'; var diam = nbFormat(dataProvider.impactor.crDiam)+"m"; var depth = nbFormat(dataProvider.impactor.crDepth)+"m"; var dl =depth.length; var dil = diam.length; ctx.fillText(diam, c.width/2 -(dil*4.2), c.height - 18); ctx.fillText(depth, c.width -165 -(dl*4.2), c.height - 70); }//==========================================================================================
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createX(){\n line(0, 0, -vScale/2, -vScale/2);\n line(0, 0, vScale/2, -vScale/2);\n line(0, 0, vScale/2, vScale/2);\n line(0, 0, -vScale/2, vScale/2);\n}", "function renderAxisLine() {\n ctx.save();\n ctx.setLineDash(renderAttrs.lineDash || []);\n if( ren...
[ "0.666861", "0.6438871", "0.6383193", "0.6371038", "0.63630515", "0.6312043", "0.6255201", "0.6255201", "0.6255201", "0.62264526", "0.6173866", "0.61598027", "0.6139451", "0.6091123", "0.60581917", "0.60348976", "0.60309803", "0.6029382", "0.60277915", "0.60252756", "0.600054...
0.6467912
1
My Solution Instructor Solution
function differenceArray(arr1, arr2){ let uniqueArray = []; for(let val of arr1) { if (!arr2.includes(val) && !uniqueArray.includes(val)) { uniqueArray.push(val); } } for(let val of arr2) { if (!arr1.includes(val) && !uniqueArray.includes(val)){ uniqueArray.push(val); } } return uniqueArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySolution(solution) {\n\n}", "function solution(s) {\n\n}", "function scoreSolution(solution) {\n\n}", "function solution(A) {\n\n}", "solutionToString () {}", "function IndividualAttestation() {}", "function Fundamentals() {\n\n }", "function GoalFactory() {\n\n}", "function theImp...
[ "0.59806323", "0.58940125", "0.5885296", "0.5830168", "0.58198696", "0.5778452", "0.5748896", "0.56812453", "0.56348085", "0.55590916", "0.55420613", "0.54861474", "0.5482463", "0.5444003", "0.54394394", "0.54287624", "0.542163", "0.54115784", "0.5363302", "0.53616554", "0.53...
0.0
-1
SubNav allows user to navigate between shopping list and shopping map
render() { return( <nav className = "subNav"> <ul> <li><Link className={this.props.path==='/shopping-list' ? "bold" : null} to="/shopping-list">list</Link></li> <li><Link className={this.props.path==='/shopping-route' ? "bold" : null} to="/shopping-route">route</Link></li> </ul> </nav> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFlashMenu(main, sub) {\n\t\telemParams.currentPage = 0;\n\n\t\tif (locParams.gloPre) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tmain = main-1;\n\t\tfor (var i = 0; i < theSitetree.length && i <= main; i++) {\n\t\t\tif (theSitetree[i][POS_ISNAVIGATION] == 'false')\n\t\t\t\tmain++;\n\t\t}\n\t\tif (theSitetree...
[ "0.609147", "0.6020206", "0.6014828", "0.5908754", "0.58745843", "0.58446956", "0.5802636", "0.57593817", "0.5737862", "0.5726527", "0.5713349", "0.5639819", "0.56272644", "0.56181484", "0.55979353", "0.55891716", "0.55837995", "0.5582958", "0.5580003", "0.5571381", "0.556374...
0.5187752
88
anything returned from this will end up on the BookList props.
function mapStateToProps(state){ return { book: state.activeBook } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Booklist() {\n\treturn (\n\t\t<section className='BookList'>\n\t\t\t{Books.map((book) => {\n\t\t\t\treturn <Book key={book.id} {...book}></Book>;\n\t\t\t})}\n\t\t</section>\n\t);\n}", "renderBooks() {\n return _.map(this.props.books, book => {\n return (<li className='list-group-item' key={book....
[ "0.68963075", "0.68839914", "0.68390006", "0.6826518", "0.6753056", "0.6741753", "0.67388344", "0.67057574", "0.66483325", "0.6616843", "0.65860116", "0.6584993", "0.6563835", "0.6536971", "0.6520957", "0.64713", "0.6434384", "0.6414625", "0.6372261", "0.6366465", "0.6365629"...
0.0
-1
Map Redux state to component props
function mapStateToProps(state) { return {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapStateToProps (state) {\n //return object of what you want to pass to component as a prop\n\n}", "function mapStateToProps(state){\n // whatever you return here will be put on the props object for this component;\n // the key in this object will be the key on the props object\n // the value for...
[ "0.7605747", "0.7518505", "0.7467345", "0.7451045", "0.74057394", "0.7394526", "0.73661447", "0.73645", "0.7304719", "0.7303738", "0.7278673", "0.72434896", "0.7215915", "0.71984196", "0.7190983", "0.7183257", "0.7165471", "0.7145838", "0.714331", "0.7131758", "0.7127008", ...
0.687417
78
Map Redux actions to component props
function mapDispatchToProps(dispatch) { return { updateCard: (card) => dispatch(changeCardView(card)) }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapActionToProps(dispatch) { return bindActionCreators({ GetActivityAction }, dispatch); }", "function mapDispatchToProps(dispatch) {\n console.log('App.js mapDispatchToProps: mapping Redux actions <-> React component props');\n return {\n increaseCount: function() {\n return dispatch(increas...
[ "0.7550068", "0.7493547", "0.72580063", "0.72569156", "0.72392106", "0.70193094", "0.6983888", "0.69700646", "0.69700646", "0.6961876", "0.6950038", "0.69492376", "0.69225246", "0.6886943", "0.6883328", "0.6877323", "0.6863439", "0.6849868", "0.68373775", "0.6830345", "0.6829...
0.0
-1
Requete SQL qui permet d'afficher les articles par ordre descendant
function getAll() { return connSql.then(function(conn){ let resultat = conn.query('SELECT * FROM posts WHERE posted = "1" ORDER BY posts.date DESC'); return resultat }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findArticles() {}", "childrens(node = undefined, filter = undefined){\r\n\t\t\r\n\t\t\r\n\t\tnode = this.node_null(node);\r\n\t\t\r\n\t\tlet listBrothers = node;\r\n\t\tlet datas = [] //list d'objet\r\n\t\t\r\n\t\twhile (listBrothers.length > 0){\r\n\t\t\tlistBrothers = this.cousin(listBrothers,\"childr...
[ "0.60755277", "0.49528927", "0.49398327", "0.48795164", "0.48221403", "0.4820834", "0.48208284", "0.4817964", "0.4786242", "0.47716898", "0.47457314", "0.47356975", "0.4731128", "0.4688601", "0.4670929", "0.467037", "0.46670914", "0.46624735", "0.46552834", "0.46518728", "0.4...
0.0
-1
Function to clear existing timeout
function clearExistingTimeout() { if ( timeoutID ) { clearTimeout( timeoutID ); } } // Function to cancel next exec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear(){timeoutID=undefined;}", "function clear(){timeoutID=undefined;}", "function clear() {\n timeoutID = undefined;\n }", "function clear() {\n timeoutID = undefined;\n }", "function clear() {\n timeoutID = undefined;\n }", "function clear() {\n timeoutID = undefi...
[ "0.8522396", "0.8522396", "0.8484727", "0.8484727", "0.8484727", "0.8484727", "0.8484727", "0.8484727", "0.8484727", "0.8484727", "0.8452658", "0.8452658", "0.8452658", "0.8452658", "0.8452439", "0.8452439", "0.8433976", "0.8396499", "0.83060086", "0.8267889", "0.8267889", ...
0.7962573
47
The `wrapper` function encapsulates all of the throttling / debouncing functionality and when executed will limit the rate at which `callback` is executed.
function wrapper() { const self = this; const elapsed = Date.now() - lastExec; const args = arguments; if ( cancelled ) { return; } // Execute `callback` and update the `lastExec` timestamp. function exec() { lastExec = Date.now(); callback.apply( self, args ); } /* * If `debounceMode` is true (at begin) this is used to clear the flag * to allow future `callback` executions. */ function clear() { timeoutID = undefined; } if ( debounceMode && ! timeoutID ) { /* * Since `wrapper` is being called for the first time and * `debounceMode` is true (at begin), execute `callback`. */ exec(); } clearExistingTimeout(); if ( debounceMode === undefined && elapsed > delay ) { /* * In throttle mode, if `delay` time has been exceeded, execute * `callback`. */ exec(); } else if ( noTrailing !== true ) { /* * In trailing throttle mode, since `delay` time has not been * exceeded, schedule `callback` to execute `delay` ms after most * recent execution. * * If `debounceMode` is true (at begin), schedule `clear` to execute * after `delay` ms. * * If `debounceMode` is false (at end), schedule `callback` to * execute after `delay` ms. */ timeoutID = setTimeout( debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wrapper () {\n\t\n\t\t\tvar self = this;\n\t\t\tvar elapsed = Number(new Date()) - lastExec;\n\t\t\tvar args = arguments;\n\t\n\t\t\t// Execute `callback` and update the `lastExec` timestamp.\n\t\t\tfunction exec () {\n\t\t\t\tlastExec = Number(new Date());\n\t\t\t\tcallback.apply(self, args);\n\t\t\t}\n\...
[ "0.765537", "0.7569833", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.75173116", "0.7513246", ...
0.7052312
35
Execute `callback` and update the `lastExec` timestamp.
function exec() { lastExec = Date.now(); callback.apply( self, args ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }", "function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }", "function exec() {\n\t lastExec = Date.now();\n\t callback.apply(self, arguments_);\n\t }", "functi...
[ "0.75365394", "0.75365394", "0.74436194", "0.74161553", "0.7291808", "0.7291808", "0.7291808", "0.7291808", "0.72254", "0.72254", "0.72254", "0.72254", "0.72254", "0.722014", "0.7209396", "0.7209396", "0.7209396", "0.7209396", "0.7209396", "0.7209396", "0.7209396", "0.72093...
0.712882
35
If `debounceMode` is true (at begin) this is used to clear the flag to allow future `callback` executions.
function clear() { timeoutID = undefined; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exec(){lastExec=Number(new Date());callback.apply(self,args);}// If `debounceMode` is true (at begin) this is used to clear the flag", "function exec(){lastExec=Number(new Date());callback.apply(self,args);}// If `debounceMode` is true (at begin) this is used to clear the flag", "function debounce(cal...
[ "0.75890416", "0.75890416", "0.7186383", "0.6594032", "0.6559964", "0.65062535", "0.64910924", "0.64910924", "0.64910924", "0.648964", "0.6391983", "0.63768727", "0.6287791", "0.6223064", "0.6152279", "0.6111874", "0.59641314", "0.5955779", "0.59517103", "0.5943719", "0.59373...
0.0
-1
File: linkify.js Version: 20101010_1000 Copyright: (c) 2010 Jeff Roberson MIT License: Summary: This script linkifys http URLs on a page. Usage: See demonstration page: linkify.html
function linkify(text) { /* Here is a commented version of the regex (in PHP string format): $url_pattern = '/# Rev:20100913_0900 github.com\/jmrware\/LinkifyURL # Match http & ftp URL that is not already linkified. # Alternative 1: URL delimited by (parentheses). (\() # $1 "(" start delimiter. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $2: URL. (\)) # $3: ")" end delimiter. | # Alternative 2: URL delimited by [square brackets]. (\[) # $4: "[" start delimiter. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $5: URL. (\]) # $6: "]" end delimiter. | # Alternative 3: URL delimited by {curly braces}. (\{) # $7: "{" start delimiter. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $8: URL. (\}) # $9: "}" end delimiter. | # Alternative 4: URL delimited by <angle brackets>. (<|&(?:lt|\#60|\#x3c);) # $10: "<" start delimiter (or HTML entity). ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $11: URL. (>|&(?:gt|\#62|\#x3e);) # $12: ">" end delimiter (or HTML entity). | # Alternative 5: URL not delimited by (), [], {} or <>. ( # $13: Prefix proving URL not already linked. (?: ^ # Can be a beginning of line or string, or | [^=\s\'"\]] # a non-"=", non-quote, non-"]", followed by ) \s*[\'"]? # optional whitespace and optional quote; | [^=\s]\s+ # or... a non-equals sign followed by whitespace. ) # End $13. Non-prelinkified-proof prefix. ( \b # $14: Other non-delimited URL. (?:ht|f)tps?:\/\/ # Required literal http, https, ftp or ftps prefix. [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]+ # All URI chars except "&" (normal*). (?: # Either on a "&" or at the end of URI. (?! # Allow a "&" char only if not start of an... &(?:gt|\#0*62|\#x0*3e); # HTML ">" entity, or | &(?:amp|apos|quot|\#0*3[49]|\#x0*2[27]); # a [&\'"] entity if [.!&\',:?;]? # followed by optional punctuation then (?:[^a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]|$) # a non-URI char or EOS. ) & # If neg-assertion true, match "&" (special). [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]* # More non-& URI chars (normal*). )* # Unroll-the-loop (special normal*)*. [a-z0-9\-_~$()*+=\/#[\]@%] # Last char can\'t be [.!&\',;:?] ) # End $14. Other non-delimited URL. /imx'; */ var url_pattern = /(\()((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\))|(\[)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\])|(\{)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\})|(<|&(?:lt|#60|#x3c);)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(>|&(?:gt|#62|#x3e);)|((?:^|[^=\s'"\]])\s*['"]?|[^=\s]\s+)(\b(?:ht|f)tps?:\/\/[a-z0-9\-._~!$'()*+,;=:\/?#[\]@%]+(?:(?!&(?:gt|#0*62|#x0*3e);|&(?:amp|apos|quot|#0*3[49]|#x0*2[27]);[.!&',:?;]?(?:[^a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]|$))&[a-z0-9\-._~!$'()*+,;=:\/?#[\]@%]*)*[a-z0-9\-_~$()*+=\/#[\]@%])/img; var url_replace = '$1$4$7$10$13<a href="$2$5$8$11$14">$2$5$8$11$14</a>$3$6$9$12'; return text.replace(url_pattern, url_replace); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linkify(text) {\r\n var replaceText, replacePattern1, replacePattern2, replacePattern3;\r\n\r\n //URLs starting with http://, https://, or ftp://\r\n replacePattern1 = /(\\b(https?|ftp):\\/\\/[\\-A-Z0-9+&@#\\/%?=~_|!:,.;]*[\\-A-Z0-9+&@#\\/%=~_|])/gim;\r\n replacedText = text.replace(replacePat...
[ "0.73212177", "0.7284751", "0.7234442", "0.7212285", "0.7210462", "0.7128047", "0.69046366", "0.6873047", "0.6612578", "0.6440961", "0.642403", "0.6311282", "0.630552", "0.6294974", "0.6288601", "0.6206067", "0.61951596", "0.6171151", "0.6165195", "0.6165195", "0.6165195", ...
0.76830006
0
Boot the component. This method is triggered after the user's webpack.mix.js file has executed.
boot() { console.log("WebpackConfig:"); console.log("-------------- \n"); console.dir(Config, {depth: 1}); console.log("----------------------------------------------- \n"); console.log("Mix Object:"); console.log("------------- \n"); console.dir(Mix, {depth: this.dumpDepth}); console.log("----------------------------------------------- \n"); if (this.die) { process.exit(0); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boot() {\n let workboxPlugin = require('workbox-webpack-plugin');\n\n this.plugin = new workboxPlugin[this.pluginName](Object.assign({\n swDest: 'service-worker.js'\n }, this.config));\n }", "boot() {\n //\n }", "onBoot() {}", "boot() {\n\n }", "async afterBootstra...
[ "0.6334365", "0.59990925", "0.5923069", "0.58922476", "0.58356553", "0.58034647", "0.5646825", "0.5618756", "0.5604551", "0.54944116", "0.54641694", "0.54373395", "0.5397692", "0.5389931", "0.53733677", "0.53467876", "0.53372073", "0.53238165", "0.5284397", "0.5238695", "0.52...
0.6398949
0
Split all rows into group and then add delay in between each group
function processAll(rows, callback) { var groups = [], i = 0, len = rows.length; while (rows.length > 0) { groups.push({ id: i, rows: rows.splice(0, NUM_ROWS_IN_GROUP) }); i += 1; } pconsole.log('Processing ' + len + ' rows in ' + groups.length + ' groups'); async.eachSeries(groups, function (group, cb) { processRowGroup(group, function (err, queries) { if (err) throw err; conn.execTransaction(queries).then(function () { pconsole.inline(' ... Done'); setTimeout(function () { cb(); }, DELAY); }, function (err) { cb(err); }); }); }, function (err) { if (err) throw err; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertTimelineGroupBasedOnTimeStamp(group, items){\n\t\t\tfor (var i = 0; i < items.length; i++) {\n\t\t\t\tif(group.timeStamp > items[i].timeStamp){\n\t\t\t\t\t// Insert above current position in items\n\t\t\t\t\titems.splice(i, 0, group);\n\t\t\t\t\treturn;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t// Add to t...
[ "0.5423795", "0.5313414", "0.522866", "0.51041", "0.5065098", "0.5016538", "0.49963775", "0.4985667", "0.49688765", "0.49503952", "0.49046758", "0.48976097", "0.48775336", "0.4864892", "0.4848283", "0.48421898", "0.4838542", "0.482665", "0.47969696", "0.47967136", "0.47802675...
0.45090157
53