How to Add a Dropdown to a Google Spreadsheet

Google Docs are awesome and there are a lot of things to learn about them. Here is a tutorial on how to add a dropdown to Google Spreadsheet

Step by Step:

  • Select the cell or cells where you want to create a drop-down list.
  • Click Data and then Data Validation.
  • In Criteria, choose the option, List of items
  • Enter items, separated by commas and no spaces.
  • Click Save. The cells you have chosen will show a dropdown list of the items you created

Video Tutorial

 React: Passing Props from one Component to another

There are some things that we just need to do to finish something fast. It’s inefficient but we can get back to later on. One of those examples is retrieving the fields you need from the database.

# Optimized way to get data 
SELECT first_name, last_name FROM users;
# Non-optimized way to get data
SELECT * FROM users;

In React, there some instances that we need to pass in props from one component to another and we are just too tired to do it right now. Here is a cool way.

Best way / Optimized

const { first_name, last_name, address } = this.props;
<ChildComponent
  first_name={first_name}
  last_name={last_name}
  address={address}
/>

Cool way / Non-optimized

<ChildComponent
 {...this.props}
/>

Remember that this isn’t the optimized thing to do

Screen shot 2017 11 15 at 8.54.00 am

 Linux: See the available disk space

The df command is a useful command that reports the total usage in all mounted filesystems in table format.

The first column shows the name of disk partition, ie, /devdisk1@ and devfs. Other columns normally show the Used Space, Available Space, and Capacity which is the percentage of available space against the used space.

Screen shot 2017 10 23 at 5.18.57 pm

 Global Regex Replace

Regular expression replacement will always have a place. The fastest way to replace substrings on a string is to split and join like to following:

let ourString = "My name is Leon. Your name is not Leon";
ourString.split("Leon").join("Buddy"); // My name is Buddy. Your name is not Buddy"

Regular expressions will let you replace string with conditions easily

let partialString = ":pensive: will only be replaced if :p is not followed by ensive"
let stringToFind = new RegExp(/:p(?!ensive)/, 'g');
partialString = partialString.replace(stringToFind, ":stuck_out_tongue:"); // :pensive: will only be replaced if :stuck_out_tongue: is not followed by ensive

Another example:

let partialString = 'party party party p';
let stringToFind = new RegExp(/p(?!arty)/, 'g');
partialString = partialString.replace(stringToFind, "party"); // party party party party