Skip to content

Instantly share code, notes, and snippets.

🍸

Christopher Keele christhekeele

🍸
Block or report user

Report or block christhekeele

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9114d43f152393088a3d002aacdb7fb4
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": {
@christhekeele
christhekeele / matcha.ex
Last active Apr 17, 2018
Possible macro API for generating match patterns/specifications in Elixir
View matcha.ex
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 Feb 22, 2018
Some git aliases
View aliases.md

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 Dec 13, 2017
An example meta store for Mnemonix
View mnemonix-passthrough-proxy.ex
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()
@christhekeele
christhekeele / default_behaviour.ex
Last active Nov 16, 2017
Behaviours with Defaults for Elixir
View default_behaviour.ex
defmodule Default.Behaviour do
@moduledoc """
Creates a behaviour that carries its own default implementation.
When used into a behaviour module, when that module in turn is used, all functions
defined on it are given to the using module.
This allows you to have concrete implementations of the behaviour's default functionality
for testing, unlike cramming them all into a __using__ macro.
@christhekeele
christhekeele / mnemonix_repos.md
Last active Jul 2, 2017
How Mnemonix's repository pattern is implemented
View mnemonix_repos.md

Synopsis

Mnemonix is a key/value adapter library that employs a repository pattern. I wanted to support a few things with it:

  • Multiple 'feature sets'--collections of functions that may or may not be implemented for an adapter
  • A single unified API inside the core module incorporating all feature sets
  • Compile-time and runtime support for configuring repositories
  • Application-controlled and DIY repo supervision
  • The ability for library users to build custom modules with only particular feature sets
@christhekeele
christhekeele / ecto_adapter_custom.ex
Last active Aug 31, 2018
Scaffold for a full implementation of the Ecto Adapter behaviours. (Ecto v2.1.4)
View ecto_adapter_custom.ex
defmodule Ecto.Adapter.Custom do
####
# Ecto.Adapter
##
# TYPES
# @type t :: Ecto.Adapter.t
@type t :: Ecto.Adapter.Custom
@christhekeele
christhekeele / guard.ex
Last active Sep 17, 2016
Check quoted expressions for validity inside guards.
View guard.ex
defmodule Guard do
@guardables ~W[
== != === !== > >= < <=
and or not
+ - * /
<>
in
is_atom is_binary is_bitstring is_boolean
is_float is_function is_integer is_list
@christhekeele
christhekeele / mix.exs
Last active May 21, 2016
Local Git Repos for Mix
View mix.exs
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[app: :my_app,
version: "0.0.1",
elixir: "~> 1.2",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
@christhekeele
christhekeele / 1-indirect_uses_tracker.ex
Last active Mar 27, 2019
A way to track when modules are used in Elixir, and an example adapter/plugin architecture built on top.
View 1-indirect_uses_tracker.ex
# For simpler use cases, see the UsesTracker instead:
# https://gist.github.com/christhekeele/e858881d0ca2053295c6e10d8692e6ea
###
# A way to know, at runtime, what modules a module has used at compile time.
# In this case, you include `IndirectUsesTracker` into a module. When that module gets
# used in some other module, it makes that module registerable under a namespace of your choosing.
# When the registerable module is used into a third module, that third module will know at runtime which
# registerables were `use`d in it at compile time, via a function titled after the namespace.
You can’t perform that action at this time.