Skip to content

Instantly share code, notes, and snippets.

View christhekeele's full-sized avatar
💜

Christopher Keele christhekeele

💜
View GitHub Profile
@maennchen
maennchen / hex_version_stats.livemd
Created December 3, 2024 13:50
Hex Version Stats

Hex Version Stats

Mix.install([
  :hex_core,
  :explorer,
  :kino_explorer,
  :kino_vega_lite
])
@christhekeele
christhekeele / gl_const.erl
Last active September 23, 2024 20:30
expose erl gl/glu/wx constants in snake_case for elixir. note there are 3 files here, just very long ones: gl_const.erl, glu_const.erl, and wx_const.erl
-module(gl_const).
-compile(nowarn_export_all).
-compile(export_all).
-include_lib("wx/include/gl.hrl").
gl_1pass_ext() ->
?GL_1PASS_EXT.
gl_1pass_sgis() ->

LiveView Forms

Application.put_env(:sample, Example.Endpoint,
  http: [ip: {127, 0, 0, 1}, port: 5001],
  server: true,
  live_view: [signing_salt: "aaaaaaaa"],
  secret_key_base: String.duplicate("a", 64)
)
@pmarreck
pmarreck / hendricks_formatter.ex
Created July 25, 2023 14:02
An Elixir formatting module for `mix format` that converts leading spaces to tabs.
defmodule HendricksFormatter do
@moduledoc """
This module is a formatter plugin for Elixir's `mix format` task
that converts leading whitespace to tabs.
It tries to intelligently determine the tab width based on the most common
counts of leading space runs in the file.
It allows additional space characters for minor adjustments that are below the tab width.
OK, why tabs? Why resurrect this age-old nerd debate again?
Very simple: It's an accessibility issue:
https://adamtuttle.codes/blog/2021/tabs-vs-spaces-its-an-accessibility-issue/
CREATE OR REPLACE FUNCTION rebuild_view() RETURNS event_trigger AS
$rebuild_view$
DECLARE
table_name text;
view_name text;
BEGIN
SELECT object_identity INTO table_name FROM pg_event_trigger_ddl_commands() LIMIT 1;
SELECT split_part(table_name, '.', 1) || '.v_' || split_part(table_name, '.', 2)
INTO view_name;
EXECUTE 'DROP VIEW IF EXISTS ' || view_name;
@mcrumm
mcrumm / app.js
Last active August 20, 2024 13:42
flatpickr + LiveView example
// assets/js/app.js
// ...
import Pickr from "./pickr"
const hooks = {
Pickr
}
// ...
{
"Inspect": {
"prefix": "ins",
"body": "|> IO.inspect(label: \"$0$TM_LINE_NUMBER\")",
"description": "Adds a pipeline with a labelled `IO.inspect`",
}
}
@IanColdwater
IanColdwater / twittermute.txt
Last active February 23, 2025 18:09
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@nroi
nroi / extract_tar_from_binary.ex
Created April 21, 2019 12:29
Decompressing a tar.gz archive in Elixir with Erlang's :erl_tar module.
@doc"""
Returns a map containing all files and their contents from the compressed tar archive.
"""
def extract_tar_from_binary(binary) do
with {:ok, files} <- :erl_tar.extract({:binary, binary}, [:memory, :compressed]) do
files
|> Enum.map(fn {filename, content} -> {to_string(filename), content} end)
|> Map.new
end
end
@0xabad1dea
0xabad1dea / speedrunning-faq.md
Last active November 16, 2024 13:40
Speedrunning FAQ/Glossary

Speedrunning FAQ/Glossary

by 0xabad1dea September 2018

You may notice a decidedly Nintendo bias to the examples. I can't change who I am.

What is Speedrunning?

Speedrunning is:

  • Completing a video game