Skip to content

Instantly share code, notes, and snippets.

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

Frznk frznk-tank

👌
¯\_(ツ)_/¯
View GitHub Profile
@frznk-tank
frznk-tank / ergo-proxy.sh
Created November 14, 2012 21:18
Configure proxies in OSX and open an SSH tunnel
# Usage: bash ergo-proxy.sh <on off>
# Hitting ctrl-c while tunneled will exit the tunnel and turn the proxies off
STATE=$1
# Get a list of network services: networksetup -listallnetworkservices
NETWORKSERVICE=Wi-Fi
# Local port
PORT=3128
@frznk-tank
frznk-tank / Gemfile
Last active January 27, 2022 17:59
Postgres Arrays in Active Admin
ruby '2.2.0'
source 'https://rubygems.org'
...
gem 'font-awesome-rails'
@frznk-tank
frznk-tank / application_helper.rb
Last active March 19, 2021 11:35
Stimulus slim view helpers
# app/helpers/application_helper.rb
module ApplicationHelper
include StimulusHelper::HelperMethods
end
@frznk-tank
frznk-tank / snippet.rb
Created January 6, 2021 14:57 — forked from timm-oh/snippet.rb
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.00, # this is R1000.00
'TransactionReference': 'SOME_TEST', # your internal reference to match against
'BankReference': "Nice Reference", # the reference that the customer will see on their bank statement
@frznk-tank
frznk-tank / 01_readme.md
Last active June 15, 2020 06:52
Sass baseline mixin

Usage

  h1,
  h2,
  h3,
  h4,
  h5,
  h6
 color: $c-txtPrimary
@frznk-tank
frznk-tank / .travis.yml
Created August 19, 2018 19:33
Postgres 10 on Travis
env:
global:
- PGPORT=5433
language: ruby
rvm:
- 2.5.1
cache:
@frznk-tank
frznk-tank / USAGE.md
Created July 19, 2018 09:44
Basic Sidekiq config

Starting Sidekiq

bundle exec sidekiq -C config/sidekiq.yml

Perform Job Immediately

TestJob.perform_now(user_id: current_user.id)
@frznk-tank
frznk-tank / control_indicator_helper.rb
Last active July 18, 2018 00:01
SimpleForm Initializer for Foundation 6 with additional markup to allow styling of checkboxes, radio buttons and file controls
# lib/components/control_indicator_helper.rb
module ControlIndicatorComponent
def select_arrow(wrapper_options=nil)
@arrow_icon ||= begin
if options[:arrow_icon].nil? || options[:arrow_icon].to_s == 'default'
''
else
options[:arrow_icon].to_s.html_safe
end
@frznk-tank
frznk-tank / gist:af1e3c3dba1627451abc8552a5e99baf
Last active June 25, 2018 13:13
Ruby random South African ID number generator
def id_number(birthday, gender)
gender = (0..4).to_a.sample if gender == 'female'
gender = (5..9).to_a.sample if gender == 'male'
random_sequence = rand.to_s[2..5]
citizenship = 0
race = 8
id_number = [
birthday.gsub('-', '')[2..-1],
gender,
@frznk-tank
frznk-tank / 1-README.md
Last active August 1, 2017 10:12
Heroku Reporting Dynos

Setup

  • Add a new worker to your Procfile. In this gist I used reporter
  • Add the Heroku Platform gem to your Gemfile
  • Create the HerokuReporterDyno module in lib or any other auto-loadable path
  • Create two jobs. A caller (Reporting::GeneratorJob) and a runner (Reporting::RunnerJob)
  • Deploy
  • Once deployed, log into Heroku and change the newly added reporter dyno to a Performance M or Performance M dyno

How this all works