Skip to content

Instantly share code, notes, and snippets.

Test Driven Development STARTS with a test that fails - then you write code to make the test pass. Every time you refactor, you run the test again; you revise the code again. The "first draft" is written as the minimal code needed to make the test past.
This ensures taht tests are written correctly.
It ensures that you actually write tests for all of your code.
This leads to better design. And profit!
Testing -
Rspec, Assertions, Minitest
Test Driven Development - Focused on objectives, allows for more flexibility
Tests also serve as documentation
Minitest vs. Rspec
Most (90% +) of Rails apps use Rspec rather than Minitest
@Jess-White
Jess-White / gist:d5be2e7ca30278fe29147abc91d6b697
Created February 21, 2020 17:17
TIL Week 7, Day 4 - Part Two - CS
Linked Lists - These are similar to arrays - a classic interview question is "reverse a linked list"
One thing to be aware of: each node involves two cells: index and value, data and link.
So how do you link a list?
When you create a list, you define each one as having a next - once you hit one that has no link, it is thus defined as the last list.
Every node has its value and an attribute called "next node" that stores the link to the next one in the list.
The "next node" returns the next item in the list.
So why linked lists?
@Jess-White
Jess-White / gist:0d6616880c05b20ef9ea2aa3f8a1e922
Created February 20, 2020 15:26
TIL Week 7, Day 4 - Capstone discussion Vue JS Frontend
Group project - 1.5 minutes to pitch the project
Capstone - Gotta come up with some whiteboarding stuff
- Figure out what tech you're gonna use
We learned to make JS Vue applications.
Vue is very similar to React.
Vue is designed to be extremely efficient and streamlined, such that it is easy to grab prefab code and plug it into your app.
CDN - Content Delivery Networks - basically pull a lot of javascript code from the web.
When you're writing Vue code, the Vue code has to go into a div with id app>
Then a script tag with script
var app = new Vue
@Jess-White
Jess-White / gist:926c4a14a66399dba8f13aff0791558e
Created February 18, 2020 15:01
TIL Week 7, Day 1 - Start JS Node!
Node - Node is for compiling JS - provides a bunch of components ready-made to build JS apps. It's sort of like Rails:ruby::Node:JS.
We are going to build out a Node thingie piece by piece.
Basic instructions: Start with an app.
Create an index.html file, then add the basic setup for an html file (html + tab).
Then make an index.js file.
Paste this into your html file instead of the basic setup:
@Jess-White
Jess-White / gist:9795c1fad760d211a188567456232977
Created February 14, 2020 20:10
TIL Week 6, day 5 - Javascript, jquery Ajax - using cookbook app
Ruby is synchronous, meaning it runs line by line
JS is asynchronous, meaning it does not read each line before moving forward
google: promise
then commands
This means you have to be careful of how you execute things in JS.
This is so that JS can execute multiple commands or logic simultaneously - so that it can work in JS.
first citizen syntax: declare a variable that IS a function, the function is a variable that can be executed at a later time.
Today we learned about some useful resources - Javascript The Good Parts - go through
Pluralsight.com
We also continued to practice converting ruby into JS.
Don't forget the closing brackets and parentheses - in JS it's even more important to remember indentation and bracketing.
Job notes from Lisa -
Resume Day!
@Jess-White
Jess-White / gist:2a7ba5c6df28e344cf928f729f334b49
Created February 12, 2020 19:37
TIL Week 6, Day 3 - Javascript!
Javascript is the "third part" of the triad:
HTML = content
CSS = styling
JS = logic
We learned that null is the equivalent of nil in ruby
In JS, 0 evaluates as falsy
So does an empty tring