View spec and code
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
it 'has a method that will call the transaction class' do | |
Transaction.should_receive(:new); | |
bank.send(:make_deposit, 5); | |
end | |
def make_deposit(amount) | |
Transaction.new(self, 'deposit', amount); | |
end |
View index.html.erb
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
<table> | |
<tr> | |
<th>Subject</th> | |
<th>Created At</th> | |
<th>Status</th> | |
</tr> | |
<% @tickets.each do |ticket| %> | |
<tr> | |
<td><a href="/ticket/<%= ticket.id %>"><%= ticket.subject %></a></td> |
View part 2?
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
totalprice=0 | |
totalitemcount=0 | |
laborcharge=0 | |
discount= 0 | |
totalgccount=0 |
View gist:8125a3a8f6d88f73e6d6e7b4f4452820
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 'concurrent' | |
class Test | |
def update(time, value, reason) | |
puts "OMG" | |
end | |
end | |
puts 'testing . . .' |
View read.rb
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 ApiRead | |
require 'open-uri' | |
require 'json' | |
attr_reader :data | |
def initialize(url) | |
# this goes fine | |
@data = JSON.parse(open(url).read)["data"] | |
end |
View scrabble.ex
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
defmodule Scrabble do | |
def score(l) when l in [nil, ""] do: 0 | |
def score(l) when l in ["A", "E", "I", "O", "U"] do: 1 | |
def score(word) do | |
word | |
|> String.upcase | |
|> String.split("") | |
|> Enum.map(&(score(&1))) | |
|> Enum.sum |
View rubocop.rb
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
def if_statement | |
return a unless condition? | |
c( | |
1, | |
2, | |
3 | |
) | |
end |
View rubocop.rb
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
def if_statement | |
a | |
if condition? | |
c( | |
1, | |
2, | |
3 | |
) | |
end | |
end |
View test.rb
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 Parent < ActiveRecord::Base | |
has_many :children | |
#Question: Does method below perform a join in children and match only children belonging to a specific parent? | |
def has_active_children | |
children.exists?(status: "active") | |
end |
View Routine wanted as Back Job
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
# Fetchs campaigns from SiB | |
class CampaignFetch | |
def get | |
def sib | |
@sib ||= Mailin.new("API_URL","API_KEY") | |
end | |
def shoot_criteria | |
{ "type"=>"classic", "status" => "sent", "page"=>10,"page_limit"=>1000 } |
NewerOlder