#301DaysOfCode & Productivity Journal - Round 2
Template
# Day xxx | xx.xx.xxxx
*How did I do well?* <br>
+
*How can I improve* <br>
+
Day 52 | 10.31.2018
How did I do well?
- More interviews.
- Two videos today.
- Watched Gatsby JS Crash Course
- After running though the Gatsby video it is 🔥!
- Makes building sites fun and fast again! + The site response speed is crazy fast!! :heart:
- Need to learn GraphQL for it to make more sense.
- Wrote a buggy MVP script in JS to add connections from a Company SERP (Search Engine Results Page) on LinkedIn. Script Repo
- Added ALL THE IZEA & CodeCademy employees I could find on LinkedIn
How can I improve
- More code, less social media.
- Convert benjaminspak.com to Gatsby.js
To Learn List
Day 51 | 10.30.2018
How did I do well?
How can I improve
- More code, less social media.
To Learn List
Day 50 | 10.29.2018
How did I do well?
How can I improve
Day 49 | 10.28.2018
How did I do well?
- Applied to more jobs & reached out to people on LinkedIn.
How can I improve
- Set up a schedule to follow to stay productive.
Brain Dump
- Worked on content for benjaminspak.com quote a bit.
- Watched a bit of man in the high castle.
Day 48 | 10.27.2018
How did I do well?
How can I improve
- Record a vlog even if exhausted. Doing it in the morning is ideal.
Brain Dump
- Missed a vlog yesterday.
- A pretty unproductive day in general. Fell into the habbit of drinking energy drinks & not exercising / meditating; have a feeling that caused my mental exhaustion.
Day 47 | 10.25.2018
How did I do well?
How can I improve
Brain Dump
- Was excited for an estate sale because I was blinded by potential dollar signs for some items. The first day prices are non-negotiable, so I reassessed and decided to wait until tomorrow to attend the sale because nothing is negotiable the first day and it’s a 45 min drive one way. I’ll risk losing some profit there and just go to my local Good Will to see if I can score some resell deals.
- Spent about $100 on GoodWill and thrifting, hoping to make decent flip profits!
- More interviews today.
- Watched more videos on what items to resell and flip.
- Took pics of resell items. Will clean up and begin researching more tomorrow.
Day 46 | 10.24.2018
How did I do well?
How can I improve
Brain Dump
- Finished the back-end of the MERN app last night; working on the front-end and possibly deployment today.
- Added Sumo email list popup to homepage of my personal site – don’t think it’s working properly with markdown, however.
- Added Google analytics to homepage of my personal site as well.
- Looked up estate sales & inquired about pricing.
- Bought cheap hosting for personal website – to implement later.
- Watched a ton of reseller videos on YouTube before bed.
TIL Another Way to Comment a Code Block in VSCode
Day 45 | 10.23.2018
How did I do well?
- Recruiter calls at 10am & 1pm for a RoR & Angular positions.
- Watched videos 1 & 2 Learn The MERN Stack
How can I improve
Brain Dump
Day 44 | 10.14.2018
How did I do well?
- Went for a walk this morning.
- Recorded a long form video today.
How can I improve
- Don’t take other people’s problems personally.
Brain Dump
- Worked on my habit app (React/Express App).
Day 43 | 10.13.2018
How did I do well?
How can I improve
- Eat a healthier breakfast.
- Play video games for a shorter period of time.
- Don’t take other people’s problems personally.
Brain Dump
- Went for a jog this morning.
- Recorded the vlog on the final stretch.
Day 42 | 10.12.2018
How did I do well?
How can I improve
- Clean my room before I go to bed instead of in the morning.
Brain Dump
Day 41 | 10.11.2018
How did I do well?
- Jogged this morning.
- Shot a vlog this morning.
How can I improve
Brain Dump
Day 40 | 10.10.2018
How did I do well?
How can I improve
- Stop seeking comfort & familiarity! Stop holding onto the past! Suffering in the right ways === growth!!
- Stop being so senseable; be the crazy, determined, courious & bold like your inner child has been demanding.
- Drink more water!
Brain Dump
- Created my 25/5 List
- Completed copying down Youtube Playbook v1
- Rough past couple of mornings. Have been self destructive with sleeping late & watching TV.
- I am not my old self! Fuck that, I will burn it away with determination & the new me will rise from the ashes.
Day 39 | 10.9.2018
How did I do well?
How can I improve
Brain Dump
- Been slacking a bit with code & org growth, but got to see friends this weekend.
- The Mcgregor fight was cray!
- I listened to some beats and freestyled in bed until I fell asleep; was fun.
- Back on my grind this week; starting off kind of slow, but a little green tea should do the trick.
- Bought a few books on classical – Trivium – based eduction.
- It will be tough to reprogram & over write the government run complusory schooling, but I think it’s a worthwhile goal for the next 10 years.
- I’ve got a long way to go to have the mind, body & success I want, but god willing I’ll make the next 10 years work for me – going to be 30 this month – it’s time to stop playing around. I now know what I want & what I don’t want out of life. It’s still to burn up the old me & free the potental, growth & wisdom that has been fostered the past 10 years.
- I’m in it for the long game.
- Removed syndicated videos from my YouTube Channel. Will revisit when it’s a larger channel.
Affirmation
I am healthy. I am wealthy. I am wise. I am bold.
Vision
Save New Developers Time & Stress.
Day 38 | 10.8.2018
How did I do well?
-
Completed thumbnails & uploaded [freeCodeCamp |
5 UX Gains](https://youtu.be/sr6tdQYOLHA) |
How can I improve
- Ensure I get to be at a good time tonight.
Day 37 | 10.7.2018
How did I do well?
How can I improve
- Go to sleep & wake at set times.
Brain Dump
- This day was a bit of a wash. My sleep schedule was wau off.
Day 36 | 10.6.2018
How did I do well?
How can I improve
Brain Dump
-
Shot a YouTube Vid [freeCodeCamp |
5 UX Gains](https://youtu.be/sr6tdQYOLHA) |
- Been fiddling with template issues for spak.co – the slider revolution banner didn’t convert.
- Just redirected spak.co directly to the Discord server invite link.
Day 35 | 10.5.2018
How did I do well?
- Maintained an 80% adherance to to habits I set for myself; feeling good.
- Went for a second walk to unwind in the evening.
How can I improve
- Discovered GitHub Pages URL are case sensitive.
- Decide on capital case or lower case naming convention.
- Leaning towards capital case for readability.
Brain Dump
- Fixed a devgains.com redirect issue.
- Created a Youtube Playbook rough draft.
- Created an Idea Log on my personal website. Will never have to hunt for a new idea again!
- Reorganized morning and evening routines.
- Decided to journal here twice a day morning & evenings.
- Think I’m going to start publishing this journal & other update from other places I write to benjaminspak.com.
- Feeling draining this morning.
- Skipped my fast for the morning & ate 2 apples.
- ~
Sore from jogging; will walk today.~
- Went for a jog anyway. Guesss my body just needed the sugar from the apples lol.
- Need to provide more time in the evenings to decompress & relax.
Day 34 | 10.4.2018
How did I do well?
- Handeled stress & my newly optimized schedule with more grace.
- Drank more water.
- Jogged in the rain.
How can I improve
- Check my phone less & only check social media / email during scheduled times.
Brain Dump
- Added an FAQ & disclaimer details to CSNewbie.com, ASDevs.com & BioDevs.com repos.
- ~
Setup an Auto DM on Twitter to raise awareness for https://github.com/SpakMedia~
- Moved tools & publications from personal account to Spak Media Org.
- Set phone alarms to check email & social media only a few times a day – 9am, 12pm & 6pm.
- Converted spak.co from Wordpress to a static website & hosted on GitHub Pages.
- Moved PopVia.com to GitHub Pages.
- Moved benjaminspak.com to GitHub pages.
- Startd a web components repo on Spak Media – Complete problem solutions in module form – dekout.com.
- Canceled hosting plan.
- Clearned out repos with just the default rails app installed.
Day 33 | 10.3.2018
Code
- Bored at work; just copy and pasting edit into web pages – so ready for a new contract.
- Worked on some Spak Media side project setup.
How did I do well?
- I was pretty damn productive; in hindsight.
How can I improve
- Drink more water.
- Take stretch breaks.
- Cut myself some slack – can’t do everything you want in one day. It’s a marathon, not a sprint.
Brain Dump (Performed At 7PM)
I didn’t feel productive today. Yet: I started a new project at work & hit over 80% of the habits I set.
Health
- Went for a jog
- Got more sun
- Did guided meditation
- Did micro-yoga
- Ate between 1600 - 2000 calories
- Updated morning & evening routine – shifted back 1 hour
Learned
- Set up GitHub Pages (Git Hub Hosted).
- Listened to a podcast (Tim Ferris).
- Read a book (Chakra for Beginners).
- Set Jeykell & pushed a first post for all publications on the Spak Media Github Org
Side Projects
- Converted 301DaysOfCode.com to a static site hosted on GitHub.
- Contacted registrar about why domain redirects were not working.
- Edited my Calendly links for programming mentorship in the evenings after work on the weekend.
Day 32 | 10.2.2018
Code
How did I do well?
- Pushed back on a project deadline in a firm but polite manner.
- Completed my next work project in half the allotted time to balance it out.
- The meditation habit has stuck.
How can I improve
- Start walking on my lunch breaks.
- Greater variety of meats in my diet to keep me entertained.
Brain Dump (Performed the following morning)
- Created an org structure to for my domains and how I want to brand / market Spak Media LLC.
- Going to use myself as the figure head & then have individual websites for products.
- Twitter poll on mentoring name link.
- Setup redirects for several domains.
- **Need to contact registrar about why their basic wildcard redirects are not working properly.
- Need to incorporate more exercise in my day.
- Going to start walking on my lunch breaks.
- Moving social media management time to my lunch break as well. It’s interfering with my side project productivity in the mornings.
- Having a little trouble sticking to no / low carbs.
- Need a greater variety of meats in my diet to keep me entertained.
- Was able to get in writing that my contract with Wells Fargo ends Jan 1st.
- Helped relieve some pressure.
- When I spoke with a few recruiters about open positions non of them wanted to pull me from the WF contract because WF is such a huge client for most staffing firms.
- Which put me in a shitty situation because most companies stop hiring around november & I don’t want a gap in my employment.
- So luckily, I can show my contract terms to recruiters now & have something lined up to segway out of this poorly timed WF contract.
- Doubtful they will need me to say on or extend the contract, but I’m open to it.
Day 31 | 10.1.2018
- Created list view for habit app.
- Pushed HabitToggle to GitHub Repo
- Reorganized this journal from ascending to descending chronologically ordered posts.
Remove Entries in a Repo But Keep Files Locally
src
git rm -r --cached [dir/file name]
Day 30
Created a wireframe, planned database tables & front-end div mockup for a habit tracking app.
Day 29
- Provided code mentoring for Trisha Chetani Tweet
- Had a 2 hour chat with Jessamyn Smith about her time with Codementor Tweet
Day 28
Watched The What, Why & How of Wireframing
Day 27
Day 26
Day 25
How to build a secure web applications with Ruby on Rails
- Physcially secure your shit.
- Use a VPN & HTTPs.
- Create backups.
- Validate the backups.
- Have a backup to your backup.
- Monitor your dependencies & ensure they are up-to-date.
- Avoid unsafe templating methods/use safe ORM calls.
- Security headers (HTTP response).
- Use a real-time security monitoring and protection tool. Sqreen.
- Don’t mix data with shell commands.
- Validate & escape all user data.
- Keep secreats away from code.
- Use ENV variables.
- ENV variables can be obtained via vunerable dependancies.
- Ensure you’re spelling your dependancies correctly.
- Encourge (but do not require strong passwords)
- Do not discourage long passwords.
- Do not disable copy & pasting passwords (password managers).
- Hash the passwords.
- Devise is time tested & a good user managment solution.
- Never call
find_by_sql()
very easy for a user database dump.
- Use
.where()
.
- Use
.to_i
on ids.
-
Ruby Security Handbook
- Breakman – profiles your code for vulerabilities; has a github hook.
Day 24
Day 22 & 23
Day 21
Finally the weekend!
Symbols
are a one off version of a string and are more memory efficient.
"Ruby".object_id
:ruby.object_id
Hashes
are a collection or set of key value pairs.
who_am_i = {
:first_name => "Benjamin",
:last_name => "Spak"
}
who_am_i[:first_name]
=> "Benjamin"
Method
is a block of reusable code.
def good_morning
puts "Good Morning"
end
Unless
is the opposite if an if statement. It only runs if false.
age = 22
unless age > 65
puts "You're a yougin"
end
.each
method. A method can accept one or more parms within pipe |
chartacters.
list = [1, 2, 3, 4, 5]
list.each do |number|
puts number * 8
end
Common Commands
rails new [appname]
to creat a new rails app.
rails server
spin up a rails server.
rails generate model [model] title:string body:text
creates a model, that interacts with with database.
Common Column Attributes
:string
Used for small data types such as a title. Columns are stings by default.
:text
Used for longer pieces of textual data, such as a paragraph.
:intereger
Used for storing whole numbers.
:binary
Used for storing data such as images, audio or video.
:boolean
Used for storing true or false values.
:date
Used for storing the date.
:time
Used for storing the time.
:datetime
Used for storing data & time in a single column.
:timestap
Used for storing data & time in a single column. Converted from the current timezone to UTC for storage and back again upon retrevial.
:decimal
Used for storing decemals. Use when you need the exact value stored.
:float
Used for storing decemals. Use when you don’t care about the percision of the float.
:primary_key
Used for storing a unique key that can uniquely idenetify each row in a table.
Common Commands Cont …
rake db:migrate
Runs the migration file and adds the table as well as the columns to the database.
rails generate controller [models] index
creates a controller, that interfaces between the model & the view.
Controller Action Example:
class PostsController < ApplicationController
def index
end
end
Common Commands Cont …
rake routes
displays current routes.
CRUD Action |
HTTP Verb |
Create |
POST |
Read |
GET |
Update |
PATCH |
Destroy |
DELETE |
Day 17 - 20
Still mostly touching code at work.
- More RoR practice at CodeCademy.
- Working on the Spak.co product road map. Breaking things into subtasks.
Day 15 - 17
Worked on Spak.co & learning the ropes at my new contract with Wells Fargo.
- Pushed Our: Org Playbook – Product Roadmap
- Practiced some RoR over at CodeCademy – build process still easier than Express/Node <3
- Networked on Dev.to; filled out profile, connected with others, read a few articles.
- Appraoching #100DaysOfCode members on Twitter and encouraging them to use the #301DaysOfCode hash to reach a wider auidience.
- 9/17 a little more RoR practice before bed.
Day 14 | Part 1 | 9.14.2018
Woo! Learning CS is fun again! Very excite! For more Data Structures and Algorithms in JavaScript - Full Course for Beginners
Cheers to Scott Diemer for mentioning on Twitter that I can just use an -a
flag in place of git add .
when stringing Git CLI commands.Re: Day 13s Tweet.
Want to expand my programming awareness a little bit today. Watching Robert C Martin - Functional Programming; What? Why? When?
Side Note: CS50 wasn’t a total waste of time – still won’t continue it – but, now I’m familiar with C syntax – which Uncle Bob likes writing his examples in.
State
1; // a value
in x=1 // x is an id that has a value.
x=x+1; // now x has changed state.
The final above line is stateful – ideally, to build more fault tolerant code we want stateless code – no variable is altered.
Thought: Ah! So this is why I’m seeing const
for variable assignment more often in JS than let
or var
. I thought I knew, but this adds an extra level of WHY it is done; huzzah!
Stateful code is liable to cause memory leaks – garbage collection is a merly a hack to deal with the side effects of stateful code.
Why Functional Programming?
- No temporal couplings.
- Fewer concurrency issues.
- Fewer raceconditions.
- No asking “What’s the state?”.
Problem:
- Multi-threading and competing CPU core on a single memory buss.
- However, if write stateless code; I can exection a hypothetical function on two cores; so long as there’s no state change, I’ll get the same results.
</ Functional Programming Video>
👀 “scala vs haskell”
👀 “scala vs go”
👀 Making The Move From Scala To Go, And Why We’re Not Going Back
Ah!!! Recalled from D 12 “All React components must act like pure functions with respect to their props.”
Now we’re cooking with gas! Love it when to seemingly unrelated topics – Reace |
Function Porgraming |
matach up and reenforce learning to two areas! |
</ Functional Programming Queries>
👀 GopherCon 2015: Russ Cox - Keynote
</ GopherCon Video>
Okay – now - back to CS.
Queue - Data Structure
FIFO -- First in First out
.
- Example:
A line at a store
or a print que.
Main methods of a queue in JS:
.enqueue
– pushed the first item onto the queue.
.dequeue
– take an item off of the queue.
.shift
– removes the first item of an array.
.front
– returns the first item of an array, without removing the item from the array.
.size
– size of the queue.
.isEmpty
– check is a queue is empty.
Tree – Data Scructure
- All data points in the tree are called
nodes
.
- The top-most node is called the
root
node.
- Below that is a
parent node
– main nodes that have children.
Subtree
a grouping of nodes below the parent node.
- Below that
siblings
– have child & parent nodes.
- Below that a
leaf
– these nodes have no children.
From personaly experience – working with the DOM – I’m familiar with grand parent & grand children nodes being used to label things as well.
Biary Search Tree – Data Scructure
On average - operations are able to skip about half of the tree.
- Quicker than linear search.
- Slower than a hash table.
Day 13 | Part 1 | 9.13.2018
Common Datatypes CS50 - Week 7 – part 2
Array
- Array’s are an advantageous data type because we know the address in memory of where the pointer and subsequent array will be stored.
- Array’s give us random access – we can jump to an element of an array in constant time BigO of 1.
- Conversely arrays are poor at expanding in size.
- An array is a fixed size; you can’t really grow it.
- You need to allocate a larger chunk of memory and move the old element into the new array.
- Doing this often will present a large time cost as the system needs to reallocate memory often.
Linked List
- A few upsides & downsides over an array. Linking your data in memory is:
- Quicker to look up.
- However, takes up more memory.
… Okay, I’m looking for another CS recourse; CS50 is horrible at providing concise lessons …
Data Structures and Algorithms in JavaScript - Full Course for Beginners
- Fucking finally! Useful info! Harvard baby, you’re a pretentious dumpster fire.
Stack - Data Structure
JavaScript already has all of the array functions necessary to use it as a stack.
push
place an element on the top of a stack.
pop
remove the top element of a stack.
peek
preview the top element of a stack.
length
for determining how many elements are on a stack.
Sets - Data Structure
- Like an array – except there are
no duplicate items
& the values are not in any particular order.
- The typical use of a set is the generally check for the presence of an item.
- A
union
allows you to combine two sets but, leaves out any duplicates.
- An
intersection
all of the items in multiple sets, returned as a new set.
- A
difference
all of the items that are in one set, but not in the other set.
- A
subset
will test if a set is a subset of another set – will test if the first set in completely contained within the second set.
Day 12 | Part 1 | 9.12.2018
CS50 Week 5 - part 1
Finally decided to complete CS50 so I have a basic grasp of how low level languages work. Only 7 more weeks worth of videos. At my current pace I’ll be done in 1 - 2 weeks.
- In C
string
is technically char*
aka a pointer to a location of the first character in RAM.
- Traditional lecture lead ‘teaching’ is so dead 💤 … I wish it wasn’t limping on. Maybe once Millenials take over company C-suites & a third parties take the place of colleges in sports recruiting for professional leagues the current system will finally die.
CS50 Week 5 - part 2
- Breaking down the following in this lecture: pre-processing, compiling, assembling, linking.
- Good to know in theory, but since I’m not taking notes because I won’t be working with nor debugging low level langs.
- Once again 3X video playback is BAE ❤️️ for these dry, repetitive lectures; ~ 120 min worth of lectures in ~ 40 min.
Lecture 63 + Jr -> Sr. Dev Course
- State is a decription of your app. State is an Object that mentions the layout of your app.
- Props are things that come out of state.
- A parent feeds the STATE into a child component
STATE >> props
.
- As soon as the state is fed to a child component, the child component becomes a prop.
- The child prop cannot change the property; the parent just tells it what the state is.
- State typically lives in the parent component & passes state to the other child components.
Day 12 | Part 2 | 9.12.2018
Going through the React tutorial; show provide better solid rules, methodologies & principles to follow for React.
- “Instead of artificially separating technologies by putting markup and logic in separate files, React separates concerns with loosely coupled units called “components” that contain both.” 🙌🙌
- “You can put any valid JavaScript expression inside the curly braces in JSX. For example,
2 + 2
, user.firstName
, or formatName(user)
are all valid JavaScript expressions.”
- JSX Prevents Injection Attacks: It is safe to embed user input in JSX:
const title = response.potentiallyMaliciousInput;
// This is safe:
const element = <h1>{title}</h1>;
JSX Represents Objects
Babel compiles JSX down to React.createElement() calls.
These two examples are identical:
const element = (
<h1 className="greeting">
Hello, world!
</h1>
);
const element = React.createElement(
'h1',
{className: 'greeting'},
'Hello, world!'
);
- “These objects are called “React elements”
- An element describes what you want to see on the screen.
- “React elements are immutable.”
Note: Always start component names with a capital letter.
- “React treats components starting with lowercase letters as DOM tags. For example, <div /> represents an HTML div tag, but represents a component and requires Welcome to be in scope.”
All React components must act like pure functions with respect to their props.
Spak.co Community Development
- Spent time organizing the spak.tv YouTube channel.
- Spend some time on Twitter and Instagram soliciting spak.co community sponsors 🤞 – may not happen today, this week, month, or year – but, we will find some!
CS50 Week 7 – part 1
- Week 6 wasn’t in the playlist.
- Week 7 talks about data storage & recovery.
CS50 Week 7 – part 2
- 30 min in we finally get to a hash table! Okay, will need to watch this video from the beginning and take notes. They are talking about data structures.
Day 11 | Part 1 | 9.11.2018
CS50 Week 4 – Part 2
More C syntax and swapping numbers in an array. 💤
- A string isn’t really text, it’s an address of characters in RAM.
- Pointer == address of something.
- Therefore a string is an array of characters that point to a stored location in RAM.
- This explains why in C if you enter two of the same text strings in a CLI prompt they will not evaluate to be the same, because they are both stored in different addresses.
- … So glad I primarily code is JS and not C hahah
- Now have a new appreciation for higher level languages. While not as performant, I’ll happily take that trade off for ease of use.
Day 11 | Part 2 | 9.11.2018
Jr to Sr Dev Course – Lecture 60 - 63
import React from 'react';
const Card = (props) => {
const { name, email, id } = props;
return (
<div className='tc bg-light-green dib br3 pa3 ma2 grow bw2 shadow-5'>
<img src={`https://robohash.org/${id}?200x200`} alt='robots' />
<div>
<h2>{name}</h2>
<p>{email}</p>
</div>
</div>
);
}
export default Card;
- Reminders:
- Use
className
vs class
when defining a class in JSX.
- use
import React from 'react';
at the top of every React file.
- Keep classes slim. Only one class to a file.
- To export the class
export default Card;
at the end of every CLASS.js file.
- Destructuring props saves your typing
const { name, email, id } = props;
vs having to call props.name, props.email & props.id
- Can make the code cleaner by passing your destructured props in place of your props arg
const Card = ({ name, email, id }) => {
Re-watch lecture 63 before work tomorrow
Day 10 | 9.10.2018
CS50 Week 4 – Part 1
Merge Sort Algo
On input of n elements:
If n < 2
Return.
Else
Sort left half of elements.
Sort right half of elements.
Merge sorted halves.
Cut the arrary in half
Sort the left 1/2 of the original array
Sort the left 1/2 of the left 1/4 of the split array
Sort the right 1/2 of the left 1/4 of the split array
Merge / group - the split 1/4 arrays into ordered 1/2 arrays
Merge / group - the split 1/2 arrays into a reordered whole array
Efficacy T(n) = 0, if n <2
T(n) = T(n/2) + T(n/2) + n, if n > 1
T(16) = 2xT(8) + 16
T(8) = 2xT(4) + 8
T(4) = 2xT(4) + 4
T(2) = 2xT(1) + 2
T(1) = 0 <-- Base Case
Cool! Plateaued on Big O notation. Will need to stop and review tomorrow.
Jr to Sr Dev Course – Part 4 – React, Redux + Bundling
Haven’t been sleeping well, crashed out for a couple of hours after my first day with Well Fargo. So far so good, chill company & team.
Starting with React in the course. Should be an informative refresher.
- React was designed as an alternative to tradition DOM manipulation library’s like jQuery.
- Large code bases get convoluted quickly with tools like jQuery, that’s why Facebook developer React – to help manage large apps.
- React focuses on using components; reusable blocks of code with markup, style & function built in.
- One way dada flow - data flows from top to bottom.
- Virtual DOM - minimizes the amount of DOM manipulation needed.
- The VDOM is just a Javascript Object which describes the current state of our website.
- React also creates a separation of concerns - not a separation of tech.
Robo Friends App
- create-react-app: Global NPM package which creates a starter project that contains Webpack, Babel & Linters/Debuggers.
Install:
npm install -g create-react-app
Create App:
create-react-app NAME
Package.json scripts:
npm start
- Reads the React script and starts up our sever.
Package-lock.json:
- Auto generated by package.json.
- Ensures the versions number of the dependencies are locked in.
.gitignore:
- Config file that excludes:
- Sensitive information like .env database strings & passwords.
- node_modules & other packages that are already specified in the package.json file. No need for the extra weight & storage usage – especially in repos.
public/manifest.json:
- A new feature that allows up to configure our web app settings like name, icons, fav icons & start URL.
src/index.js:
- Main JS file.
- Changed
ReactDOM.render(<app />, document.getElementById('root'));
to ReactDOM.render(<h1>Hello, World!</h1>, document.getElementById('root'));
and previewed in browser to ensure setup is functionung properly.
RF APP Component 1
src/index.js
import ReactDOM from 'react-dom';
used to enable React in our web browser. Alternatively, it would be something like react-native
is developing a mobile app using React.
Tachyons – A more light weight bootsrap-esk package
npm install tachyons
- Use the new package easily by going to
src/index.js
and import 'tachyons';
.
Getting too tired - re-watch lecture 60 before work tomorrow
Day 9 | 9.9.2018
Starting The Complete Junior to Senior Web Developer Roadmap (2018) – On Udemy
Now using ^^
to denote something to look up tomorrow.
Now using ==>
to denote a topic / task has been pushed from the previous day.
Made it though the SSH section of the course. It’s 2am. Going to try to sleep again.
Pick up here
- ~
Revisit a linux sys admin course on YouTube to learn TMux ^^~
- ~
rsync ^^~
- 🤔 Saving for just-in-time learning.
- ~
The Complete Junior to Senior Web Developer Roadmap – Section 3 - Performance.~
Day 9 | Part 2 | 9.9.2018
Now including search queries. Denoting with eyes emoji 👀
.
Using ...
alternatively for searching or to denote time has passed.
GitHub Command Efficiency
- Breaking my shorthand notes into their own repo … would like to make running Git Hub creation commands more efficient in the future.
- 👀 – how to chain terminal commands – Which one is better: using ; or && to execute multiple commands in one line?
- Top response:
Cheatsheet:
A; B # Run A and then B, regardless of success of A
A && B # Run B if and only if A succeeded
A || B # Run B if and only if A failed
A & # Run A in background.
- Copy pasting the GitHub commands info my IDE and adding ` && ` at the end of each line will help with efficacy for now – less copying and pasting.
- Moving along … 🤔 – still plenty of energy && time for CS50 today.
CS50 Week 2 – Part 1
-
Casting
– Example: forcing a data type such as an Int
to become a Float
with (float)
.
#include <stdio.h>
int main(void)
{
float f = (float) 1 / (float) 10;
printf("%.2f\n", f);
}
- Trying to view data points past their bit limit causes the computers to begin to approximate values – often incorrectly.
- Modern Marvels - Rocket Failure video
- Failure reason(s) - there was a number that required 64 bits to express and it was converted to a 16 bit number instead.
- The assumption was the number would never need to be that large.
- The dev team used much of the same software from a previous - slower - predecessor rocket the Ariane 4.
- In C, variables are scoped to blocks. For example: in order to get a do while loop to function properly variables will need to be declared within a higher scope.
The Complete Junior to Senior Web Developer Roadmap – Section 3 - Performance
Why we need performant websites
- Website response speed effects to bottom line.
- Google determined that if page load speed took one second longer than normal they would loose $1 Billion per year in ad revenue.
- Over 50% of users will leave - bounce - if the website takes over 3 seconds to load.
- The average website makes over 100 requests to load.
Network Optimizations
- Minimize / uglifiy text files – HTML, CSS, JS.
- Minimize images.
- SVG, JPG, PNG, GIF, WebP
- File format use cases
- jpeg-optimizer.com
- tinypng.com
- Always lower JPG image quality to
30% - 60%
- Resize image based on size it will be displayed.
- Use media queries to display different size images based on browser window size / client.
- Use CDNs like imigx to serve images.
- Use a tool such as verexif to remove image meta data.
- Use light wight frameworks that contain smaller, less files.
Critical Render Path
DOM --> CSSOM --> Render Tree --> Layout --> Paint |
HTML
- Load styles first so the webpage is displayed correctly.
- Load scripts last – they block page rendering – such as CSS style.
CSS
CSS is render blocking
.
- Only load whatever is needed.
- Above the fold loading.
- Load essential styles via stylesheet calls. Than use JS to call additional styles.
- This will make the render more asynchronous and serve up content just in time – after web web page is loaded.
- Use less Specificity.
JS
Javascript is parser blocking
.
- Load scripts asynchronously.
- Defer loading of scripts.
- Run above the fold scripts first.
<script>
- Run background scripts such analytics - that do not display to users as async.
<script async>
- Run third party scripts that aren’t that important or above the fold as deferred.
<script defer>
- Minimize DOM manipulation – why React.js & virtual DOM are BAE ❤️
- Avoid long running Javascript files – while loop GTFO.
Prefetching, preloading, prebrowsing
After going though a solid portion of this content I realized I researched many of these concepts while working @EBG in order to get Adobe Target experiences to be more performant – also had to use setTimeout() often haha.
However, I never wrote them down. It’ll be nice to now have written cheat sheet / check list to come back to.
“Premature Optimization is the root of all evil” 🔥🔥
CS50 Week 2 – Part 2
- Boring date. Was nice to get out of the house, other than that; poor conversation lol
- Back to code … 🔥🔥
The first part of this video is just C syntax and C caveats … 💤
Stanford algos may be up next 🤔
Skipped ahead about 20 min. Just talking about square bracket selection of indices & arrays.
hmm 🤔 they are talking about crypto in week 3. Okay, I’ll check it out.
CS50 Week 3 – Part 1 & 2
Thank god to 2x speed – 2x video speed is BAE ❤️ j/k Youtube Playback Speed Control and 3X is BAE ❤️️ It really is the simple things in life … 🔥🔥
hahah man, if I were paying for this course from Harvard I would be pissed; it’s super redundant – they are calling back to the algo in week 0.
Woo! Okay, sorting algo @ 16 min in. Time to slow it down :)
Bubble Sort Algo
Check number to right of current number
if number to right is smaller
move that number to the left
if no sorting took place
sorting is complete
Efficacy == n squared -- in theory
Selection Sort Algo
search and store smallest number
then check the rest of the data for a smaller number
if a smaller number is found, store that number and let go of the previously stored number
then after checking the entire set of numbers, move the ultimate smallest number to the start of the set.
as an optimization, ignore the known smallest number
if a larger number is in the the index of the next smallest number you would like to store, swap the place of the larger and smaller number to place the smaller number in the correct location
repeat the above pattern for the next smallest number until the sequence is complete
Efficacy == n squared -- in theory
Insertion Sort Algo
take the first index and mark it as sorted
check the next unsorted index and compair it to the previous sorted index.
move the smaller of the indices to the left; within the sorted indices.
then sort the stored set similarly to the selection sort algo ...
Efficacy == n squared -- in theory
Day 8 | 9.8.2018
Continuing CS50 – Week 1
-
Week 0 part 2 was removed from YouTube, but you can still get the notes (fall 2018 version) on Havard’s Website.
-
Cool part 1 of week 1 has a recap of last weeks problem set & concepts; they covered:
- Statements
- Booleans
- Conditions/branches
- Loops
- Functions/procedures
Week 1 – Part 1 – Notes
Now using |
to denote simple Googleable/familiar concepts for brevity.
-
-
-
Source code --> Compiler --> Object Code
-
-
Basic Linux CLI commands, flags & args |
-
Clang, make, compiling, handling bugs & infinite loops |
- I have not seen C code before. Can definitely tell JavaScript & PHP got their syntax roots from C.
Week 1 – Part 2 – Notes
Downing energy drinks because I wanted to be productive. On to the second video …
-
API (Application Programming Interface) |
-
Preprocessor directive / include / header file |
-
-
-
-
for loop, while loop, do while loop |
-
- Huh.
%d
& %s
are similar to python’s approach – visa versa.
New concepts:
- A
double
is a float
with potentially more numbers after the decimal point.
- A
character
is 8 bits
.
- A
float
is 32 bits
.
- A
double
is 64 bits
.
hmm … may dip in and out of a few videos so I can skip to things I may be unfamiliar with. Or, I think stanford has quality algorithm videos online; may switch to those. TBD.
Day 7 | 9.7.2018
Watching the first video of Harvard CS50. Had gone through the course before, but I wasn’t experienced enough to grasp most of the applicability. Now, I’m excited to marry CS theory with my coding experience!
Linear
- Most problems in CS problems are linear.
- The larger the dataset or problem to solve, the longer it will take.
- ‘n’ is the variable used to represent a value.
Logarithmic
- Logarithmic algorithms - such as binary search - “narrows down the search by repeatedly halving the dataset until you find the target value.” -src
What’s an algorithm?
- A set of instructions to solve a problem, step-by-step.
Ted Ed Explainer Video
What is Pseudocode?
- English-like syntax that resembles a programming language.
Example:
let N = 0
for each person in room
set N = N +1
- Line 1: declares a variable
N
and initalizes it’s value of 0
.
- Line 2: is a loop.
- Line 3: how we will go about counting. The indentation implies this is a line that will be repeated.
In other words:
For each person in the room we will increase our count N
by 1.
Optimization of the above algorithm
let N = 0
for each pair (2) of people in the room
set N = N + 1
- The above sudocode is buggy, if there is an odd number of people in the room. However, we can catch this exception by updating our logic.
let N = 0
for each pair of people in room
set N = N + 2
if 1 person remains then
set N = N + 1
- A
condition
is also known as a branch
.
- An
edge Case
is also known as a corner case
.
To-to-date CS50 Resources
cs50.net
Day 6 | 9.6.2018
- Decided to change the branding for SpakMedia on my social media accounts back to my personal name. Seemed to convert better (more followers) with my face & name vs a logo & organization name.
- Overall, being more efficient with the time & attention I put into SpakMedia; seems like a wise play. It is difficult to get everyone on the same page and fired up without semi-started projects. Will need to lead from the front.
- Tossing around some open-source project ideas for Spak.co. Projects can be found on our org page on GitGub.
- Also kicking around the idea of transitioning careers to a product manager. I enjoy the merits of code, but working with code for a job & then trying to code as a hobby is daunting. Not all hobbies should be monitized.
- While I’ve been kicking around back-end JS & PHP frameworks; I did some research and Ruby on Rails is still one of the hottest back-end frameworks. I think I’ll go back to it now that I’ve had some time to sample what a few languages have to offer. Rails is mature and was fun to work with when I first picked it up. Dig the freedom.
- Looked at CS resources as well. Will need to fill in some gaps I missed being self taught. Really want to improve my development time & sharpen my problem solving skills.
- Thinking I will start CS50 tomorrow.
Tonight
- Getting listlink.me & devnode.me setup in Cpanel. Also, creating & pushing simple readme.md explainers to our GitHub org.
- Created Github & command line basics video for 301DaysOfCode newbies.
Tomorrow
- Will want to sketch the UI for listlink.me – should be straight forward. Also, map out MVP functionality & push to GH.
- Start CS50.
Day 4 & 5 | 9.4.2018 - 9.5.2018
Haven’t been tinkering with code as much as I’d like to the past couple of days. However! I put to two websites from Wordpress templates to help our community.
-
Spak.co got a facelift & created an overview video for the homepage.
-
301DaysOfCode.com FINALLY setup a v1 website for the #301DaysOfCode challenge.
-
Changed gears a little today and started learning more Laravel. Laravel From Scratch. Only made it a couple videos it, but it was nice to work with something different than Node.
Day 4 | 9-3-2018
Was working on the Spak.co startup, building out the squad, hosting a few meetings & figuring out new social media marketing strategies for the podcast, twitter, Instagram & YouTube. Finally back to Node :)
MVC
- Touched on MVC & middleware more. MVC in unintuitive; it should be called MCV because you have a data connection (model), a layer that controls the flow and use of that data (controller & middleware) & then the view that is displayed to the edn-user. Just makes more sense that way, to me at least.
Middleware
- Handles the logic after the request but before the response.
- Middleware in Node requires the use of the
next
parameter. Example:
- Create the logic you want in the controller as well as adding next.
exports.myMiddleware = (req, res, next) => {
req.name = 'Wes';
next();
};
- Then add your middleware to the route.
router.get('/', storeController.myMiddleware, storeController.homePage);
Schema
Example schema:
const storeSchema = new mongoose.Schema({
name: {
type: String,
trim: true,
required: 'Please enter a store name!'
},
slug: String,
description: {
type: String,
trim: true
},
tags: [String]
});
If you want to use these this
keyword you need to use the function
keyword instead of ES6 arrow frunctions.
storeSchema.pre('save', function(next) {
if (!this.isModified('name')) {
next(); // Skip it
return; // stop this function from running
}
this.slug = slug(this.name);
next();
// TODO make more resiliant so slugs are unique.
});
Day 3 | 8-30-2018:
Note: Signed employment contracts & did several interviews last calendar day 8-29-2018. Still on track for coding 301 days out of 365 😃
- Picking up on template helpers video #6 w/ learnnode.com
Day 2 | 8-28-2018:
Going through Wes Bos’s Node.js course for a quick refreasher. Killer course; I’m sure I’ll pick up some things I missed last time.
Setup
- Installed latest version of node form the node.js website.
- Created a database in Mlab.
- Checked Node version
Node -v
.
- Created and move to working directory
\301DaysOfCode\Day-1-Node-JS-Practice\starter-files
.
- Ran
Node install
on package.json dependencies.
- Replaced DB connection string & renamed sample environment file.
- Downloaded, installed and verified database connection (via connection string) with Mongo DB Compass.
- Ran
npm start
to kick start our server locally on localhost:7777
.
Routes
- Installed JSON formatter to view JSON syntax in Chrome in a user friendly way.
- Echo a data string onto the page from the address bar.
res.json(req.query);
example.com?name=sam&cool=true
Routes - Req/Res
- Use the
req
callback function to search the route’s code block for statements and logic to run.
- Use the
res
callback function to output / display info for the client/browser.
Pug(Jade) Template Engine
- Pug is indentation based.
- Added pug classes using dot notation - you can add multiple classes by chaining.
- Adding IDs are just like classes.
- You can remove
div
elements prepending class names because div is an implicit element in PUG.
div.wrapper
p.hello Hello!
span#yo YO!
- Wrap an
img
element src
and alt
attributes in parentheses. Example:
img(src="dog.jpg" alt="Dog")
- You can use a standard HTML
tag for line breaks. - Working in MD too, whoops ;)
h2 Hello <br>
em How are you?
- Passing res from DB to template - pass an object in the render function.
res.render('hello', {
name: 'was',
dog: 'snickers'
});
- Interpolating a variable inside of text in PUG templates
p.hello Hello my dog's name us #{dog}
- Interpolating attributes in PUG templates - Use back-ticks instead of quotes.
img.dog(src="dog.jpg" alt=`Dog ${dog}`)
- Blocks are sections of your website/PUG template that can be filled in with other PUG templates/partials.
block header
EOD Note
Got tired / spacey on the template helpers video #6. Rewatch tomorrow.
Day 1 | 8-27-2018:
Checking out Wes’s Mastering MarkDown Course. It’s 100% free and helped me fill out this journal entry.
- Adding links in Markdown: Souround your anchor text with an array literal notation [] then add your link immediatly afterwards within parenthasese ().
[anchor text](URL)
- Installing “Code Spell Checker” extention in VSCode. Leaving typos above this entry for posterity.
- Block Quotes in Markdown Use a chevron for each line you want to make a block quote.
>
.
- Horizontal Rule In MD Use three dashes.
---
.
- Diff in MD
x = 100;
- x = 200;
+ x = 300;
```diff
x = 100;
- x = 200;
+ x = 300; ```
* [ ] Unchecked
* [x] Checked
Lookup
Notes
BNS-shorthand-and-dev-env-explained
Tools-to-read-and-articles-to-try”# org-roadmap”