• Web Development - WAYWO - #9
    4,377 replies, posted
[QUOTE=jetboy;48390735] REST APIs are not consumed via the browser, why the hell would you test through one?[/QUOTE] Awesome Chrome App for this: [url]https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en[/url]
[QUOTE=benbb;48391383]Awesome Chrome App for this: [url]https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en[/url][/QUOTE] Been using it for months. It's really fucking useful
Got the backend for playlist creation working with Mysql. Now I just need to figure out how to pass POST data from Javascript to a php script. Which I'm 99% sure is xmlhttprequest, but I've never done that So I'll have to do some research. Meanwhile, in the front end: when adding songs to the playlist queue, which is a separate div on its own, I need to be able to delete songs from the queue and have the other songs around it fill in its space (next song gets pushed back on in the playlist). I'm 99% sure that to do this I need a linked list, but is there something more rudimentary that I can use?
[QUOTE=proboardslol;48392904] Meanwhile, in the front end: when adding songs to the playlist queue, which is a separate div on its own, I need to be able to delete songs from the queue and have the other songs around it fill in its space (next song gets pushed back on in the playlist). I'm 99% sure that to do this I need a linked list, but is there something more rudimentary that I can use?[/QUOTE] Using something like [URL="https://angularjs.org/"]AngularJS[/URL] and [URL="https://docs.angularjs.org/api/ng/directive/ngRepeat"]ng-repeat[/URL] would probably help you with this. For using POST data if you're using Angular just use [URL="https://docs.angularjs.org/api/ng/service/$http"]$http[/URL], otherwise use [URL="http://api.jquery.com/jquery.post/"]jQuery's Post[/URL]. You might need to [URL="http://enable-cors.org/index.html"]enable CORS[/URL] if you're on a different port/host for the backend/frontend.
[QUOTE=proboardslol;48392904]Got the backend for playlist creation working with Mysql. Now I just need to figure out how to pass POST data from Javascript to a php script. Which I'm 99% sure is xmlhttprequest, but I've never done that So I'll have to do some research.[/QUOTE] Yes, that's how you'd do it. [QUOTE]when adding songs to the playlist queue, which is a separate div on its own, I need to be able to delete songs from the queue and have the other songs around it fill in its space (next song gets pushed back on in the playlist). I'm 99% sure that to do this I need a linked list, but is there something more rudimentary that I can use?[/QUOTE] Purely inside the HTML document? The DOM API should let you do that, no need for you to squash your view into another data structure. [editline]a[/editline] Ninja'd. Yes, you could pull in libraries. However, if you haven't done this sort of thing before, it's good to know how it works before using jQuery etc. for convenience.
Well when I add it to the playlist html doc, I also want to keep the song id's in order to later be POSTed to the PHP doc to add to the db. I figure I need some sort of data structure to easily add/remove from this, unless there's a certain way I can get a song-id attribute from every child of the playlist area. Is there a way to iterate among every child of a document?
[QUOTE=proboardslol;48393443]Well when I add it to the playlist html doc, I also want to keep the song id's in order to later be POSTed to the PHP doc to add to the db. I figure I need some sort of data structure to easily add/remove from this, unless there's a certain way I can get a song-id attribute from every child of the playlist area. Is there a way to iterate among every child of a document?[/QUOTE] [code] { "playlists": [ { "playlist_id": 123, "songs": [ { "song_id": 6912, "title": "Title", "artist": "Artist" } ] } ] } [/code] Something like this?
[QUOTE=benbb;48393501][code] { "playlists": [ { "playlist_id": 123, "songs": [ { "song_id": 6912, "title": "Title", "artist": "Artist" } ] } ] } [/code] Something like this?[/QUOTE] Right, but if I delete an element from the playlist, will there just be an empty space there or will every element down the line be shifted back one?
[QUOTE=proboardslol;48393543]Right, but if I delete an element from the playlist, will there just be an empty space there or will every element down the line be shifted back one?[/QUOTE] Say you had this: [code] "playlists": [ { "playlist_id": 123, "songs": [ { "song_id": 6912, "title": "Title", "artist": "Artist" } ] }, { "playlist_id": 864, "songs": [ { "song_id": 890, "title": "Title", "artist": "Artist" } ] }, { "playlist_id": 532, "songs": [ { "song_id": 123, "title": "Title", "artist": "Artist" } ] } ] } [/code] Removing the middle one (index 1) would leave you with this [code] { "playlists":[ { "playlist_id":123, "songs":[ { "song_id":6912, "title":"Title", "artist":"Artist" } ] }, { "playlist_id":532, "songs":[ { "song_id":123, "title":"Title", "artist":"Artist" } ] } ] } [/code]
I'll look into this, but I made a simpler solution. I'm POSTing comma separated values and then exploding them in PHP. I'm only passing song id's since I can get artist and song name and stuff from another table. So my very simple solution is: [url]http://pastebin.com/BCfXcH8j[/url] (using pastebin since facepunch stops me with a captcha when trying to post code) this logs 1,2,56,128, which works well enough for me
[QUOTE=voodooattack;48386384]I personally can't stand Angular.js, I find the syntax repulsive for some reason.[/QUOTE] Dude, you find Angular repulsive, but you're cool with code that looks like this? [code] render() { var supportedLocales = this.props.supportedLocales, locale = this.props.locale.code; var menuHeader = !this.props.mobile ? ( <Semantic ui title><Icon world /><Semantic ui content>{supportedLocales[locale]}</Semantic></Semantic> ) : ( <Semantic ui title><Icon dropdown /><FormattedMessage message="Intl.Language" /></Semantic> ); var elements = Object.keys(supportedLocales).map(function (loc) { return locale === loc ? (<Item active key={loc}>{supportedLocales[loc]}</Item>) : (<Item key={loc} onClick={this.switchLocale.bind(this, loc)}>{supportedLocales[loc]}</Item>); }.bind(this)); return ( <Dropdown {...this.props} labeled icon> {menuHeader} <Menu> <Semantic ui icon search input> <Icon search /> <input type="text" name="search" placeholder={this.app.translate('Intl.Search')} /> </Semantic> <Menu ui vertical scrolling> {elements} </Menu> </Menu> </Dropdown> ); } } [/code] :v: I'm the complete opposite. I love Angular, and I can't get over how... odd JSX is (and what's React without JSX). Each to their own.
[QUOTE=icantread49;48393895]Dude, you find Angular repulsive, but you're cool with code that looks like this? [code] render() { var supportedLocales = this.props.supportedLocales, locale = this.props.locale.code; var menuHeader = !this.props.mobile ? ( <Semantic ui title><Icon world /><Semantic ui content>{supportedLocales[locale]}</Semantic></Semantic> ) : ( <Semantic ui title><Icon dropdown /><FormattedMessage message="Intl.Language" /></Semantic> ); var elements = Object.keys(supportedLocales).map(function (loc) { return locale === loc ? (<Item active key={loc}>{supportedLocales[loc]}</Item>) : (<Item key={loc} onClick={this.switchLocale.bind(this, loc)}>{supportedLocales[loc]}</Item>); }.bind(this)); return ( <Dropdown {...this.props} labeled icon> {menuHeader} <Menu> <Semantic ui icon search input> <Icon search /> <input type="text" name="search" placeholder={this.app.translate('Intl.Search')} /> </Semantic> <Menu ui vertical scrolling> {elements} </Menu> </Menu> </Dropdown> ); } } [/code] :v: I'm the complete opposite. I love Angular, and I can't get over how... odd JSX is (and what's React without JSX). Each to their own.[/QUOTE] React without JSX is still a powerful MVC framework, just without the useful shortcut of using JSX instead of writing out all the elements in Javascript. And I assume by "repulsive" they mean the inclusion of logic in HTML, which I agree with.
[QUOTE=Rocket;48396494] And I assume by "repulsive" they mean the inclusion of logic in HTML, which I agree with.[/QUOTE] The idea is you separate the logic from the HTML. Put your logic in the controller and make the HTML use that. It makes perfect sense. Sure you can put logic within the HTML but that's bad practice.
[QUOTE=voodooattack;48390877]Yeah.. I use them extensively in other situations, just not with JSX. It quickly turns into a special kind of hell looking at the angle brackets. :)[/QUOTE] Perf isn't gonna be spectacular though, especially when it matters in hot code paths like render().
So I guess I'm releasing this: [url]http://coderemote.hintcode.com/[/url] What the fuck is going on here, do you ask? Well, I wrote a WCF service like two months ago that can invoke methods from managed DLLs remotely (provided the user the WCF service is running under has access, of course.) This was cool, but had no practical use. So I threw together some demo DLLs and this website, and hey, here we are. Website is cool because it's my first time doing Angular and a bootstrapped website from scratch! It's a little rough around the edges, but it works!
[QUOTE=Protocol7;48400930]So I guess I'm releasing this: [url]http://coderemote.hintcode.com/[/url] What the fuck is going on here, do you ask? Well, I wrote a WCF service like two months ago that can invoke methods from managed DLLs remotely (provided the user the WCF service is running under has access, of course.) This was cool, but had no practical use. So I threw together some demo DLLs and this website, and hey, here we are. Website is cool because it's my first time doing Angular and a bootstrapped website from scratch! It's a little rough around the edges, but it works![/QUOTE] Looks really nice. Looking at the code though, why are you using 'var libraryCtrl = this;' and adding the functions to the controller rather than using $scope?
I made a lot of last-minute architectural decisions that bled over, it totally could be $scoped though. That's actually how it started. v:v:v [editline]7th August 2015[/editline] Here, I threw it all into a $scope again and added some new stuff (like visibility into function return types.) Also added a new library with no parameters just to prove that it all works. [url]http://coderemote.hintcode.com/[/url] It may have cached the old app.js and I purged the cache in CloudFlare and I have no idea if this is working in production, but works great locally.
Google App Scripting is like they took Java's insistent need to use `[I]try {} catch() {}[/I]` so often and then collided it with Javascript because most of their services can be pretty damn unreliable. I had a script try using a Google Document for temporarily/live log storage but kept hanging at the Docs service not responding. [img]http://puu.sh/jtASd.png[/img] [I][...][/I] In retrospect, I should take all the Google services/requests/whateverthefuck and add error handling to save myself the trouble of scattered `[I]try {} catch() {}[/I]` everywhere and occasional moments that I just don't care anymore. [editline]8th August 2015[/editline] Also I'm finding that the first code I write for a project always becomes garbage at first. And each iteration of re-coding the software can generally yield less clusterfucks. [code] function doSort(contact, source, destination, kind) { if(!Drive || !MailApp){ throw new Error("Google Drive or GMail exploded for unknown reasons. Nothing productive is to come.") } var scriptProperties = PropertiesService.getScriptProperties() Logger.log('Testing settings...') try { scriptProperties.setProperties({test: 'This is a test'},false) } catch(err) { Logger.log('Something\'s wrong with `PropertiesService`. Cannot safely continue. Error: ' + err) throw new Error('Something\'s wrong with `PropertiesService`. Cannot safely continue. Error: ' + err) } var photoAmmount = Number(scriptProperties.getProperty('photoAmmount')) function saveState(takerName, takerWork, takerFolder, yearFolder, i, dest, finalName){ try { scriptProperties.setProperties({ takerName: takerName, takerWork: takerWork, takerFolder: takerFolder, yearFolder: yearFolder, stopFile: i, stopDest: dest.getId(), contact: contact, finalName: finalName }, false) } catch(err) { Logger.log('Save Error! Error: ' + err + ' Retrying...') Utilities.sleep(500) saveState(takerName, takerWork, takerFolder, yearFolder, i, dest, finalName) } } function email(takerName, takerWork, photos){ var d = new Date() MailApp.sendEmail(contact, "[CISS] Photos Ready: " + takerName + " did " + takerWork + " Listings.", takerName + " has completed " + takerWork + " listings with " + photos + " photos at an average of " + Math.round(photos/takerWork) + " per listing on the " + d.getFullYear() + "/" + (d.getMonth() + 1) + "/" + d.getDate() + ".\n\nThis is an automated message from the Concepts Image Sorting Script." ) } // Here be dragons. function findImages(takerName, takerWork, takerFolder, yearFolder) { var query = '"' + yearFolder + '" in parents and trashed = false and not title contains "DELETE_" and not ' + 'mimeType = "application/vnd.google-apps.folder"'; var folders, pageToken; do { folders = Drive.Files.list({ q: query, maxResults: 9000, pageToken: pageToken }); var d = new Date() var finalName = d.getFullYear() + "." + (d.getMonth() + 1) + "." + d.getDate() + "." + takerName + "." + takerWork if (folders.items && folders.items.length > 0) { var d = new Date() var finalName = d.getFullYear() + "." + (d.getMonth() + 1) + "." + d.getDate() + "." + takerName + "." + takerWork var dest = DriveApp.getFolderById(destination).createFolder(finalName + ".BUSY") scriptProperties.setProperty('photoAmmount', folders.items.length) for (var i = 0; i < folders.items.length; i++) { var TIME = new Date().getTime() if(TIME - TIMELIMIT > 240000){ saveState(takerName, takerWork, takerFolder, yearFolder, i, dest, finalName) Logger.log("Execution Time Near. " + takerName) throw new Error("Execution Time Near on " + takerName) } var item = folders.items[i]; Logger.log('--%s READ', item.title) try { DriveApp.getFileById(item.id).makeCopy(dest) DriveApp.getFileById(item.id).setName("DELETE_" + item.title) } catch(err) { saveState(takerName, takerWork, takerFolder, yearFolder, i, dest, finalName) Logger.log("DriveApp Error on " + takerName + ": " + err) throw new Error("DriveApp Error on " + takerName + ": " + err) } } dest.setName(finalName) } else { Logger.log('--No Images?'); } pageToken = folders.nextPageToken; } while (pageToken); } function sort(takerName, takerWork, takerFolder) { var query = '"' + takerFolder + '" in parents and trashed = false and not title contains "DELETE_" and ' + 'mimeType = "application/vnd.google-apps.folder"'; var folders, pageToken; do { folders = Drive.Files.list({ q: query, maxResults: 100, pageToken: pageToken }); if (folders.items && folders.items.length > 0) { for (var i = 0; i < folders.items.length; i++) { var folder = folders.items[i]; Logger.log('-Year Folder: %s', folder.title); findImages(takerName, takerWork, takerFolder, folder.id) /*DriveApp.getFolderById(folder.id).setName("DELETE_" + folder.title) DO NOT DELETE THE YEAR FOLDER FOR ALL THAT IS HOLY*/ } } else { Logger.log('--No Folders?'); } pageToken = folders.nextPageToken; } while (pageToken); } function continueWork(){ var properties = scriptProperties.getProperties() var takerName = properties['takerName'] var takerWork = properties['takerWork'] var takerFolder = properties['takerFolder'] var yearFolder = properties['yearFolder'] var stopFile = properties['stopFile'] var stopDest = properties['stopDest'] contact = properties['contact'] var finalName = properties['finalName'] Logger.log("Resuming work... \n[" + takerName + ", \n" + takerWork + ", \n" + takerFolder + ", \n" + yearFolder + ", \n" + stopFile + ", \n" + stopDest + ", \n" + contact + ", \n" + finalName + "\n]") var query = '"' + yearFolder + '" in parents and trashed = false and not title contains "DELETE_" and not ' + 'mimeType = "application/vnd.google-apps.folder"'; var folders, pageToken; do { folders = Drive.Files.list({ q: query, maxResults: 9000, pageToken: pageToken }); if (folders.items && folders.items.length > 0) { var dest = DriveApp.getFolderById(stopDest) for (var i = 0; i < folders.items.length; i++) { var TIME = new Date().getTime() if(TIME - TIMELIMIT > 240000){ saveState(takerName, takerWork, takerFolder, yearFolder, i, dest, finalName) Logger.log("Execution Time Near. " + takerName) throw new Error("Execution Time Near on " + takerName) } var item = folders.items[i]; Logger.log('--%s READ', item.title) try { DriveApp.getFileById(item.id).makeCopy(dest) DriveApp.getFileById(item.id).setName("DELETE_" + item.title) } catch(err) { saveState(takerName, takerWork, takerFolder, yearFolder, i, dest) Logger.log("DriveApp Error on " + takerName + ": " + err) throw new Error("DriveApp Error on " + takerName + ": " + err) } } dest.setName(finalName) } else { Logger.log('--No Images?'); } pageToken = folders.nextPageToken; } while (pageToken); DriveApp.getFolderById(takerFolder).setName(takerName + ".OPEN") email(takerName, takerWork, Number(scriptProperties.getProperty('photoAmmount'))) scriptProperties.deleteAllProperties() } if(scriptProperties.getProperty('stopFile')){ var backupContact = contact continueWork() contact = backupContact } // No more dragons. Logger.log("[- " + kind + " -]") var query = '"' + source + '" in parents and trashed = false and ' + 'mimeType = "application/vnd.google-apps.folder"'; var folders, pageToken; do { folders = Drive.Files.list({ q: query, maxResults: 9000, pageToken: pageToken }); if (folders.items && folders.items.length > 0) { for (var i = 0; i < folders.items.length; i++) { var folder = folders.items[i]; Logger.log('%s READ', folder.title); var takerName = folder.title.split('.')[0] var takerWork = folder.title.split('.')[1] if(takerWork == "OPEN"){ Logger.log('File Open. No Work.') }else{ Logger.log(takerWork + ' Listings done.') sort(takerName, takerWork , folder.id) DriveApp.getFolderById(folder.id).setName(takerName + ".OPEN") email(takerName, takerWork, Number(scriptProperties.getProperty('photoAmmount'))) scriptProperties.deleteAllProperties() } } } else { Logger.log('No Folders?'); } pageToken = folders.nextPageToken; } while (pageToken); Logger.log("Work done.") } [/code] Buggy code and generally unreadable. [code] function doSortv2(contact, source, destination, kind, command) { var logs var date = new Date() date = date.getHours() var isMorning = (date == 7) function pad(num, size) { var s = num+"" while (s.length < size) s = "0" + s return s } function debugLogger(log){ if(logs){ var date = new Date() try { logs.getBody().editAsText().appendText("[" + pad(date.getHours(),2) + ":" + pad(date.getMinutes(),2) + ":" + pad(date.getSeconds(),2) + "." + pad(date.getMilliseconds(),3) + "]: " + log.toString() + '\n') } catch(err) { debugLogger('Append error. Retrying... `' + err + '`') debugLogger(log) } } Logger.log(log) } function initalizeLogger(doNotAppend){ if(!logs && LOGGINGENABLED){ try { logs = DocumentApp.openById('1fQNoN90o1U_emvbL2PAAj3KnhHITZDoHvU5sUH5w6-I') } catch(err) { debugLogger('Logger error. Retrying... `' + err + '`') initalizeLogger(doNotAppend) } if(!doNotAppend){ debugLogger("\n!--"+Date()+"--!\nLog Document Initialized.\n" + Logger.getLog()) } } } function closeLogger(){ initalizeLogger(true) var body = logs.getBody() if(logs.getBody().getText() != ""){ var permLog = DriveApp.getFolderById("0B1mmDRBx5OIqfnJhaU1zNFJqbzZtXzJmLVhRbXZxbjhUWlFtdm5CX0tyZElSN2o1MWNZbFE") var date = new Date() date = date.getFullYear() + "/" + date.getMonth() + "/" + date.getDate() + " " + pad(date.getHours(),2) + ":" + pad(date.getMinutes(),2) var newLog = DriveApp.createFile("Log - " + date, body.getText()) var copyLog = newLog.makeCopy(newLog.getName(),permLog) newLog.setTrashed(true) debugLogger("Log closed at " + date) body.clear() try { logs.saveAndClose() } catch(err) { debugLogger('Logger save error. Retrying... `' + err + '`') closeLogger() } } } function scriptError(mesg){ initalizeLogger() debugLogger(mesg) throw new Error(mesg) } if(!Drive || !MailApp || !DriveApp){ scriptError("Google Drive or GMail exploded for unknown reasons. Nothing productive is to come.") } try { var scriptProperties = PropertiesService.getScriptProperties() scriptProperties.setProperties({test: 'This is a test'},false) } catch(err) { scriptError('Something\'s wrong with `PropertiesService`. Cannot safely continue. Error: ' + err) } function photoCount(takerName, count){ try { var currentCount = Number(scriptProperties.getProperty(takerName)) if(count && count > 0){ currentCount += count scriptProperties.setProperty(takerName, currentCount) } } catch(err) { scriptError('Photo Count Error. ' + err) } return currentCount } function email(takerName, takerWork, photos){ var d = new Date() initalizeLogger() debugLogger("Email of " + takerName + " with " + takerWork + " listings totalling " + photos + " sent to " + contact) MailApp.sendEmail(contact, "[CISS (Release Candidate)] Photos Ready: " + takerName + " did " + takerWork + " Listings.", takerName + " has completed " + takerWork + " listings with " + photos + " photos at an average of " + Math.round(photos/takerWork) + " per listing on the " + d.getFullYear() + "/" + (d.getMonth() + 1) + "/" + d.getDate() + ".\n\nThis is an automated message from the Concepts Image Sorting Script." ) } function folderSearch(query){ var pageToken, result var tick = new Date().getTime() result = Drive.Files.list({q: query, maxResults: 9000, pageToken: pageToken}) debugLogger("Request complete with " + result.items.length + " items returned in " + ((new Date().getTime()) - tick) + "ms.") return result } function copyFile(dest, file, takerName){ var tick = new Date().getTime() try { var DFile = DriveApp.getFileById(file.id) DFile.makeCopy(dest) DFile.setName("DELETE_" + file.title) } catch(err) { scriptError("DriveApp Error on " + takerName + ": " + err) } debugLogger("Copied " + file.title + " in " + ((new Date().getTime()) - tick) + "ms.") photoCount(takerName, 1) return true } function processFiles(FolderID, takerName, takerWork){ var d = new Date() debugLogger("Checking for extra folders...") var extraFolders = folderSearch('"' + FolderID + '" in parents and trashed = false and not title contains "DELETE_" and not title contains "NO_SORT_" and mimeType = "application/vnd.google-apps.folder"') if(extraFolders.items && extraFolders.items.length > 0){ for(var i = 0; i < extraFolders.items.length; i++){ debugLogger("Navigating into " + extraFolders.items[i].title) processFiles(extraFolders.items[i].id, takerName, takerWork) } } else { debugLogger("No extra files.") } debugLogger("Getting file listing...") var fileList = folderSearch('"' + FolderID + '" in parents and trashed = false and not title contains "DELETE_" and title contains "IMG_" and not mimeType = "application/vnd.google-apps.folder"') if(fileList.items && fileList.items.length > 0){ initalizeLogger() debugLogger("Updating destination folder listing...") var destinationFolders = folderSearch('"' + destination + '" in parents and trashed = false and not title contains "DELETE_" and mimeType = "application/vnd.google-apps.folder"') for(var i = 0; i < fileList.items.length; i++){ var file = fileList.items[i] debugLogger("Sorting " + file.title) var imageYear = Number(file.title.substring(4,8)) var imageMonth = Number(file.title.substring(8,10)) var imageDay = Number(file.title.substring(10,12)) if(destinationFolders.items.length == 0){ var newDest = DriveApp.getFolderById(destination).createFolder(imageYear + "." + imageMonth + "." + imageDay + "." + takerName + "." + takerWork) debugLogger("There was no destinations avaiable. One was created.") debugLogger("Updating destination folder listing...") destinationFolders = folderSearch('"' + destination + '" in parents and trashed = false and not title contains "DELETE_" and mimeType = "application/vnd.google-apps.folder"') copyFile(newDest, file, takerName) } var sucess = false for(var a = 0; a < destinationFolders.items.length; a++){ var TIME = new Date().getTime() if(TIME - TIMELIMIT > 240000){ scriptError("Execution Time Near on " + takerName) } if(destinationFolders.items[a].title.indexOf(imageYear + "." + imageMonth + "." + imageDay + "." + takerName) == 0){ sucess = copyFile(DriveApp.getFolderById(destinationFolders.items[a].id), file, takerName) break } } if(!sucess){ var newDest = DriveApp.getFolderById(destination).createFolder(imageYear + "." + imageMonth + "." + imageDay + "." + takerName + "." + takerWork) debugLogger("There was no destinations available. One was created. (No Match)") debugLogger("Updating destination folder listing...") destinationFolders = folderSearch('"' + destination + '" in parents and trashed = false and not title contains "DELETE_" and mimeType = "application/vnd.google-apps.folder"') copyFile(newDest, file, takerName) } } } else { debugLogger("No files to process.") } } if(command){ initalizeLogger() debugLogger("Running command >" + command) eval(command) return } debugLogger("[- " + kind + " -]") var workerFolders = folderSearch('"' + source + '" in parents and trashed = false and not title contains "DELETE_" and mimeType = "application/vnd.google-apps.folder"') if(workerFolders.items && workerFolders.items.length > 0){ for(var i = 0; i < workerFolders.items.length; i++){ var takerName = workerFolders.items[i].title.split('.')[0] var takerWork = workerFolders.items[i].title.split('.')[1] if(takerWork != "OPEN"){ debugLogger("Processing " + workerFolders.items[i].title) processFiles(workerFolders.items[i].id, takerName, takerWork) var date = new Date() date = date.getHours() if(isMorning){ DriveApp.getFileById(workerFolders.items[i].id).setName(takerName + ".OPEN") email(takerName, takerWork, photoCount(takerName)) } } else { debugLogger(workerFolders.items[i].title + " Open") } } } if(isMorning){ scriptProperties.deleteAllProperties() closeLogger() } } [/code] Much more cleaner, better error handling, and generally better than the first generation. [editline]8th August 2015[/editline] Also I know I'll be bitched at because I'm inconsistent. Maybe the third gen will be better and suck your dick I don't know.
Are you afraid of whitespace or something?
Whitespace is obviously a complete waste of time and resources, everyone knows this
[QUOTE=Moofy;48408405]Whitespace is obviously a complete waste of time and resources, everyone knows this[/QUOTE] Write the code using as much whitespace as you want then run it through a minifier. Best of both worlds.
[QUOTE=Moofy;48408405]Whitespace is obviously a complete waste of time and resources, everyone knows this[/QUOTE] This made me wonder what C# would do when it encountered ZERO WIDTH NO-BREAK SPACE (U+FEFF) but was disappointed to find that Visual Studio renders it as a regular space, and C# actually seems to treat it as a regular space. Javascript seems to do the same
I know there are a couple of FP'ers at the big tech companies (Facebook, Google) I just wanted to ask what the hiering process was like?
[QUOTE=Moofy;48408405]Whitespace is obviously a complete waste of time and resources, everyone knows this[/QUOTE] I can see someone arguing that, because it takes longer to parse a larger file, adding more whitespace slows down your application.
Okay just to clarify, I meant it as a joke. Whitespace for some readability, I'd take that any day. In my class we had a guy who did this: [code] function swag(param) { if(param == "garry") { return "OH MY"; } return "AYYY"; } [/code] :suicide: [editline]8th August 2015[/editline] I know I write killer functions
[QUOTE=Moofy;48411388]Okay just to clarify, I meant it as a joke. Whitespace for some readability, I'd take that any day. In my class we had a guy who did this: [code] function swag(param) { if(param == "garry") { return "OH MY"; } return "AYYY"; } [/code] :suicide: [editline]8th August 2015[/editline] I know I write killer functions[/QUOTE] Wow...
[QUOTE=Moofy;48411388]Okay just to clarify, I meant it as a joke. Whitespace for some readability, I'd take that any day. In my class we had a guy who did this: [code] function swag(param) { if(param == "garry") { return "OH MY"; } return "AYYY"; } [/code] :suicide: [editline]8th August 2015[/editline] I know I write killer functions[/QUOTE] People think I'm weird because I do it like this: [code] function swag( param ) { if( param == "garry" ) { return "OH MY"; } return "AYYY"; } [/code] It feels cluttered to me otherwise. Someone tried to say I was a bad programmer for it but you've got to be super anal to think that way over whitespace. Could be worse: [code] function swag(param) { if(param=="garry") { return "OH MY"; } return "AYYY"; } [/code]
[QUOTE=Richy19;48410580]I know there are a couple of FP'ers at the big tech companies (Facebook, Google) I just wanted to ask what the hiering process was like?[/QUOTE] they sign NDAs
[QUOTE=wauterboi;48411980]People think I'm weird because I do it like this: [code] function swag( param ) { if( param == "garry" ) { return "OH MY"; } return "AYYY"; } [/code] It feels cluttered to me otherwise. Someone tried to say I was a bad programmer for it but you've got to be super anal to think that way over whitespace. Could be worse: [code] function swag(param) { if(param=="garry") { return "OH MY"; } return "AYYY"; } [/code][/QUOTE] garry does the [lua] func( param ) [/lua] stuff too, so it's a pretty bad sign
I do [code] for(var i = 0; i < 10; i++){ function(param){ console.log("this is a test"); } } [/code] I think the only whitespace I used is in for loops and between binary operators
Sorry, you need to Log In to post a reply to this thread.