The Best Places to Find Free, High-Res Images for your Website

Good, high-quality images add visual interest to your website. Another reason why photos have become so important is because web pages that include good photos get better engagement when shared on social sites like Twitter and Facebook.

high quality photo

Download High Quality Images for Free

The web offers billions of photos that are just a Google search away. The images that are in public domain, or licensed under the Creative Commons license, can be used without any copyright issues.

The only problem is that Google may not always surface the best content that is free. Their algorithms, at least for image search, prefer pages from premium stock photography websites and the free listings thus lose out. If Google isn’t helping in your quest for images, here are some of the best websites where you may find high-quality photos for free.

1. unsplash.com (Unsplash) - This is my favorite website for downloading high-resolution photographs. Subscribe to the email newsletter and you’ll get 10 photos in your inbox every 10 days. All images are under the CC0 license meaning they are in public domain and you are free to use them in any way you like.

2. google.com (LIFE) - The Google images website hosts millions of historical photographs from the LIFE library. You can add source:life to any query in Google image search to find these images and they are free for personal, non-commercial use.

3. flickr.com (The British Library) - The national library of the UK has uploaded over a million vintage photographs and scanned images to Flickr that are now in pubic domain and they encourage re-use.

4. picjubmo.com (Picjumbo) - Here you’ll find exceptionally high-quality photos for your personal and commercial use. The pictures have been shot by the site owner himself and all he requests for in return is proper attribution.

5. pixabay.com (Pixabay) - All the images on Pixabay are available under the CC0 license and thus can be used anywhere. Like Flickr, there’s an option to browse photographs by camera model as well.

6. publicdomainarchive.com (Public Domain Archive) - This is an impressive online repository of public domain images that are neatly organized in categories. It contains only high quality photos though the collection is limited at this time.

7. commons.wikimedia.org (Wikimedia Commons) - The site hosts 21+ million images under some kind of free license or in the public domain. The images are arranged in categories or you can find images through search keywords.

8. superfamous.com (Super Famous) - Another great resource for finding high-res images for your websites and other design projects. The images are licensed under Creative Commons and require attribution.

old historical photos

9. nos.twnsnd.co (New Old Stock) - Here you will find a curated collection of vintage photographs from public archives that are free of any copyright restrictions. If you are trying to create a twitter feed like @HistoricalPics, this might be a good source for images.

10. freeimages.com (Stock Exchange) - This is one of the biggest repositories of free images and graphics that you can use for almost any purpose. You do however need to sign-in to download the images. The site, previously hosted on the schx.hu domain, is now part of Getty Images.

11. raumrot.com (Raumrot) - The site features beautiful, hi-res 300DPI stock photographs available for both personal and commercial use. The pictures are sorted by subject and available under Creative Commons.

Related: Protect your photos from Casual Copying

12. gettyimages.com (Getty Images) - If you are looking for professional images for your website but without the expensive license fee, Getty has something in store for you. You can embed pictures from Getty Images for free on your website though in future, the embeds may carry ads.

13. pdpics.com (Public Domain Photos) - The website contains thousands of royalty free images that can be used in both personal and commercial projects but with attribution. Unlike other sites that merely curate content, the images found here have been clicked by their in-house photographers.

14. imcreator.com (IM Free) - A curated collection of outstanding high-quality photos on all subjects that are also free for commercial use. The images have mostly been sourced from Flickr and require attribution.

15. photopin.com (Photo Pin) - Flickr is among the biggest repository of photographs on the web and Photo Pin helps you easily find photos on Flickr that are available under the Creative Commons license. You get the embed code as well so you don’t have to host the images on your own server.

16. kaboompics.com (Kaboom Pics) - Karolina Grabowska, a web designer from Poland, has uploaded 550+ high-resolution photos (240-300dpi ) that you can use for all kind of projects included commercial ones. The photos are arranged in categories and tags or you can use the search box to quickly find images on various subjects.

17. morguefile.com (Morgue File) - The site hosts 300,000+ free images and you are free to use them in both personal and commercial projects even without attribution. The image gallery has a built-in cropping tool and you can even hotlink the images from your website.

18. magdeleine.co (Magdeleine) - Hand-picked and free stock photos that you can search by subject, mood or even the dominant color. Some of the images are copyright free and you can do whatever you like with those photos.

Tip: How to avoid common photos

You may have found a great photo that is perfect for your project but there’s a probability that several other websites are using the same image. It will therefore help if you do a reverse image search using Google Images to estimate the relative popularity of that image on the Internet.

Also see: Sell your Instagram & Facebook Photos

The Best Websites to Learn Coding Online

The Learn to Code movement has picked up momentum worldwide and that is actually a good thing as even basic programming skills can have a major impact. If you can teach yourself how to write code, you gain a competitive edge over your peers, you can think more algorithmically and thus can tackle problems more efficiently.

Learn Programming

Don’t just download the latest app, help redesign it. Don’t just play on your phone, program it. — Obama.

There’s no reason why shouldn’t know the basics of coding. You can automate tasks, you can program your Excel sheets, improve workflows, you can extract data from websites and accomplish so much more with code. You may not be in the business of writing software programs but knowing the basics of coding will help you communicate more effectively with developers.

Gone are the days when you had to enroll in expensive computer training classes as now exist a plethora of web-based courses that will help you learn programming at your own pace in the comfort of your web browser.

The Best Sites to Learn Programming

If you are ready to take the plunge, here are some of the best websites that offer courses in a variety of programming languages for free. I have also added a list of companion ebooks that will give you a more in-depth understanding of the language and they don’t cost anything either.

Programming LanguageOnline Courses and Video ScreencastsDownload PDF Books (Read online for free)
JavaScriptCode Academy, Learn Street, Code Combat, Code AvengersEloquent JavaScript, JavaScript Guide, Speaking JS, JS The Right Way, Oh My JS, Canvassing
HTML & CSSCode Academy, Don’t Fear The Internet, Tutsplus, Learn Layout, A to Z CSS, Dash, Web Accessibility, The Hello World, Khan Academy, HTML5 from ScratchMozilla, Dive into HTML5, 20 Things I Learned, HTML Dog, HTML & CSS, HTML5 for Designers, DOM Enlightenment, HTML Canvas
jQueryCode Academy, Tutsplus, Code SchooljQuery Fundamentals, Learn jQuery
PythonCode Academy, Google, Learn Street, Python Tutor, IHeartPYPython for You and Me,  Dive into Python, Learn Python the Hard Way, Think Python, Python for Fun, Tango with Django, Django
Ruby & Ruby on RailsCode Academy, TryRubyCode Learn, Railscasts, Rubymonk, Learn StreetWhy’s (Poignant) Guide to Ruby, Learn Ruby the Hard Way, Learn to Program, Learn Rails by Example
PHPCode AcademyPHP Programming, Practical PHP
Also see: How to Learn Regular Expressions (RegEx)
Google Apps ScriptGetting Started, Office Hours, Google Scripts Examples, Learning Apps Script
WordPressTreehouse, WordPress TV
Linux & Shell ScriptingStanford.edu, Explain ShellConquer the Command Line
Node.jsNodetuts, Node SchoolThe Node Beginner Book, Mixu’s Node book, Node Up and Running, Mastering Node.js
Angular JSCode School, Egg Head, Learn AngularAngular JS Tutorial, Thinking Angular, Angular Tutorial, Getting Started (Adobe)
Also see:Learn Touch Typing & Code Faster
Git (version control)Code School, Git Immersion, GitHub Training, UdacityPro Git, Learn Git, Gists in Github
Objective-C (iOS & Mac)Code School, Stanford, iTunesU
Chrome Dev ToolsCode School, Dev Tools Secret, Chrome Dev Tools Tutorial, Udacity, Building Browser Apps
Go LanguageGolang.org, GopherCastsProgramming in Go, Go by Example, Learning Go, Building Web Apps with Go, Learning Go
JavaLearn Java, Coding Bat, Java Udemy, LearnerooProgramming in Java, Thinking in Java, O’Reilly Learning Java, Think Java, Java & CS, Java for Python Devs
Android App DevelopmentUdacity (Google Developers), Coursera, The New Boston, Google University, App Development Essentials, Code Learn, App Inventor (Visual)
D3 (data visualization)Data Visualization for the Web, Dashing D3, D3 Tips & Tricks
Also see:Learn VIM, the text editor for programmers
SQL (Databases)SQL Zoo, SQL @Stanford, Essential SQL, SQL for Nerds, Intro to SQL, SQL Bolt, PHP & MySQL
Everything ElseUdacity, edX.org, Coursera, Udemy$, Lynda$, Pluralsight$, Treehouse$, Open Consortium, One Month Rails$

Teaching Kids to Code

If there are kids in the family, you should download either Tynker (Android/iOS) or the Hopscotch app for iPad and they can learn the basics of programming through games and puzzles.

