Skip to content

Instantly share code, notes, and snippets.

View Alacrity01's full-sized avatar

Alacrity Alacrity01

View GitHub Profile
@Alacrity01
Alacrity01 / til.txt
Last active June 27, 2019 15:26
Week 10, Day 4
rails active_storage:install
rake db:migrate
||in the model||
has_one_attached :avatar <- can call it anything (e.g. image)
json.array! @profiles.each do |profile|
json.name profile.name
@Alacrity01
Alacrity01 / til.txt
Last active June 19, 2019 20:10
Week 9, Day 3
Capstone Requirements (planning)
Trello Board with:
1. MVP
2. Tier 2
3. Tier 3
4. Done
5. Waiting
6. Icebox
@Alacrity01
Alacrity01 / til.txt
Created June 18, 2019 15:49
Week 9, Day 2
scope :quick, -> { where("prep_time < ?", 40) }
A lambda ( -> ) is a block of code that...
^ lambda
block_of_code = -> (num) {5 * number}
block_of_code.call
@Alacrity01
Alacrity01 / til.txt
Created June 17, 2019 19:38
Week 9, Day 1
heroku logs --tail <- will show Netlify errors in terminal
git push heroku master <- pushes changes to heroku
Monolith vs Microservices
Monolith is one big app. Microservices are an individual app.
@Alacrity01
Alacrity01 / til.txt
Created June 13, 2019 18:34
Week 8, Day 4
tasks.each(&:snooze_hour!)
^ same as ^
tasks.each do |task|
task.snooze_hour!
end
words = ['ace', 'butter', 'cats']
loud_words = word.map(&:upcase) -> loud_words is a new array of ['ACE', 'BUTTER', 'CATS']
@Alacrity01
Alacrity01 / til.txt
Created June 12, 2019 17:29
Week 8, Day 3
Test Driven Development (TDD)
1. Write a test that fails
2. Make the code work
3. Eliminate redundancy (refactor)
Test again (fails, process repeating)
• Ensures that your test is written correctly
• Ensure that you actually write tests for all your code
• Leads to better design (debatable)
@Alacrity01
Alacrity01 / til.txt
Created June 11, 2019 15:46
Week 8, Day 2 (no class on Monday, no Day 1)
Automated Testing (also known as regression testing)
Testing usually has a note that explains what the code does. Can improve the code written. Leads into TDD - Test Driven Development.
Can incorporate Rspec (stands for Ruby specs - we will use this). Doesn't come standard with rails.
<|terminal>
mkdir rspec_exercises
<calculator.rb>
@Alacrity01
Alacrity01 / til.txt
Last active June 7, 2019 15:32
Week 7, Day 5
dom - document object model
<!DOCTYPE html>
<html lang="en">
<head onmousemove="doAnotherThing()">
<meta charset="UTF-8">
<title>Hamilton</title>
</head>
<body onmousemove="doAnotherThing()">
<h1 onmouseover="doTheThing()">Alexander Hamilton</h1>
@Alacrity01
Alacrity01 / til.txt
Last active June 7, 2019 14:37
Week 7, Day 4
<|terminal/cookbook_vue_app|>
npm install vue2-filters --save
<|RecipesIndex.vue|>
<script>
import Vue2Filters from 'vue2-filters';
var axios = require('axios');
data: function() {
return {
@Alacrity01
Alacrity01 / til.txt
Last active June 7, 2019 14:38
Week 7, Day 3
"If you see the word render as an error, it means something is wrong with the template."