Skip to content

Instantly share code, notes, and snippets.

View ozmullins's full-sized avatar

Joseph Mullins ozmullins

View GitHub Profile
@ozmullins
ozmullins / Tz.rb
Last active May 5, 2018 15:26
Timezone
irb(main):023:0> tz = TZInfo::Timezone.get('Europe/Warsaw')
=> #<TZInfo::DataTimezone: Europe/Warsaw>
irb(main):024:0> d = DateTime.parse('08/04/2018 22:45:00')
=> #<DateTime: 2018-04-08T22:45:00+00:00 ((2458217j,81900s,0n),+0s,2299161j)>
irb(main):025:0> tz.utc_to_local(d)
=> #<DateTime: 2018-04-09T00:45:00+00:00 ((2458218j,2700s,0n),+0s,2299161j)>
irb(main):026:0> tz.local_to_utc(d)
=> #<DateTime: 2018-04-08T20:45:00+00:00 ((2458217j,74700s,0n),+0s,2299161j)>
@ozmullins
ozmullins / bpay_crn_gen.rb
Created May 10, 2017 04:35
Bpay CRN - MOD10V05
##
# Generate a valid BPay CRN with the checksum bit in Mod 10 version 5 (MOD10V05).
# The checksum bit is to provide a base test to see if the customer accidently
# entered a invalid CRN.
def checksum(number)
check_digit = 0;
number.to_s.split('').each_with_index do |n, i|
digit = n.to_i
check_digit += digit * (i + 1);
end

Keybase proof

I hereby claim:

  • I am ropeney on github.
  • I am ropeney (https://keybase.io/ropeney) on keybase.
  • I have a public key whose fingerprint is CA36 F5F2 54C9 4FCA 8E77 5180 DE13 11C5 47FB DC54

To claim this, I am signing this object: