Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View thataustin's full-sized avatar

Austin Brown thataustin

  • San Franscisco, CA
View GitHub Profile
@thataustin
thataustin / Answers.md
Last active March 31, 2016 02:19
Bloc SET Assessment

##Question 1 So, you're on the right track, which is great! And I can see what's tripping you up here.
It's what's happening when you click the button and the .onclick function is run. So let's run through this a bit.

When you're going through for loop, each time around, you create a function that will run when the button is clicked.
And there's the trick, that function won't be executed UNTIL the button is clicked. So I want you to look at the code inside that function and tell me what all of the values would be when that function is executed after you click it.

[PAUSE....] ... maybe get the right or the wrong answer

@thataustin
thataustin / cycle_detection.rb
Last active October 31, 2015 20:11
Project Firehose teasers
#
# I didn't take the time to implement floyd's algorithm, I just used a dirty "has this been visited before" scheme.
#
# It felt like cheating anyway since Floyd's (allegedly Floyd's?) algorithm is on the
# page in Python and this isn't really just a "can you convert python to ruby" challenge
#
# But I also hadn't read about that algorithm before, so thanks for the interesting read!!
#
@thataustin
thataustin / scraper.rb
Created March 11, 2015 20:02
Scraping CA NOI's
require 'rubygems'
require 'mechanize'
require 'byebug'
a = Mechanize.new { |agent|
agent.user_agent_alias = 'Mac Safari'
key = 'JSESSIONID'
value = '3a70858e14aca4f6aac9ec59d95d13d86e0b4e755b40b67bb56f96f27fbf05b2.e3qSc3iTc34Oe3iNaO0'
cookie = Mechanize::Cookie.new(key, value)
@thataustin
thataustin / gist:f8703d25ff5503e6762a
Created May 28, 2014 18:01
Hadoop setup on Vagrant/Docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "trusty64"
config.vm.network "private_network", ip: "192.168.50.4"
@thataustin
thataustin / gist:7778287
Created December 3, 2013 22:05
refactoring a Lund credit card checker
# Original unrefactored code:
class CreditCard
#initialize
def initialize(card_number)
raise ArgumentError.new("Card nunber must be 16 digits long") if card_number.to_s.length != 16
@card_number = cardNumber
end
#convert a string card number to Luhn Algorithm
def luhnConvert(card_number)
@thataustin
thataustin / boggle_class.rb
Last active December 28, 2015 01:19 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize (board)
@board = board
end
def create_word(*coords)
coords.map { |coord| @board[coord.first][coord.last]}.join("")
end
def get_row(row)