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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
email: [email protected] | |
password: jackbrown | |
email: [email protected] | |
password: johnbrown | |
email: [email protected] | |
password: adamdaniel | |
email: [email protected] |
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
#!/bin/bash | |
# Bash Script to automate deploying to Heroku staging and dev servers for yelloday | |
usage="$(basename "$0") commit-message dev|staging-- Push to Development/Staging Server Heroku" | |
if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] ; then | |
echo "$usage" | |
else | |
git stash |
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
* Basic Operations | |
* Prelude | |
* Booleans | |
* Comparison between different types | |
* Adding different types | |
* succ | |
* min, max | |
* Functions | |
* Higher Order |
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
def create | |
uploaded_file = params[:batch_payouts_csv] | |
unless valid_file_type?(uploaded_file) | |
render json: {"error_message" => I18n.t("merchant.messages.errors.invalid_file_type")}, status: 400 | |
return | |
end | |
uploaded_csv_file = Batch::CsvFile.new(uploaded_file.path) | |
unless uploaded_csv_file.valid_size? |
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
composed_of :amount, | |
:class_name => 'Money', | |
:mapping => [%w(amount value), %w(currency_id currency_id)], | |
:constructor => Proc.new { |amount, currency_id| Money.new(amount, currency_id) } | |
class Money | |
attr_reader :value, currency_id |
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
time = Time.now | |
Timecop.freeze(time) do | |
merchant.mark_as_review_approved_by(admin_user) | |
end | |
expect(merchant.reload.last_reviewed_at.utc.to_s).to eq(time.utc.to_s) |
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 'benchmark/ips' | |
Benchmark.ips do |x| | |
x.config(:time => 5, :warmup => 2) | |
x.time = 5 | |
x.warmup = 2 | |
times = 10000 |
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 'benchmark/ips' | |
Benchmark.ips do |x| | |
x.config(:time => 5, :warmup => 2) | |
x.time = 5 | |
x.warmup = 2 | |
no_of_times = 1_000_000 | |
last_value = 10000 |
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
exceptions = [] | |
tree = {} | |
ObjectSpace.each_object(Class) do |cls| | |
next unless cls.ancestors.include? Exception | |
next if exceptions.include? cls | |
next if cls.superclass == SystemCallError # avoid dumping Errno's | |
exceptions << cls | |
cls.ancestors.delete_if {|e| [Object, Kernel].include? e }.reverse.inject(tree) {|memo,cls| memo[cls] ||= {}} | |
end |
OlderNewer