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 |
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 . . .' |
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
FactoryBot.define do | |
factory :property, aliases: [:current_prop] do | |
is_active "true" | |
factory :nowhereland do | |
name "NowhereLand" | |
property_code 'nwlnd' | |
address "123 Nowhere Lane" | |
city "Erewhon" | |
state "Oblivion" |
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 |
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
# /etc/nginx/sites-enabled/berlin | |
upstream spree.ryanbigg.com { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
# for UNIX domain socket setups: | |
server unix:/tmp/berlin.socket fail_timeout=0; | |
} |
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 kpi(campaigns) | |
{ | |
unique_views: campaigns.sum(:unique_views), | |
clicks: campaigns.sum(:clicker), | |
sent: campaigns.sum(:sent), | |
turnover: campaigns.sum(:turnover), | |
cost: campaigns.sum(:cost), | |
margin: campaigns.sum(:margin), | |
active_sent: active_campaigns.sum(:sent), | |
active_margin: active_campaigns.sum(:margin), |
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
Usage: | |
rails generate test_unit:helper NAME [options] | |
Options: | |
[--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications) | |
Runtime options: | |
-f, [--force] # Overwrite files that already exist | |
-p, [--pretend], [--no-pretend] # Run but do not make any changes | |
-q, [--quiet], [--no-quiet] # Suppress status output |
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 |
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 |
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 |