Skip to content

Instantly share code, notes, and snippets.

View mikecmpbll's full-sized avatar
🎯
Focusing

Mike Campbell mikecmpbll

🎯
Focusing
  • Skipton, North Yorkshire
View GitHub Profile
@mikecmpbll
mikecmpbll / console
Last active August 29, 2015 14:04 — forked from anonymous/console
1.9.3p392 :002 > Postcode
=> Postcode(id: integer, postcode: string, long: decimal, lat: decimal, address: string, bias: string, data: text, tries: integer, updated_at: datetime, created_at: datetime)
1.9.3p392 :003 >
@mikecmpbll
mikecmpbll / code
Last active August 29, 2015 14:18 — forked from baditaflorin/code
#!/usr/bin/env ruby
# encoding: utf-8
require 'savon'
require 'csv'
startDate = Date.new(2004, 01, 01)
stopDate = Date.today
csvHeaders = ['numar', 'numar_vechi', 'data', 'institutie', 'departament',
'categorie_caz', 'stadiu_procesual', 'obiect', 'data_modificare','nume','calitate_parte','solutie']
print "Enter an integer number to be calculated as factorial: "
Integer(gets) rescue print "Hey, that's not an integer! Enter an integer, please: "
n = gets.to_i
def factorial n
n > 1 ? n * factorial(n - 1) : 1
end
puts "Factorial of number #{n} is #{factorial(n)}"
@mikecmpbll
mikecmpbll / _form.html.haml
Created October 27, 2015 16:45
trying to embed erb inside yml locale file
.form-actions
- if params[:action] == "new"
= button_tag type: "submit", class: "btn btn-success btn-cons",
id: "submit" do
= fa_icon "check"
%span  Create
= link_to courses_path, class: "btn btn-danger btn-cons" do
= fa_icon "close"
%span  Cancel
@mikecmpbll
mikecmpbll / totp
Last active October 29, 2015 14:23 — forked from jurisgalang/totp
Ruby implementation of the Time-Based One-Time Password (TOTP) Algorithm described at http://tools.ietf.org/html/rfc6238
[jgalang@rashomon:~/Code/skunkworks/2fa]
∴ ruby totp_demo.rb
Time(sec) Time (UTC format) Value of T(Hex) TOTP Mode OK
------------------------------------------------------------------------------------------
59 1970-01-01 00:00:59 0000000000000001 94287082 SHA1 ✔
59 1970-01-01 00:00:59 0000000000000001 46119246 SHA256 ✔
59 1970-01-01 00:00:59 0000000000000001 90693936 SHA512 ✔
1111111109 2005-03-18 01:58:29 00000000023523EC 07081804 SHA1 ✔
1111111109 2005-03-18 01:58:29 00000000023523EC 68084774 SHA256 ✔