There’s also Scratch, an MIT project that allows kids to program their own stories and games visually. Scratch is available as a web app or you can download it on your Mac/Windows/Linux computer for offline use. Microsoft TouchDevelop, Blockly and Alice are some other web apps that will introduce the concepts of computer progamming to your children.

On a related note, the following chart from Google Trends shows the relative search popularity of various programming languages over the last 5 years. The interest in PHP has dipped over the years, JavaScript has more or less maintained its position while the popularity of Python & Node.js is on the rise.

Popularity of Programming Languages

Useful Regular Expressions for Validating Input in Google Forms

Your organization has a few vacant positions and you are planning to use Google Forms to prepare a pre-interview questionnaire for job applicants. You have created a form and it has all the standard fields where candidates can fill-in their name, email address, phone number, zip code and other information.

The form has been prepared but before you make it live, how would you ensure that candidates have entered data in the correct format? And even if the format is proper, is the data itself valid? Can you add a CAPTCHA to Google forms to prevent spam bots? Can you include a profanity filter to block people from submitting entries that include obscene words?

When you are expecting dozens, or even hundreds, of responses in your Google Forms, it is always a good idea to have some rules in place and the respondents’ data be matched against these rules even before they submit the form. For instance, if your form is asking for a person’s year of birth, and the applicant’s age should be between 25 and 50, they should only be allowed to enter a number between 1970 and 1996 in the year of birth field.

Advanced data validation in Google Forms using RegEx (regular expressions)

Regular Expressions in Google Forms

Google Forms makes it relatively easy to add such advanced date validation rules to individual fields through Regular Expressions (or regex or regexp). Think of them as search patterns and every character entered in a form field is matched against that pattern - the form can only be submitted if the patter and the user-input matches.

Let’s understand this with a real-world example.

Say your Google form expects the user to enter their year of birth. At the time of designing the form, expand the “Data Validation” section below the form field (see screenshot above) and choose Regular Expression from the drop-down. Next select “Matches” in the other drop-down and enter the following regex:

^19([78]\d|9[0-6])$

The field will now accept input value like 1977, 1995 but would reject other values that fall outside the 1970..1996 range.

Google Forms RegEx

Regular Expressions for Common Form Fields

A regular expression may appear gibberish but they aren’t so difficult to read and understand if you can know the basic rules of the language. What you see here is a compilation of some useful regular expressions that can be used to validate common form fields like URLs, phone numbers, zip codes, dates, etc.

1. Postal Address - allow only alphanumeric characters, spaces and few other characters like comma, period and hash symbol in the form input field.

[a-zA-Z\d\s\-\,\#\.\+]+

2. ZIP Code - the regex allows ZIP codes in standard formats and it matches both US and Indian zip codes.

^\d{5,6}(?:[-\s]\d{4})?$

3. Date - accept date input in the mm/dd/yyyy or mm-dd-yyyy formats.

((0[1-9])|(1[0-2]))[\/-]((0[1-9])|(1[0-9])|(2[0-9])|(3[0-1]))[\/-](\d{4})

Also see: Get Google Form Data by Email

4. Email Address - the regex below should match most common email address formats, including Gmail aliases that accept the ”+” sign but there’s no perfect solution.

[a-zA-Z0-9_\.\+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-\.]+

5. URL (Web domain) - this is useful for fields that require the user to enter their website address and it even matches the upcoming TLDs like .directory or .restaurant. The other regex matches YouTube URL including those using the youtu.be domains.

https?\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}
https?\:\/\/(www\.)?youtu(\.)?be(\.com)?\/.*(\?v=|\/v\/)?[a-zA-Z0-9_\-]+

6. Character Limit - the default text box in a Google form allows users to input any number of characters but you can impose a limit with the help of regular expression. Here we limit the input to 140 characters much like Twitter.

[\w]{1,140}

7. Phone Numbers - these are often a series of numbers preceded by an optional ”+” sign and the area code may be inside brackets.

\+?\(?\d{2,4}\)?[\d\s-]{3,}

8. Price (with decimal) - if a form field requires users to enter a price of an item in their own currency, this regex will help. Replace the $ sign with your own currency symbol.

\$?\d{1,3}(,?\d{3})*(\.\d{1,2})?

9. Complex Password - only accept a string that has 1 uppercase alphabet, 1 lowercase alphabet, 2 digits and 1 special character. Also the minimum allowed length is 8 characters.

(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9].*[0-9])(?=.*[^a-zA-Z0-9]).{8,}

10. CAPTCHA - Google forms do not offer CAPTCHAs but you can create one using regex. Here’s a simple captcha that requires users to answer a simple question - what is 2+2?

^(4|[Ff][Oo][Uu][Rr])$

