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 'httparty' | |
require 'pry' | |
class User | |
def initialize(username, score, reposcore) | |
@username = username | |
@score = score | |
@reposcore = reposcore | |
@reponame = "" |
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 'sinatra' | |
require 'mongo' | |
require 'json' | |
class RequestLogger | |
include Mongo | |
attr_accessor :ip, :path, :method, :body, :url_params | |
def self.log(request) |
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
#Mixtape Controller | |
def share | |
@mixtape = Mixtape.find(params[:id]) | |
@shared_user = User.find(params[:user]) | |
@shared_permission = params[:permission].to_sym | |
@mixtape.add_user(@shared_user, @shared_permission) if @mixtape.user_mixtapes.find_by_user_id_and_permission(@shared_user,@shared_permission) | |
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 'date' | |
all_files = [] | |
file_path = "./" | |
Dir.foreach(file_path) do |file_name| | |
next if file_name == "." || file_name == ".." || file_name == ".DS_Store" || file_name == "data_display.rb" || file_name == "cyrus_data_display" #potentially could refactor this into a while file_name.includes(/.rb/) | |
puts "got #{file_name}" | |
#Can refactor to a case statement |
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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'sqlite3' | |
require 'active_record' | |
require 'active_support' | |
ActiveRecord::Base.establish_connection( | |
:adapter => "sqlite3", |
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
@list = Array.new | |
puts "Please enter all of the people that will be participating in this years Secret Santa" | |
while true | |
input = gets.chomp |
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
list = Array.new | |
puts "Please enter all of the people that will be participating in this years Secret Santa" | |
while true | |
input = gets.chomp | |
if input == '' | |
break | |
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 'csv' | |
class CsvReader | |
def initialize | |
@number_of_entries = [] | |
end | |
def read_in_csv_data(csv_file_name) | |
CSV.foreach(csv_file_name, headers: true ) do |row| | |
@number_of_entries << ValueInCells.new( row["Amount"]) |
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
root /(.:format) {:controller=>"pages", :action=>"home"} | |
sessions GET /sessions(.:format) {:action=>"index", :controller=>"sessions"} | |
POST /sessions(.:format) {:action=>"create", :controller=>"sessions"} | |
new_session GET /sessions/new(.:format) {:action=>"new", :controller=>"sessions"} | |
edit_session GET /sessions/:id/edit(.:format) {:action=>"edit", :controller=>"sessions"} | |
session GET /sessions/:id(.:format) {:action=>"show", :controller=>"sessions"} | |
PUT /sessions/:id(.:format) {:action=>"update", :controller=>"sessions"} | |
DELETE /sessions/:id(.:format) |
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
root /(.:format) {:controller=>"pages", :action=>"home"} | |
sessions GET /sessions(.:format) {:action=>"index", :controller=>"sessions"} | |
POST /sessions(.:format) {:action=>"create", :controller=>"sessions"} | |
new_session GET /sessions/new(.:format) {:action=>"new", :controller=>"sessions"} | |
edit_session GET /sessions/:id/edit(.:format) {:action=>"edit", :controller=>"sessions"} | |
session GET /sessions/:id(.:format) {:action=>"show", :controller=>"sessions"} | |
PUT /sessions/:id(.:format) {:action=>"update", :controller=>"sessions"} | |
DELETE /sessions/:id(.:format) |