Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Nunogawa @amattn amattn

View GitHub Profile
View input.css
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
@layer utilities {
.fgoto {
/* don't use this with <sup>... one or the other.*/
font-size: 75%; line-height: 0; position: relative; vertical-align: baseline;
top: -0.3em; vertical-align: super;
}
View input.css
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
/* I mostly use this for math like exponents and stuff */
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -0.3em; vertical-align: super;}
sub { bottom: -0.25em; vertical-align: sub;}
View input.css
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
/* Works on Firefox */
pre {
scrollbar-color: #6B7280 #1f2937;
}
/* Works on Chrome, Edge, and Safari */
View tailwind.config.js
// https://tailwindcss.com/docs/customizing-colors#color-palette-reference
const colors = require('tailwindcss/colors')
const round = (num) =>
num
.toFixed(7)
.replace(/(\.[0-9]+?)0+$/, '$1')
.replace(/\.0$/, '')
const rem = (px) => `${round(px / 16)}rem`
const em = (px, base) => `${round(px / base)}em`
View generate_html_for_route.ex
def generate_html_for_route(route_path) do
conn = Phoenix.ConnTest.build_conn()
conn = get(conn, route_path)
resp = html_response(conn, 200)
priv_static_path =
Path.join([
:code.priv_dir(:dash_home),
"static",
route_path
@amattn
amattn / Dockerfile
Created Jan 6, 2021
Dockerfile example used to build an elixir/phoenix project on linux and output a tarball
View Dockerfile
FROM elixir:1.11.2 AS build
## instll some dependencies (webpack basically)
RUN \
apt-get update -y && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs && node -v && npm -v
# Required environment variables passed in via --build-arg flags
View deploy.sh
#!/bin/sh
set -o nounset
set -o errexit
usage(){
echo "Usage: $0 X.Y.Z dev|test|staging|prod"
echo ""
echo "example: ./deploy.sh 1.1.3 prod"
echo "example: ./deploy.sh 1.2.0 dev"
View keybase.md

Keybase proof

I hereby claim:

  • I am amattn on github.
  • I am amattn (https://keybase.io/amattn) on keybase.
  • I have the public key with fingerprint A9AD 6782 656D 3E83 C67B  8B56 DFDA DA1B 1538 2CEB

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am amattn on github.
  • I am amattn (https://keybase.io/amattn) on keybase.
  • I have the public key with fingerprint A9AD 6782 656D 3E83 C67B  8B56 DFDA DA1B 1538 2CEB

To claim this, I am signing this object:

@amattn
amattn / riak.go
Created Sep 10, 2012
Rough draft of a golang Riak driver
View riak.go
// Package riak is an opinionated driver for the Riak datastore
// Developed against Riak 1.2
//
// Design decisions were made to prioritize safety over absolute ease of use.
// This is a work in progress, but could be good starting point for your own custom driver
// Eventually, there will be a real repo.
// Also on the roadmap is protocol buffer support, multi-node clusters, better sibling
// resolution and even client-side CRDTs
//
// If you have any feedback, please let me know.