Also see: Regular Expressions for Gmail Search

11. Word Limit - If you would like to limit the number of words that a user can type in the input field of a Google Form, there’s a regex for that as well. In this case, we only allow any input that has between 10 to 15 words:

^[-\w]+(?:\W+[-\w]+){9,14}\W*$

Useful Regular Expressions for Validating Input in Google Forms

Your organization has a few vacant positions and you are planning to use Google Forms to prepare a pre-interview questionnaire for job applicants. You have created a form and it has all the standard fields where candidates can enter their name, email address, website URL, phone number, zip code and other essential details.

The form is ready for publishing online but before you make it live, how would you ensure that candidates have entered data in the correct format? And even if the format is proper, is the data itself valid? Can you add a CAPTCHA to Google forms to prevent spam bots? Can you include a profanity filter to block people from submitting entries that include obscene words?

When you are expecting dozens, or even hundreds, of responses in your Google Forms, it is always a good idea to have some rules in place and respondents data should be matched against these rules even before they submit the form. For instance, if your form is asking for a person’s year of birth, they should only be allowed to enter a number between 1900 and 2014.

Advanced data validation in Google Forms using RegEx (regular expressions) Advanced data validation in Google Forms using RegEx (regular expressions)

Regular Expressions in Google Forms

Google Forms makes it relatively easy to add such advanced date validation rules to individual fields through Regular Expressions (or regex or regexp). Think of them as search patterns and every character entered in a form field is matched against that pattern - the form can only be submitted if the patter and the user-input matches.

Let’s understand this with a real-world example.

Say your Google form expects the user to enter their year of birth. At the time of designing the form, expand the “Data Validation” section below the form field (see screenshot above) and choose Regular Expression from the drop-down. Next select “Matches” in the other drop-down and enter ^(19\d{2}|20[0-1]\d)$ in the input field. The field will now accept input value like 1920, 2010 but would reject other values that fall outside the range.

Regular Expressions for Common Form Fields

A regular expression may appear gibberish but they aren’t so difficult to read and understand if you can know the basic rules of the language. What you see here is a compilation of some useful regular expressions that can be used to validate common form fields like URLs, phone numbers, zip codes, dates, etc.

1. Postal Address - allow only alphanumeric characters, spaces and few other characters like comma, period and hash symbol in the form input field.

[a-zA-Z\d\s\-\,\#\.\+]+

2. ZIP Code - the regex allows ZIP codes in standard formats and it matches both US and Indian zip codes.

^\d{5,6}(?:[-\s]\d{4})?$

3. Date - accept date input in the mm/dd/yyyy or mm-dd-yyyy formats.

((0[1-9])|(1[0-2]))[\/-]((0[1-9])|(1[0-9])|(2[0-9])|(3[0-1]))[\/-](\d{4})

Also see: Get Google Form Data by Email

4. Email Address - the regex below should match most common email address formats, including Gmail aliases that accept the ”+” sign but there’s no perfect solution.

[a-zA-Z0-9_\.\+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-\.]+

5. URL (Web domain) - this is useful for fields that require the user to enter their website address and it even matches the upcoming TLDs like .directory or .restaurant. The other regex matches YouTube URL including those using the youtu.be domains.

https?\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}
https?\:\/\/(www\.)?youtu(\.)?be(\.com)?\/.*(\?v=|\/v\/)?[a-zA-Z0-9_\-]+

6. Character Limit - the default text box in a Google form allows users to input any number of characters but you can impose a limit with the help of regular expression. Here we limit the input to 140 characters much like Twitter.

[\w]{1,140}

7. Phone Numbers - these are often a series of numbers preceded by an optional ”+” sign and the area code may be inside brackets.

\+?\(?\d{2,4}\)?[\d\s-]{3,}

8. Price (with decimal) - if a form field requires users to enter a price of an item in their own currency, this regex will help. Replace the $ sign with your own currency symbol.

\$?\d{1,3}(,?\d{3})*(\.\d{1,2})?

9. Complex Password - only accept a string that has 1 uppercase alphabet, 1 lowercase alphabet, 2 digits and 1 special character. Also the minimum allowed length is 8 characters.

(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9].*[0-9])(?=.*[^a-zA-Z0-9]).{8,}

10. CAPTCHA - Google forms do not offer CAPTCHAs but you can create one using regex. Here’s a simple captcha that requires users to answer a simple question - what is 2+2?

^(4|[Ff][Oo][Uu][Rr])$

Also see: Regular Expressions for Gmail Search

