This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nokogiri requires open-uri | |
require 'nokogiri' | |
require 'open-uri' | |
# csv will be used to export data | |
require 'csv' | |
require 'mechanize' | |
# pp is useful to display mechanize objects | |
require 'pp' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DrawShape | |
def line(user_num=9) | |
"*" * user_num | |
end | |
def number_line(input) | |
input.times do |number| | |
print number unless number == 0 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DrawShape | |
def line(user_num=9) | |
"*" * user_num | |
end | |
def number_line(input) | |
input.times do |number| | |
print number unless number == 0 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'nokogiri' | |
require 'mechanize' | |
agent = Mechanize.new | |
page = agent.get('http://www.reddit.com/') | |
count = 0 | |
# prints out the first link for the first five pages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>Remap Right Option to Hyper</name> | |
<appendix>OS X doesn't have a Hyper. This maps Right Option to Control + Shift + Option + Command.</appendix> | |
<identifier>space_cadet.right_option_to_hyper</identifier> | |
<autogen> | |
--KeyToKey-- |
OlderNewer