Skip to content

Instantly share code, notes, and snippets.

View gist:805d420df70f1c377510
# infinity symbol
fill_color(card_color)
if(render_infinity)
fill_color(card_color)
x, y = width / 2, height * (barcode_height_ratio + 0.15)
s = width / 6
m = s / 2
n = m/2
move_to [x, y - n/2]
curve_to [x + s / 4, y - m/2], :bounds => [[x + n / 5 * KAPPA, y - (m/2)*KAPPA], [x + (s / 4) * (1-KAPPA), y - m/2]]
@debreczeni
debreczeni / database_cleaner.rb
Created Nov 17, 2014
Always ensure clean db state when mixing feature and other specs (transaction & truncation dbcleaning strategy) running in a random order
View database_cleaner.rb
# spec/support/database_cleaner.rb
def restore_clean_db_state!
DatabaseCleaner.clean_with :truncation
# load Rails.root.join('db', 'seeds.rb')
RSpec.configuration.db_is_dirty = false
end
def start_transaction!
DatabaseCleaner.strategy = :transaction
@debreczeni
debreczeni / slip13.rb
Last active Oct 24, 2015
Ruby implementation of HD Structure of SLIP-0013 Authentication using deterministic hierarchy
View slip13.rb
# lib/slip13.rb
# Ruby implementation of SLIP-0013 : Authentication using deterministic hierarchy
# https://doc.satoshilabs.com/slips/slip-0013.html
module SLIP13
class HDNode
def initialize(uri, index = 0)
@uri = uri
@index = index
@debreczeni
debreczeni / iban.rb
Created Jan 14, 2016
GIRO to IBAN converter in ruby
View iban.rb
class IBAN
def self.sanitize(account_number)
account_number.gsub(/\D*/, '')
end
def self.giro2iban(giro, country_code = 'HU')
giro = sanitize giro
country_code.upcase!
unless giro.size == 16 || giro.size == 24
@debreczeni
debreczeni / zendesk_ticket_and_comment_search_by_email.rb
Last active Feb 1, 2019
Zendesk Ticket search based on search query like "email@address.com" and with results including comments. Using the official Zendesk API v2 ruby gem: https://github.com/zendesk/zendesk_api_client_rb
View zendesk_ticket_and_comment_search_by_email.rb
require 'zendesk_api'
class Zendesk
attr_accessor :client
def initialize
@client = ZendeskAPI::Client.new do |config|
# Mandatory:
config.url = "<- your-zendesk-url ->" # e.g. https://mydesk.zendesk.com/api/v2
View keybase.md

Keybase proof

I hereby claim:

  • I am debreczeni on github.
  • I am davidd (https://keybase.io/davidd) on keybase.
  • I have a public key ASC9WKA5kVQL0IDNxksA0K6woBL5EQaeDvWJfOfMBV0WFAo

To claim this, I am signing this object: