Skip to content

Instantly share code, notes, and snippets.

View dustinbrownman's full-sized avatar

Dustin Brown dustinbrownman

View GitHub Profile
// 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
@dustinbrownman
dustinbrownman / ps5.js
Created December 15, 2020 20:49
Add PS5 to cart
// 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"
// import ActiveModelAdapter from 'active-model-adapter';
import DS from 'ember-data';
const ActiveModelAdapter = DS.ActiveModelAdapter;
export default ActiveModelAdapter.extend();
var wifi = require("Wifi");
var http = require("http");
function setupAccessPoint() {
wifi.disconnect();
wifi.startAP("Setup", { password: "password" }, createServer);
wifi.save();
}
function createServer(err) {
@dustinbrownman
dustinbrownman / active_record_naming_conventions.md
Last active November 3, 2023 09:56
ActiveRecord naming conventions

Active Record naming conventions

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

Unit 1: BDD with JavaScript

BDD, Mocha, Chai, Branching, Looping, Callbacks, Basic Git, jQuery, Using objects to store info.

Methods:

  • if / else if / else
  • for loop
  • parseInt()
  • forEach()
@dustinbrownman
dustinbrownman / nthprime.rb
Created March 5, 2014 06:41
A function to return the nth prime.
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)
@dustinbrownman
dustinbrownman / resume.md
Last active December 27, 2015 19:49
My resumé

Dustin Brown

Web developer, board game geek, father of four (daughters).

Github | LinkedIn | [email protected]

Summary

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.

@dustinbrownman
dustinbrownman / numbers_in_words.rb
Created October 28, 2013 23:55
A recursive function that converts numbers in to words.
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)}"
@dustinbrownman
dustinbrownman / allergies.rb
Last active December 22, 2022 04:38
Given a person's allergy score, it can tell if that person is allergic to a certain item and generate a list of all that persons allergies. Here's a list of allergens covered with their scores: eggs (1) peanuts (2) shellfish (4) strawberries (8) tomatoes (16) chocolate (32) pollen (64) cats (128)
class Allergies
ALLERGENS = {
128 => "cats",
64 => "pollen",
32 => "chocolate",
16 => "tomatoes",
8 => "strawberries",
4 => "shellfish",
2 => "peanuts",