Skip to content

Instantly share code, notes, and snippets.

View waldothedeveloper's full-sized avatar
Never give up!

Waldo Lavaut waldothedeveloper

Never give up!
View GitHub Profile
waldothedeveloper / repl_game.rb
Created July 11, 2017 16:38
Purrfect Insane Cats
# Title and Rules of the Game
puts "Welcome to the Purrfect Game of Insane Cats =ˆ.ˆ= "
puts "Rule 1: Choose your cat"
puts "Rule 2: Type A or B only to select an option"
puts "Ready? Here we go"
# Starting the actual game
puts "Choose your cat (Type just the name):"
puts "Vivaldi =ˆ.ˆ="
puts "Adele =ˆ.ˆ="
waldothedeveloper / url_parser.rb
Last active July 18, 2017 01:13
URL_PARSER homework
class UrlParser
def initialize(new_url)
@new_url = new_url
def scheme
waldothedeveloper / bank_account.rb
Last active July 17, 2017 19:12
Bank Account HM
class BankAccount
attr_reader :balance
@@minimum_balance = 200
def initialize(opening_balance, account_holder)
raise ArgumentError if opening_balance < @@minimum_balance
@balance = opening_balance
def deposit amount
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/script.js"></script>
waldothedeveloper / filters.markdown
Created August 10, 2017 20:38 — forked from jcasimir/filters.markdown
Controller Filters

Controller Filters

The Rails REST implementation dictates the default seven actions for your controllers, but frequently we want to share functionality across multiple actions or even across controllers. Controller filters are the easiest way to do that.

Before, After, and Around

There are three types of filters implemented in Rails:

  • a before_filter runs before the controller action
  • an after_filter runs after the controller action
class UsersController < ApplicationController
after_action :notify_slack, only: [:create, :update, :destroy]
before_action :set_user, only: [:show, :edit, :update, :destroy]
def index
@users = User.all
def show

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
waldothedeveloper / app.js
Created May 17, 2018 22:29
FreeCodeCamp Random Quotes App
$(document).ready(() => {
$("i#tweet-icon").on("click", () => {
let quote = $.trim($("#quote").text());`${quote}`);
let endpoint = '';
waldothedeveloper / index.html
Created May 18, 2018 11:36
The HTML file for this challenge
<!doctype html>
<html lang="en">
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"