11. Word Limit - If you would like to limit the number of words that a user can type in the input field of a Google Form, there’s a regex for that as well. In this case, we only allow any input that has between 10 to 15 words:

^[-\w]+(?:\W+[-\w]+){9,14}\W*$

The Best Google Add-ons for Docs, Sheets, Slides and Google Forms

The availability of third-party add-ons for Google Docs, Sheets and Google Slides have certainly made the Google Office productivity suite more capable and useful. If you haven’t tried them yet, open any Google document or spreadsheet in your Google Drive and look for the new add-ons menu near Help. G Suite users may have to ask their admin to enable support for add-ons for the organization.

For starters, Google add-ons are like extensions for Chrome. Extensions add new features to the Chrome browser and add-ons extend the functionality of Google Office applications. To give you an example, here’s the screenshot of a Twitter add-on I wrote for Google Docs and Google Sheets that you can use to find and curate tweets right inside your documents.

Twitter Curator is an add-on for Google Docs and Sheets Twitter Curator is an add-on for Google Docs and Sheets

Anyone can write an add-on for Google Docs. All you need are some basic programming skills for writing HTML, CSS for styling the add-on while the server side code is written in Google Apps Script which is similar to JavaScript but runs on the Google Cloud.

Google Apps Script vs Google Add-ons

Google Add-ons are written in the Google Apps Script language but while regular Google Scripts can work on any document in your Google Drive, add-ons only work against the document or sheet that’s currently open in your browser.

Also, while Google Scripts support triggers and can run in the background (like this Website Monitor), add-ons can only run while a document or sheet is open and active. (Update: Google now allows you to create time-based triggers for add-ons)

The other big difference is that you can view the source code of regular Google Scripts while in the case of add-ons, the code is hidden from the end user. This helps developers protect their code but a downside is that the user has no clue about what’s happening behind the scenes.

We have seen issues with Chrome extensions and add-ons for Google Docs can be a target as well. For instance, an add-on can possibly email a copy of the current document or sheet to another email address? Or maybe it can share a folder in Google Drive with someone else. All add-ons currently listed in the Chrome store have been tested and reviewed by Google but if they open the gates for all, I would be a little hesitant to install add-ons created by unknown developers.

The Best Add-ons For Google Docs, Sheets and Google Slides

The GSuite marketplace lists hundreds of Google add-ons and here are some of favorite ones that you should have in your Google Docs and Sheets. The are compatible with both GSuite and consumer Google accounts.

  1. Mail Merge for Gmail - Send personalized emails with emails to multiple email recipients with Mail Merge for Gmail and G Suite.
  2. Document Studio - Generate certificates, invoices, and other documents automatically from source data in Google Sheets or Google Form submissions.
  3. Download Gmail Emails - Download your Gmail messages and attachments in Google Drive for archiving.
  4. Twitter Archiver - Save tweets forever in a Google Sheet for any search term or hashtag.
  5. Email Scheduler for Gmail - Schedule emails inside Gmail for sending later at a specific date and time. Send repetitive emails that go on a recurring schedule.
  6. Google Drive Permissions - Know who has access to your files in Google Drive.
  7. Gmail Address Extractor - The add-on extracts the email addresses from the header and body of email messages for preparing a mailing list.
  8. Google Slides Studio - Convert Google Slides presentations to animated GIF and MP4 movies.
  9. Twitter Curator - Search, filter and add tweets in a Google Documents. It is like Storify for Google Docs.
  10. Google Forms Notifications - Get Google Forms responses in an email message when people submit your forms. Send customized email notifications to respondents.
  11. Email Spreadsheet as PDF - Convert and email Google Spreadsheets as PDF, Excel or CSV to multiple people. Email sheets manually or on a recurring schedule.
  12. Bulk Gmail Forward - Easily forward one or more email threads from Gmail to any other address.
  13. Email AutoResponder for Gmail - Setup email autoresponders in Gmail and quickly reply to messages using pre-written email templates.
  14. HelloFax - You can now send a fax to any number worldwide directly from inside Google documents. The free version lets you fax up to 5 pages.
  15. UberConference - You can have an audio conference with up to 10 people while working on a Google Document. There’s an option to record the call too.
  16. PanDoc - You can send the current document to the client from within Google Docs to request their legally-binding signature.
  17. Unsplash Photos - Instantly search and embed free photos in your Google Slides from the extensive image database.
  18. Avery - Create address labels inside Google Docs for printing.
  19. EasyBib - Cite books, journal articles and websites and add them to your Google Documents in MLA, APA and Chicago style.
  20. Lucidchart - Create flow charts, diagrams, site mockups, org charts and other technical drawings inside your Google Documents.
  21. Mapping Sheets - Create a spreadsheet with a list of places and the sheets add-on will plot them on a Google Map.
  22. TextHelp - This is like the yellow highlighter for your Google Documents. Select and highlight passages and save the annotations in a separate document.

