Skip to content

Instantly share code, notes, and snippets.

View frznk-tank's full-sized avatar
👌
¯\_(ツ)_/¯

Frznk frznk-tank

👌
¯\_(ツ)_/¯
View GitHub Profile
@timm-oh
timm-oh / snippet.rb
Last active January 13, 2021 04:52
Ozow integration
# refer to https://ozow.com/integrations/ for more information
# Ordering with the params matters, see the link above for more information
ozow_params = {
'SiteCode': 'SOME_SITE_CODE', # find this here https://dash.ozow.com/MerchantAdmin/Site
'CountryCode': 'ZA', # only supports ZA currently
'CurrencyCode': 'ZAR', # only supports ZAR currently
'Amount': 1000, # this is R1000, not working well for floats though
'TransactionReference': 'SOME_TEST', # your internal reference to match against
'BankReference': "Nice Reference", # the reference that the customer will see on their bank statement
@cseelus
cseelus / custom_uploader.js
Last active May 1, 2019 16:12
Uploading files automatically with ActiveStorage
import { DirectUpload } from 'activestorage'
// See DirectUploadController from Rails Active Storage source
export class CustomUploader {
constructor(input, file) {
this.input = input
this.file = file
this.directUpload = new DirectUpload(this.file, this.url, this)
this.dispatch("initialize")
}
@ryandotsmith
ryandotsmith / hack-reactor.md
Last active November 24, 2022 07:01
Hack Reactor Talk

Tales From a Heroku User

Here are some things I have learned along the way.

Last Updated: 2013-02-08

Original Audience: Hack Reactor

About

@kmckelvin
kmckelvin / timed_formatter.rb
Created March 18, 2012 09:55
RSpec formatter with timed outputs
require 'rspec/core/formatters/documentation_formatter'
class TimedFormatter < RSpec::Core::Formatters::DocumentationFormatter
def example_passed(example)
output.puts "#{passed_output(example)} - #{example.execution_result[:run_time]}"
end
def example_failed(example)
output.puts "#{failure_output(example, example.execution_result[:exception])} - #{example.execution_result[:run_time]}"
end
# In your test_helper.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end