Skip to content

Instantly share code, notes, and snippets.

View dkarter's full-sized avatar

Dorian Karter dkarter

View GitHub Profile
@dkarter
dkarter / malomo tracking page url.md
Last active February 14, 2023 19:04
Malomo Tracking Page URL

Get Tracking Page URL

Returns the tracking page url for an account + order/return

API URL

https://api.gomalomo.com/public/tracking_pages/url

Parameters

@dkarter
dkarter / snippet.liquid
Created December 14, 2022 20:19
Malomo Tracking Block Theme 1.0 Snippet
{%- style -%}
{% assign header_font = section.settings.header_font %}
{{ header_font | font_face }}
{% assign header_font_bold = header_font | font_modify: 'weight', 'bolder' %}
{% assign header_font_italic = header_font | font_modify: 'style', 'italic' %}
{% assign header_font_bold_and_italic = header_font_bold | font_modify: 'style', 'italic' %}
{{ header_font_bold | font_face }}
@dkarter
dkarter / migrate.exs
Created June 28, 2022 20:00
Migrate TypeScript/Javascript projects from relative to absolute paths
relative_to_absolute = fn relative_path, importing_file ->
Path.expand(relative_path, Path.dirname(importing_file))
|> String.split("src/")
|> List.last()
end
Path.wildcard('src/**/*.{ts,tsx}')
|> Enum.each(fn file ->
IO.puts("Migrating #{file}...")
contents = File.read!(file)
@dkarter
dkarter / error.log
Last active March 14, 2022 17:47
ASDF Erlang Failed Install Log (POP_OS)
/home/dorian/.asdf/plugins/erlang/kerl-home/builds/asdf_24.2/otp_src_24.2/configure --cache-file=/dev/null CC=clang CPPFLAGS=-I/usr/local/opt/qt/include\ -I/usr/local/opt/openssl\@1\.1/include LDFLAGS=-L/usr/local/opt/qt/lib\ -L/usr/local/opt/openssl\@1\.1/lib --with-ssl=/usr/include/openssl
=== Running configure in /home/dorian/.asdf/plugins/erlang/kerl-home/builds/asdf_24.2/otp_src_24.2/erts ===
./configure 'CC=clang' 'CPPFLAGS=-I/usr/local/opt/qt/include -I/usr/local/opt/openssl@1.1/include' '--with-ssl=/usr/include/openssl' LDFLAGS='-L/usr/local/opt/qt/lib -L/usr/local/opt/openssl@1.1/lib' --disable-option-checking --cache-file=/dev/null --srcdir="/home/dorian/.asdf/plugins/erlang/kerl-home/builds/asdf_24.2/otp_src_24.2/erts"
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether
defmodule KingOfTokyoWeb.ChatComponent do
@moduledoc """
Displays the chat history and allows sending new messages
"""
use KingOfTokyoWeb, :live_component
@impl true
def handle_event("send-message", %{"body" => body}, socket) do
send(self(), {:send_message, body})
name: Elixir CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
MIX_ENV: test

Automate Your Elixir Deployments - Part 1 - Ansible

Summary

This post will guide you through automating a "bare-metal" machine configuration, and getting a server ready for building and deploying Elixir / Phoenix applications (with LiveView support!)

Body

Automate Your Infrastructure with Pulumi

Managing infrastructure can be frustratingly hard. Combing through byzantine interfaces with poor documentation and hidden features, clicking through hundreds of menus - these experiences are all too familiar to DevOps engineers using AWS. A DevOps engineer's worst fear is that the business will ask for a new instance of the application for a client, and they will have to repeat all those manual steps again. (Hopefully in the correct order, and not forgetting anything along the way!)

At Hashrocket we are big fans of automation, and part of that means we use the

import * as Pulumi from '@pulumi/pulumi';
import * as DigitalOcean from '@pulumi/digitalocean';
import * as fs from 'fs';
const projectName = Pulumi.getProject();
const config = new Pulumi.Config();
const sshPubKeyFilename = config.require('sshPubKeyFilename');
const publicKey = fs.readFileSync(sshPubKeyFilename).toString();
on run argv
set zoom to "zoom.us"
set wait to 0.5
log "activating zoom"
tell application zoom to activate
# Wait for Zoom's create meeting window to open
tell application "System Events"
repeat until visible of process zoom is true