Related tutorial: How to Create a Google Docs Add-on

The Best Online Teachers for Learning Web Development

For the past few months, I have been on a learning spree looking to enhance my existing coding skills and also learn new programming languages and frameworks. In this process, I have watched a countless number of video tutorials and online courses that pertain to programming and, specifically, web development.

In my quest to become a better developer, I’ve come across several awesome “teachers” who aren’t just excellent programmers but awesome educators and have the art of explaining complex and difficult concepts.

Learn Modern Web Programming with the Best Online Teachers

This is an attempt to highlight the best instructors on the Internet for JavaScript, React, Redux, Node.js, Firebase (database and storage), Docker, Google Golang, Typescript, Flutter (for mobile app development), Dart, Git, Webpack and Parcel bundler.

I’ve taken courses by every single instructor mentioned here (PDF) and recommend them highly.

Awesome Web Teachers

Language / PlatformTeacher / Course
React.jsAndrew Mead, Maximilian Schwarzmüller, Stephen Grider, Ryan FlorenceScott Tolinski, Elijah Manor, Brian Holt, Dave CeddiaKirupa Chinnathambi
Advanced JavaScript / ES6 / ES2017Anthony Alicea, Wes Bos, Mark Zamoyta, Tyler McGinnis,  Mosh HamedaniKent C. DoddsKyle SimpsonKyle Robinson YoungBrandon Morelli, Cody Seibert
ReduxDan AbramovShaun PellingBucky RobertsCory House
Dart & FlutterMary Xia & Matt SullivanStephen Grider, Maximilian Schwarzmüller, Filip & Emily Fortuna
Docker / KubernetesJake Wright, Stephen Grider, James Lee
Webpack / Parcel web bundlerAndrew MeadLawrence Whiteside, Sean LarkinPetr TichyBrad TraversyMax Schwarzmüller
Node.jsMaximilian SchwarzmüllerStephen GriderAndrew MeadAzat MardanAnthony AliceaSamer Buna
Git & GithubTrevor MillerAlex Garret-SmithTom Preson-Werner, Daniel Shiffman
Go LanguageTodd McLeod, Stephen Grider, Derek Banas, Jon Calhoun, Harrison Kinsley
TypeScriptTodd MottoJohn LidquistBasarat Ali SyedMarius Schulz
Firebase / FirestoreDavid East, Doug Stevenson, Shaun Pelling, Todd Kerpelman, Steve Kinney
Google Chrome Dev ToolsPaul Irish, Surma, Umar Hansa, Jon Kuperman
GraphQLAndrew Mead, Stephen Grider

Also see: Learn How to Code Online

How to Move Files Uploads from Google Forms to a Specific Folder in Google Drive

The File Upload feature of Google Forms lets you receive files from form respondents directly in your Google Drive. You may add the File Upload question in your Google Form to receive PDF assignments from students, résumé applications, portfolio images from contestants, and so on. When a respondent uploads a file through Google Forms, the file are stored in a fixed folder of your Google Drive. All files are uploaded in the same folder and, thus looking at the file in your Google Drive, it is difficult to determine which respondent has uploaded which set of files. We can however use Google Apps Script with Google Form triggers to instantly organize files in Google Drive as soon as they are uploaded by the form respondent. You can change the destination folder where files are stored or create custom folders based on the form response.

Organiza File Uploads in Google Drive

    In the following example, we will create a parent folder in Google Drive to house all the uploaded files. Each form response will have its own subfolder and all files for that specific form entry will go in the same folder.

Create Parent Folder

To get started, go to your Google Drive and create a new folder (or use an existing folder). Open the folder and grab the ID of the folder from the browser’s address bar as shown in the screenshot.

Add the Google Script

Next, go to your Google Form that is accepting File Uploads and choose Script Editor from the 3-dot menu.   Inside the script editor, remove all the existing code and copy-paste the following snippet. Remember to replace the Folder Id in line #1 with the Id of the folder that you’ve created in the previous step.
const PARENT_FOLDER_ID = "<<Folder ID here>>";

const initialize = () => {
  const form = FormApp.getActiveForm();
  ScriptApp.newTrigger("onFormSubmit").forForm(form).onFormSubmit().create();
};

const onFormSubmit = ({ response } = {}) => {
  try {
    // Get a list of all files uploaded with the response
    const files = response
      .getItemResponses()
      // We are only interested in File Upload type of questions
      .filter(
        (itemResponse) =>
          itemResponse.getItem().getType().toString() === "FILE_UPLOAD"
      )
      .map((itemResponse) => itemResponse.getResponse())
      // The response includes the file ids in an array that we can flatten
      .reduce((a, b) => [...a, ...b], []);

    if (files.length > 0) {
      // Each form response has a unique Id
      const subfolderName = response.getId();
      const parentFolder = DriveApp.getFolderById(PARENT_FOLDER_ID);
      const subfolder = parentFolder.createFolder(subfolderName);
      files.forEach((fileId) => {
        // Move each file into the custom folder
        DriveApp.getFileById(fileId).moveTo(subfolder);
      });
    }
  } catch (f) {
    Logger.log(f);
  }
};
Tip: The script can also be enhanced to create custom folder names based on the user’s answers in the form response.

Create OnFormSubmit Trigger

Inside the script editor, select initialize from the function drop-down and click the Run button to create the OnFormSubmit trigger for your current Google Form. This will essentially run the Apps Script code whenever someone submits a new form entry and upload files to a specific folder in Google Drive.     That’s it. Go to your Google Form and submit a new test entry. You should now see all the uploaded files neatly organized in a custom folder under the parent folder. The name of the custom folder is the unique Response Id that Google Forms automatically assigns to every form submission.   PS: You can combine File Uploads in Google Forms with Document Studio to generate customized PDFs (certificates, employee ID cards, etc) from the uploaded images

How to Send a File to Participants After they Submit your Google Form

When someone fills out your Google Form, you may want to send a file or two to the form respondent. For instance:

  1. A school teacher can send a Word document containing a copy of the answers to students who have completed the quiz.
  2. A musician can send her latest composition as an MP3 file to users who have completed her website survey built with Google Forms.
  3. An author can email a preview copy of her upcoming book in PDF to fans who have subscribed to her newsletter.
  4. An online store may send their catalog PDF to customers who have placed orders through Google Forms.

Demo - Send Files with Google Forms

Open this Google Form, type your email address and hit the Submit button. Check your inbox and you should immediately find a PDF copy of our famous 101 useful websites collection.

How to Attach Files to Form Emails

The Email Notifications add-on for Google Forms lets you send customized emails to form respondents after a new entry is received. The same notification can also be customized to include one or more file attachments that are picked from your Google Drive and sent as an attachment in the auto-responder email.

Add File to Google Drive

  1. Go to the Google Drive website and upload any file that you wish to send via Google Forms.
  2. Change the sharing settings on the file so that it is accessible to anyone with a link. You cannot attach private files to form emails.
  3. Right-click the file in Google Drive and choose Get Link to copy the full URL of the file to the clipboard.

File Attachments in Google Drive

Configure Google Forms

  1. Go to your Google Form, and create a new email rule.
  2. Check the Notify Form Submitter option and select the form field where you ask for the email address of the form submitter.
  3. Go to the Attach Files section and paste the URL of the Google Drive file that you have copied in the previous step.

Save the rule to activate it. Submit a new form and when new users submit the form, they’ll automatically receive a copy of your file as an attachment.

Send File Attachment

PS: You may use this workflow to send files in any format including PDF, Images, Audio, Video, GIFs, PowerPoint, Excel and Word documents. The file size should be less than 5 MB. Also, it is not possible to attach native Google file formats like Google Docs, Sheets and Google Slides.

JavaScript Design Patterns

This article is a summary of the various design patterns in JavaScript that help us create clean, easier to maintain code without polluting the global namespace.

Object Literal Design Pattern

To avoid the possibility of collusion with other variables of the same name in the global namespace, take all your variables and functionn and make them part of an object with a unique name.

var com = com || {};
com.digitalinspiration = com.digitalinspiration || {};
com.digitalinspiration.person = {
  _name: "Amit Agarwal",
  _country: "",
  setCountry: function (country) {
    this._country = country;
  },
  printCountry: function () {
    console.log(this._name + " lives in " + this._country);
  },
};
com.digitalinspiration.person.setCountry("India");
com.digitalinspiration.person.printCountry();

Module Design Pattern

This pattern helps create private variables in JavaScript that cannot be accessed from the global scope as everything is wrapped inside an IIFE. We create a module that returns an object containing all the public functions. The variable are not accessible outside the module.

