Content-Length: 175622 | pFad | https://gist.github.com/christhekeele/#start-of-content

47 christhekeele’s gists · GitHub
Skip to content

Instantly share code, notes, and snippets.

View christhekeele's full-sized avatar
💜

Christopher Keele christhekeele

💜
View GitHub Profile
@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() ->
@christhekeele
christhekeele / postgres-uuid-reflection.md
Last active July 20, 2023 16:29
Automatic UUID Reflection in Postgres

Automatic UUID Reflection in Postgres

You have a system backed by a Postgres database that uses UUIDs as primary keys for everything. This is nice:

  • You can generate ids on clients before transmitting writes to servers if you wish.
  • You don't have to worry about exhausting the integer size allocated to your auto-incrementing primary keys.[^1]
  • You don't have to worry about enumeration attacks from auto-incrementing primary keys.
  • You can identify and index on data that has no natural key, without the challenges of auto-incrementing primary keys.

The Problem

@christhekeele
christhekeele / elixir-bio.md
Last active October 26, 2023 03:42
My activity in Elixir since 2013!

In roughly chronological order:

@christhekeele
christhekeele / compile.markdown.ex
Last active August 16, 2020 08:51
Turn markdown files into HTML in Elixir projects at compile-time.
####
# USAGE:
#
# 1. Add Earmark to your dependencies
# 2. Place this file in lib/mix/compile.markdown.ex
# 3. Add to your mix.exs project's compilers:, ie:
# compilers: [:markdown] ++ Mix.compilers()
# 4. Profit?
defmodule Mix.Tasks.Compile.Markdown do
@christhekeele
christhekeele / foo.ex
Created June 12, 2020 07:56 — forked from 0x6a74/foo.ex
Spec to Callback
defmodule MyApp.Foo do
@on_definition MyApp.SpecToCallback
@spec bar(String.t()) :: String.t()
def bar(foobar) do
impl().bar(foobar)
end
defp impl, do: Application.get_env(:my_app, :my_app_foo_impl, __MODULE__.DefaultImpl)
end
@christhekeele
christhekeele / README.md
Last active March 17, 2020 19:08 — forked from twolfson/README.md
Leverage Flask-SQLAlchemy with Celery

Last update: 2020-03-17

Flask-SQLAlchemy has some nice built-ins (e.g. accessing query directly on classes). To continue leveraging these nicities while still inside of a Celery worker, we need to make sure we setup/teardown in a similar fashion to Flask-SQLAlchemy does on Flask.

Setup

Flask-SQLAlchemy uses create_scoped_session at startup which avoids any setup on a per-request basis.

https://github.com/mitsuhiko/flask-sqlalchemy/blob/2.0/flask_sqlalchemy/__init__.py#L668

This means Celery can piggyback off of this initialization.

This file has been truncated, but you can view the full file.
{
"yieldstar_best": [
{
"Partner": "realpage",
"Data": {
"PhysicalProperty": {
"Property": {
"Building": { "@IDValue": "1", "Name": "N/A" },
"Floorplan": {
"Identification": { "@IDValue": "1" },
@christhekeele
christhekeele / matcha.ex
Last active April 17, 2018 22:19
Possible macro API for generating match patterns/specifications in Elixir
defmodule Matcha do
@moduledoc """
Documentation for Matcha.
"""
@doc """
Handles the sigil `~m`.
It returns a match pattern or specification.
@christhekeele
christhekeele / aliases.md
Last active February 22, 2018 09:14
Some git aliases

git chunk

git config --global alias.chunk 'add -p'

Usage: starts an interactive chunk-by-chunk staging session, similar to git rebase -i. Handy for picking apart a full index to make a nicer narrative of small commits.

git current

@christhekeele
christhekeele / mnemonix-passthrough-proxy.ex
Last active December 13, 2017 19:54
An example meta store for Mnemonix
defmodule Mnemonix.Stores.Meta.PassThrough do
@moduledoc """
A `Mnemonix.Store` that caches reads from a backend store into a frontend one.
Writes and removals are applied to both stores.
Works best with quicker or closer stores in the frontend, like in-memory ones;
with a store-wide ttl to keep their footprint light.
iex> {:ok, backend} = Mnemonix.Stores.Redix.start_link()








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://gist.github.com/christhekeele/#start-of-content

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy