Skip to content

Instantly share code, notes, and snippets.

View arjunvenkat's full-sized avatar

Arjun Venkataswamy arjunvenkat

View GitHub Profile
@arjunvenkat
arjunvenkat / crud_flow_pt1.md
Last active August 29, 2015 14:20
Basic Rails connections

The CRUD flow

Named route helpers

in the index page...

@arjunvenkat
arjunvenkat / git_guide.md
Last active August 29, 2015 14:23
Git Guide

Git Guide

Cloning down a project

In your web browser, navigate to the project page that you want to clone down and copy the clone URL on the middle-right side of the project page. It should look something like https://github.com/tsl-su-15/ruby_logic.git

Then in terminal, navigate to the parent folder that you want to download the project into and and use the following command, replacing [project_url] with your project's URL:

git clone [project_url]
@arjunvenkat
arjunvenkat / ruby_questions.md
Last active August 29, 2015 14:24
Ruby conceptual review

Define the following terms:

  • integer
  • string
  • array
  • hash
  • loop
  • conditional logic
  • class
  • method
  • instance variable
@arjunvenkat
arjunvenkat / rails_questions.md
Created July 8, 2015 14:49
Rails conceptual review

Use these questions to self-assess your understanding of Rails up to this point:

  1. What is Rails? What problem is it solving for us?
  2. How would you describe terminal?
  3. What is the purpose of the application layout file?
  4. What is the purpose of each of the following parts of a Rails request:
  • the routes file
  • the controller
  • the action
  • the view
@arjunvenkat
arjunvenkat / gist:4075116
Created November 14, 2012 21:56
ruby challenge wk 7
# Gene Sequencing
# Given an input array and a test array, create a method that takes in
# two arrays as inputs, named 'input' and 'test,' respectively.
# 'input' is an array of any number of letters
# 'test' is an array of 4 letters
# The method returns 'match!' if the 'test' array is found inside the
# 'input' array and returns 'no match =(' if the 'test' array is not found
# Bonus: Try to make the script work even if your test sequence is reversed
@arjunvenkat
arjunvenkat / benfords_data.rb
Last active October 13, 2015 09:57
Benfords Data
# Try to figure out which dataset is real and which dataset is fake
# Hint: http://en.wikipedia.org/wiki/Benford's_law
data1 = ["2", "3", "8", "1", "3", "1", "8", "599", "1", "5", "7", "7", "8", "7", "6", "1", "1", "1", "5", "596", "7", "1", "7", "1", "1", "1", "7", "2", "1", "4", "542", "7", "1", "1", "3", "3", "2", "1", "7", "2", "2", "510", "1", "1", "1", "2", "2", "1", "3", "2", "557", "7", "2", "7", "2", "1", "7", "7", "5", "7", "2", "595", "2", "1", "4", "3", "2", "1", "2", "8", "1", "563", "2", "1", "3", "2", "2", "2", "7", "1", "569", "7", "1", "1", "1", "2", "3", "7", "538", "3", "2", "2", "3", "2", "3", "3", "1", "1", "8", "40239", "502", "5", "9", "1", "1", "7", "1", "8", "7", "568", "1", "2", "1", "1", "7", "1", "2", "7", "1", "2", "501", "1", "8", "7", "2", "1", "2", "1", "1", "1", "2", "509", "9", "2", "1", "1", "2", "2", "7", "1", "2", "541", "2", "2", "1", "8", "1", "2", "2", "2", "3", "525", "2", "7", "1", "1", "3", "2", "2", "1", "1", "479", "3", "2", "1", "8", "2", "3", "2", "2", "5", "2",
@arjunvenkat
arjunvenkat / scraper_lab_p1.rb
Created December 12, 2012 17:07
build a scraper using Nokogiri
# nokogiri requires open-uri to work properly
require 'nokogiri'
require 'open-uri'
# Putting it all together
# ===============================================
# initialize a url and feed into Nokogiri
url = "http://www.rottentomatoes.com/m/lincoln_2011/"
doc = Nokogiri::HTML(open(url))
@arjunvenkat
arjunvenkat / apprenticeship_scraper.rb
Created December 12, 2012 19:03
scraper to save apprenticeship info from department of labor site
namespace :apprenticeships do
desc "scrapes DOL site for apprenticeship data by state"
task :scrape => :environment do
require 'mechanize'
require 'open-uri'
require 'csv'
apprenticeships_in_state_array = []
# states = ["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","WI","WY"]
@arjunvenkat
arjunvenkat / chord_scraper.rb
Created December 12, 2012 19:02
scraper to save chord information for songs on ultimate guitar
require 'open-uri'
require 'csv'
require 'Mechanize'
require 'awesome_print'
# letter_array = ['0-9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
# 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
# 'u', 'v', 'w', 'x', 'y', 'z']
letter_array = ['b']
letter_array.each do |letter|