var personModule = (function () {
  // private variables and methods
  var _name = "Amit Agarwal";
  var _country = "";
  var print = function () {
    console.log(_name + " lives in " + _country);
  };
  return {
    setCountry: function (country) {
      _country = country;
    },
    printCountry: function () {
      console.log("Calling private method to print " + _country);
      print();
    },
  };
})();

personModule.setCountry("India");
personModule.printCountry();

Module Reveal Pattern

The Reveal Module design pattern makes it easy for the private methods and properties to communicate with the public methods. All methods and variables are hidden unless deliberately exposed inside the returning object.

var personModule = (function () {
  var _name = "Amit Agarwal";
  var _interests = [];
  function _printInterests() {
    console.log(_name + " likes " + _interests.join(", "));
  }
  function addInterest(interest) {
    _interests.push(interest);
  }
  function printInterests() {
    console.log("Calling private method");
    _printInterests();
  }
  return {
    printInterests: printInterests,
    addInterest: addInterest,
  };
})();

personModule.addInterest("Travel");
personModule.addInterest("Reading");
personModule.printInterests();

Avoid the Global Scope

Here we conditionally add our module to the global scope and make everyithng private by wrapping our entire module in an IIFE. The advantage with the pattern is that we are not immediately adding elements to the global scope but performing checks to avoid overriding names.

(function (win) {
  var personModule = (function () {
    var _name = "Amit Agarwal";
    function printName() {
      console.log(_name);
    }
    return {
      printName: printName,
    };
  })();
  if (!win.personModule) {
    win.personModule = personModule;
  } else {
    throw new Error("Cannot initialize application");
  }
})(window);

window.personModule.printName();

YouTube Email Alerts – Monitor Videos around your favorite Topics

The Google Alerts service makes it easy for you to monitor brand mentions and your favorite topics on the Internet. Just specify one or more keywords and Google will send an email notification when new web pages matching your search keywords are found on the web.

The YouTube Email Alerts service is similar to Google Alerts but instead of scanning the whole worldwide web, it limits the searches to videos uploaded on the YouTube website. It then sends automatic email notifications when new videos are uploaded on YouTube around your topics of interest.

Here’s a sample email notification sent by the YouTube Alert system that, in this example, is configured to track new video uploads around three topics - Tesla Model Y, The Queen’s Gambit, and Minecraft tutorials.

YouTube Email Alerts

Setup YouTube Email Alerts

Here’s a step by step guide on how to set up your own YouTube email alert system for monitoring videos around your topics of interest.

  1. Click here to make a copy of the YouTube alert script in your Google Account.

  2. Inside the Google Script, go to line #12 and update the default configuration. You need to specify the email address where the alerts should arrive, the topic or keywords that you wish to track, and the list of negative words. If a matching video contains any of the negative words, they’ll be filtered out of the email notification.

  3. Go to the Run menu and choose the initialize option. Authorize the Google Script and your email system is deployed instantly. Go to your Gmail sent items and you should see an email alert with the matching videos.

The system is now deployed and it will send one email digest per day with a list of matching videos. The email is sent around 11 AM GMT but you can change this time by updating the value of the emailAlertHour property in the configuration.

Configure Video Alerts

How YouTube Email Alerts Work

The alert system is built using the official YouTube API with Google Apps Script. You can find the complete source code on Github.

When you run the initialize function, it creates a cron job that will automatically run once per day around the specified hour. It then uses the YouTube API to find all matching videos that have been uploaded on YouTube since the last execution of the script. It takes the 10 most relevant videos and adds them to the notification email.

const fetchYouTubeVideos = (query = "cats") => {
  const date = new Date();
  date.setDate(date.getDate() - 3);
  const dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'";
  const publishedAfter = Utilities.formatDate(date, "UTC", dateFormat);
  const { items = [] } = YouTube.Search.list(["snippet"], {
    maxResults: 10,
    regionCode: "US",
    publishedAfter: publishedAfter,
    relevanceLanguage: "en",
    q: query,
    type: ["video"],
    fields: "items(id(videoId),snippet(title, channelTitle, channelId))",
  });
  return items.map((item) => {
    const {
      id: { videoId },
      snippet: { title, channelTitle, channelId },
    } = item;
    return { videoId, title, channelTitle, channelId };
  });
};

The preferredLanguage parameter in the configuration is, by default, set to en (English) and instructs YouTube to return videos that are most relevant to the specified language. You can use your two-letter language ISO code (like fr from French or hi for Hindi) here.

Similarly, the regionCode parameter (default is US) helps you restrict search results to videos that can be viewed in your country.

Also see: Google Drive File Monitor