Skip to content

Instantly share code, notes, and snippets.

@SViccari
SViccari / blackjack.rb
Created August 25, 2013 21:56
Apollo Assignment - Blackjack
#!/usr/bin/env ruby
# encoding: UTF-8
SUITS = ['♠', '♣', '♥', '♦']
VALUES = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
def build_deck
deck = []
SUITS.each do |suit|
@SViccari
SViccari / hangman.rb
Created August 25, 2013 23:14
Hangman
#!/usr/bin/env ruby
#Purpose of Program
def set_up_game
word_bank = ["maverick", "boston", "apollo", "hangman", "developer"]
@word = word_bank.shuffle.first
@word_count = @word.length
puts "This word has #{@word_count} letters."
@guess_count = 10
@count = 0
@SViccari
SViccari / show_collapsed_comments_on_pr.js
Created March 29, 2017 13:43
Show all collapsed comments on PR
document.querySelectorAll(".show-outdated-button").forEach(function(i){i.click()});
@SViccari
SViccari / brookview_class_2017.md
Last active October 18, 2017 14:20
Brookview House - Intro to HTML & CSS Class

Brookview House - Intro to HTML & CSS

Prep for the First Class

Date: October 11, 2017

People: Christine Chapman, Shayna Cummings, Stephanie Viccari

Link to Slides: https://christinezchapman.com/brookview

Questions

  • Should we do two big projects that use Neocities and WordPress?
@SViccari
SViccari / rubocop.sh
Created December 15, 2017 20:21
Run rubocop against current branch commits that differ from master
#!/bin/sh
#
# Check for ruby style errors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
NC='\033[0m'
if git rev-parse --verify HEAD >/dev/null 2>&1
@SViccari
SViccari / account_registration.rb
Last active December 20, 2017 21:54
Account Registration
class AccountRegistration
include ActiveModel::Model
attr_accessor :email
validates :email, presence: true, format: { with: /.+@.+\..+/i }
end
class Piranha::CampaignPerformance
def initialize(profile_amazon_id:, campaign_amazon_id:, date_range:)
@profile_amazon_id = profile_amazon_id
@campaign_amazon_id = campaign_amazon_id
@date_range = date_range
end
def all
response = piranha_client.get(daily_campaign_performance_uri)
handle_response(response)
@SViccari
SViccari / rack_rewrite.rb
Created June 13, 2018 19:47
Rack Rewrite Example
# config/initializers/rack_rewrite.rb
require "rack/rewrite"
Rails.configuration.middleware.insert_before(Rack::Runtime, Rack::Rewrite) do
# Content
r301 "/upcase/ruby", "/upcase/rails"
r301 "/upcase/sass", "/upcase/design"
r301 "/upcase/products", "/upcase/practice"
r301 "/upcase/users/new", "/upcase/join"
r301 "/upcase/sign_up", "/upcase/join"
@SViccari
SViccari / example.rb
Last active December 5, 2018 16:07
Gem API Wrapper - To Raise or Not To Raise
# example of working with a gem that always returns a response object
class Account
def find(account_id)
response = Hubspot::Account.find(account_id)
handle_response(response)
end
private
def handle_response(response)
if response.success?
@SViccari
SViccari / vim.md
Last active November 24, 2019 16:57
Cheat Sheet for Vim and Tmux

Vim

dap delete paragraph with bottom space dip delete paragraph

J capital J will reformat the line below to be on the current line

G; jumps to the last edit made in the file

zz centers the current line in the window