Skip to content

Instantly share code, notes, and snippets.

@TaylorOD

TaylorOD/TIL.md

Last active Nov 11, 2020
Embed
What would you like to do?
Today I learned...

Day 22/100:

Last week I deployed a few static apps using @netlify. Today I'm deploying a larger #rails and #vue app using @heroku to my own domain... Fingers Crossed.

#100DaysOfCode

Day 21/100:

I've been getting in the habit of using branches in @github and #Git. It's a little slower when I'm coding alone but it makes it easier to track my code on longer projects.

#100DaysOfCode

Day 20/100:

Working on integrating @twilio into a #rails and #vue app. So cool to see SMS working correctly after a couple hours of work!

#100DaysOfCode

Day 19/100:

https://imgflip.com/i/4l9dkg

#100DaysOfCode

Day 18/100:

I worked on pushing two #javascript sites out today using Netlify and Surge. They are both great options to get simple projects online. I like Surge a bit better because it can all be done in the command line.

#100DaysOfCode

Day 17/100:

I missed yesterday because I was working the polls in #Chicago. Today it is easy to refresh the news over and over but I WILL FINISH MY #JAVASCRIPT PROJECT! Just a little more #CSS before it's ready to push to #heroku

#100DaysOfCode

Day 16/100:

I was styling two #javascript apps I built recently when I discovered to use .classList.add("") to add a class to a generated item. Makes it much easier to style everything!

#100DaysOfCode #HTML5 #CSS

Day 15/100:

A few days ago I mentioned my first open-source pull request accepted. I had 3 others accepted and qualified for a prize with Hacktoberfest 2020. (On the last day!)

Thanks @digitalocean!

#100DaysOfCode #Hacktoberfest2020

Day 14/100:

I've officially made it. A recruiter from Amazon reached out to me about a SWD role! Time to get started on the algo practice... Jokes aside I finally cemented Bubblesort in my brain after several attempts over the last few weeks!

#100daysofcode

Day 13/100:

My first pull request merged on an open-source project today. I've worked on other projects but not one where I didn't know the creator. It was a bit scary but exciting to see that my code had been accepted and to be added to the contributor's list!

#100DaysOfCode

Day 12/100:

I finished a coding assessment in C# this morning! I haven't touched the language before so it was interesting to say the least. Reminds me of my start in recruiting when I was only working on C#, http://ASP.NET MVC roles.

#100DaysOfCode

Day 11/100:

I found about the Fetch API in #JavaScript and I have been replacing .open and .send requests with Fetch to try it out. It works much better with Promises!

#100DaysOfCode

Day 10/100:

Today I've been working with Promises in #JavaScript. I haven't needed to use them until recently so I decided to dig in and explore them more.

#100DaysOfCode

Day 9/100:

I've been working on a #javascript project from a month ago that used traditional functions. I've been replacing them with arrow functions and using the arrow function return shortcut where I can.

#100DaysOfCode

Day 8/100:

Working with the #Mapbox api today on a #vue app. They have incredible #vue documentation. It's better than a lot of the documentation I see for most #javascript projects.

#100DaysOfCode

Day 7/100:

I've been implementing an #API into a #javascript application I built and just discovered the Network tab in the #Chrome Dev Tools. I can't believe I didn't know about this before. Really helpful when tracking what #http requests are being made.

#100DaysOfCode

Day 6/100:

I was messing around with a new #rubyonrails app and was struggling with my seeds file. I remembered that I need to add ! after create to make sure it crashes and gives errors so I could debug it.

#100DaysOfCode

Day 5/100:

Today I worked on refactoring an app I'd previously written in #javascript with Class syntax. It's much cleaner and all my functions are easier to read.

#100DaysOfCode

Day 4/100:

Building a #VueJS front end for a blog #Rails app I wrote a while back. I've never tried to throw #Bootstrap and a theme into Vue before! Crossed fingers

#100DaysOfCode

Day 3/100:

I've been working on building a simple hangman game in #javascript. I did something similar in #ruby a few months ago so it's interesting to see how each language treats classes/objects.

#100DaysOfCode

Day 2/100:

Today I'm learning about prototypal inheritance in JavaScript. It's a bit different than in Ruby on Rails so it's been fun to tackle. I like using JavaScript for something outside of the browser.

#100DaysOfCode #javaScript #react

Day 1/100:

I'm publicly committing to the 100DaysOfCode Challenge starting today! Learn More and Join me! https://100DaysOfCode.com #100DaysOfCode

#100DaysOfCode

11/4/2020

Today I learned that when building a Vue app your .vue files will almost always consist of:

<template>
<script>
<style>

10/30/2020

Today I learned about CSS styleing. The * selector in a CSS file will be applied to everything in the document.

* {
 color: red;
}

10/27/2020

Today I learned about closure in JavaScript. I've been using it with async code recently.

const createTipper = (tip) => {
  return (total) => {
    return tip * total
  }
}

const tip25 = createTipper(.25)
console.log(tip25(10))

10/24/2020

Today I learned I can code and watch UFC at the same time! Built two crud functions for a new project while watching UFC 254!

10/23/2020

Today I learned about the Subclass syntax in JavaScript. Similar to Rails inheritance it allows you to create a class that shares some of the properties of an existing class but you can also give it new properties that only that subclass will have.

class Person {
constructor (firstName, lastName) {
  this.firstName = firstName
  this.lastName = lastName
  }
}

class Employee extends Person {
  constructor (firstName, lastName, title) {
    super(firstName, lastName)
    this.title = title
  }
}

10/22/2020

Today I learned Class syntax in JavaScript. It is consitered to be clearner than other using the prototype object syntax.

class Hangman { 
  constructor(word, allowedGuesses) {
    this.word = word.toLowerCase().split("");
    this.allowedGuesses = allowedGuesses;
    this.guessedLetters = [];
    this.status = "playing";
  }
  getPuzzle() {
    let puzzle = "";
    this.word.forEach((letter) => {
      if (this.guessedLetters.includes(letter) || letter === " ") {
        puzzle += letter;

      } else {
        puzzle += "*";

      }
    });
    return puzzle;
  }

Rather than:

const Hangman = function (word, allowedGuesses) {
  this.word = word.toLowerCase().split("");
  this.allowedGuesses = allowedGuesses;
  this.guessedLetters = [];
  this.status = "playing";
};

Hangman.prototype.getPuzzle = function () {
  let puzzle = "";
  this.word.forEach((letter) => {
    if (this.guessedLetters.includes(letter) || letter === " ") {
      puzzle += letter;

    } else {
      puzzle += "*";

    }
  return puzzle;
};

10/19/2020

Today I learned about OOP and prototypal inheritance in JavaScript.

const Person = function (firstName, lastName, age) {
  this.firstName = firstName  
  this.lastName = lastName
  this.age = age
}

Person.prototype.getBio = function () {
  return `${this.firstName} is ${this.age}.`
}

const me = new Person("Taylor", "Dorsett", 28)
console.log(me.getBio())

10/18/2020

Today I learned about the .split function in JavaScript

let word = "hello"
let splitWord = word.split("")

10/17/2020

Today I learned about type coercion in JavaScript.

const value = false + 12
console.log(value)

is 12.

const value = true + 12
console.log(value)

is 13 because true becomes 1 and false becomes zero.

10/16/2020

Today I learned about truthy and falsy.

if (todo !== undefined) {
  todo.completed = !todo.completed
}

becomes

if (todo) {
  todo.completed = !todo.completed
}

10/15/2020

Today I learned about arrow functions in JavaScript. Best used with one line functions that return something. You do not need to use curly brackets.

const square = (num) => num * num

10/14/2020

Today I learned about catching and throwing errors in JavaScript.

const gradeCalc = function (studentScore, maxScore) {
  
  if (typeof studentScore !== "number" || typeof maxScore !== "number") {
    throw Error("Inputs must both be numbers!")
  }
  const studentGrade = (studentScore / maxScore) * 100
  let letterGrade = ""

  if (studentGrade >= 90) {
    letterGrade = "A"
  } else if (studentGrade >= 80) {
    letterGrade = "B"
  } else if (studentGrade >= 70) {
    letterGrade = "C"
  } else if (studentGrade >= 60) {
    letterGrade = "D"
  } else {
    letterGrade = "F"
  }
  return (`You got an ${letterGrade}. (${studentGrade}%)`)
}

try {
  const result = gradeCalc("purple", 100)
  console.log(result)
} catch (e) {
  console.log(e.message)
}

10/13/2020

Today I learned about JavaScripts strict mode. It prevents some issues like leaked vars.

"use strict"
let data = ""
const processData = () => {
  data = "13123123"
}
processData()
console.log(data)

runs while

"use strict"
const processData = () => {
  data = "13123123"
}
processData()
console.log(data)

does not.

10/12/2020

Today I learned how to display dates in JavaScript.

const now = new Date("January 21 2001 6:25:01")
const timestamp = now.getTime()

console.log(`Year: ${now.getFullYear()}`)
console.log(`Month: ${now.getMonth()}`)
console.log(`Day of month: ${now.getDate()}`)
console.log(`Hour: ${now.getHours()}`)
console.log(`Minutes: ${now.getMinutes()}`)
console.log(`Seconds: ${now.getSeconds()}`)

10/9/2020

Today I learned about the !! shortcut in the terminal. I use it when I have a permission issue and need to run sudo.

sudo !!

10/8/2020

Today I learned the window function in JavaScript. This can allow you to sync data across multiple pages.

window.addEventListener("storage", function (e) {
  if (e.key === "notes") {
    notes = JSON.parse(e.newValue)
    renderNotes(notes, filters)
  }
})

10/7/2020

Today I learned how to use UUID to generate unique ID's using JavaScript.

In your html file:

<script src="https://unpkg.com/uuid@latest/dist/umd/uuidv4.min.js"></script>

In your JavaScript file:

todos.push({
  id: uuidv4(),
  text: e.target.elements.text.value,
  completed: false,  
  })

10/6/2020

Today I learned about displaying in Vue.js. If you create a div with a ID that Vue.js calls, anything you include in {{ }} will run.

<div id="vue">
   <h1> {{name}} </h1>
</div>

Name is definded in your JavaScript/Vue file.

10/5/2020

Today I learned about the defer attribute in JavaScript/HTML. If you write defer along with your script tag it will not run until the rest of the document is loaded.

<script src="index.js" defer></script>

10/5/2020

Today I learned about /* global blank */ which will tell your ESLint to calm down.

/* global Vue */
var app = new Vue({
})

10/3/2020

Today I learned about debugger. You can use debugger in your JavaScript code to see more details about your app and use the console in your browser. This also pauses the code so you can find out where the issue is in your code.

10/2/2020

Today I learned refactoring code means changing the code so it is cleaner, more efficient, is organized in another way, but functionally runs the same.

10/1/2020

Today I was able to finish my first problem on algoexpert.io which has been a goal since I started programming. I finished the Two Number Sum question and had to learn how to check if my result array was empty to do so.

9/30/2020

Today I learned how to make a checkbox in JavaScript.

 <label>
    Show compleated todos: <input id="completed-checkbox" type="checkbox">
 </label>

9/29/2020

Today I learned how to set up a dropdown menu in JavaScript.

    <select id="filter-by">
        <option value="byEdited">Sort By Last Edited</option>
        <option value="byCreated">Sort By Recently Created</option>
        <option value="alphabetical">Sort Alphabetically</option>
    </select>

9/28/2020

Today I learned that if your email in git or github is incorrect your profile will not show any of the commits you make from your terminal.

9/27/2020

Today I learned how to use the input tag in JavaScript.

<input type="text">

Gives you a box that users can input text into while,

<input type="password">

gives you a password box.

9/26/2020

Today I learned editing text using .target in JavaScript.

document.querySelector("button").addEventListener("click", function(e) {
    e.target.textContent = "Added Todo"
})

This allows one to change the text of a button after it has been pressed by the user.

9/25/2020

Today I learned about using .addEventListener in JavaScript. This allows you to interact with the user in the broswer.

document.querySelector("button").addEventListener("click", function() {
    console.log("the user clicked")
})

9/24/2020

Today I learned how to load JavaScript into an HTML file using a <script> tag.

    
<script src="notes_app.js"></script>
        

This is will call the notes_app.js file.

9/23/2020

Today I learned create actions in HTML require building a #new route to build a form and then a #create action to actually create the photo.

9/21/2020

Today I learned how to use Live Server. It allows you to host html and other docutments and will auto update when you save your file. It is a simple and easy way to get JavaScript in your local browser.

9/20/2020

Today I learned about the Bypass Paywalls Chrome Extention on Github. You can check it out here: https://github.com/iamadamdev/bypass-paywalls-chrome

After downloading and unzipping the folder all you have to do to install is go to your Chrome Extentions and enable Developer Mode. Then drag the folder to your Chrome Extentions page and it will load and work right away!

Of course please support journalism whenever you can.

9/19/2020

Today I learned how to set up my blog quickly and easily using Jekyll. There is a great tutorial here: https://www.smashingmagazine.com/2014/08/build-blog-jekyll-github-pages/

You can find my blog at taylordorsett.com

9/18/2020

Today I learned how to search an array in JavaScript for the index of an item using indexOf().

const notes = ["Note 1", "Note 2", "Note 3"]

console.log(notes.indexOf("Note 2"))

This will return 1 in the console.

9/17/2020

Today I learned that the human brain takes up only 2% of human body weight but uses 20% of its energy. Thanks Snapple facts!

9/16/2020

Today I learned about join tables. You can build a join table when the has_many and belongs_to relationship involves multiple ID's. This allows you to associate things that would otherwise be difficult or restrictive.

9/15/2020

Today I learned about before_actions in Ruby.

before_action :authenticate_admin, except: [:index, :show]

If you write the method authenticate_admin in your app contoller this allows you to select what you are allowing users and admins to do in your app.

9/14/2020

Today I learned about creating array's in JavaScript.

const notes = ["note 1", "note 2", "note 3"]
let books = ["Book 1", "Book 2", "Book 3"]

9/13/2020

Today I learned about terminal aliases

code ~/.bash_profile
alias clr="clear"

9/12/2020

Today I learned about const in JavaScript. This allows you to create a variable that cannot be changed. This improves code readability.

const isRaining = true
isRaining = false // This code will not change isRaining to false and will cause an error when run
console.log(isRaining

9/11/2020

Today I learned about Math in JavaScript.

let num = 105.9073

console.log(Math.round(num))
console.log(Math.floor(num))
console.log(Math.ceil(num))

9/10/2020

Today I learned about built in JavaScript methods like .toUpperCase and .length

let name = "Taylor Dorsett"

console.log(name.length)
console.log(name.toUpperCase())

9/9/2020

Today I learned you can write functions within JavaScript objects.

let resturant = {
    name: "Half Sour",
    guestCapacity: 75,
    guestCount: 0,
    checkAvailability: function (partySize) {
    let seatsLeft = this.guestCapacity = this.guestCount
    return partySize <= seatsLeft
    }
}

9/8/2020

Today I learned about changing data in objects in JavaScript.

let myBank = {
  name: "Taylor Dorsett,
  balance: 356
}
myBank.balance = 1000000

console.log(myBank)

9/7/2020

Today I learned that no mater how many games of tennis I play with my Partner I will never win.

while true
  taylor_win_tennis = false
end

9/6/2020

Today I learned about REST naming conventions

"/photos" => "photos#index"

display a list of all photos - All REST API's should be the same.

9/5/2020

Today I learned about datebase migrations and change comands in Ruby

def change
  change_column :products, :price, :integer
end

9/4/2020

Today I learned about Validation in Ruby

class User < ActiveRecord::Base
  validates :name, :unquicness => true
end

9/3/2020

Today I learned about template strings

let name = "Robert"
let age = 29

console.log(`I have a friend named ${name} who is ${age}.`)

This is similar to interpolation in Ruby.

9/2/2020

Today I learned about default arguments in JavaScript

let getScoreText = function (name, score) {
  console.log(name)
  console.log(score)
 }
 
 getScoreText() 
 

returns undefined twice while

let getScoreText = function (name, score = 0) {
 console.log(name)
 console.log(score)
}

getScoreText() 

returns undefined and 0.

9/1/2020

Today I learned the nothingness of a black hole generates a sound in the key of B flat.

Thanks Snapple Facts!

8/31/2020

Today I learned about Global and Local scope in JavaScript

let name = "Taylor"

if (true) {
   let name = "Dorsett"
   console.log(name)

// Dorsett is printed

8-30-2020

Today I learned about responsive HTML templates that are easy and free to use.

https://html5up.net/

8-29-2020

Today I learned that github will host one page for you for free at .github.io

taylorod.github.io

8-28-2020

Today I learned JavaScript uses dot notion when calling objects.

console.log(`${myBook.title} by ${myBook.author}`)

8-27-2020

Today I learned not to post my API key's on Github and how to put my API Key in my bash profile.

export OPEN_WEATHER_API_KEY= api key

8-26-2020

Today I learned about Inheritance in Classes.

class Employees

class Manager < Employee

8-25-2020

Today I learned how to check what version of a programming language you have installed

# list whatever language you want to check

node -v

8-24-2020

Today I learned how to initialize Git and have it push to a GitHub Repository

git init

git add --all
git commit -m "commit message"

08-23-2020

Today I learned about ruby's .each method

numbers = [1, 3, 4]
numbers.each do |number|
  puts number
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.