Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
#Alex Pilafian - "Manchester United"-themed data parsing program. 2015
#https://docs.google.com/document/d/1NWtzQj1irzL86cv3A48HVxWdT2tRpJw7UQ8dWYHaHgA/edit?usp=drive_web
#The $-sign just denotes a global variable.
$scores = "Manchester United 1 Chelsea 0, Arsenal 1 Manchester United 1, Manchester United 3 Fulham 1, Liverpool 2 Manchester United 1, Swansea 2 Manchester United 4"
def is_number?(str)
#!/usr/bin/env ruby
#Alex Pilafian - Zeller Algorithm. 2015
#https://docs.google.com/document/d/1BKHrV0SEhblnPUgcISKV1oIJ8ejC6jjhtXs_jX8CbWU/edit
$days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
print "Enter your date of birth (dd/mm/yyyy):\n"
input = gets.chomp
Alexs-MacBook-Pro:rv8 sikanrong$ git remote -v
origin git@bitbucket.org:sikanrong/rv8.git (fetch)
origin git@bitbucket.org:sikanrong/rv8.git (push)
upstream git@bitbucket.org:restoin/rv8.git (fetch)
upstream git@bitbucket.org:restoin/rv8.git (push)
Alexs-MacBook-Pro:rv8 sikanrong$ git pull upstream market
From bitbucket.org:restoin/rv8
* branch market -> FETCH_HEAD
Already up-to-date.
Alexs-MacBook-Pro:rv8 sikanrong$ git push upstream market
@sikanrong
sikanrong / transaction_buckets_models.rb
Last active August 29, 2015 13:59
Hypothetical Bucket-Transaction Architecture
class TransactionItem < ActiveRecord::Base
has_many :transaction_bucket_item_links
before_save :sub_account_balance
before_destroy :sub_account_balance, :destroy_links
after_save :add_account_balance
def destroy_links
TransactionBucketItemLink.destroy(:all, ["transaction_item_id = ?", self.id])
end
location /socket.io {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";