This file contains 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' | |
require 'active_support/core_ext/integer/inflections' # Used for printing date as human text | |
require 'holidays' # Gives access to holiays | |
class Payday | |
def initialize(query_date) | |
@query_date = query_date | |
@next_payday = 'unknown' | |
end |
This file contains 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' | |
require 'active_support/core_ext/integer/inflections' | |
class Payday | |
def self.get_next_payday(date) | |
payday = Payday.get_next_standard_payday(date) | |
payday = Payday.weekend_adjustment(payday) | |
"Payday will be " + payday.strftime("%a %b #{payday.day.ordinalize}") |
This file contains 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 'json' | |
require 'rest-client' | |
#get a big block of json | |
github_json = RestClient.get('https://api.github.com/users/rails/repos') | |
#format the json for ruby to read | |
ghub_json = JSON.load(github_json) | |
#loop over all the repos in the formatted json |
This file contains 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 Person | |
attr_accessor :name, :age | |
def initialize | |
puts "name: #{name}" | |
puts "@name: #{@name}" | |
name = "David" | |
@name = "Tom" |
This file contains 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 'json' | |
uri = URI.parse("https://api.admoda.com/v1/advertiser/stats/campaigns.csv?date=2015-03-11") | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE # read into this | |
headers = {'Authorization' => 'Token a3446590e8920e90e857f20c3d24479c'} | |
response = http.get(uri.request_uri, headers) | |
p "----Response----" |
This file contains 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 'docopt' | |
class Todo | |
def initialize | |
puts "Generating 'To Do' list" | |
@file = File.open("todo_list.txt", 'w+') | |
puts "'To Do' list generated" | |
end |
This file contains 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 'docopt' | |
#------------------------------------------------------- | |
class List | |
# attr_accessor :all_tasks | |
def initialize | |
@all_tasks = [] |
This file contains 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 'spec_helper' | |
require 'simplecov' | |
SimpleCov.start | |
require './list' | |
require './todo' | |
require './task' | |
describe Todo::List do |
This file contains 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html lang="en"> | |
<head> | |
</head> | |
<body> |
This file contains 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
module InWords | |
def in_words | |
ones = { | |
1 => "one", | |
2 => "two", | |
3 => "three", | |
4 => "four", | |
5 => "five", |
OlderNewer