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
Convert from UTC to account for different time zones
function convertFromUTC(utcdate) { localdate = new Date(utcdate); return localdate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "localTimeToUTC(localTime) {\r\n let dateIsoString;\r\n if (typeof localTime === \"string\") {\r\n dateIsoString = localTime;\r\n }\r\n else {\r\n dateIsoString = dateAdd(localTime, \"minute\", localTime.getTimezoneOffset() * -1).toISOString();\r\n }\r\n ...
[ "0.6623361", "0.6553579", "0.636182", "0.6087981", "0.59756655", "0.59392315", "0.5935672", "0.5884768", "0.5870722", "0.58174556", "0.57627285", "0.57627285", "0.57627285", "0.57627285", "0.57627285", "0.57584906", "0.5757649", "0.5757649", "0.5734492", "0.57145", "0.5706694...
0.6342179
3
now we will be using new keywords ASYNC and AWAIT await is to tells us that a function is returning a promise wait until its done i.e..,resolved create a fetchtodo
function getTodo(){ return new Promise((resolve,reject)=>{ let error = false; if(!error){ resolve({text:"you should work on this"}) } else{ reject() } },1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function asynFunc() {\r\n await createPost(\"title#3\", \"body#3\");\r\n getPosts();\r\n}", "async function getDetailsAsync(){\n const details = await getDetails(\"Here is your details from ASYNC AWAIT\");\n\n console.log(details);\n}", "async function asyncWrapperFunction() {\r\n await htmlRo...
[ "0.6677672", "0.6656829", "0.6483484", "0.64800024", "0.6396786", "0.63749623", "0.6362798", "0.6350954", "0.63150537", "0.6265807", "0.62570405", "0.6253253", "0.6243075", "0.6241737", "0.62399954", "0.62125546", "0.62030494", "0.6198117", "0.6180709", "0.61520445", "0.61264...
0.0
-1
TODO do we also need to store value's type?
setUniform(name, value) { this.uniforms[name] = value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function value() { }", "set type(value) {}", "get value() { return this._value; }", "get value() { return this._value; }", "get value() { return this._value; }", "get value() { return this._value; }", "get value() { return this._value; }", "get value() { return this._value; }", "get value() { retur...
[ "0.6743143", "0.673287", "0.6620208", "0.6620208", "0.6620208", "0.6620208", "0.6620208", "0.6620208", "0.6620208", "0.6620208", "0.6620208", "0.6576745", "0.6453963", "0.6414844", "0.6404815", "0.6401283", "0.63497293", "0.6306706", "0.6261238", "0.62537855", "0.62537855", ...
0.0
-1
Shows how long it will take the driver to complete the entire path (all of the legs). Also, calculate how much time is left for the driver based on their current position
toHHMMSS( num ) { let hours = Math.floor(num / 3600); let minutes = Math.floor((num - (hours * 3600)) / 60); let seconds = num - (hours * 3600) - (minutes * 60); if (hours < 10) {hours = "0"+hours;} if (minutes < 10) {minutes = "0"+minutes;} if (seconds < 10) {seconds = "0"+seconds;} return hours+':'+minutes+':'+seconds; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "computePathToComplete(){\n if (Object.keys(this.state.legs_dict).length !== 0 &&Object.keys(this.state.stops_dict).length !== 0 && this.state.driver_location !== null) {\n\n // Time required to complete all legs\n var time_complete_all_legs = 0\n // Time required to complete driver's remaining p...
[ "0.6987525", "0.61795187", "0.5930575", "0.5882869", "0.5838576", "0.580843", "0.5793571", "0.57772696", "0.5766943", "0.5657002", "0.5637903", "0.5632606", "0.56216824", "0.56208664", "0.56088674", "0.5597037", "0.5596953", "0.55876577", "0.558611", "0.55437326", "0.5543095"...
0.0
-1
LAB 1: A Trip to Woodland Park Zoo Welcome to Lab 1 =) Be sure to read all the comments! All of the instructions are inline with the assignment below. Look for the word TODO in comments. Each TODO will have a description of what is required. To run this file, type the following (in the terminal): node lab1.js and then press enter/return. Instructions for turning this lab in are in the assignment description in Canvas. I'm happy to answer any questions on Slack. / Helper We've implemented a function that will help you sanitycheck your code.
function assert(expression, failureMessage) { if (!expression) { console.log('assertion failure: ', failureMessage); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exercise11() {}", "function exercise07() {}", "function MainFunction()\n{\n 'use strict';\n\n Steps(7);\n\n}", "function puzzle_welcome() {\n return {\n id: \"intro_puzzle\",\n name: \"Welcome to Puzzle Code!\",\n description: \"Collect all the coins on the board.\",\n\n // TODO: ...
[ "0.6215853", "0.607895", "0.5939162", "0.5936773", "0.58385456", "0.577253", "0.57572347", "0.57332367", "0.5733056", "0.5704488", "0.56910634", "0.5681246", "0.5653455", "0.5623779", "0.5623779", "0.5623179", "0.5595207", "0.559488", "0.5593485", "0.55865085", "0.55744195", ...
0.0
-1
Return the courses given the particular filters
function addToCourse(course_id, session_key, user_name, students) { var status = 200; return (fetch(URL + course_id + "/", { method: 'PUT', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({session_key, user_name, students}) })).then((response) => { status = response.status; if (status >= ERROR_STATUS) { return response.json(); } else { return "Empty"; } }).then((json) => { if(status >= ERROR_STATUS) { return {status: false, body: json}; } else { return {status: true, body: json}; } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCourses () {\n return [\n {id: 'csc148h1'},\n {id: 'csc165h1'},\n {id: 'csc240h1'},\n {id: 'cog250y1'},\n {id: 'eng110y1'},\n {id: 'eng140y1'},\n {id: 'eng150y1'},\n {id: 'bio130h1'},\n {id: 'bio150y1'},\n {id: 'chm138h1'},\n {id: 'chm139h1'},\n {id: 'phl100y1'},\n ...
[ "0.6760918", "0.67289", "0.65786", "0.6450647", "0.6413308", "0.64052004", "0.6326141", "0.6216369", "0.6198658", "0.618823", "0.618702", "0.6160085", "0.6154418", "0.6147037", "0.6138319", "0.6066836", "0.60506666", "0.5967074", "0.5947476", "0.5931652", "0.5899167", "0.58...
0.0
-1
Find all wish lists in the dayabase
async userDisplay (req, res) { try { const displayUser = await User.findOne({ where: { userName: req.params.user }, include: ['beers', 'friends'] }) res.send(displayUser) } catch (err) { res.status(500).send({ error: 'An error has occured trying to fetch the user' }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findLists() {}", "async getAllGiveaways() {\n // Get all giveaways from the database\n return giveawayDB.fetchEverything().array();\n }", "async function checkWishlist() {\n\t// If the current user is logged in:\n\tif (wixUsers.currentUser.loggedIn) {\n\t\t// Query the collection to f...
[ "0.60927945", "0.5802196", "0.56968987", "0.56936437", "0.55954665", "0.555977", "0.5555159", "0.55304885", "0.5515735", "0.548706", "0.5456238", "0.5452148", "0.54423565", "0.53665096", "0.53191316", "0.5300466", "0.52865535", "0.52622753", "0.52552134", "0.5253193", "0.5238...
0.0
-1
array function builds map info into map variable and then returns its display.
function displayMap(myMap) { var map = "\n"; for (var i = 0; i < 9; i++) { for (var j = 0; j < 6; j++) { map += myMap[i][j]; } map += "\n"; } return map; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapDisplayer() {\n $(\"#map\").empty();\n for(var idx = 0; idx < mapArrays.length; idx++) {\n var tempString = \"\";\n for(var idx2 = 0; idx2 < mapArrays[idx].length; idx2++) {\n tempString += \"<span id=\\\"location-\" + idx + \"-\" + idx2 + \"\\\" class=\\\"\" + mapArrays[idx][idx2].color +...
[ "0.6364121", "0.62733495", "0.6261396", "0.6255166", "0.62296975", "0.61836725", "0.6159762", "0.6087654", "0.6000221", "0.5974674", "0.59659064", "0.59278524", "0.59248453", "0.59232867", "0.5892943", "0.58537066", "0.5846781", "0.582977", "0.58139", "0.58085155", "0.5806239...
0.66575354
0
The render function generates the registration form
render() { return ( <View style= {styles.register}> <Text style={styles.header}>REGISTER</Text> <TextInput style = {styles.textInput} placeholder= "First Name" onChangeText= { (fname) => this.setState ( {fname} ) } underlineColorAndroid= {'transparent'}/> <TextInput style = {styles.textInput} placeholder= "Last Name" onChangeText= { (lname) => this.setState ( {lname} ) } underlineColorAndroid= {'transparent'}/> <TextInput style = {styles.textInput} placeholder= "Age" onChangeText= { (age) => this.setState ( {age} ) } underlineColorAndroid= {'transparent'}/> <TextInput style = {styles.textInput} placeholder= "Gender" onChangeText= { (gender) => this.setState ( {gender} ) } underlineColorAndroid= {'transparent'}/> <TextInput style = {styles.textInput} placeholder= "Favorite Borough" onChangeText= { (favBorough) => this.setState ( {favBorough} ) } underlineColorAndroid= {'transparent'}/> <TextInput style = {styles.textInput} placeholder= "Username" keyboardType='username' onChangeText= { (username) => this.setState ( {username} ) } underlineColorAndroid= {'transparent'}/> <TextInput style = {styles.textInput} placeholder= "Password" secureTextEntry={true} onChangeText= { (password) => this.setState ( {password} ) } underlineColorAndroid= {'transparent'}/> <TextInput style = {styles.textInput} placeholder= "Confirm Password" secureTextEntry={true} onChangeText= { (cPassword) => this.setState ( {cPassword} ) } underlineColorAndroid= {'transparent'}/> <View style={styles.overallButtonContainer}> <TouchableOpacity style={styles.btn} onPress={this.register}> <Text style={styles.buttonText}> Register</Text> </TouchableOpacity> <TouchableOpacity style={styles.btn} onPress={ () => {this.props.navigation.navigate('Home')} }> <Text style={styles.buttonText}> Cancel</Text> </TouchableOpacity> </View> <Text>{this.getErrorMessages()}</Text> <Text>{this.isFieldInError()}</Text> <Text>{this.getErrorsInField()}</Text> </View> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n\t\treturn this.renderRegisterPage();\n\t}", "function getFormRegister(request,response) {\n response.render('pages/login/signUp')\n}", "function loadRegisteData() {\n const registerBody = document.getElementById(\"registerBody\");\n\n const registerContainer = createSection(registerBody, \"se...
[ "0.7329158", "0.71377826", "0.68123585", "0.66666824", "0.6649705", "0.6644622", "0.66394496", "0.6614284", "0.66094273", "0.66061246", "0.65974647", "0.6571575", "0.6569441", "0.6493935", "0.64841235", "0.64510125", "0.6427592", "0.6405365", "0.64046896", "0.6379968", "0.637...
0.0
-1
Defines a helper function that will control our generator
function async(generator) { // Creates an iterator through which we'll control the generator const iterator = generator(); // Defines the function that will handle each value generated by the genrator function handle(iteratorResult) { // Stops when the generator has no more results if (iteratorResult.done) { return; } const iteratorValue = iteratorResult.value; // If the generated value is a promise, register a suucess and a failure callback. // This is the asynchronous part. // If the promise succeeds, great, resume the generator and send in the promised value. // If there's an error, through an exception to the generator. if (iteratorValue instanceof Promise) { iteratorValue.then((res) => handle(iterator.next(res))).catch((err) => iterator.throw(err)); } } // Restarts the generator execution. try { handle(iterator.next()); } catch (err) { iterator.throw(err); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Generator(){}", "function Generator(){}", "function Generator(){}", "function Generator(){}", "function Generator(){}", "function Generator(){}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "fu...
[ "0.7378487", "0.7378487", "0.7378487", "0.7378487", "0.7378487", "0.7378487", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0.73513967", "0...
0.0
-1
Defines the function that will handle each value generated by the genrator
function handle(iteratorResult) { // Stops when the generator has no more results if (iteratorResult.done) { return; } const iteratorValue = iteratorResult.value; // If the generated value is a promise, register a suucess and a failure callback. // This is the asynchronous part. // If the promise succeeds, great, resume the generator and send in the promised value. // If there's an error, through an exception to the generator. if (iteratorValue instanceof Promise) { iteratorValue.then((res) => handle(iterator.next(res))).catch((err) => iterator.throw(err)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gen() {\nfor (var i = 0; i < stuff; i++) {\n return randomValue\n }\n}", "function createFareMultiplier(integar){\nreturn function (Multiplier) {\n return Multiplier * integar;\n }}", "function value() { }", "function Generator() {} ...
[ "0.6247035", "0.6099559", "0.596092", "0.59592307", "0.5929242", "0.58667994", "0.58055407", "0.5767642", "0.576255", "0.576255", "0.576255", "0.576255", "0.576255", "0.576255", "0.5747744", "0.5747744", "0.56834394", "0.56834394", "0.56834394", "0.56834394", "0.56834394", ...
0.0
-1
Write a function to find the rectangular intersection of two given love rectangles. O(1) time and O(1) space
function findOverlap(x1, width1, x2, width2) { let startX = Math.max(x1, x2); let endX = Math.min(x1 + width1, x2 + width2); if (startX > endX) { return {startPoint: null, range: null}; } else { return {startPoint: startX, range: endX-startX} } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function intersectRects(rect1,rect2){var res={left:Math.max(rect1.left,rect2.left),right:Math.min(rect1.right,rect2.right),top:Math.max(rect1.top,rect2.top),bottom:Math.min(rect1.bottom,rect2.bottom)};if(res.left<res.right&&res.top<res.bottom){return res;}return false;}", "function intersect(rectangle1, rectangl...
[ "0.7528436", "0.752486", "0.73316234", "0.7312936", "0.72516924", "0.72367334", "0.71376795", "0.71376795", "0.71376795", "0.71376795", "0.71376795", "0.71224856", "0.71224856", "0.71224856", "0.71224856", "0.71224856", "0.71224856", "0.71224856", "0.71224856", "0.70669717", ...
0.0
-1
A utility function to create HTML.
function getHtml(template) { return template.join('\n'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createHtml(o){\n var b = '',\n attr,\n val,\n key,\n cn;\n\n if(typeof o == \"string\"){\n b = o;\n } else if (Ambow.isArray(o)) {\n for (var i=0; i < o.length; i++) {\n if(o[i]) {\n b ...
[ "0.70083255", "0.69676286", "0.69038135", "0.6871408", "0.6770828", "0.6735295", "0.67150605", "0.66873163", "0.668702", "0.6627301", "0.6575555", "0.65703076", "0.6563294", "0.6512549", "0.6512549", "0.6512549", "0.6512549", "0.6512549", "0.64919186", "0.64720607", "0.647200...
0.6139077
65
snippetend:[s3.JavaScript.s3_PhotoViewer.config] Functions snippetstart:[s3.JavaScript.s3_PhotoViewer.listAlbums] List the photo albums that exist in the bucket.
function listAlbums() { s3.listObjects({Delimiter: '/'}, function(err, data) { if (err) { return alert('There was an error listing your albums: ' + err.message); } else { var albums = data.CommonPrefixes.map(function(commonPrefix) { var prefix = commonPrefix.Prefix; var albumName = decodeURIComponent(prefix.replace('/', '')); return getHtml([ '<li>', '<button style="margin:5px;" onclick="viewAlbum(\'' + albumName + '\')">', albumName, '</button>', '</li>' ]); }); var message = albums.length ? getHtml([ '<p>Click on an album name to view it.</p>', ]) : '<p>You do not have any albums. Please Create album.'; var htmlTemplate = [ '<h2>Albums</h2>', message, '<ul>', getHtml(albums), '</ul>', ] document.getElementById('viewer').innerHTML = getHtml(htmlTemplate); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listAlbums() {\n s3.listObjects({Delimiter: '/'}, function(err, data) {\n if (err) {\n return alert('There was an error listing your albums: ' + err.message);\n } else {\n var albums = data.CommonPrefixes.map(function(commonPrefix) {\n var prefix = commonPrefix.Prefix;\n var...
[ "0.8024313", "0.7243369", "0.6794385", "0.6745076", "0.6455987", "0.64443034", "0.6256037", "0.6229391", "0.61871964", "0.61222136", "0.6019089", "0.60035217", "0.596359", "0.5958814", "0.59500635", "0.5905532", "0.58850634", "0.58154565", "0.5808184", "0.5793066", "0.5789109...
0.8272134
0
snippetend:[s3.JavaScript.s3_PhotoViewer.listAlbums] snippetstart:[s3.JavaScript.s3_PhotoViewer.viewAlbum] Show the photos that exist in an album.
function viewAlbum(albumName) { var albumPhotosKey = encodeURIComponent(albumName) + '/'; s3.listObjects({Prefix: albumPhotosKey}, function(err, data) { if (err) { return alert('There was an error viewing your album: ' + err.message); } // 'this' references the AWS.Request instance that represents the response var href = this.request.httpRequest.endpoint.href; var bucketUrl = href + albumBucketName + '/'; var photos = data.Contents.map(function(photo) { var photoKey = photo.Key; var photoUrl = bucketUrl + encodeURIComponent(photoKey); return getHtml([ '<span>', '<div>', '<br/>', '<img style="width:128px;height:128px;" src="' + photoUrl + '"/>', '</div>', '<div>', '<span>', photoKey.replace(albumPhotosKey, ''), '</span>', '</div>', '</span>', ]); }); var message = photos.length ? '<p>The following photos are present.</p>' : '<p>There are no photos in this album.</p>'; var htmlTemplate = [ '<div>', '<button onclick="listAlbums()">', 'Back To Albums', '</button>', '</div>', '<h2>', 'Album: ' + albumName, '</h2>', message, '<div>', getHtml(photos), '</div>', '<h2>', 'End of Album: ' + albumName, '</h2>', '<div>', '<button onclick="listAlbums()">', 'Back To Albums', '</button>', '</div>', ] document.getElementById('viewer').innerHTML = getHtml(htmlTemplate); document.getElementsByTagName('img')[0].setAttribute('style', 'display:none;'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listAlbums() {\r\n s3.listObjects({Delimiter: '/'}, function(err, data) {\r\n if (err) {\r\n return alert('There was an error listing your albums: ' + err.message);\r\n } else {\r\n var albums = data.CommonPrefixes.map(function(commonPrefix) {\r\n var prefix = commonPrefix.Prefix;\...
[ "0.7894317", "0.7626682", "0.69266987", "0.68596125", "0.6788956", "0.67698354", "0.6760671", "0.67581177", "0.67003363", "0.6636396", "0.64802694", "0.6478993", "0.6407122", "0.6382332", "0.6378019", "0.6374532", "0.6347924", "0.63412625", "0.63008416", "0.63008416", "0.6279...
0.77872026
1
Constructor Put your required dependencies in the constructor parameters list
constructor(cache, tagsService, postsService) { this.cache = cache; this.tagsService = tagsService; this.postsService = postsService; this.schema = { slug: null, title: null, image: null, content: null, tags: [], }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(params) {\n this.params = params;\n }", "constructor(args, required) {\n super(args, required);\n // <<-- Creer-Merge: constructor -->>\n // setup any thing you need here\n // <<-- /Creer-Merge: constructor -->>\n }", "constructor(args, required) {\n super(...
[ "0.69842225", "0.6833624", "0.6833624", "0.67252344", "0.66913277", "0.66913277", "0.66803926", "0.66610587", "0.6652505", "0.6652505", "0.6652505", "0.6652505", "0.6652505", "0.6652505", "0.6652505", "0.6627949", "0.6586442", "0.6568772", "0.65339845", "0.6528502", "0.650395...
0.0
-1
Initialize the component This method is triggered before rendering the component
init() { this.errors = {}; this.modal = null; this.isSending = false; this.isValidForm = true; this.cachedPostValue = this.cache.get('t-post', ''); // t-post => timeline post this.onSave = this.inputs.getEvent('save'); this.onClose = this.inputs.getEvent('close'); this.data = this.inputs.getProp('post', this.schema); if (! this.data.content) { this.data.content = this.cachedPostValue; } this.heading = this.data.id ? `Edit ${this.data.title}` : 'Create new post'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initialize() {\n this.render();\n }", "init() {\n this.render();\n }", "init() {\n this.render();\n }", "init() {\n if (this.initialised) {\n return;\n }\n\n // Set initialise flag\n this.initialised = true;\n // ...
[ "0.78513736", "0.7619341", "0.7619341", "0.7560289", "0.75375986", "0.74452835", "0.7443599", "0.73289156", "0.7321705", "0.73024684", "0.72739834", "0.7197493", "0.71857035", "0.71266896", "0.70746905", "0.7052088", "0.7052088", "0.7033113", "0.7032479", "0.7032479", "0.7018...
0.0
-1
Form to create new card with word and definition
function NewCardForm({ handleCreate }) { const currentUser = useContext(UserContext); const [formData, setFormData] = useState({ word: '', defn: '' }); function handleChange(evt) { let { name, value } = evt.target; setFormData((oldformData) => ({ ...oldformData, [name]: value })); } return ( <Form onSubmit={(evt) => handleCreate(evt, currentUser.userId, formData)}> <FormGroup> <Input name="word" value={formData.word} placeholder="Word" onChange={handleChange} required /> </FormGroup> <FormGroup> <Input name="defn" value={formData.defn} placeholder="Definition" onChange={handleChange} required /> </FormGroup> <Button> Create Card </Button> </Form> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleCreateCard() {\n let payload = {\n hint: card.hint,\n answer: card.answer,\n type: 'text',\n };\n if (image !== '' && card.type === 'image') {\n payload = {\n hint: image,\n answer: card.answer,\n type: 'image',\n };\n }\n else if (sound !...
[ "0.6642591", "0.6618146", "0.6561909", "0.63169515", "0.6219841", "0.620289", "0.6175802", "0.60431105", "0.5962907", "0.59616053", "0.59004194", "0.5881875", "0.58643514", "0.58464986", "0.58189225", "0.5814129", "0.5793754", "0.57919675", "0.5759717", "0.575578", "0.5753767...
0.6704491
0
Clear the response. Resets some values back to their defaults. Call this between tests if you are going to reuse a single Response object for multiple intersection tests (recommented as it will avoid allcating extra memory).
clear() { this.overlap = Number.MAX_VALUE; this.aInB = true; this.bInA = true; return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearPreviousResponses() {\n\tlastResponse = {\n\t\t\"actions\" : []\n\t};\n}", "function clearResponse(clear){\r\n while(response.firstChild){\r\n response.removeChild(response.firstChild);\r\n }\r\n playerScore = 0;\r\n computerScore = 0;\r\n}", "reset() {\n this.classList.add('clo...
[ "0.69551986", "0.6934768", "0.68229336", "0.6719653", "0.6627428", "0.6477026", "0.6452805", "0.6375394", "0.63742906", "0.6222826", "0.6160884", "0.6135466", "0.61059767", "0.60162914", "0.59714854", "0.59714854", "0.59714854", "0.59477454", "0.5928571", "0.5845798", "0.5844...
0.0
-1
Time: O(n n n)
function sortString(s) { let input = s.split(''); let result = []; let currentLetter; let getSmallest = true; while (input.length !== 0) { let index; if (getSmallest) { index = getNextLargestLetter(input, currentLetter); } else { index = getNextSmallestLetter(input, currentLetter); } if (index === undefined) { getSmallest = !getSmallest; currentLetter = undefined; } else { const lastLetter = input.splice(index, 1); currentLetter = lastLetter; result.push(currentLetter); } } return result.join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function boooo(n) {\n for (let i = 0; i < n; i++) { // O(1)\n console.log('booooo');\n }\n}", "function findUniqueValues(arr){ //O(n) // You wrote this\r\n let uniqueVal = []; \r\n let left = 0; \r\n let right = arr.length - 1;\r\n while(left < right){ ...
[ "0.6586823", "0.6391703", "0.629024", "0.62489676", "0.61400515", "0.6129802", "0.6129802", "0.6116326", "0.6099428", "0.60690093", "0.60363495", "0.5998905", "0.5985945", "0.59679604", "0.59395343", "0.59367657", "0.59352857", "0.5910229", "0.5891375", "0.5884211", "0.588285...
0.0
-1
Space: O(1) Time: O(s)
function alternative(s) { const counts = new Array(26).fill(0); for (let i = 0; i < s.length; i++) { counts[s.charCodeAt(i) - 97]++; } const result = new Array(Math.max(...counts)).fill(''); // iterate through each letter of alphabet for (let i = 0; i < 26; i++) { // iterate through each count of a letter for (let j = 0; j < counts[i]; j++) { if (j % 2 === 0) { result[j] += String.fromCharCode(i + 97); } else { result[j] = String.fromCharCode(i + 97) + result[j]; } } } return result.join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compressBoxes(input){\n for(var i = 0; i<=100; i++){\n console.log('hi'); // O(100)\n }\n\n input.forEach(function(box){\n console.log(box); // O(n)\n })\n\n input.forEach(function(box){\n console.log(box); //O(n)\n })\n }", "function fastPermutate...
[ "0.5820679", "0.5787601", "0.5734751", "0.57192147", "0.56462574", "0.56139266", "0.5543364", "0.550842", "0.548855", "0.5445043", "0.54335546", "0.54029053", "0.537168", "0.53455395", "0.5323178", "0.532034", "0.5311005", "0.53068864", "0.5275456", "0.5257535", "0.52550274",...
0.0
-1
Enty array that will hold total sum for each card
function alex(){ for (arrayPosition = 0; arrayPosition < array.length; arrayPosition++){ for (i=0; i < array[arrayPosition].length; i++){ if (isNaN(array[arrayPosition][i])) { continue; } else { sum += parseInt(array[arrayPosition][i]); } } // inside for loop totals.push(sum); sum = 0; } // outside for loop arrayPosition console.log("Array with totals: " + totals); var topNumber = Math.max.apply(Math, totals); console.log('------'); var index = totals.lastIndexOf(topNumber); console.log("Highest count is: " + topNumber + " and the credit card number is: " + array[index]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get sum() {\r\n let cardSum = 0\r\n for (const card of this.cards) {\r\n cardSum += card.value;\r\n }\r\n return cardSum\r\n }", "total (itens) {\n prod1 = list[0].amount\n prod2 = list[1].amount\n prod3 = list[2].amount\n prod4 = list[3].amou...
[ "0.7053534", "0.69008124", "0.68277574", "0.6823024", "0.6787793", "0.6728793", "0.66848296", "0.6633015", "0.66231424", "0.6601148", "0.6565345", "0.6546556", "0.65377533", "0.6531683", "0.652488", "0.6522388", "0.6509741", "0.6499215", "0.64952296", "0.6491637", "0.6485718"...
0.0
-1
take the values of html
function paramaters(data){ return document.querySelector(data) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRulaiHtml(content){\n\n}", "function pagehtml(){\treturn pageholder();}", "function fnGetHtmlText(i, value) {\n var html = $(\"<div/>\").text(value).html();\n return $.trim(html);\n }", "function getTableDataFromHtml() {\n\n }", "function parseRatkojatHtml(htmlres) {\n ...
[ "0.65092385", "0.62216705", "0.6110217", "0.607251", "0.59608865", "0.58772224", "0.5831328", "0.58183527", "0.5806415", "0.57901245", "0.5775941", "0.57221305", "0.5714905", "0.5680191", "0.56736255", "0.5655975", "0.5655137", "0.56343603", "0.56099826", "0.5605167", "0.5605...
0.0
-1
get path of the image and load in the canvas
function pathFile(event){ imageLoad = URL.createObjectURL(event.target.files[0]); loadImage(imageLoad, img => { image(img, 0, 0); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImageToCanvas(){\n img.onload = function(){\n ctx.drawImage(img, 0,0);\n }\n img.src = imgHolder.src;\n }", "function loadImg(e){\n const reader = new FileReader(); \n reader.onload = function(){\n imgHo...
[ "0.7161191", "0.68201184", "0.6790953", "0.6768371", "0.66306484", "0.6491823", "0.64799446", "0.64259785", "0.6353772", "0.6342281", "0.6337488", "0.62757075", "0.6246974", "0.6232981", "0.62265486", "0.61989856", "0.6191581", "0.61748576", "0.6168299", "0.61618435", "0.6152...
0.6700588
4
Handle when the primary card at the top of the HomeView component is tapped. Use delta to determine whether or not the tap is singular or double.
cardTap() { const delta = new Date().getTime() - this.state.lastPress; let updateShowBack = this.state.showBack; if (delta < 200) { // double tap happend updateShowBack = this.state.showBack ? false : true; } this.setState({ ...this.state, showBack: updateShowBack, lastPress: new Date().getTime() }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function didTap() {\n //Enure we dont return 0 or null for false values\n return !!(validateTap() && hasTap());\n }", "function didTap() {\n //Enure we dont return 0 or null for false values\n return !!(validateTap() && hasTap());\n }", "function didTap() {\n\t\t //...
[ "0.5840773", "0.5813912", "0.5795543", "0.5795543", "0.5795543", "0.55705005", "0.5511246", "0.5501126", "0.54984814", "0.54984814", "0.54984814", "0.54984814", "0.54984814", "0.54984814", "0.54984814", "0.54978764", "0.54978764", "0.54978764", "0.5485832", "0.5484199", "0.54...
0.6647205
0
Returns an array of known XRAnchor instances. May be empty.
get anchors(){ //readonly attribute sequence<XRAnchor> anchors; let results = [] for(let value of this._session.reality._anchors.values()){ results.push(value) } return results }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getDocumentAnchors()\n {\n let anchors = [];\n\n for (let i = 0; i < document.anchors.length; i++)\n {\n anchors[this.hashSeparator + document.anchors[i].name] = true;\n }\n\n return anchors;\n }", "function getAnchorNodes(node) {\n var SELECTOR = '[' + ...
[ "0.6959122", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494", "0.65383494",...
0.7785882
0
Create an anchor at a specific position defined by XRAnchor.coordinates
addAnchor(coordinateSystem, position=[0,0,0], orientation=[0,0,0,1]){ //DOMString? addAnchor(XRCoordinateSystem, position, orientation); let poseMatrix = MatrixMath.mat4_fromRotationTranslation(new Float32Array(16), orientation, position) MatrixMath.mat4_multiply(poseMatrix, coordinateSystem.getTransformTo(this._session._display._trackerCoordinateSystem), poseMatrix) let anchorCoordinateSystem = new XRCoordinateSystem(this._session._display, XRCoordinateSystem.TRACKER) anchorCoordinateSystem._relativeMatrix = poseMatrix return this._session.reality._addAnchor(new XRAnchor(anchorCoordinateSystem), this._session.display) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createAnchor(xx, yy, offset, nme) {\n\tvar anchor = paper\n\t .circle(xx, yy, 2)\n\t .attr({\"stroke-width\": 1, fill: \"#F00\"});\n\tanchor.name = nme;\n\tanchor.node.name = nme;\n\t\n\t// on clicking on the circle, \n\t// 1. create a new draggable object\n\t// 2. create a connection object between the...
[ "0.6890784", "0.6535481", "0.6486419", "0.59145063", "0.59000015", "0.57848835", "0.57848835", "0.57848835", "0.57560533", "0.574368", "0.566826", "0.56567556", "0.5530413", "0.55218136", "0.5476556", "0.5431981", "0.5423774", "0.5341269", "0.53360736", "0.5259411", "0.520061...
0.623716
3
normalized screen x and y are in range 0..1, with 0,0 at top left and 1,1 at bottom right
findAnchor(normalizedScreenX, normalizedScreenY, options=null){ // Promise<XRAnchorOffset?> findAnchor(float32, float32); // cast a ray to find or create an anchor at the first intersection in the Reality return this._session.reality._findAnchor(normalizedScreenX, normalizedScreenY, this._session.display, options) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "worldToScreenXY(x, y) {\n return new Vector2D(Math.round(x), Math.round(-y + this.canvas.height));\n }", "normalizeCoords(x: number, y: number) {\n return {\n x: (x - this.im.position.x) / this.im.scale,\n y: (y - this.im.position.y) / this.im.scale,\n };\n }", ...
[ "0.74771494", "0.7027409", "0.69512177", "0.68741554", "0.680003", "0.6781072", "0.67347944", "0.6701663", "0.66424936", "0.6589856", "0.65289354", "0.6524923", "0.6500318", "0.64919496", "0.64755785", "0.6432975", "0.64243615", "0.63446456", "0.63126266", "0.6276747", "0.626...
0.0
-1
Find an XRAnchorOffset that is at floor level below the current head pose uid will be the resulting anchor uid (if any), or if null one will be assigned
findFloorAnchor(uid=null){ // Promise<XRAnchorOffset?> findFloorAnchor(); return this._session.reality._findFloorAnchor(this._session.display, uid) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_findFloorAnchor(display, uid=null){\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tresolve(null)\n\t\t})\n\t}", "absAnchorOut(nid) {\n const ltd = this.lastTreeData;\n if (ltd && (nid in ltd)) {\n const ndata = ltd[nid];\n return {\n x: ndata.position.x + ndata.anchorOut....
[ "0.5992247", "0.5897993", "0.55991775", "0.5462787", "0.52190477", "0.5214754", "0.5134181", "0.50937563", "0.508515", "0.5066168", "0.50644076", "0.50627375", "0.50465006", "0.49820626", "0.49646086", "0.49417618", "0.49413696", "0.491731", "0.488746", "0.48602098", "0.48594...
0.7003973
0
Returns an existing XRAnchor or null if uid is unknown
getAnchor(uid){ // XRAnchor? getAnchor(DOMString uid); return this._session.reality._getAnchor(uid) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "findFloorAnchor(uid=null){\n\t\t// Promise<XRAnchorOffset?> findFloorAnchor();\n\t\treturn this._session.reality._findFloorAnchor(this._session.display, uid)\n\t}", "_findFloorAnchor(display, uid=null){\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tresolve(null)\n\t\t})\n\t}", "getAnchor(name) {\n ...
[ "0.6680218", "0.59649634", "0.56794304", "0.5588274", "0.5537615", "0.55274224", "0.54108703", "0.54108703", "0.5410701", "0.5410701", "0.5410701", "0.53035825", "0.52973884", "0.5237611", "0.5237611", "0.5237611", "0.5235187", "0.5235187", "0.5235187", "0.5235187", "0.519529...
0.7675937
0
and collect the results in a new array.
function arrayProjection() { var newReleases = [ { "id": 70111470, "title": "Die Hard", "boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg", "uri": "http://api.netflix.com/catalog/titles/movies/70111470", "rating": [4.0], "bookmark": [] }, { "id": 654356453, "title": "Bad Boys", "boxart": "http://cdn-0.nflximg.com/images/2891/BadBoys.jpg", "uri": "http://api.netflix.com/catalog/titles/movies/70111470", "rating": [5.0], "bookmark": [{ id: 432534, time: 65876586 }] }, { "id": 65432445, "title": "The Chamber", "boxart": "http://cdn-0.nflximg.com/images/2891/TheChamber.jpg", "uri": "http://api.netflix.com/catalog/titles/movies/70111470", "rating": [4.0], "bookmark": [] }, { "id": 675465, "title": "Fracture", "boxart": "http://cdn-0.nflximg.com/images/2891/Fracture.jpg", "uri": "http://api.netflix.com/catalog/titles/movies/70111470", "rating": [5.0], "bookmark": [{ id: 432534, time: 65876586 }] } ]; var videoIdAndTitle = []; newReleases.forEach(function(video) { videoIdAndTitle.push({ id: video.id, title: video.title }); }); return videoIdAndTitle; console.log('New Array (projection)--->', videoIdAndTitle); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pushResultsToArrays() {\n for(var i = 0; i < Product.allProducts.length; i++) {\n totalClicksArr.push(Product.allProducts[i].totalClicks);\n }\n for(var j = 0; j < Product.allProducts.length; j++) {\n allProductNames.push(Product.allProducts[j].stringName);\n }\n for(var k = 0; k < Product.allP...
[ "0.7071986", "0.6731019", "0.66542625", "0.665342", "0.665342", "0.665342", "0.665342", "0.665342", "0.665342", "0.64975107", "0.61560345", "0.6110735", "0.61004466", "0.6061947", "0.6025506", "0.6016042", "0.5947504", "0.59438074", "0.59333307", "0.59293604", "0.5917254", ...
0.0
-1
RGB([primaries]) RGB(value [, primaries]]) RGB(red, green, blue [, primaries])
constructor(...args) { const rest = [...args] const scope = internal(this) if (args[args.length - 1] instanceof Primaries) { scope.primaries = rest.pop() } else { scope.primaries = Primaries.sRGB } if (rest.length === 0) { this.r = 0 this.g = 0 this.b = 0 } else if (rest.length === 1) { const [value] = rest this.r = value || 0 this.g = value || 0 this.b = value || 0 } else { const [r, g, b] = rest this.r = r || 0 this.g = g || 0 this.b = b || 0 } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rgb(r, g, b) {\n \n}", "set ETC_RGB4(value) {}", "function getColor(value) {\n // More votes for republican, show red\n var red = 0;\n var blue = 0;\n var green = 0;\n if (value > 1) {\n var trimmed_value = Math.min(value, 3);\n red = 255;\n ...
[ "0.76554847", "0.71316075", "0.7073709", "0.7052197", "0.70288366", "0.7018211", "0.699844", "0.69947547", "0.6963534", "0.6960009", "0.69509286", "0.6939522", "0.6921466", "0.6919289", "0.68741053", "0.68741053", "0.6838799", "0.6837406", "0.6837406", "0.6837406", "0.6837406...
0.6635123
41
APP_SECRET to sign the JWTs Helper function to be called in resolvers, Wich require authentication.
function getUserId(context) { //get the Authorization header, contains user JWT from context const Authorization = context.request.get('Authorization'); //Verify the JWT if (Authorization) { const token = Authorization.replace('Bearer ', ''); const { userId } = jwt.verify(token, APP_SECRET); return userId; } //if not verified throw error throw new Error('Not authenticated'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function authJwt() {\n const secret = process.env.secret;\n const api = process.env.API_URL;\n console.log(\"I am getting called\");\n return expressJwt({\n secret,\n algorithms: [\"HS256\"],\n // isRevoked: isRevoked,\n }).unless({\n path: [\n {\n url: /\\/api\\/v1\\/books(.*)/,\n ...
[ "0.67094314", "0.66989625", "0.6499316", "0.6499144", "0.64691293", "0.645821", "0.64370745", "0.64071983", "0.6392832", "0.63791233", "0.6289386", "0.62720346", "0.62498534", "0.62151927", "0.6212272", "0.61867833", "0.61751837", "0.61629707", "0.61615837", "0.61529547", "0....
0.0
-1
Set the prototype chain to inherit from `parent`, without calling `parent`'s constructor function.
function Surrogate(child) { this.constructor = child; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extend(parent) {\n\t\tthis.prototype = Object.create(parent.prototype);\n\t\tthis.prototype.constructor = parent;\n\n\t\tvar d = 0, p = this.prototype;\n\n\t\tthis.prototype.uber = function(args) {\n\t\t\tvar f = d;\n\t\t\tvar t = d;\n\t\t\tvar v = parent.prototype;\n\t\t\tif (t) {\n\t\t\t\twhile (t) {\n\...
[ "0.71436614", "0.70977736", "0.7069744", "0.7003358", "0.6916243", "0.6914045", "0.6815367", "0.66552323", "0.66517895", "0.65085185", "0.6376329", "0.6340662", "0.62952995", "0.62634254", "0.622443", "0.6142899", "0.6093282", "0.6092074", "0.6080786", "0.6025002", "0.6009418...
0.0
-1
necessary to determine the exact positioning dependent on the text length
function getWidthOfText(txt, fontname, fontsize){ if(getWidthOfText.c === undefined){ getWidthOfText.c=document.createElement('canvas'); getWidthOfText.ctx=getWidthOfText.c.getContext('2d'); } getWidthOfText.ctx.font = fontsize + ' ' + fontname; return getWidthOfText.ctx.measureText(txt).width; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTextPositionInLabel(text) {\r\n\t\ttext = text + \"\";\r\n\t\treturn 15 - (text.length * 2.2); \r\n\t}", "convertPointToCharacterPosition(text, point) {\n var position = 0;\n var w = 0;\n for (var i = 0, n = text.length; i < n; i++) {\n\n var charWidth = this.calculateCharacterSize(text...
[ "0.77611184", "0.6996046", "0.6972673", "0.68239707", "0.68239707", "0.68066204", "0.6769876", "0.6769876", "0.6684288", "0.6678145", "0.6674764", "0.6477504", "0.6477504", "0.6477504", "0.64566815", "0.6448371", "0.6388521", "0.631873", "0.6301182", "0.62949", "0.6261091", ...
0.0
-1
corrects the font size depend on distance or amount (if this mode is active)
function fontCorrection(distance){ if (mapSettings[0].fontCorrection==true){ if (mapSettings[0].mode == "distance"){ if (distance>10000){return 0.6}else{ if (distance>1000){return 0.7}else{ if (distance>100){return 0.8} else{ if (distance>10){return 0.9} else{ return 1}}}} } if (mapSettings[0].mode == "amount"){ if (distance>10000){return 1.60}else{ if (distance>1000){return 1.45}else{ if (distance>100){return 1.30} else{ if (distance>10){return 1.15} else{ return 1}}}} } } else {return 1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustTextSize(){\n /* var size = 0;\n console.log(\"screen \" + screen.width());\n console.log(\"expre \" + screenExpression.width());\n if(screenExpression.width() > screen.width()){\n size = (screen.width()+40)/screenExpression.width();\n screenExpression.css(\"font-size\",size + \"rem\");\n ...
[ "0.6917897", "0.6861202", "0.6824301", "0.67418593", "0.67391694", "0.6711214", "0.66542923", "0.6617985", "0.6578702", "0.6578018", "0.6568328", "0.6567033", "0.6561523", "0.6544547", "0.651056", "0.64499193", "0.64456725", "0.6440148", "0.6429964", "0.6415159", "0.641215", ...
0.6712731
5
calculates the end points given the angle is known template ::: :::
function vectorOfPoints(lat1, lon1, lat2, lon2,displayed_text,displayed_distance,manipulation=0, fontLocation="Helvetica", fontSizeLocation=25, fontDistance="Helvetica", fontSizeDistance=25, displayed_amount) { var start = 500; var length = 490; var length_of_text = Math.round(getWidthOfText(displayed_text,fontLocation, fontSizeLocation*fontCorrection(displayed_distance)+"px")) if (mapSettings[0].mode=="distance"){ var length_of_textDist = Math.round(getWidthOfText(displayed_distance+" km",fontDistance,fontSizeDistance*fontCorrection(displayed_distance)+"px" )) } if (mapSettings[0].mode=="amount"){ var length_of_textDist = Math.round(getWidthOfText(displayed_amount +" €",fontDistance,fontSizeDistance*fontCorrection(displayed_distance)+"px" )) } // Calculate the distance between two coordinates https://planetcalc.com/713/ var Calculate712_result = {}; var la1 = lat1 //default: 28.1272222222 var lo1 = lon1 //default: -15.4313888889 var la2 = lat2 //default: 13.0961111111 var lo2 = lon2 //default: -59.6083333333 var ellipseType = "wgs84" var angleL = { "SetValue": function(v) { Calculate712_result["angleL"] = v; } }; var distanceM = { "SetValue": function(v) { Calculate712_result["distanceM"] = v; } }; var distanceNMI = { "SetValue": function(v) { Calculate712_result["distanceNMI"] = v; } }; function rad(a) { return Math.PI * a / 180; } function grad(a) { return 180 * a / Math.PI; } function meridionalD(a) { return Math.tan(rad(45 + a / 2)); } function geoidD(a, e) { return Math.pow((1 - e * Math.sin(rad(a))) / (1 + e * Math.sin(rad(a))), e / 2); } function abs(a) { return a < 0 ? -a : a; } function calcDestination(e, la1, lo1, la2, lo2) { var lD = lo2 - lo1; if (abs(lD) > 180) lD = lD < 0 ? 360 + lD : -360 + lD; var rRes = Math.atan2(rad(lD), (Math.log(meridionalD(la2) * geoidD(la2, e)) - Math.log(meridionalD(la1) * geoidD(la1, e)))); var arcLen = (la2 - la1) ? ((1 - e * e / 4) * rad(la2 - la1) - (3 / 8) * e * e * (Math.sin(2 * rad(la2)) - Math.sin(2 * rad(la1)))) / Math.cos(rRes) : (lo2 - lo1) ? Math.cos(rad(la1)) * Math.abs(rad(lo2 - lo1)) : 0; return { "arc": arcLen, "rhumb": rRes }; } var ellipsoids = { "wgs84": { "min": 6356752.314, "max": 6378137 }, "sk42": { "min": 6356863, "max": 6378245 }, "sphere": { "min": 6378137, "max": 6378137 } }; if (ellipseType === undefined) ellipseType = "wgs84"; var geoid = ellipsoids[ellipseType]; var a2 = geoid.max * geoid.max; var b2 = geoid.min * geoid.min; var e = Math.sqrt((a2 - b2) / a2); var res1 = calcDestination(e, la1, lo1, la2, lo2, geoid.max); var res2 = calcDestination(e, la1, lo1, la2, lo2 + 360, geoid.max); var res = (res2.arc < res1.arc) ? res2 : res1; var aRes = grad(res.rhumb); if (aRes < 0) { aRes = 360 + aRes } ;angleL.SetValue(aRes); var len = geoid.max * res.arc; angle = aRes-90 // continue var text_angle = angle; if (angle > 90 & angle < 180) {text_angle = angle + 180} //transform in a way to be readible as a poster e.g. not turned around if (angle > 180 & angle < 270) {text_angle = angle - 180} var start_x = start + 0.95* length * Math.cos(angle * Math.PI / 180); var start_y = start + 0.95* length * Math.sin(angle * Math.PI / 180); var end_x = start + length * Math.cos(angle * Math.PI / 180); var end_y = start + length * Math.sin(angle * Math.PI / 180); var text_x = end_x - (25+10+length_of_textDist+length_of_text/2)*Math.cos(angle * Math.PI / 180) var text_y = end_y - (25+10+length_of_textDist+length_of_text/2)*Math.sin(angle * Math.PI / 180) var textDist_x = end_x - (25+5+length_of_textDist/2)*Math.cos(angle * Math.PI / 180) var textDist_y = end_y - (25+5+length_of_textDist/2)*Math.sin(angle * Math.PI / 180) if (manipulation!=0) { // calculates a new text positioning, while the line is kept correct (start_x,end_x var start_x2 = start + 0.95* length * Math.cos((angle+manipulation) * Math.PI / 180); var start_y2 = start + 0.95* length * Math.sin((angle+manipulation) * Math.PI / 180); var end_x2 = start + length * Math.cos((angle+manipulation) * Math.PI / 180); var end_y2 = start + length * Math.sin((angle+manipulation) * Math.PI / 180); var text_x = end_x2 - (25+10+length_of_textDist+length_of_text/2)*Math.cos((angle+manipulation) * Math.PI / 180) var text_y = end_y2 - (25+10+length_of_textDist+length_of_text/2)*Math.sin((angle+manipulation) * Math.PI / 180) var textDist_x = end_x2 - (25+5+length_of_textDist/2)*Math.cos((angle+manipulation) * Math.PI / 180) var textDist_y = end_y2 - (25+5+length_of_textDist/2)*Math.sin((angle+manipulation) * Math.PI / 180) // console.log("Start_x2 is" + start_x2 + "for " + displayed_text) // console.log("Start_y2 is" + start_y2 + "for " + displayed_text) text_angle = text_angle +manipulation } var pointsInPlot = { start_x:start_x,start_y:start_y,end_x:end_x,end_y:end_y, text_x:text_x,text_y:text_y,text_angle:text_angle, textDist_x:textDist_x,textDist_y:textDist_y, length_of_text:length_of_text,length_of_textDist:length_of_textDist,angle:angle, start_x_corr:start_x2, start_y_corr:start_y2 } return pointsInPlot }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateEndpoints(head = this.head, tail = this.tail) {\n const curve = new Curve(head, this.controlPt, tail);\n const incrementsArray = [0.001, 0.005, 0.01, 0.05];\n let increment = incrementsArray.pop();\n let t = 0;\n // let iterations = 0;\n while (increment && t < 0....
[ "0.60453606", "0.58917344", "0.5774873", "0.56131047", "0.5574945", "0.5554614", "0.55511606", "0.5533894", "0.55255455", "0.5502252", "0.5500518", "0.54998744", "0.5436608", "0.542795", "0.5420645", "0.5415051", "0.5404976", "0.53926593", "0.53857756", "0.534527", "0.5256932...
0.0
-1
add parameters to friendlocation
function AddParametersFriendLocation(){ var i =0 for (i = 0; i < friendLocation.length; i++) { friendLocation[i].dist = distance(homeLocation[0].lat,homeLocation[0].lon,friendLocation[i].lat,friendLocation[i].lon, "K"); friendLocation[i].data = vectorOfPoints(homeLocation[0].lat,homeLocation[0].lon,friendLocation[i].lat,friendLocation[i].lon,friendLocation[i].location,friendLocation[i].dist, manipulation=0, fontLocation=mapSettings[0].fontLocation, fontSizeLocationn=mapSettings[0].fontSizeLocation, fontDistancen=mapSettings[0].fontDistance,fontSizeDistance=mapSettings[0].fontSizeDistance,friendLocation[i].spendings ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateMapParameter(){\n\n\tAddParametersFriendLocation()\n\n\tcorrectCloseLocations()\n\n}", "function setParameters(origin, address, filter, location){\n ORIGIN_LIST = origin;\n if (address[0] == \"\") { //if no destinations in database\n ADDRESS_LIST = 0;\n }\n else {\n AD...
[ "0.63558537", "0.6346681", "0.5954811", "0.5643424", "0.55829346", "0.5573025", "0.5537914", "0.5528827", "0.5492518", "0.54728156", "0.5454784", "0.54192686", "0.54150164", "0.5408661", "0.5360932", "0.5341492", "0.5337575", "0.53229415", "0.5318921", "0.5300617", "0.5296363...
0.825313
0
correction of notsonice visualization (locations with the same direction)
function correctCloseLocations(){ var min_correction_dist = 5 // if helvetica == 20, a correction of 3 seems enough var correction = [0] for (i = 0; i < friendLocation.length; i++) { correction[i]=friendLocation[i].data.angle } function checkSimilar(value) { return value == x; } function compute_correction_diff(correction){ var correction_diff = [] var correction_diff_abs = [] for (i = 0; i < correction.length; i++) { correction_diff_one = [] correction_diff_one_abs = [] for (j = 0; j < correction.length; j++) { if (i == j){ correction_diff_one.push(1000) //set to a high value correction_diff_one_abs.push(1000) }else{ if ((Math.abs(correction[i]-correction[j])) <(360-min_correction_dist) ){ if (correction[i]>350) {correction[i]=(correction[i]-360)} if (correction[j]>350) {correction[j]=(correction[j]-360)} } correction_diff_one.push(correction[i]-correction[j]) correction_diff_one_abs.push(Math.abs(correction[i]-correction[j])) } } x = Math.min(...correction_diff_one_abs) abs_index= correction_diff_one_abs.findIndex(checkSimilar ) correction_diff_abs[i] =x correction_diff[i] = correction_diff_one[abs_index] } var corr=[] corr[0]=correction_diff_abs corr[1]=correction_diff return corr } var k; for (k = 0; k < 100; k++) { var corr = compute_correction_diff(correction) x = Math.min(...corr[0]) abs_index= corr[0].findIndex(checkSimilar ) if (x > min_correction_dist) { break; } if (corr[1][abs_index]<0){ correction[abs_index] = correction[abs_index] - 0.2 // console.log("Value has been reduced by 0.2 for " + friendLocation[abs_index].location) }else{ correction[abs_index] = correction[abs_index] + 0.2 // console.log("Value has been increased by 0.2 for " + friendLocation[abs_index].location) } //to find the second pendant set the abs_index to +1 corr[0][abs_index] = corr[0][abs_index] + 0.2 abs_index= corr[0].findIndex(checkSimilar ) //find second example if (corr[1][abs_index]<0){ correction[abs_index] = correction[abs_index] - 0.2 // console.log("Value has been reduced by 0.2 for " + friendLocation[abs_index].location) }else{ correction[abs_index] = correction[abs_index] + 0.2 // console.log("Value has been increased by 0.2 for " + friendLocation[abs_index].location) } } var i =0 for (i = 0; i < friendLocation.length; i++) { text_corrector = -friendLocation[i].data.angle+correction[i] friendLocation[i].data = vectorOfPoints(homeLocation[0].lat,homeLocation[0].lon,friendLocation[i].lat,friendLocation[i].lon,friendLocation[i].location,friendLocation[i].dist, manipulation=text_corrector, fontLocation=mapSettings[0].fontLocation, fontSizeLocationn=mapSettings[0].fontSizeLocation, fontDistancen=mapSettings[0].fontDistance,fontSizeDistance=mapSettings[0].fontSizeDistance,friendLocation[i].spendings); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showTrainArea(map, x, y) {\n let previewSize = 6 / 2;\n for (let j = Math.max(0, y - previewSize); j < Math.min(map.map.length - 1, y + previewSize); j++) {\n let line = \"\";\n for (let i = Math.max(0, x - previewSize); i < Math.min(x + previewSize, map.map[j].length); i++) {\n ...
[ "0.5986192", "0.59763193", "0.59486794", "0.5711595", "0.56706893", "0.56602633", "0.5621629", "0.56213063", "0.5600042", "0.55999804", "0.55525774", "0.55014837", "0.5498066", "0.5482615", "0.54121846", "0.5393094", "0.5388206", "0.5386546", "0.53769803", "0.5371065", "0.534...
0.51857895
46
parameter calculation and correction
function calculateMapParameter(){ AddParametersFriendLocation() correctCloseLocations() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calc(params) {\n return 22; \n}", "function updateParams()\n{\n beta = parseFloat($('#param1').val()).toFixed(2);\n alpha = (1 - Number(beta)).toFixed(2);\n $('#fairnessVal').html(\"Fairness Weight: \" + beta);\n $('#throughputVal').html(\"Throughput Weight: \" + alpha);\n}", "function c...
[ "0.6360211", "0.61976403", "0.6065874", "0.6006052", "0.58915895", "0.5882498", "0.5859229", "0.5709164", "0.5703393", "0.56997615", "0.56949455", "0.56727695", "0.5668661", "0.5658289", "0.5648664", "0.56040835", "0.5594275", "0.5587066", "0.5559364", "0.5557143", "0.5534360...
0.5486283
25
Initial data fetch asynchronous (ain't nothing holding the page back while it loads)
async connectedCallback() { let request = new XMLHttpRequest(); request.open('GET', jsonData, false); request.send(null); this.data = JSON.parse(request.responseText); // turns out that github does not provide // unauthenticated access to public repos over rest // Thank you github. Hence cannot fatch Data using the Fetch API //const data = await fetchDataHelper({ amountOfRecords: 100 }); //this.data = data; this.calculateData(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n fetchData();\n}", "async function loadData() {\n //initialize() will return either\n //multiple resolved promises of AJAX calls for initializing database or\n //Already Initialized\n const result = await initialize();\n\n //if result is array we have array of resolved promises...
[ "0.7836573", "0.77522427", "0.7539224", "0.7150297", "0.70738596", "0.7062026", "0.7054877", "0.70489025", "0.6991692", "0.69897443", "0.6959671", "0.6943829", "0.69286376", "0.68694484", "0.6863396", "0.686015", "0.68112504", "0.6789645", "0.677177", "0.67689234", "0.6766588...
0.68008065
17
Event Handler for "Add Debt" onclick
handleAddRow(event) { this.showInputSection = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buttonBuyEvent() {\r\n sumAllMoney += Number($(this).text().match(/\\d+\\.\\d+/g)[0]);\r\n $('h1:eq(1)').text(`Total Store Profit: ${sumAllMoney} BGN`)\r\n $(this).parent().remove()\r\n }", "function addToCartEvent() {\n\t\t$(\"form.product_form .wpsc_buy_button\").click(function...
[ "0.6388382", "0.6312957", "0.62104166", "0.6171229", "0.6162787", "0.608986", "0.6070457", "0.59900147", "0.597411", "0.59577554", "0.5956974", "0.5940397", "0.5888081", "0.58224314", "0.58144814", "0.58085424", "0.5804701", "0.5788317", "0.5785078", "0.57827777", "0.5764892"...
0.0
-1
Event Handler for "Remove Debt" onclick
handleRemoveRow(event) { // For some reason lwc returns a proxy and not an object array when // accessing seslectedData directly so going to have to do a query // selection for elements to fetch selected rows //let selectedRows = this.selectedData; let selectedRows = this.template.querySelector('lightning-datatable').getSelectedRows(); if(!selectedRows.length) { this.showNotification('No Rows Selected'); return; } for(let i = 0; i < selectedRows.length; i++) { for(let j = 0; j < this.data.length; j++) { if(this.data[j]['id'] == selectedRows[i]['id']) { this.data.splice(j,1); } } } this.calculateData(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remove(){\nremove_btn();\nquant();\ncalculate_total();\n}", "function handleRemove(){\r\n //making sure it does not remove if there are 0 items\r\n if (quantity.innerHTML !== \"0\"){\r\n quantity.innerHTML = parseInt(quantity.innerHTML)-1;\r\n }\r\n //disabling the \"a...
[ "0.7309488", "0.7177573", "0.70164657", "0.69206375", "0.69182664", "0.6871848", "0.68686795", "0.68233", "0.6801254", "0.6796952", "0.6763039", "0.6756368", "0.6716516", "0.66996086", "0.6630511", "0.6588026", "0.6581877", "0.65619403", "0.6454827", "0.64139354", "0.6394211"...
0.0
-1
Event Handler for "Save" onclick
handleSaveRow(event) { // Run all validations since it is run from a non form submit button // and may skip validation component validation rules const checkAllField = [...this.template.querySelectorAll('lightning-input')] .reduce((validSoFar, inputField) => { inputField.reportValidity(); return validSoFar && inputField.checkValidity(); }, true); if (checkAllField) { let newRow = {}; newRow.id = this.lastID + 1; // could have been smiplified by using same DOM name as object schema but // may incur heavy price if overlooked this.template.querySelectorAll('lightning-input').forEach(function(element){ if(element.name == 'creditorInput') newRow.creditorName = element.value; else if(element.name == 'firstNameInput') newRow.firstName = element.value; else if(element.name == 'lastNameInput') newRow.lastName = element.value; else if(element.name == 'minPayInput') newRow.minPaymentPercentage = element.value; else if(element.name == 'balanceInput') newRow.balance = element.value; },this); this.data.push(newRow); this.showInputSection = false; this.calculateData(); } else { this.showNotification('Please verify fields'); return; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnBtnSave_Click( e )\r\n{\r\n Save( 'generic_save_title' , 'save_confirm_msg' ) ;\r\n}", "function OnBtnSave_Click( e )\r\n{\r\n Save( 'generic_save_title' , 'save_confirm_msg' ) ;\r\n}", "onSaveButtonClick(eventObject) {\n let saveButton = eventObject.target;\n let savedTy...
[ "0.79770654", "0.79770654", "0.72572094", "0.7254854", "0.7228365", "0.7221425", "0.7190218", "0.71634847", "0.7100591", "0.70950043", "0.70810235", "0.7017893", "0.7002524", "0.6998178", "0.69302905", "0.691032", "0.68942547", "0.6866755", "0.685673", "0.6823339", "0.6818064...
0.0
-1
Event Handler for "Cancel" onclick
handleCancelRow(event) { this.showInputSection = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cancel(e) { }", "_handleClickCancel(e) {\n if (DEBUG) {\n console.log('[*] ' + _name + ':_handleClickCancel ---');\n }\n\n e.preventDefault();\n }", "function cancel() {\r\n click(getCancel());\r\n waitForElementToDisappear(getCancel());\r\n }", ...
[ "0.84697753", "0.8102043", "0.7760309", "0.7737894", "0.76904225", "0.7682232", "0.7569041", "0.75648934", "0.7536879", "0.74954766", "0.7486528", "0.7486163", "0.7478079", "0.7476684", "0.74088424", "0.7395636", "0.739047", "0.73738134", "0.73386055", "0.73128057", "0.730365...
0.0
-1
Event Handler for "lightningdatatable" onSelect
handleRowSelection(event) { this.selectedData = this.template.querySelector('lightning-datatable').getSelectedRows(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSelectRow() {\n // Update selected rows\n if (component.initialized) {\n updateSelectedRows();\n }\n }", "function onSelect(event) {\r\n refresh(JSON.parse(event.data));\r\n}", "function selectHandler() \n {\n var selectedItem = chart...
[ "0.6965394", "0.6917137", "0.67212576", "0.6600849", "0.65319467", "0.6506635", "0.6387158", "0.63683957", "0.63565326", "0.63564444", "0.63564444", "0.63308305", "0.6317594", "0.6317594", "0.6299829", "0.6259634", "0.6235656", "0.6223951", "0.6223951", "0.61801934", "0.61428...
0.7328452
0
Reused Code to refersh table data as well as balance total
calculateData() { let calculatedBalance = 0; // lwc does not track changes in an array but only when the object reference changes (weird) // hence JSON - string - JSON conversion to generate new object instance this.data = JSON.parse(JSON.stringify(this.data)); for(let i = 0; i < this.data.length; i++) { calculatedBalance = Number(calculatedBalance) + Number(this.data[i]['balance']); if(Number(this.data[i]['id']) > this.lastID) { // ensures that the Id is never repeated this.lastID = this.data[i]['id'] } } this.totalBalance = calculatedBalance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dataTableTotal(){\n console.log(table.page.info());\n let startPage = table.page.info().start;\n let endPage = table.page.info().end;\n let totalHarga = 0;\n let totalData = parseInt(table.page.info().end - table.page.info().start);\n // console.log(table.page.info().start);\...
[ "0.7137763", "0.6992679", "0.6981347", "0.6799577", "0.679407", "0.6773406", "0.66576904", "0.65515625", "0.6544135", "0.6530894", "0.652622", "0.6495421", "0.6463047", "0.6462236", "0.6448397", "0.6434446", "0.6423547", "0.6361304", "0.63584447", "0.6311489", "0.6303051", ...
0.63806707
17
Reusable method to trigger a Toast notification event currently only generates error notifications with configurable message
showNotification(message) { const evt = new ShowToastEvent({ title: 'Error', message: message, variant: 'error', mode: 'dismissable', }); this.dispatchEvent(evt); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showError(error, toastTitle) {\n //console.log('Error received: ' + JSON.stringify(error));\n\n let errorMessage = 'Unknown error';\n if (Array.isArray(error.body)) {\n errorMessage = error.body.map(e => e.message).join(', ');\n }\n else if (error && error.body && erro...
[ "0.76409173", "0.7605937", "0.75561714", "0.7479432", "0.7453989", "0.7158677", "0.7148761", "0.7067646", "0.6947318", "0.6933967", "0.6933967", "0.68265957", "0.6812822", "0.66661197", "0.6650817", "0.663666", "0.6624274", "0.65694743", "0.65448344", "0.6510844", "0.6510844"...
0.75928825
2
Obtain the node text
function nodeText(node){ var str = node.textContent || node.innerHTML || node.innerText || ''; return str.trim(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getText(node) {\n\n if (node.nodeType === 3) {\n return node.data;\n }\n\n var txt = '';\n\n if (!!(node = node.firstChild)) do {\n txt += _getText(node);\n } while (!!(node = node.nextSibling));\n\n return txt;\n\n }", "function getNodeText(node: Node) {\n let textContent...
[ "0.7950219", "0.77213913", "0.7706418", "0.76911503", "0.76457703", "0.7643448", "0.7643448", "0.7643448", "0.7643448", "0.7643448", "0.7643448", "0.76192784", "0.7573738", "0.75559855", "0.735868", "0.73320645", "0.7282481", "0.72499084", "0.7236062", "0.7224772", "0.7103059...
0.77994555
1
Create an object based on the list of attributes from a DOM node
function objFromAttributes(node, attrList){ var i, a, obj = {}; for(i=0; i < attrList.length; i++){ a = attrList[i]; obj[a] = node.getAttribute(a); } return obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createWith(tag, attributes)\n {\n const element = this.document().createElement(tag);\n\n for (var i = 0, l = (attributes || []).length; i < l; i++) {\n const key = attributes.item(i).name;\n const value = attributes.item(i).nodeValue;\n\n element.setAttribute(key,...
[ "0.665965", "0.6469817", "0.64228153", "0.62208813", "0.6138542", "0.6136938", "0.6091582", "0.6086575", "0.599479", "0.5961836", "0.59482443", "0.5933485", "0.59009457", "0.59009457", "0.59009457", "0.59009457", "0.59009457", "0.59009457", "0.59009457", "0.59009457", "0.5884...
0.7741049
0
Callback listener for XMLHttpRequest
function reqListener(){ var x = this; if(isFunc(this.cb_func)){ this.cb_func(this.responseXML); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onRequestData(url, listener){\n const oReq = new XMLHttpRequest();\n oReq.addEventListener('load', listener);\n oReq.open('GET',url);\n oReq.send();\n}", "function reqListener() {\n console.log(\"res\", this.responseText);\n }", "function reqListener () {\r\n console.log(this.re...
[ "0.73812973", "0.7177435", "0.7151438", "0.71057534", "0.71017927", "0.70793766", "0.70532584", "0.7049591", "0.67537177", "0.67445207", "0.66872513", "0.6678534", "0.66558105", "0.6643317", "0.6614074", "0.65930516", "0.65823305", "0.6543701", "0.65184844", "0.6509528", "0.6...
0.6996655
8
Object representing a creative within the ad
function VastCreative(node, parent){ var me = this; var par = parent; this.sequence = node.getAttribute('sequence'); this.adId = node.getAttribute('adid'); this.id = node.getAttribute('id'); this.apiFramework = node.getAttribute('apiFramework'); /** * @function * Retrieve companion ads associated with this ad or null */ this.getCompanionAds = function(){ var i, comp = null, c, len, seq = me.sequence; if(!parent || (me.adType != 'linear' && me.adType != 'nonlinear') || par.creative_companions.length == 0){ return null; } len = par.creative_companions.length; for(i=0; i < len; i++){ c = par.creative_companions[i]; if(c.adType == COMPANION_ADS){ if(c.sequence == null){ comp = c; } else if(c.sequence == seq){ return c; } } } return comp; } function parseTrackingEvents(detObj, trackingNode){ var i, tn, evt, tracks = childElements(trackingNode), tevts = detObj.trackingEvents || {}; for(i=0; i < tracks.length; i++){ tn = tracks[i]; if(tn.tagName.toUpperCase() != 'TRACKING'){ continue; } evt = tn.getAttribute('event'); tevts[evt] = { event: evt, url: nodeText(tn) }; } // insure reassignment detObj.trackingEvents = tevts; } function parseCreative(node){ var i, n, kids, tname; kids = childElements(node); if(kids.length == 0){ return; } else{ tname = kids[0].tagName.toLowerCase(); me.adType = tname; if(tname == 'linear'){ parseLinear(kids[0]); } else if(tname == COMPANION_ADS){ parseCompanionAds(kids[0]); } else if(tname == 'nonlinear'){ parseNonLinear(kids[0]); } } } /** * @function * Parse a linear ad node */ function parseLinear(lnode){ var l, tn, k, mfiles, mf, mfAttribs, mObj, i, m, kids = childElements(lnode); mfAttribs = ['delivery', 'type', 'width', 'height', 'codec', 'id', 'bitrate', 'minBitrate', 'maxBitrate', 'scalable', 'maintainAspectRatio', 'apiFramework' ]; me.linear = { duration : null, mediaFiles: [] }; l = me.linear; for(i=0; i < kids.length; i++){ k = kids[i]; tn = k.tagName.toUpperCase(); switch(tn){ case 'DURATION': l.duration = nodeText(k); break; case 'MEDIAFILES': mfiles = childElements(k); for(m=0; m < mfiles.length; m++){ mf = mfiles[m]; mObj = objFromAttributes(mf, mfAttribs); mObj.url = nodeText(mf); l.mediaFiles.push(mObj); } case 'TRACKINGEVENTS': parseTrackingEvents(l, k); break; case 'ADPARAMETERS': case 'VIDEOCLICKS': case 'ICONS': break; } } } function parseCompanionAds(cnode){ var k, i, kids = childElements(cnode); me.companions = []; for(i=0; i < kids.length; i++){ me.companions.push(new CompanionAd(kids[i])); } } function parseNonLinear(nlnode){ } // Begin parsing parseCreative(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function VastAd(node){\n\t\tvar me = this;\n\t\t// required elements - section 2.2.4.1\n\t\tthis.id = node.getAttribute('id');\n\t\tthis.sequence = node.getAttribute('sequence');\n\t\tthis.impressions = [];\n\t\tthis.creatives = [];\n\t\tthis.creative_companions = [];\n\t\t\n\t\t// optional elements - - section 2...
[ "0.60025346", "0.5495766", "0.53622514", "0.52953815", "0.52795583", "0.52789277", "0.52789277", "0.52601653", "0.52579063", "0.52579063", "0.52127767", "0.51980555", "0.51979446", "0.5164931", "0.5115585", "0.5055893", "0.50306714", "0.5011333", "0.49710134", "0.4966907", "0...
0.6614021
0
Object representing an AD element in a VAST template
function VastAd(node){ var me = this; // required elements - section 2.2.4.1 this.id = node.getAttribute('id'); this.sequence = node.getAttribute('sequence'); this.impressions = []; this.creatives = []; this.creative_companions = []; // optional elements - - section 2.2.4.2 this.description = NULL; this.advertiser = NULL; this.error = NULL; this.pricing = NULL; this.extensions = NULL; function parseAd(node){ var kid = childElements(node)[0], tagName = kid.tagName.toUpperCase(); if(tagName == 'WRAPPER'){ me.isWrapper = true; me.wrapperUrl = 'http://example/org'; return; } else if(tagName == 'INLINE'){ parseInlineAd(kid); } } /** * @function * Parsing routine for the INLINE tag element and children */ function parseInlineAd(ilnode){ var i, m, n, key, kidNode, adSys, url, adname, vnum, sysname; var cr, crar, allcr; var kids = childElements(ilnode); me.isWrapper = false; me.isInline = true; for(i=0; i < kids.length; i++){ kidNode = kids[i]; switch(kidNode.tagName.toUpperCase()){ case 'ADSYSTEM': vnum = kidNode.getAttribute('version'); sysname = kidNode.innerHTML; if(vnum == null){ vnum = parseFloat(sysname); if(isNaN(vnum)){ vnum = null; } else{ sysname = null; } } adSys = { version: vnum, name: sysname } me.adSystem = new function(){ this.version = adSys.version; this.name = adSys.sysname; this.toString = function(){ var s = (this.name || 'Unknown') + ', version ' + (this.version || '0'); return s; } } break; case 'ADTITLE': adname = nodeText(kidNode); me.adName = adname; break; case 'IMPRESSION': url = nodeText(kidNode); me.impressions.push({id: kidNode.getAttribute('id'), url: url}); break; case 'CREATIVES': allcr = childElements(kidNode); for(m=0; m < allcr.length; m++){ cr = new VastCreative(allcr[m], me); if(cr.adType == COMPANION_ADS){ me.creative_companions.push(cr); } else{ me.creatives.push(cr); } } break; // Optional Inline Elements - 2.2.4.2 case 'DESCRIPTION': me.description = nodeText(kidNode); break; case 'ADVERTISER': me.advertiser = nodeText(kidNode); break; case 'SURVEY': if(me.survey === undefined){ me.survey = []; } // open for interpretation me.survey.push({ attributes: {}, content: kidNode.innerHTML }); for(m=0; m < kidNode.attributes; m++){ me.survey.attributes[kidNode.attributes.name] = kidNode.attributes.value; } break; case 'PRICING': me.pricing = { model : kidNode.getAttribute('model'), currency: kidNode.getAttribute('currency'), value: nodeText(kidNode) }; break; case 'EXTENSIONS': me.extensions = kidNode.innerHTML; break; } // TODO - SORT CREATIVES BY Sequence } } parseAd(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function VMAPAdSource(xml) {\n\t var i = void 0;\n\t var len = void 0;\n\t var node = void 0;\n\t this.id = xml.getAttribute('id');\n\t this.allowMultipleAds = xml.getAttribute('allowMultipleAds');\n\t this.followRedirects = xml.getAttribute('followRedirects');\n\t this.vastAdData = null;\n\t this.adTagURI...
[ "0.57194495", "0.5322524", "0.519831", "0.519831", "0.51490253", "0.5091709", "0.50292176", "0.5024515", "0.5021083", "0.5021083", "0.5021083", "0.49836984", "0.4962434", "0.4951648", "0.49125886", "0.48921937", "0.48880607", "0.48880607", "0.4880534", "0.48552525", "0.484632...
0.5845063
0
Instance object of a VAST document
function VastDoc(xdoc){ var me = this; this.xml = xdoc; this.ads = []; this.isAdPod = false; function parseStructure(xml){ var ads, i; var root = xml.documentElement; // version 2.0 forward should use VAST as the root node if(root.tagName.toUpperCase() !== 'VAST'){ throw {message: 'Invalid VAST document'}; } me.vast_version = root.getAttribute('version'); ads = childElements(root); for(i=0; i < ads.length; i++){ if(ads[i].tagName.toUpperCase() === 'AD'){ me.ads.push(new VastAd(ads[i])); } } if(me.ads.length > 1){ me.isAdPod = true; } } parseStructure(xdoc); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "function ...
[ "0.64372015", "0.629957", "0.629957", "0.629957", "0.629957", "0.629957", "0.6142987", "0.59593993", "0.5926811", "0.58568805", "0.5801582", "0.5785759", "0.5785759", "0.5785759", "0.5785759", "0.5785759", "0.5781909", "0.57804894", "0.57797796", "0.5776937", "0.5776937", "...
0.6895495
0
Actual VAST parsing code
function parseVastSource(source){ var xdoc, parser; parser = new DOMParser(); xdoc = parser.parseFromString(source, 'text/xml'); return new VastDoc(xdoc); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function VNode() {}", "function parseStatement() {}", "analyze(lexer){ return null }", "function Parser() {\n\n}", "visitNode(node) { }", "function parse(p,src){\n var st = new ParserState(src),\n r = p.runParser(st);\n return r.getAst();\n }", "function traverseAST(astNode)...
[ "0.64005315", "0.6324929", "0.61906564", "0.61600363", "0.6058125", "0.6037482", "0.59242666", "0.5916055", "0.5916055", "0.5899561", "0.5895922", "0.585676", "0.5844705", "0.58376455", "0.57688576", "0.57358545", "0.56623256", "0.5647107", "0.5641289", "0.5636529", "0.561177...
0.62212044
2
Thanks to Stack overflow
function isOneChecked(radioname) { // All <input> tags... var chx = document.getElementsByName(radioname); for (var i=0; i<chx.length; i++) { // If you have more than one radio group, also check the name attribute // for the one you want as in && chx[i].name == 'choose' // Return true from the function on first match of a checked item if (chx[i].type == 'radio'&& chx[i].checked) { return true; } } // End of the loop, return false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "transient private internal fun...
[ "0.6451393", "0.6211462", "0.6123348", "0.5964502", "0.5797353", "0.56459343", "0.5625277", "0.5573363", "0.5535185", "0.5443656", "0.5442566", "0.5416472", "0.5379307", "0.52987903", "0.5296901", "0.52901995", "0.52729225", "0.5242841", "0.51962465", "0.5149347", "0.5148757"...
0.0
-1
var reverseEntireSentence = reverseBySeparator(string, ""); // var reverseEachWord = reverseBySeparator(reverseEntireSentence, " ");
function reverseBySeparator(string, separator) { return string .split(separator) .reverse() .join(separator) .replace(/[^A-Za-z 0-9]/gi, ""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverseEachWord(str, separator){\n\n return str.split(separator).reverse().join(separator);\n\n}", "function reverseSentence(string) {\n return console.log(string.split(' ').reverse().join(''));\n}", "function wordReverse(string) {\n var split = string.split(\" \");\n return split.reverse();...
[ "0.8212599", "0.8085617", "0.7956091", "0.7836381", "0.7783865", "0.7766943", "0.7732637", "0.76943046", "0.76894647", "0.76846766", "0.76825017", "0.7667559", "0.765865", "0.76264715", "0.76060116", "0.75921994", "0.7589852", "0.75869846", "0.7585202", "0.7585202", "0.757812...
0.7505236
26
the function below randomizes a line according to the number of syllables allowed
function randomizeLine(num){ var result = ""; while (num > 0){ var j = Math.round(Math.random() * (num - 1) + 1); var randomWord = getRandomWord(j); result += randomWord + " "; num -= j; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomizeSentence(sentence) {\n\n}", "randomLine(nbEmpty) {\n // Use default value if no param provided\n nbEmpty = nbEmpty || ((this.width / 3) | 0);\n let result = Array(this.width).fill(this.EMPTY);\n for(let count = this.width; count > nbEmpty; ) {\n let idx = Math.floor(...
[ "0.68040866", "0.67376137", "0.6534846", "0.63994604", "0.62451684", "0.6196211", "0.61307245", "0.61227655", "0.61095613", "0.6109424", "0.6045315", "0.6028608", "0.602666", "0.60029006", "0.60025156", "0.60022855", "0.5994358", "0.59785444", "0.5970096", "0.5946891", "0.593...
0.75583625
0
Configuring the Users module
function menuConfig(menuService) { menuService.addMenuItem('topbar',{ title: 'Pacientes', state: 'paciente', type: 'dropdown', roles: ['admin', 'eli', 'gio', 'user'] }); menuService.addSubMenuItem('topbar', 'paciente', { title: 'Listar Pacientes', state: 'paciente.list', roles: ['admin', 'eli', 'gio', 'user'] }); menuService.addSubMenuItem('topbar', 'paciente', { title: 'Registrar Paciente', state: 'paciente.create', roles: ['admin', 'eli', 'gio', 'user'] }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initUsers() {\n this.user = new _models_user__WEBPACK_IMPORTED_MODULE_2__[\"User\"]('', // \"_id\"\n null, // \"cuenta\"\n null, // \"contrase\"\n null, // \"correo\"\n '', // \"nombre\"\n '', // \"image\"\n '', // \"apellido\"\n '', // \"cedula\"\n ''...
[ "0.67340666", "0.6712787", "0.66848457", "0.65620315", "0.62629145", "0.6150309", "0.613553", "0.6118517", "0.60889965", "0.6056425", "0.605201", "0.6002881", "0.5958288", "0.59133583", "0.5902473", "0.5887292", "0.5832695", "0.5821733", "0.5798553", "0.5783456", "0.5782437",...
0.0
-1
Write password to the password input
function writePassword() { var password = generatePassword(); var passwordText = document.querySelector("#password"); passwordText.value = password; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writePassword() {}", "function writePassword() {\n var password = getPasswordOptions();\n var passwordText = document.querySelector('#password');\n \n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.qu...
[ "0.88605946", "0.85434437", "0.8511256", "0.8500835", "0.84896296", "0.84846", "0.84719414", "0.84686357", "0.8454292", "0.8443738", "0.8431387", "0.8419759", "0.8418786", "0.8406216", "0.8403772", "0.8400314", "0.8392802", "0.83758265", "0.8370068", "0.83642554", "0.836013",...
0.0
-1
Sets the status of a specific schedule. id id of the specific schedule which should be set up
setScheduleStatus(id) { let statusToSet = this.state.scheduleIsOn ? 'enabled' : 'disabled'; /** * REST call to change the status of a schedule to enabled/disabled. */ fetch('http://192.168.0.21/api/CeyiFspaKI7cxGvtu9uOLJmQgOmAZuoUyMaxwETp/schedules/' + id, { method: 'PUT', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ 'status': statusToSet }) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setScheduleTime(id) {\n\n let minutes = this.state.WakeUpTimeMinutes;\n let hours = this.state.WakeUpTimeHours;\n\n if(minutes > this.state.sunriseDurationBeforeWakeUp) {\n minutes = minutes - this.state.sunriseDurationBeforeWakeUp;\n }\n else {\n minutes = 60 + minutes - this.state.sunris...
[ "0.6909573", "0.6799831", "0.60335", "0.60310316", "0.59682524", "0.5910756", "0.5839768", "0.57532656", "0.5659066", "0.5653452", "0.56521744", "0.565207", "0.5643706", "0.5599471", "0.55869824", "0.5576613", "0.55636865", "0.55456233", "0.5500756", "0.5496788", "0.5489824",...
0.77155966
0
Sets the time of a specific schedule. id id of the specific schedule which should be set up
setScheduleTime(id) { let minutes = this.state.WakeUpTimeMinutes; let hours = this.state.WakeUpTimeHours; if(minutes > this.state.sunriseDurationBeforeWakeUp) { minutes = minutes - this.state.sunriseDurationBeforeWakeUp; } else { minutes = 60 + minutes - this.state.sunriseDurationBeforeWakeUp; hours == 0 ? hours = 23 : hours -= 1; } let time = "W124/T" + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":00"; /** * REST call to change the status of a schedule to enabled/disabled. */ fetch('http://192.168.0.21/api/CeyiFspaKI7cxGvtu9uOLJmQgOmAZuoUyMaxwETp/schedules/' + id, { method: 'PUT', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ 'localtime': time }) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setTime() {\n var hours = $('input[name=\"schedule_hour_submit\"]').val();\n var minutes = $('input[name=\"schedule_minute_submit\"]').val();\n if (!_.isEmpty(hours) && !_.isEmpty(minutes)) {\n schedule.scheduleTime = $('input[name=\"schedule_hour_submit\"]').val() + ':' + ...
[ "0.68209475", "0.60670316", "0.59914833", "0.59150565", "0.59122765", "0.5885495", "0.58764976", "0.5859781", "0.58267653", "0.58108634", "0.5805996", "0.57979095", "0.5760425", "0.57583797", "0.5687236", "0.56838435", "0.56824195", "0.56649256", "0.5635112", "0.5629422", "0....
0.7021235
0
Renders the UI components. Returns the same result each time it's invoked, and it does not read from or write to the DOM or otherwise interact with the browser (e.g., by using setTimeout). If you need to interact with the browser, perform your work in componentDidMount().
render() { return ( <View style={styles.container}> <View style={{height: 50}}></View> <Text style={styles.textS}>Time you want to wake up</Text> <TouchableWithoutFeedback onPress={this.showPicker.bind(this, 'isoFormat', { hour: this.state.WakeUpTimeHours, minute: this.state.WakeUpTimeMinutes, is24Hour: true, })}> <View> <Text style={styles.textL}>{this.formatTime(this.state.WakeUpTimeHours, this.state.WakeUpTimeMinutes)}</Text> </View> </TouchableWithoutFeedback> <View style={{height: 150}}></View> <Text style={styles.textS}>Sunrise</Text> <View style={{height: 5}}></View> <Switch onValueChange={(value) => this.setState({scheduleIsOn: value})} value={this.state.scheduleIsOn} /> <View style={{height: 20}}></View> <Text style={styles.textS}>Minutes sunrise starts before you want to wake up</Text> <Picker style={styles.picker} selectedValue={this.state.sunriseDurationBeforeWakeUp.toString()} onValueChange={(value) => this.setState({sunriseDurationBeforeWakeUp: parseInt(value)})} > <Picker.Item label="0" value="0" /> <Picker.Item label="5" value="5" /> <Picker.Item label="10" value="10" /> <Picker.Item label="15" value="15" /> <Picker.Item label="20" value="20" /> <Picker.Item label="25" value="25" /> <Picker.Item label="30" value="30" /> </Picker> </View> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_render() {\n this._reactComponent = this._getReactComponent();\n if (!this._root) this._root = createRoot(this._container.getElement()[0]);\n this._root.render(this._reactComponent);\n }", "render() {\n this.el.innerHTML = this.template();\n\n setTimeout(() => {\n ...
[ "0.73375976", "0.72756207", "0.70760757", "0.69886875", "0.6903232", "0.6892822", "0.6892822", "0.6892822", "0.681339", "0.67150325", "0.6710088", "0.67068726", "0.6695447", "0.6695447", "0.66906536", "0.66662276", "0.6657271", "0.664744", "0.6633744", "0.663319", "0.66194034...
0.0
-1
Identify modules used Merge package dependencies Create files for each module Find user input connections Prechain flow Write readme
bundle(user, flow, version){ console.log(user) version = '0.0.1' return new Promise((resolve, reject) => { console.log("Bundling Flow: ", flow) let modulesUsed = this.find_modules(flow); let connectionsUsed = this.find_connections(flow) let packageFiles = modulesUsed.map((x) => { return `${x.fs_path}/package.json` }) let moduleFileBundles = modulesUsed.map((x) => { return this.get_module_files(x) }) let mergedPackageFile = JSON.stringify(this.merge_packfiles(flow, packageFiles, version)) let libraries = {} let publishedModules = moduleFileBundles.map((x, ix) => { let published_mod = this.libify(modulesUsed, x, ix) libraries = {...libraries, ...published_mod.files} return published_mod }) console.log("Libraries", publishedModules) this.registry.newRepo(flow).then(() => { this.write_main(flow, modulesUsed, connectionsUsed, publishedModules).then((indexFile) => { this.getPackage(user.user, flow, indexFile, mergedPackageFile, libraries, (sha) => { resolve({name: mergedPackageFile.name, version: sha}) }) }) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dependencies() {\n\n //as we do multiple things in this task, we merge the multiple streams\n var stream = new MergeStream();\n\n // Pick the dependencies we need from each package\n // so we don't just ship with a lot of files that aren't needed\n const nodeModules = [\n {\n ...
[ "0.6271695", "0.6253758", "0.6236957", "0.5923804", "0.5858413", "0.5682076", "0.5675119", "0.5647293", "0.5607576", "0.5589731", "0.5576396", "0.5574216", "0.5554441", "0.55509794", "0.55461514", "0.5525063", "0.5514758", "0.5510601", "0.5478361", "0.54779506", "0.54471904",...
0.56609595
7
TODO check that all modules added will actually get fired
find_modules(flow){ let modules = {} let nodes = flow.flow.nodes; for(var i = 0; i < nodes.length; i++){ modules[nodes[i].module_name] = this.modules[nodes[i].module_name] } let retArr = [] for(var k in modules){ modules[k].uuid = uuid.v4() retArr.push(modules[k]) } return retArr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onModulesLoaded() {\n\t checkModules.call(this, projectGlobal.modules, onAllInit);\n\t}", "runModules (event) {\n if (event === 'init') {\n // Initializing a module should only be done if it has an init\n // function, which means it's not rendered in the template.\n for (let key in...
[ "0.73181087", "0.7080021", "0.6895552", "0.6754784", "0.6447568", "0.6406349", "0.6396715", "0.636616", "0.6361018", "0.63585675", "0.6314566", "0.61783516", "0.61671954", "0.61578286", "0.60860515", "0.60593766", "0.6034606", "0.60229135", "0.6019595", "0.6005321", "0.599320...
0.0
-1
Since our contract will have different addresses depending on which network it is deployed on we need to load the network ID before we can initialize the contract. This will happen async.
static currentNetwork() { return web3.eth.net.getId().then(function(networkID){ return web3.eth.getAccounts().then(function(accounts){ return new TokenService(networkID, accounts[0]); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function init() {\n console.log(\"init is running\")\n const networkId = await web3.eth.net.getId() \n\n // const new Web3.HttpProvider()\n\n // instantiate local versions of hedging contract\n\n const HCDeployedNetwork = HedgingContract.networks[networkId]\n const hedgingcontract = new we...
[ "0.7202198", "0.7064355", "0.68463504", "0.68232316", "0.6729329", "0.67176574", "0.6618755", "0.65911233", "0.6493597", "0.64898986", "0.6466433", "0.64412105", "0.6373389", "0.629049", "0.6257765", "0.6217128", "0.61947113", "0.6179849", "0.6158657", "0.60866874", "0.608668...
0.53061754
85
Creates a new token, as long as we are not over our limit. createCitizen(string _name, address _to, uint _strength, uint _perception, uint _endurance, uint _charisma, uint _intelligence, uint _agility, uint _luck)
createCitizen() { let randomTokenID = web3.utils.randomHex(32); return this.contract.methods.mint(randomTokenID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createCharacter(name, nickname, race, origin, attack, defense, weapon = 'their fists') {\n let character = {\n name, nickname, race, origin, attack, defense, weapon,\n describe: () => `${name} is a ${race} from ${origin} who uses ${weapon}`,\n evaluateFight: (char) => `Your opponent takes ${atta...
[ "0.58797634", "0.57275736", "0.5680671", "0.56391835", "0.55792046", "0.54358405", "0.54237443", "0.5272464", "0.5132492", "0.5077638", "0.50669724", "0.4972312", "0.49484265", "0.49454793", "0.48942825", "0.48887536", "0.48596305", "0.48398778", "0.48358983", "0.48267353", "...
0.60173595
0
battle(uint _citizenId, uint _targetId) onlyOwnerOf(_citizenId)
battle(token, targetId) { return this.contract.methods.battle(this.contract._address, token, targetId); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playerAfflictedCheck(target) {\n if (target.name === 'Bog Rat') {\n poxChance(player);\n } else if (target.name === 'Basilisk') {\n poxChance(player);\n } else if (target.name === 'Moor Hound') {\n bleedChance(player);\n } else if (target.name === 'Cursed Militia') {\n var throwChance = Ma...
[ "0.57123727", "0.5673088", "0.55670863", "0.55659145", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154", "0.53862154",...
0.6104942
0
Gets a list of all tokens owned by us.
list() { return this.contract.methods.getOwnerTokens(this.contract.defaultAccount).call(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getTokens () {\n\t\tthis.tokens = this.members.reduce((tokens, user) => {\n\t\t\tconst userAttrs = user.attributes || user;\n\t\t\tif (userAttrs.broadcasterToken) {\n\t\t\t\ttokens.push(userAttrs.broadcasterToken);\n\t\t\t}\n\t\t\treturn tokens;\n\t\t}, []);\n\t}", "static async getUsers (token) {\n con...
[ "0.7440106", "0.6707279", "0.6542079", "0.6446956", "0.64206964", "0.63754565", "0.6301163", "0.6225859", "0.6164834", "0.60858214", "0.60697484", "0.6043096", "0.60347664", "0.59970623", "0.59858334", "0.59721", "0.5882159", "0.5868559", "0.5864072", "0.58545834", "0.5854328...
0.73607177
1
Gets a count of our tokens.
balance() { return this.contract.methods.balanceOf(this.contract.defaultAccount).call(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function count_Tokens()\n{\n return this.tokens.length;\n}", "get getTokenCallCount() {\n return this._getTokenCallCount;\n }", "get count() {}", "count() {\n return this.reduce(0, math_1.incr);\n }", "function getCount() {\n return count;\n}", "function charactersOccurencesCount() {\n \...
[ "0.8540666", "0.6882339", "0.6584911", "0.63925767", "0.62011325", "0.61118215", "0.61118215", "0.61118215", "0.61118215", "0.6058852", "0.6058108", "0.6058108", "0.6058108", "0.6058108", "0.6058108", "0.6041395", "0.603463", "0.60307956", "0.59777796", "0.5945682", "0.589328...
0.0
-1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ home movie click
function home_movie_details(url_query, respond){ //get data from db my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p>connected to db</p>"); //respond.end();//ending here } //get data from db //multiple row search var mysql_db_home_movie_data_show = "SELECT * FROM movie_table WHERE movie_id="+url_query; //connect to existing db my_sql_conn_db.query(mysql_db_home_movie_data_show, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data connection error : "+err+"</p>"); return ;//respond.end();//ending here } else{ // respond.write("<p>Data added "+JSON.stringify(results[0].m_producer)+"</p>"); //console.log(results.length); if(results.length ==0){return respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Could'nt find movie with any details of whats searched for</p>");}//if record match not found respond.write("<script>document.getElementById('heading').innerHTML ='"+results[0].m_title+"';</script>"); //change header respond.write("<p style='width:100%;height:auto;overflow:auto;background-color:white;color:black'><style>#movie_poster{width:15em;height:10em;top:0px;}</style><img id='movie_poster' src='"+results[0].m_image+"'><br>Movie Title : "+results[0].m_title+" <br> Movie Director : "+results[0].m_director+" <br> Movie Producer : "+results[0].m_producer+" <br> Movie Producing Company : "+results[0].m_production_company+" <br> Movie filmed Country : "+results[0].m_country+" <br> Movie Starring : "+results[0].m_actor+" <br> Movie Genre : "+results[0].m_genre+" <br> Movie Synopsis : "+results[0].m_description+" <br> Movie Disclaimer : "+results[0].m_disclaimer+"</p><hr>"); } //respond.end();//ending here } ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "click_Homescreen_TVShows(){\n this.Homescreen_TVShows.waitForExist();\n this.Homescreen_TVShows.click();\n }", "function walkHome(){\r\n\tbackground(0);\r\n\tfirstOption.hide();\r\n\tsecondOption.hide();\r\n\tuserName.hide();\r\n\r\n\t//change the text for the title\r\n\ttitle.html(\"You have go...
[ "0.68992555", "0.677454", "0.66580296", "0.64274836", "0.6400437", "0.63258904", "0.63191915", "0.6310086", "0.6224483", "0.6219141", "0.62177896", "0.6197731", "0.61815256", "0.6173206", "0.61189127", "0.61172444", "0.6115505", "0.60853595", "0.6075443", "0.6062602", "0.6058...
0.0
-1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mysql table create
function routing(respond){ respond.write("<script>document.getElementById('heading').innerHTML ='SQL db& table create';</script>") my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connected to db</p>"); //respond.end();//ending here } //create database give a name; my_sql_conn.query("CREATE DATABASE movie_shop",function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>DB creation err "+err+"</p>"); //return respond.end();//ending here } else{ respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>DB created "+JSON.stringify(results)+"</p>"); //respond.end();//ending here } }); //create db table var mysql_db_table ="CREATE TABLE movie_table (movie_id int NOT NULL AUTO_INCREMENT PRIMARY KEY, m_title varchar(255), m_director varchar(255), m_producer varchar(255), m_production_company varchar(255), m_country varchar(255), m_actor varchar(255), m_genre varchar(255), m_description varchar(255), m_disclaimer varchar(255), m_image varchar(255))"; //connect to existing db my_sql_conn_db.query(mysql_db_table, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>table creation err "+err+"</p>"); return;// respond.write();//ending here } else{ respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>table created "+results+"</p>"); // respond.end();//ending here } } ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTable() {\n var conn = Jdbc.getCloudSqlConnection(dbUrl, user, userPwd);\n conn.createStatement().execute('CREATE TABLE entries ' +\n '(guestName VARCHAR(255), content VARCHAR(255), ' +\n 'entryID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(entryID));');\n}", "function makeCreateTable() {...
[ "0.7311507", "0.71923107", "0.71092254", "0.71060216", "0.70860463", "0.7048172", "0.70120513", "0.7011127", "0.69860816", "0.6977017", "0.6973753", "0.6892336", "0.68128604", "0.6806557", "0.67949283", "0.6787026", "0.6754884", "0.67395496", "0.6726497", "0.67124575", "0.670...
0.0
-1
++++++++++++++++++++++++++++++++++++++++++++++++++++++ create db movie adding form
function db_add(url_query, respond){ respond.write("<script>document.getElementById('heading').innerHTML ='DB Add data';</script>"); var add_form ='<input type ="text" id="m_title" placeholder="Please enter Movie title" style="width:60%;height:5%; text-align:center;margin-left:20%"><br><input type ="text" id="m_director" placeholder="Please enter Movie director name" style="width:60%;height:5%;text-align:center;margin-left:20%"><br><input type ="text" id="m_producer" placeholder="Please enter Movie producer name" style="width:60%;height:5%;text-align:center;margin-left:20%"><br><input type ="text" id="m_production_company" placeholder="Please enter Movie production company" style="width:60%;height:5%;text-align:center;margin-left:20%"><br><input type ="text" id="m_country" placeholder="Please enter country movie produced in" style="width:60%;height:5%;text-align:center;margin-left:20%"><br><input type ="text" id="m_actor" placeholder="Please enter Movie Starring" style="width:60%;height:5%;text-align:center;margin-left:20%"><br><input type ="text" id="m_genre" placeholder="Please enter Movie genre" style="width:60%;height:5%;text-align:center;margin-left:20%"><br><textarea id="m_description" style="width:60%;height:10%;text-align:center;margin-left:20%">Please give Movie description</textarea><br><input type ="text" id="m_disclaimer" placeholder="Please give Movie disclaimer" style="width:60%;height:5%;text-align:center;margin-left:20%"><br><input type ="text" id="m_image" placeholder="Please enter image link" style="width:60%;height:5%;text-align:center;margin-left:20%"><hr><input type="button" onclick ="db_write()" value="Save data" style="width:100%;height:10%; border-radius:0px"; class="btn btn-primary">'+ '<script> var m_title=document.getElementById("m_title");var m_director=document.getElementById("m_director");var m_producer=document.getElementById("m_producer");var m_production_company=document.getElementById("m_production_company");var m_country=document.getElementById("m_country");var m_actor=document.getElementById("m_actor");var m_genre=document.getElementById("m_genre"); var m_description=document.getElementById("m_description");var m_disclaimer=document.getElementById("m_disclaimer"); var m_image=document.getElementById("m_image"); function db_write(){if(m_title.value==""||m_director.value==""||m_producer.value==""||m_production_company.value==""||m_country.value==""||m_actor.value==""||m_genre.value==""||m_description.value==""||m_disclaimer.value==""){ document.getElementById("heading").innerHTML ="Please feel in all information";}else{ window.open("db_write?"+m_title.value+"&"+m_director.value+"&"+m_producer.value+"&"+m_production_company.value+"&"+m_country.value+"&"+m_actor.value+"&"+m_genre.value+"&"+m_description.value+"&"+m_disclaimer.value+"&"+m_image.value, "_self");} /*alert(m_title.value+"&"+m_director.value+"&"+m_producer.value+"&"+m_production_company.value+"&"+m_country.value+"&"+m_actor.value+"&"+m_genre.value+"&"+m_description.value+"&"+m_disclaimer.value+"&"+m_image.value)*/;}</script>'; respond.write(add_form); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createMovie(e) {\n e.preventDefault();\n const title = $(\"#title\").val();\n if (title.length < 2) {\n return;\n }\n const rating = $(\"#rating\").val();\n const movieData = { title, rating, id: currentMovieID };\n movieMap.push(movieData);\n\n $(\"#movie-table\").append(cr...
[ "0.7157837", "0.7155326", "0.7067668", "0.7009994", "0.6984904", "0.6712076", "0.6585498", "0.6529115", "0.65018344", "0.6472152", "0.64082736", "0.6357879", "0.6338004", "0.62977815", "0.62845975", "0.62621653", "0.6189075", "0.6172359", "0.61614996", "0.61525935", "0.609043...
0.60281587
24
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ write data to db
function db_write(url_query, respond){ // create an array var data_to_write = url_query.replace(/%20/g, " ").split('&'); respond.write("<script>document.getElementById('heading').innerHTML ='DB Add data 2';</script>"); console.log(data_to_write); //add data to db table my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p>connected to db</p>"); //respond.end();//ending here } //add data to db var mysql_db_data_add ="INSERT INTO movie_table (m_title, m_director, m_producer, m_production_company, m_country, m_actor, m_genre, m_description, m_disclaimer, m_image) VALUES ('"+data_to_write[0]+"','"+data_to_write[1]+"','" +data_to_write[2]+"','" +data_to_write[3]+"','" +data_to_write[4]+"','" +data_to_write[5]+"','" +data_to_write[6]+"','" +data_to_write[7]+"','" +data_to_write[8]+"','" +data_to_write[9]+"')"; console.log(mysql_db_data_add); //connect to existing db my_sql_conn_db.query(mysql_db_data_add, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data adding err(write to db) "+err+"</p>"); return ;//respond.end();//ending here } else{ respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data added "+JSON.stringify(results)+"</p>"); return;// respond.end();//ending here } } ); }); //respond.write(url_query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveData(data) {\n const transaction = db.transaction([\"open\"], \"readwrite\");\n\n const store = transaction.objectStore(\"open\");\n\n store.add(data);\n}", "function dbWriteData( query, callback){\n dbCon.query( query, function( error, result){\n if( error) handleError(...
[ "0.72436124", "0.72302604", "0.72029907", "0.71798366", "0.71541655", "0.7149343", "0.7074406", "0.7072854", "0.70201933", "0.6945145", "0.6925748", "0.68811136", "0.6841664", "0.68416315", "0.6793797", "0.6778868", "0.67386675", "0.67350036", "0.6658894", "0.66179466", "0.65...
0.60102344
88
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//edited only take as is mysql_db_data_get copy paste, can get spacing issues search movie
function movie_find_search(url_query, respond){ respond.write("<script>document.getElementById('heading').innerHTML ='You searched for : "+url_query.replace(/%20/g, " ")+"';</script>"); var search_input ='<style>input[type=search] {width: 130px;box-sizing: border-box;border: 2px solid #ccc;border-radius: 4px;font-size: 16px;background-color: white; margin:2% auto 2% 40%;background-image:url("searchicon.png");background-position: 10px 10px;background-repeat: no-repeat;padding: 12px 20px 12px 40px;-webkit-transition: width 0.4s ease-in-out;transition: width 0.4s ease-in-out;}input[type=search]:focus {width: 95%;margin:2% auto 2% auto;}/* #searh_input{margin:2% auto 2% 40%;width: 50%;} */</style><input type="search" name="search" placeholder="Search.." id="search_input" onsearch ="call_db_search()"><button onclick="call_db_search()" style ="width:4%; height:7.5%;font-size:2.3em;border-radius:0px;background-color:transparent;" class="btn btn-info"><i class="fas fa-search"></i></button><br><hr><div id style="width:100%;height:7%;background-color:white;color:black;font-size:1em;"><a href="movie_find_show_all" onclick ="">Show all stored movies</a></div><hr><script> function call_db_search(){ var search_query = document.getElementById("search_input"); if(search_query.value == ""){ document.getElementById("heading").innerHTML ="Please feel data to be searched for"; } else{ window.open("movie_find_search?"+search_query.value, "_self"); } } </script>'; respond.write(search_input);//search header //clean query string var data_to_search = url_query.replace(/%20/g, " "); //get data from db my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p>connected to db</p>"); //respond.end();//ending here } //get data from db //multiple row search var mysql_db_data_get = "SELECT * FROM movie_table WHERE m_title like '%"+data_to_search+"%' OR m_director like '%"+data_to_search+"%' OR m_producer like '%"+data_to_search+"%' OR m_production_company like '%"+data_to_search+"%' OR m_country like '%"+data_to_search+"%' OR m_actor like '%"+data_to_search+"%' OR m_genre like '%"+data_to_search+"%' OR m_description like '%"+data_to_search+"%' OR m_disclaimer like '%"+data_to_search+"%' "; //connect to existing db my_sql_conn_db.query(mysql_db_data_get, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data connection error : "+err+"</p>"); return ;//respond.end();//ending here } else{ // respond.write("<p>Data added "+JSON.stringify(results[0].m_producer)+"</p>"); //console.log(results.length); var result = results; if(results.length ==0){return respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Could'nt find movie with any details of whats searched for</p>");}//if record match not found var extra_results = 1;//skip result duplicate var count = 0; for(var i =0; i<=result.length; i++){ db_data_shower();//break if setup is not like this extra_results =i;//capture duplicate count = i; } //respond.end();//ending here } function db_data_shower(){ if(extra_results==0){return} respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Movie Title : "+result[count].m_title+" | Movie Director : "+result[count].m_director+" | Movie Producer : "+result[count].m_producer+" | Movie Producing Company : "+result[count].m_production_company+" | Movie filmed Country : "+result[count].m_country+" | Movie Starring : "+result[count].m_actor+" | Movie Genre : "+result[count].m_genre+" | Movie Synopsis : "+result[count].m_description+" | Movie Disclaimer : "+result[count].m_disclaimer+" | Movie Poster : "+result[count].m_image+"</p><hr>"); } } ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SearchByTitlePre(database,word,func) {\r\n database.query('SELECT books_basic.ID,Title,Subtitle,Image FROM books_basic WHERE Title = \"'+word+'\";', func);\r\n}", "function getOMDB(movie='Mr. Nobody') {\n\tvar vImdbRating=\"\";\n\t// console.log('move is ', movie);\n\t// console.log(\"OMDB function r...
[ "0.57684994", "0.56667954", "0.5493696", "0.54348415", "0.54297596", "0.54175603", "0.53681475", "0.5346404", "0.53404844", "0.5303413", "0.5289087", "0.52833873", "0.5283085", "0.5262754", "0.52469826", "0.52456695", "0.52403426", "0.5234755", "0.52204865", "0.5173992", "0.5...
0.55380654
2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ show all movies
function movie_find_show_all(url_query, respond){ respond.write("<script>document.getElementById('heading').innerHTML ='Movie search All';</script>"); var search_input ='<style>input[type=search] {width: 130px;box-sizing: border-box;border: 2px solid #ccc;border-radius: 4px;font-size: 16px;background-color: white; margin:2% auto 2% 40%;background-image:url("searchicon.png");background-position: 10px 10px;background-repeat: no-repeat;padding: 12px 20px 12px 40px;-webkit-transition: width 0.4s ease-in-out;transition: width 0.4s ease-in-out;}input[type=search]:focus {width: 95%;margin:2% auto 2% auto;}/* #searh_input{margin:2% auto 2% 40%;width: 50%;} */</style><input type="search" name="search" placeholder="Search.." id="search_input" onsearch ="call_db_search()"><button onclick="call_db_search()" style ="width:4%; height:7.5%;font-size:2.3em;border-radius:0px;background-color:transparent;" class="btn btn-info"><i class="fas fa-search"></i></button><br><div id style="width:100%;height:7%;background-color:white;color:black;font-size:1em;"><a href="movie_find_show_all" onclick ="">Show all stored movies</a><br><a href="delete_all" onclick ="">Delete all stored movies</a></div><hr><script> function call_db_search(){ var search_query = document.getElementById("search_input"); if(search_query.value == ""){ document.getElementById("heading").innerHTML ="Please feel data to be searched for"; } else{ window.open("movie_find_search?"+search_query.value, "_self"); } } </script>'; respond.write(search_input); //get data from db my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p>connected to db</p>"); //respond.end();//ending here } //get data from db var mysql_db_data_get = "SELECT * FROM movie_table" //connect to existing db my_sql_conn_db.query(mysql_db_data_get, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data adding err (serach) "+err+"</p>"); return ;//respond.end();//ending here } else{ // respond.write("<p>Data added "+JSON.stringify(results[0].m_producer)+"</p>"); var result = results; if(results.length ==0){return respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Could'nt find movie in db, please add some</p>");}//if record match not found var extra_results = 1;//skip result duplicate var count = 0; for(var i =0; i<=result.length; i++){ db_data_shower();//break if setup is not like this extra_results =i;//capture duplicate count = i; } //respond.end();//ending here } function db_data_shower(){ if(extra_results==0){return} respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Movie Title : "+result[count].m_title+" | Movie Director : "+result[count].m_director+" | Movie Producer : "+result[count].m_producer+" | Movie Producing Company : "+result[count].m_production_company+" | Movie filmed Country : "+result[count].m_country+" | Movie Starring : "+result[count].m_actor+" | Movie Genre : "+result[count].m_genre+" | Movie Synopsis : "+result[count].m_description+" | Movie Disclaimer : "+result[count].m_disclaimer+" | Movie Poster : "+result[count].m_image+"<br>"+ '<input type="button" style="width:40%;height:2em;margin:1% 1% 1% 1%" onclick="window.open(\'movie_update?'+result[count].movie_id+'\',\'_self\')" value="Update Movie" class="btn btn-primary"><input type="button" style="width:40%;height:2em;margin:1% 1% 1% 1%" onclick="window.open(\'movie_delete?'+result[count].movie_id+'\',\'_self\')" value="Delete Movie" class="btn btn-primary"></p>'); } } ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAllMovies() {\n Movie.find()\n .then(allMovies => console.log('here are all the movies', allMovies))\n .catch(err => console.log('could not get all movies', err))\n}", "function printMovies(movies, genre) {\n\tvar handlebars = handlebarsInit('#movie');\n\t// search every movies\n\tfor (var i =...
[ "0.7541515", "0.73505324", "0.7324169", "0.7254256", "0.72266597", "0.7223161", "0.7214421", "0.7143797", "0.70669204", "0.70375615", "0.7027039", "0.7014801", "0.69696033", "0.6959119", "0.69549954", "0.694106", "0.6939921", "0.6924565", "0.68586236", "0.685659", "0.68282545...
0.636733
69
write updated data to db
function data_update_to_db(url_query, respond){ // create an array var data_to_write = url_query.replace(/%20/g, " ").split('&'); respond.write("<script>document.getElementById('heading').innerHTML ='Updating DB';</script>"); console.log(data_to_write); //add data to db table my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p>connected to db</p>"); //respond.end();//ending here } //add data to db var mysql_db_data_add ="UPDATE movie_table SET m_title='"+data_to_write[0]+"', m_director='"+data_to_write[1]+"', m_producer='"+data_to_write[2]+"', m_production_company='" +data_to_write[3]+"', m_country='" +data_to_write[4]+"', m_actor='" +data_to_write[5]+"', m_genre='" +data_to_write[6]+"', m_description='" +data_to_write[7]+"', m_disclaimer='" +data_to_write[8]+"', m_image='" +data_to_write[9]+"' WHERE movie_id='"+data_to_write[10]+"'"; // console.log(mysql_db_data_add); //connect to existing db my_sql_conn_db.query(mysql_db_data_add, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data adding err(update write) "+err+"</p>"); return ;//respond.end();//ending here } else{ console.log(JSON.stringify(results)); respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data added "+JSON.stringify(results)+"</p>"); respond.write("<script>alert('Movie deleted')</script>"); load_all_movies(); } } ); }); function load_all_movies(){//call movie load all movie_find_show_all(url_query, respond); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "save() {\n this.db.write();\n }", "function updateDb() {\n fs.writeFile(\"./db/db.json\", JSON.stringify(notes), (err, data) => {\n if (err) throw err;\n return true;\n });\n }", "function updateDb() {\n fs.writeFile(\"db/db.json\",JSON.stringify(notes,'\\t'),err => {\...
[ "0.7118681", "0.69086725", "0.68596846", "0.68596846", "0.6843186", "0.67805845", "0.67805845", "0.67805845", "0.6686983", "0.6613339", "0.6600542", "0.6570251", "0.65692556", "0.6556991", "0.6462963", "0.6437775", "0.6428894", "0.6408294", "0.6348898", "0.63425183", "0.63423...
0.6025196
54
edited ready to export all
function delete_all(url_query, respond){ respond.write("<script>document.getElementById('heading').innerHTML ='Delete all movies';</script>"); my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p>connected to db</p>"); //respond.end();//ending here } //delete table var mysql_db_table_delete ="DROP TABLE movie_table"; // console.log(mysql_db_data_add); //connect to existing db my_sql_conn_db.query(mysql_db_table_delete, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data adding err(update write) "+err+"</p>"); return ;//respond.end();//ending here } else{ console.log(JSON.stringify(results)); // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data added "+JSON.stringify(results)+"</p>"); // respond.write("<script>alert('Movie deleted')</script>"); create_new_table(); } } ); }); function create_new_table(){//create new empty table structure after delete my_sql_conn.connect(function(err){//doing mysql connection handshake aka test connectability if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>connection error: "+err+"</p>"); //return respond.end();//ending here } else{ // respond.write("<p>connected to db</p>"); //respond.end();//ending here } //delete table var mysql_db_create_new_table ="CREATE TABLE movie_table (movie_id int NOT NULL AUTO_INCREMENT PRIMARY KEY, m_title varchar(255), m_director varchar(255), m_producer varchar(255), m_production_company varchar(255), m_country varchar(255), m_actor varchar(255), m_genre varchar(255), m_description varchar(255), m_disclaimer varchar(255), m_image varchar(255))"; // console.log(mysql_db_data_add); //connect to existing db my_sql_conn_db.query(mysql_db_create_new_table, function(err, results){ if(err){ // respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Data adding err(update write) "+err+"</p>"); return ;//respond.end();//ending here } else{ // console.log(JSON.stringify(results)); respond.write("<p style='width:100%;height:10%;overflow:auto;background-color:white;color:black'>Table deleted</p>"); // respond.write("<script>alert('Movie deleted')</script>"); } } ); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "export() {\n\t\treturn {}\n\t}", "function save_and_export() {\r\n\r\n}", "function exportPuzzle(){\n \n }", "function Export_All(){\n //data_export.Export_User_Annotation_Data()\n tagging_data_export.Export_User_Annotation_Data()\n}", "onExport() {\n\t\t// you can do work before running th...
[ "0.6261411", "0.6237569", "0.6223455", "0.62066734", "0.6017446", "0.5938178", "0.5891641", "0.5874507", "0.5848278", "0.5778121", "0.57662326", "0.5681616", "0.5659055", "0.5654672", "0.5603843", "0.55691874", "0.552136", "0.54698664", "0.5467536", "0.5424706", "0.54156816",...
0.0
-1
Renders a modal for joining a group in the Profile page. See pages/Profile.jsx.
render() { let fRef = null; let open = this.props.open; return ( <Modal open={open} size={'tiny'} onClose={this.props.closeModal}> <Modal.Header>Join a Group</Modal.Header> <AutoForm ref={ref => { fRef = ref; }} schema={bridge} onSubmit={data => { this.submit(data, fRef);this.updateLocation(data)}} model={this.props.doc}> <TextField name='groupID' className={'join-modal'}/> { this.state.joined ? <Button className={'button-align'}> <Link to={`/group/${this.state.groupID}`}>Go to your group!</Link> </Button> : <SubmitField value='Join' className={'button-align'}/> } <ErrorsField /> </AutoForm> </Modal> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createGroupModal() {\n $('#createModal').modal('show');\n document.getElementById(\"modal-group-email-domain\").innerHTML = \"@\" + domain;\n}", "function showProfileModal(data) {\n // used to display the modal\n setIsProfileModal(true);\n // set the memberUrl to pass into the profile mod...
[ "0.63541377", "0.6148399", "0.602535", "0.6025005", "0.58852005", "0.580391", "0.5778836", "0.5720856", "0.56839585", "0.5646463", "0.5608878", "0.55902916", "0.5589106", "0.5583365", "0.55238354", "0.5499967", "0.5477225", "0.5474793", "0.5468672", "0.5430664", "0.5422781", ...
0.5544355
14
Function to handle group joins [in progress]
submit(data, formRef) { const { groupID } = data; const userID = Meteor.user()._id; const exists = Memberships.collection.find({ userID, groupID }, {limit: 1}).count({}); if (!exists) { Memberships.collection.insert({ userID, groupID }, (error) => { if (error) { swal('Error', error.message, 'error'); } else { swal('Success', 'Group joined successfully', 'success') .then((value) => { this.setState({ groupID, joined: true, }); }); formRef.reset(); } }); } else { swal('Error', 'Group already joined!', 'error'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function acceptGroupJoin(feedRequest) {\n\n Parse.Promise.when([\n feedRequest.get(\"group\"),\n feedRequest.get(\"fromUser\"),\n feedRequest.get(\"toUsers\")\n ]).then(function(group, user, toUsers){\n\n var promises = [];\n\n group.add('joinedUsers', user);\n group.remove('pendingUsers', user...
[ "0.6332928", "0.63300353", "0.6077625", "0.59283495", "0.57782733", "0.5749969", "0.5745026", "0.57386786", "0.57124925", "0.57089996", "0.5695714", "0.56820774", "0.56561124", "0.5618851", "0.5559066", "0.55163544", "0.5507717", "0.54594386", "0.542739", "0.5411201", "0.5384...
0.0
-1
Given an element id, read its classnames and find the correct URLstring to prefix a URN.
function citekit_getUrlString( elementId ){ var thisURN = ""; var thisType = ""; var thisService = ""; var thisString = ""; // identify the type of link for ( whichClass in citekit_var_classNames ){ if ( $("#" + elementId).hasClass(citekit_var_classNames[whichClass])) { thisType = whichClass; } } // Get the plain URN from the attribute if ( $("#" + elementId).attr("src")) { thisURN = $("#" + elementId).attr("src"); } else if ( $("#" + elementId).attr("cite")) { thisURN = $("#" + elementId).attr("cite"); } else if ( $("#" + elementId).attr("href")) { thisURN = $("#" + elementId).attr("href"); } //If a service is specified, grab that URL-string for (whichService in citekit_var_services){ if ( $("#" + elementId).hasClass(whichService) ){ switch (thisType) { case "cts": thisString = citekit_var_services[whichService] + citekit_var_qs_GetPassagePlus; break; case "citeimg": thisString = citekit_var_services[whichService] + citekit_var_qs_GetImagePlus; break; case "cite": thisString = citekit_var_services[whichService] + citekit_var_qs_GetObjectPlus; break; } } } //Otherwise, grab the default URL-string if ( thisString == ""){ switch (thisType) { case "cts": thisString = citekit_var_services[citekit_var_default_cts] + citekit_var_qs_GetPassagePlus; break; case "citeimg": thisString = citekit_var_services[citekit_var_default_img] + citekit_var_qs_GetImagePlus; break; case "cite": thisString = citekit_var_services[citekit_var_default_coll] + citekit_var_qs_GetObjectPlus; break; } } //Assemble and return return thisString + thisURN; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findNZBId(elem) {\n var url = $(elem).attr('href');\n\n var nzbid = url.substr(url.indexOf('/getnzb/') + 8);\n nzbid = nzbid.substr(0, nzbid.indexOf('/'));\n url = nzbSite + '/getnzb/' + nzbid + '.nzb';\n\n return url;\n}", "function make_prefix_selector_from_id(id) {\n return '[id^=\"...
[ "0.57154965", "0.56249183", "0.56249183", "0.54397786", "0.5426901", "0.54023623", "0.52973056", "0.5274815", "0.52697206", "0.52697206", "0.5240385", "0.52090764", "0.51956576", "0.519366", "0.51932734", "0.51715547", "0.5154293", "0.5140008", "0.5140008", "0.5104562", "0.50...
0.5485872
3
The resulting Lighthouse reports contain way more info than we are interested it So we select just the data we will use, to cut down on disk usage and ease of reading data
async function parseResult(port) { const raw = await fs.readFile(path.join(__dirname, `reports/http:127.0.0.1:${port}-lighthouse.json`)); const data = JSON.parse(raw.toString()) // All units are ms return { firstContentfulPaint: data.lhr.audits['first-contentful-paint'].numericValue, largestContentfulPaint: data.lhr.audits['largest-contentful-paint'].numericValue, firstMeaningfulPaint: data.lhr.audits['first-meaningful-paint'].numericValue, speedIndex: data.lhr.audits['speed-index'].numericValue, estimatedInputLatency: data.lhr.audits['estimated-input-latency'].numericValue, totalBlockingTime: data.lhr.audits['total-blocking-time'].numericValue, maxPotentialFid: data.lhr.audits['max-potential-fid'].numericValue, cumulativeLayoutShift: data.lhr.audits['cumulative-layout-shift'].numericValue, firstCpuIdle: data.lhr.audits['first-cpu-idle'].numericValue, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async getData () {\n return await App.getPage('popular', 1);\n }", "async function getData(countiesObj, logFile) {\n console.log(`\\nRO @extractData START 111111111111111111111`);\n\n // get counties home pages\n const countiesArr = countiesObj.counties.map((county) => {\n return {\n ...
[ "0.58540154", "0.57740176", "0.56492496", "0.55910975", "0.55119795", "0.5457745", "0.54350996", "0.5417911", "0.5412468", "0.5410375", "0.5345171", "0.5321396", "0.5306225", "0.5290836", "0.5283403", "0.5282417", "0.5281172", "0.5253199", "0.5232408", "0.5207306", "0.5194073...
0.4994364
58
map : (a > b) > Functor a > Functor b
function map2(fn) { return function $map(functor) { return functor.map(fn); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Function$prototype$map(f) {\n var functor = this;\n return function(x) { return f(functor(x)); };\n }", "function Function$prototype$map(f) {\n var functor = this;\n return function(x) { return f (functor (x)); };\n }", "function map (array, predicate) {\n}", "function binaryMap(func, ...
[ "0.6383477", "0.6364249", "0.6231084", "0.59821117", "0.5931884", "0.5920691", "0.5896256", "0.58724314", "0.5862765", "0.58194506", "0.5797551", "0.57509756", "0.5724553", "0.57232124", "0.5687154", "0.5665435", "0.56511235", "0.5634526", "0.5614075", "0.5603554", "0.5593307...
0.6149235
3
Load the required SharePoint libraries
function initializePage() { //Get the URI decoded URLs. hostweburl = decodeURIComponent( getQueryStringParameter("SPHostUrl") ); appweburl = decodeURIComponent( getQueryStringParameter("SPAppWebUrl") ); var scriptbase = hostweburl + "/_layouts/15/"; $.getScript(scriptbase + "SP.RequestExecutor.js", getListsFromWeb); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadLibraries() {\n gapi.load('client:auth2', {'callback': onClientLoad});\n gapi.load('picker', {'callback': () => { pickerApiLoaded = true; }});\n}", "function loadAdditionalLibraries() {\n additionalLibraries.forEach(function(each) {\n importScripts(each);\n });\n }"...
[ "0.6449085", "0.64078635", "0.63024586", "0.6263948", "0.622145", "0.61037815", "0.60471004", "0.6022259", "0.5891218", "0.58313876", "0.58059233", "0.5774939", "0.5758002", "0.5737387", "0.5598327", "0.5484892", "0.5454391", "0.5430105", "0.5426586", "0.5424552", "0.5397641"...
0.59383565
8
Function to retrieve a query string value. For production purposes you may want to use a library to handle the query string.
function getQueryStringParameter(paramToRetrieve) { var params = document.URL.split("?")[1].split("&"); var strParams = ""; for (var i = 0; i < params.length; i = i + 1) { var singleParam = params[i].split("="); if (singleParam[0] == paramToRetrieve) return singleParam[1]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function queryValue() {\n var qrStr = window.location.search;\n if (qrStr)\n var qrvalue = (qrStr.split(\"?\")[1].split(\"=\")[1]);\n return decodeURIComponent(qrvalue);\n}", "function queryValue() {\n var qrStr = window.location.search;\n if (qrStr)\n var qrvalue = (qrStr.split(\"?\...
[ "0.8209506", "0.81985337", "0.8084118", "0.769233", "0.76275235", "0.7474217", "0.7474217", "0.74713415", "0.744418", "0.7434209", "0.7422516", "0.7417253", "0.7410254", "0.7399484", "0.7399484", "0.7399484", "0.7399484", "0.73277193", "0.73277193", "0.73277193", "0.73277193"...
0.7500336
5
expects a string with a name of hero, like cards[i].name
checkIfPair() { let card1 = this.pickedCards[0]; let card2 = this.pickedCards[1]; this.pairsClicked += 1; if(card1.dataset.cardName == card2.dataset.cardName) { this.pairsGuessed += 1; this.pickedCards = []; $('.card').removeClass('blocked') return true } else { setTimeout(() => { $(this.pickedCards[0]).children().toggleClass('front back'); $(this.pickedCards[1]).children().toggleClass('front back'); this.pickedCards = []; $('.card').removeClass('blocked') }, 600) return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function establishCharacter(hero, heroClass = \"\") {\n var heroHTML =\n '<div id=\"' +\n hero[\"name\"].split(\" \").join(\"-\") +\n '\"class=\"mx-1 hero-holder ' +\n heroClass +\n ' d-flex flex-column align-items-center\"> <p class=\"mb-0 hero-name\">' +\n hero[\"name\"] +\n '</p> <img clas...
[ "0.64407414", "0.6353934", "0.63046414", "0.6006078", "0.5982191", "0.5975011", "0.5891689", "0.57782227", "0.5764481", "0.5740078", "0.5721513", "0.5629904", "0.5627157", "0.55956066", "0.557527", "0.5518778", "0.54658", "0.5457632", "0.54121363", "0.5406761", "0.5370601", ...
0.0
-1
Set the width of the side navigation to 0
function closeNav() { document.getElementById("mySidenav").style.width = "0"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeNav() {\r\n document.getElementById(\"mySidepanel\").style.width = \"0\";\r\n }", "closeNav() {\n document.getElementById(\"mySidebar\").style.width = \"0\";\n }", "function closeNav() {\r\n document.getElementById(\"mySidepanel\").style.width = \"0\";\r\n}", "function closeNav() {...
[ "0.70849997", "0.7048696", "0.70117784", "0.69661146", "0.6954063", "0.6943325", "0.690015", "0.6895077", "0.6895074", "0.68786633", "0.68749243", "0.686089", "0.68548334", "0.68548334", "0.68548334", "0.68548334", "0.68548334", "0.6847666", "0.6847666", "0.6837757", "0.68319...
0.6740824
71
Dynamic Nav for pages
function loadNav() { let url = window.location.href.split("/").pop(); let user_id = localStorage.getItem("user_id"); $(".nav-bar").html(`<ul class='cf'> ${ user_id != null ? ` <li> <a class="login out" href="./index.html"> Log Out </a> </li>` : ` <li> <a class="login" href="./index.html"> Log In </a> </li>` } ${ url != "cards.html" ? ` <li> <a href='./cards.html'>Cards</a> </li>` : "" } ${ url != "community.html" ? ` <li> <a href='./community.html'>Community Lists</a> </li> ` : "" } ${ url != "index.html" ? ` <li> <a href='./account.html'>My Lists</a> </li>` : "" } </ul> <a href="#" id="openup">Menu</a>`); $(".login.out").click(() => { localStorage.clear(); window.location.replace("/signup.html"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupPageNavs () {\n\t\t// For any nested list items, wrap the link text in a span so that we can put a border under the text on hover.\n\t\t$mobilemenu.find(\".ibm-mobilemenu-section li li a\").wrapInner(\"<span>\");\n\n\t\tIBM.common.util.a11y.makeTreeAccessible({\n\t\t\tel: $mobilemenu.find(\".ibm-mobi...
[ "0.73581475", "0.72801596", "0.7272414", "0.7094888", "0.6995981", "0.696279", "0.6958643", "0.68614644", "0.68601054", "0.6859685", "0.68502456", "0.68382764", "0.6832683", "0.680222", "0.6784236", "0.67698014", "0.6765353", "0.6743272", "0.6723414", "0.67173", "0.6703209", ...
0.0
-1
Create Promise for SQLite3 database SELECT query
function databaseSelect(query, params) { return new Promise((resolve, reject) => { db.all(query, params, (err, rows) => { if (err) { reject(err); } else { resolve(rows); } }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUserByRowId(id) {\n return new Promise( function (resolve,reject) {\n let db = new sqlite3.Database(file);\n\n let sql = \n `SELECT * FROM user \n WHERE id=\"${id}\"\n LIMIT 1`;\n\n db.all(sql,function(err,rows) {\n if (err)...
[ "0.68799055", "0.68773186", "0.6814937", "0.67153496", "0.67111963", "0.660529", "0.6587528", "0.6569411", "0.65419465", "0.6532298", "0.6528552", "0.6507818", "0.64650536", "0.6446671", "0.6429413", "0.6417632", "0.6409268", "0.63942945", "0.6377212", "0.6377212", "0.6376504...
0.66421974
5
Create Promise for SQLite3 database INSERT query
function databaseInsert(query, params) { return new Promise((resolve, reject) => { db.run(query, params, (err) => { if (err) { reject(err); } else { resolve(); } }); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static createTask(task={}){\n \n return new Promise(async (resolve, reject) => {\n try {\n //const person = new Task(task)\n const databaseLayer = new DatabaseLayer(async () => SQLite.openDatabase('didits.db'), Task.tableName)\n const items = [task]\n databaseLayer.bulkInsert...
[ "0.688229", "0.6774268", "0.67295337", "0.66684866", "0.66575986", "0.6649997", "0.660664", "0.6579003", "0.6554538", "0.6523943", "0.64945847", "0.64837503", "0.6471823", "0.6455231", "0.6445674", "0.6438946", "0.6409074", "0.6372778", "0.63651234", "0.6364895", "0.63413626"...
0.7198979
0
Helper method to construct a JSON API url endpoint from supplied declaration and params. This will be used to build the endpoints for the various method actions
function getJsonApiUrl(declaration, params) { const endpoint = get(declaration, 'endpoint'); // Use if a fully-formed url, otherwise pass to buildUrl return endpoint.indexOf('https://') === 0 ? endpoint : buildUrl(endpoint, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function constructURL(params){\n \n delimiter = '/';\n \n url = new Array(domainName, pathToAPI);\n\n if(params.module){\n \n url.push(params.module);\n\n if(params.id && params.datatype){\n \n url.push(params.datatype + params.id);\n \n }...
[ "0.7027609", "0.6566117", "0.6475729", "0.62919766", "0.624349", "0.6200663", "0.61838025", "0.61216277", "0.6112147", "0.6102012", "0.59820294", "0.59775764", "0.59043086", "0.58766294", "0.5876306", "0.5810037", "0.5760384", "0.57168984", "0.56911576", "0.5652379", "0.56107...
0.7601602
0
Now, transform the dispatch props (Request) into methods on the nion.action prop
function mergeProps(stateProps, dispatchProps, ownProps) { const nextProps = { ...stateProps, ...ownProps }; mapDeclaratives((declaration, key) => { const data = get(stateProps.nion, key); const ref = data ? { id: data.id, type: data.type } : null; // Add each method's corresponding request handler to the nextProps[key].request // object const methods = ['GET', 'PATCH', 'POST']; methods.forEach(method => { const dispatchFn = dispatchProps[key][method]; set(nextProps.nion, [key, 'actions', method.toLowerCase()], dispatchFn); }); // Handle deletion, where we're passing in the ref attached to the dataKey to be deleted const deleteDispatchFn = dispatchProps[key].DELETE; const deleteFn = (props) => deleteDispatchFn(ref, props); set(nextProps.nion, [key, 'actions', 'delete'], deleteFn); // Handle the special NEXT submethod, for paginated declarations if (dispatchProps[key].NEXT) { const { nion } = stateProps; const next = get(nion, [key, 'links', 'next']); const dispatchFn = dispatchProps[key].NEXT; if (next) { const nextFn = () => dispatchFn({ next }); set(nextProps.nion, [key, 'actions', 'next'], nextFn); } } if (dispatchProps[key].initializeDataKey) { const fn = dispatchProps[key].initializeDataKey; set(nextProps.nion, [key, 'actions', '_initializeDataKey'], fn); } }); // Pass along the global nion action creators nextProps.nion.updateEntity = dispatchProps.updateEntity; return nextProps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function actionsToMethods(actions, dispatch){\n const methods = Object.keys(actions).reduce((allMethods, type) => {\n\n allMethods[type] = (payload) => dispatch({\n type,\n payload\n });\n\n return allMethods;\n }, {});\n\n return methods;\n}", "function action...
[ "0.6406483", "0.63773704", "0.6309297", "0.6268497", "0.62040234", "0.6163224", "0.61537194", "0.6126306", "0.6124097", "0.61103094", "0.61092", "0.6090499", "0.6086417", "0.60673213", "0.6053477", "0.60518944", "0.6006533", "0.6005455", "0.5992352", "0.59782284", "0.59781724...
0.57759976
51
Pop out all the array into html format
function extract(msg_desc,msg_title,msg_url){ var desc = []; var title = []; var url = []; desc = msg_desc; title = msg_title; url = msg_url; var tags = ""; for(var x = 0; x < desc.length; x ++){ tags += "<h3>'"+title[x]+"'</h3><h4>'"+desc[x]+"'</h4><a href='"+url[x]+"'>Link</a><br>" } return tags; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayToHTML(json) {\n var output = '[<ul class=\"array collapsible\">';\n var hasContents = false;\n for (var prop in json) {\n hasContents = true;\n output += '<li>';\n output += valueToHTML(json[prop]);\n output += '</li>';\n }\n ...
[ "0.6820724", "0.6779951", "0.6771189", "0.656405", "0.65311193", "0.6512462", "0.64598024", "0.6459389", "0.6443657", "0.6436567", "0.64221805", "0.6316895", "0.62976414", "0.62747294", "0.6178981", "0.6171394", "0.6164464", "0.6156421", "0.61287475", "0.612133", "0.61029506"...
0.0
-1
initiates a reset of the board depending on the difficulty selected
function reset() { gameMode = modeSelector.options[ modeSelector.selectedIndex ].value; gameDifficulty = difficultySelector.options[ difficultySelector.selectedIndex ].value; if ( gameDifficulty === "Easy" ) { playGame( 3 ); } else { playGame( 6 ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetme(){\n\tinitiateBoard();\n\tmode=0;\n\tdisplay(0);\n}", "function reset() {\n\t\t\tclear_board()\n\t\t}", "function resetBoard() {\n\t\"use strict\";\n\t// Mark all cells as empty and give default background.\n\tfor (var i = 0; i < size; i++) {\n\t\tfor (var j = 0; j < size; j++) {\n\t\t\tvar ce...
[ "0.786401", "0.78084767", "0.77674884", "0.75676", "0.7567517", "0.75581074", "0.74128515", "0.74029344", "0.7400406", "0.7396109", "0.7378152", "0.7338557", "0.7320339", "0.72804195", "0.7254268", "0.7245536", "0.72187936", "0.72061366", "0.7199692", "0.71851075", "0.7183742...
0.76778036
3
loads the game board ready for the player to play
function playGame( difficultyValue ) { colours = generateRandomColours( difficultyValue ); pickedColour = pickRandomColour( colours ); colourDisplay.textContent = pickedColour; if ( difficultyValue === 3 ) { for ( let index = 0; index < squares.length; index++ ) { if ( colours[ index ] ) { console.log( colours[ index ] ); squares[ index ].style.backgroundColor = colours[ index ]; } else { squares[ index ].style.display = "none"; } } } else { for ( let index = 0; index < squares.length; index++ ) { squares[ index ].style.backgroundColor = colours[ index ]; squares[ index ].style.display = "block"; } } changeSquaresToRandomColours( colours ); title.style.backgroundColor = "#232323"; resetButton.textContent = "Reset"; messageDisplay.textContent = ""; processInput(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadGame(){\n\tgame = getJSON(\"http://navy.hulu.com/create?user=rhassan@andrew.cmu.edu\");\n\tboard = [];\n\t\n\t// Display game information\n\twriteToConsole(\"GAME ID = \" + game.game_id);\n\twriteToConsole(\"SHIPS = [\" + game.ship_sizes + \"]\");\n\twriteToConsole(\"BOARD = (\" + game.board_size.widt...
[ "0.7372514", "0.73632103", "0.73471427", "0.72948307", "0.70983773", "0.70877457", "0.70814455", "0.70803124", "0.7075369", "0.7024341", "0.69789964", "0.6963253", "0.6943282", "0.6767274", "0.6752374", "0.6752306", "0.67032015", "0.66990477", "0.6690518", "0.66616356", "0.66...
0.0
-1
processes input from the user on the game board
function processInput() { for ( let index = 0; index < squares.length; index++ ) { squares[ index ].addEventListener( "click", function() { if ( gameMode === "RGB" ) { var clickedColour = this.style.backgroundColor; } else { var clickedColour = rgbToHex( this.style.backgroundColor ); } console.log( "This is the colour I clicked " + clickedColour ); if ( clickedColour === pickedColour ) { messageDisplay.textContent = "✅"; resetButton.textContent = "Play again?"; changeSquaresToWinningColour( clickedColour ); title.style.backgroundColor = clickedColour; } else { this.style.background = "#232323"; messageDisplay.textContent = "❌"; } } ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getInput(e) {\n\tif(!e) { var e = window.event; }\n\t\n\t// Preventing the defult browser controls to prevent unwanted scrolling.\n\te.preventDefault();\n\t\n\tif(isGameOver != true) {\n\t\tswitch(e.keyCode) {\n\t\t\t\n\t\t\t// 2 different keycodes so both arrows and WASD work for moving pieces.\n\t\t\tca...
[ "0.6951294", "0.69132525", "0.66958964", "0.66536516", "0.6629008", "0.6626635", "0.662475", "0.6616964", "0.65451765", "0.65451765", "0.65155584", "0.6494442", "0.6488087", "0.64642763", "0.645679", "0.6435435", "0.6425906", "0.6388714", "0.6360538", "0.636015", "0.6353615",...
0.61138165
30
sets the difficulty of the game
function setDifficulty() { difficultySelector.addEventListener( "input", function() { if ( this.options[ this.selectedIndex ].value === "Easy" ) { gameDifficulty = "Easy"; } else { gameDifficulty = "Hard"; } reset(); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setDifficulty(val) {\n if (difficulty !== val) {\n difficulty = val;\n score = 0;\n lives = 2;\n\n resetGame();\n // these functions are defined in HighScore.js\n removeHighScoreTable();\n defineCollection();\n renderHighScoreTable(collection);\n ...
[ "0.8102562", "0.7884789", "0.7537295", "0.7385058", "0.717491", "0.7153394", "0.6932113", "0.6904888", "0.6806206", "0.65710235", "0.6531491", "0.6496348", "0.6464565", "0.6403068", "0.63918793", "0.6248661", "0.6247666", "0.6220067", "0.62052923", "0.6178988", "0.6171837", ...
0.7435733
3
Sets the colour of each square to a single colour
function changeSquaresToWinningColour( colour ) { for ( let index = 0; index < squares.length; index++ ) { squares[ index ].style.backgroundColor = colour; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeColors(square){\n\t// loop through all squares\n\tfor(var i = 0; i < square.length; i++){\n\n\t// change each color to match the given color\n\tsquare[i].style.backgroundColor = pickedColor;\n}\n}", "function changeAllSquareColor(color) {\n for (i = 0; i < squares.length; i++) {\n $(squares[i]...
[ "0.7908317", "0.7805191", "0.7799405", "0.7772632", "0.7737764", "0.77086467", "0.77014196", "0.76969635", "0.7664235", "0.75763154", "0.7561774", "0.75436103", "0.75128436", "0.7512291", "0.7509444", "0.75034666", "0.74976194", "0.7493061", "0.7484999", "0.74814045", "0.7469...
0.73833954
33
sets the value of each square to a range of colours
function changeSquaresToRandomColours( colours ) { for ( let index = 0; index < squares.length; index++ ) { squares[ index ].style.backgroundColor = colours[ index ]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setColors(n) { //give colors to blocks\r\n for (var i = 0; i < color.length; i++) {\r\n square[i].style.background = color[i];\r\n square[i].style.display = \"block\";\r\n\r\n }\r\n\r\n}", "function changeColors(square){\n\t// loop through all squares\n\tfor(var i = 0; i < square.len...
[ "0.7146685", "0.71362925", "0.7108997", "0.7062834", "0.70416677", "0.7015922", "0.7002145", "0.69848514", "0.697579", "0.6939395", "0.6909422", "0.6896878", "0.68754196", "0.683647", "0.6821803", "0.68204945", "0.6809752", "0.67887586", "0.67839664", "0.6774938", "0.6770446"...
0.62655234
63
selects a single colour from an array of colours at random
function pickRandomColour() { var randomNumber = Math.floor( Math.random() * colours.length ); return colours[ randomNumber ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickColor(){\n\tvar random = Math.floor(Math.random() * colors.length);\n\t//Return random colour from array\n\treturn colors[random];\n}", "function pickColor(){\n //generate a number between 1 and the length of our color array\n var random = Math.floor(Math.random() * color.length);\n //return that...
[ "0.8576947", "0.8440747", "0.8423161", "0.8380474", "0.83637166", "0.83602935", "0.83602935", "0.8345294", "0.8344562", "0.8344562", "0.83434045", "0.83354145", "0.83278894", "0.83237773", "0.8321711", "0.8321304", "0.8317993", "0.83070946", "0.8305222", "0.83003736", "0.8289...
0.8137231
38