This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Helpers do | |
def copy(term) do | |
text = | |
if is_binary(term) do | |
term | |
else | |
inspect(term, limit: :infinity, pretty: true) | |
end | |
port = Port.open({:spawn, "pbcopy"}, []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All other config | |
# Usage | |
# $ git:(main) new-task "Setup dockerfile for development" | |
# $ git:(tim.mccarthy/setup-dockerfile-for-development) | |
function new-task () { | |
main_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') | |
username=$(git config user.name | tr '[:blank:]' '.') | |
branch_detail=$(echo $1 | sed 's/[^[:blank:][:alnum:]-]//g' | tr '[:blank:]' '-') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:logger.debug(""" | |
> `docker attach $(docker compose ps web -q)` to attach IEx.pry() | |
> Ctrl + P + Q to detach from the container terminal | |
""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
pipeline = "PIPELINE_UUID" | |
pipeline_owner = "enterprise_team_name or email_address" | |
name = "heroku_app_name" | |
# CREATE APP | |
`heroku apps:create #{name} --team=#{pipeline_owner} --region=eu` # using eu region, otherwise it defaults to us | |
info_output = `heroku apps:info #{name} --json` | |
app_info = JSON.parse(info_output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG RUBY_VERSION=3.1.2 | |
FROM ruby:$RUBY_VERSION-bullseye as builder | |
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 \ | |
LANG=C.UTF-8 \ | |
BUNDLE_RETRY=3 \ | |
BUNDLE_PATH=/gems | |
ARG RAILS_ENV=production | |
ENV RAILS_ENV $RAILS_ENV | |
# This is needed during the build process because when precompiling assets, the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
import esbuild from "esbuild" | |
import chokidar from "chokidar" | |
import http from "http" | |
const watchDirectories = [ | |
"./app/assets/builds/*", | |
"./app/views/**/*.erb", | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- app/views/errors/500.html.erb --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= "SUPER COOL TITLE" %></title> | |
</head> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# | |
# Run parallel commands and fail if any of them fails. | |
# | |
set -eu | |
pids=() | |
for x in 1 2 3; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PeachPayments::Decoder | |
def initialize(body:, auth_tag:, iv:, key:) | |
@body = body | |
@key = key | |
@auth_tag = auth_tag | |
@iv = iv | |
end | |
def decode | |
packed_key, packed_iv, packed_auth_tag, packed_body = *[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
NewerOlder