Class name Table name In belongs_to In has_many In has_and_belongs_to_many
-----------------------------------------------------------------------------------------------------------------------
Task tasks belongs_to(:task) has_many(:tasks) has_and_belongs_to_many(:tasks)
Person people belogns_to(:person) has_many(:people) has_and_belongs_to_many(:people)
CreditCard credit_cards belongs_to(:credit_card) has_many(:credit_cards) has_and_belongs_to_many(:credit_cards)
singular plural singular snake case plural snake case plural snake case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // MISSION: OPERATION TRANS LIBERATION | |
| // | |
| // USAGE: | |
| // 1) Navigate to https://new.reddit.com/r/place/ | |
| // 2) Open the "Developer Tools" (CTRL+SHIFT+I) | |
| // 3) Make sure the context dropdown is set to: "embed" (https://i.imgur.com/YfCY4WP.png) | |
| // 4) Paste the code below in the console and hit enter. (https://i.imgur.com/YAHjJXP.png) | |
| // 5) Leave window open and a pixel will be placed in the set | |
| // range every time your timer goes down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // PS5 | |
| var interval = setInterval(() => { | |
| fetch("https://www.walmart.com/api/v3/cart/customer/:CID/items", { | |
| "headers": { | |
| "accept": "application/json", | |
| "accept-language": "en-US,en;q=0.9,es;q=0.8", | |
| "content-type": "application/json", | |
| "sec-fetch-dest": "empty", | |
| "sec-fetch-mode": "cors", | |
| "sec-fetch-site": "same-origin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // import ActiveModelAdapter from 'active-model-adapter'; | |
| import DS from 'ember-data'; | |
| const ActiveModelAdapter = DS.ActiveModelAdapter; | |
| export default ActiveModelAdapter.extend(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var wifi = require("Wifi"); | |
| var http = require("http"); | |
| function setupAccessPoint() { | |
| wifi.disconnect(); | |
| wifi.startAP("Setup", { password: "password" }, createServer); | |
| wifi.save(); | |
| } | |
| function createServer(err) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def is_prime(num) | |
| (2...num).all? { |n| num % n != 0 } | |
| end | |
| def nth_prime(n) | |
| prime_numbers = [] | |
| num = 1 | |
| until prime_numbers.length >= n | |
| if is_prime(num) | |
| prime_numbers.push(num) |
Github | LinkedIn | [email protected]
I am an aspiring full-stack web developer studying object-oriented design and test-driven development using mostly Ruby and JavaScript. I'm excited to join and contribute to the growing Portland tech community.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def numbers_in_words(number) | |
| under_twenty = {1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six", 7 => "seven", 8 => "eight", 9 => "nine", 10 => "ten", 11 => "eleven", 12 => "twelve", 13 => "thirteen", 14 => "fourteen", 15 => "fifteen", 16 => "sixteen", 17 => "seventeen", 18 => "eighteen", 19 => "nineteen"} | |
| tens = { 20 => "twenty", 30 => "thrity", 40 => "forty", 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", 90 => "ninety" } | |
| suffix = {1 => "thousand", 2 => "million", 3 => "billion", 4 => "trillion", 5 => "quadrillion", 6 => "quintillion", 7 => "sextillion", 8 => "septillion", 9 => "octillion", 10 => "nonillion", 11 => "decillion"} | |
| if number < 20 | |
| under_twenty[number] | |
| elsif number < 100 | |
| "#{tens[number - (number % 10)]} #{numbers_in_words(number % 10)}" | |
| elsif number < 1000 | |
| "#{under_twenty[number / 100]} hundred #{numbers_in_words(number % 100)}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Allergies | |
| ALLERGENS = { | |
| 128 => "cats", | |
| 64 => "pollen", | |
| 32 => "chocolate", | |
| 16 => "tomatoes", | |
| 8 => "strawberries", | |
| 4 => "shellfish", | |
| 2 => "peanuts", |
NewerOlder