Skip to content

Instantly share code, notes, and snippets.

View alacritythief's full-sized avatar

Andy Wong alacritythief

View GitHub Profile
@alacritythief
alacritythief / mobilize_guide_yang2020.md
Last active July 27, 2019 04:47
Mobilize America API guide for Yang2020

Mobilize America API guide for Yang2020

Yang2020 Mobilize ID: 1396

Documentation

Mobilize America event API documentation:

Keybase proof

I hereby claim:

  • I am alacritythief on github.
  • I am alacritythief (https://keybase.io/alacritythief) on keybase.
  • I have a public key ASDSR9xHIFPnMjmhn6DQbMc_WMxlFBqFQPykr3I-84_1HAo

To claim this, I am signing this object:

@alacritythief
alacritythief / guess_the_number.js
Created September 15, 2014 16:57
Guess the Number
var randomNumber = Math.floor(Math.random()*101);
var userName = prompt("What is your name?");
var guess = prompt("Please guess a number 1 - 100:");
if (guess == randomNumber) {
alert(userName + ", you guessed correctly! You win!");
} else {
alert(userName + ", that is the wrong number! You lose!");
}
@alacritythief
alacritythief / blackjack.rb
Created September 3, 2014 20:44
Andy's Blackjack Game
class Card
attr_reader :suit, :numeral, :card
def initialize
@numeral = %w[1 2 3 4 5 6 7 8 9 10 J Q K A].sample
@suit = %w[♦ ♠ ♥ ♣].sample
@card = "#{@numeral}#{@suit}"
return @card
end
@alacritythief
alacritythief / marker_has_ink.rb
Created August 29, 2014 01:03
Added '.has_ink?' instance variable to check if the marker is empty or not.
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
def clean
@contents = []
end
@alacritythief
alacritythief / whiteboard.rb
Created August 29, 2014 00:58
Added .clean instance method to whiteboard to clear it.
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
def clean
@contents = []
end
class Car
def initialize(color, owner, cylinders)
@color = color
@owner = owner
@cylinders = cylinders
end
def color
@color
end
@alacritythief
alacritythief / TV_objects.rb
Created August 28, 2014 18:32
A class and sensible constructor for a TV, channel, and show.
class TV
def initialize(model = nil, size = nil, resolution = nil)
if model.nil?
@model = ["Sony", "LG", "Samsung", "Vizio"].sample
else
@model = model
end
if size.nil?
@size = [19, 28, 30, 32, 36, 38, 42, 52].sample
@alacritythief
alacritythief / cards.rb
Last active August 29, 2015 14:05
An invocation to Card.new should result in a random card.
class Card
def initialize(rank = nil, suit = nil)
if suit.nil?
@suit = ['♠', '♣', '♥', '♦'].sample
else
@suit = suit
end
if rank.nil?
@rank = ((2..10).to_a + ["A", "J", "Q", "K"]).sample
@alacritythief
alacritythief / commands
Created August 25, 2014 19:45
Commands for a Recipe PostgreSQL database
CREATE TABLE recipes (id serial, name varchar(255) NOT NULL, directions TEXT);
CREATE TABLE ingredients (id serial, items TEXT);
INSERT INTO recipes (name, directions)
VALUES ('Green Eggs & Ham', '1. Cook the eggs.
2. Cook the ham.
3. Combine.');
INSERT INTO recipes (name, directions)
VALUES ('Fried Green Tomatoes', '1. Slice the tomatoes 1/2 inch thick.