Skip to content

Instantly share code, notes, and snippets.

View mhanberg's full-sized avatar
🏎️
Vroom

Mitchell Hanberg mhanberg

🏎️
Vroom
View GitHub Profile
<!DOCTYPE html>
<html lang="en" class="dark">
<head><!-- head stuff --></head>
<body class="h-screen bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-grey-200 font-sans transition transition-colors ease-out">
<main role="main" class="container mx-auto">
<div x-data="{text: ['Light', 'Dark']}">
<button
class="border p-2 font-bold bg-gray-900 dark:bg-white text-white dark:text-grey-900"
@click="document.documentElement.classList.toggle('dark'); text = text.reverse()"
x-text="text[0]"
const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
purge: [],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
colors: {
grey: defaultTheme.colors.gray
},
@mhanberg
mhanberg / live_view.ex
Created March 9, 2021 18:17
Using Temple directly in live view modules
# lib/my_app/views/live_view.ex
defmodule MyAppWeb.LiveView do
defmacro render(block) do
quote do
def render(var!(assigns)) do
require Temple
Temple.compile(unquote(Phoenix.LiveView.Engine), unquote(block))
end
end
-- We're going to install the package manager, packer.nvim
-- It is based on (n)vims native package management
-- Let's install it into ~/.local/share/nvim
local install_path = vim.fn.stdpath("data").."/site/pack/packer/opt/packer.nvim"
-- If it's not already installed, let's download it
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.api.nvim_command.execute("!git clone https://github.com/wbthomason/packer.nvim "..install_path)
end
=== running autoconf in lib/common_test
=== running autoconf in lib/crypto
=== running autoconf in lib/erl_interface
=== running autoheader in lib/erl_interface
=== running autoconf in lib/megaco
@mhanberg
mhanberg / endpoint.ex
Last active February 19, 2021 01:33
esbuild + postcss-cli in phoenix
import Config
# Configure your database
config :my_app, MyApp.Repo, show_sensitive_data_on_connection_error: true
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
go fuck yourself
defmodule Mix.Tasks.D03.P1 do
use Mix.Task
import AdventOfCode.Day03
@shortdoc "Day 03 Part 1"
def run(args) do
# Downloads your input for the given day and year
# and caches it in ~/.cache.
input = AdventOfCode.Input.get!(3, 2020)
@mhanberg
mhanberg / feature.ex
Created November 30, 2020 19:44
wallaby
defmodule BifrostWeb.FeatureCase do
use ExUnit.CaseTemplate
import Bifrost.AccountsFixtures
alias BifrostWeb.Router.Helpers, as: Routes
using do
quote do
use Wallaby.Feature
import Bifrost.AccountsFixtures
import Bifrost.HealthFixtures
defmodule BifrostWeb.RoutineLive.Show do
use BifrostWeb, :live_view
alias Bifrost.Health
@impl true
def mount(_params, _session, socket) do
{:ok, assign_breadcrumb(socket, "Routines", Routes.routine_index_path(socket, :index))}
end