Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rShetty's full-sized avatar
💭
What's on my mind ?

Rajeev N Bharshetty rShetty

💭
What's on my mind ?
View GitHub Profile
@rShetty
rShetty / gist:d740955288c82ac688d7
Created December 27, 2014 10:47
Off By One Second Errors
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)
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
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?
@rShetty
rShetty / gist:4d23995a586234322552
Last active August 29, 2015 14:04
Haskell 101
* Basic Operations
* Prelude
* Booleans
* Comparison between different types
* Adding different types
* succ
* min, max
* Functions
* Higher Order
@rShetty
rShetty / deploy.sh
Last active January 3, 2016 20:39
Deploy Script For Yelloday Servers
#!/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
@rShetty
rShetty / test_users
Created December 31, 2013 09:49
Test Users
email: jack@cc.com
password: jackbrown
email: john@cc.com
password: johnbrown
email: adam@cc.com
password: adamdaniel
email: eve@cc.com
@rShetty
rShetty / 0_reuse_code.js
Created November 6, 2013 15:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console