Skip to content

Instantly share code, notes, and snippets.

View avescodes's full-sized avatar

Avery Quinn avescodes

View GitHub Profile
@avescodes
avescodes / sexp-cheat-sheet
Created September 13, 2017 19:21 — forked from dylanmcdiarmid/sexp-cheat-sheet
vim sexp mappings for normal people cheat sheet
.vimrc
" Map leader to comma
let maplocalleader=","
" Toggle this for vim-sexp to not go into insert mode after wrapping something
let g:sexp_insert_after_wrap = 0
" Toggle this to disable automatically creating closing brackets and quotes
let g:sexp_enable_insert_mode_mappings = 1
Vocab
A B C D E
A
B 16
C 15 4
D 8 7 8
E 10 3 6 11
@avescodes
avescodes / Editing Clojure with Emacs
Last active July 5, 2022 13:32
Get started editing Clojure in Emacs with this basic config.
Check out README.md to get started editing Clojure with Emacs.
@avescodes
avescodes / gist:e5d1acbb007f47655508
Created August 18, 2014 18:42
Great little snippet for using Postgres enum types inside clojure.java.jdbc
(defn keyword->pg-enum
"Convert a keyword value into an enum-compatible object."
[enum-type kw]
(doto (org.postgresql.util.PGobject.)
(.setType enum-type)
(.setValue (name kw))))
(def ->status
"Convert a keyword status into a something_status enum object"
(partial keyword->pg-enum "something_status"))
require 'fastercsv'
task 'usda:import' => ['usda:import:food_items','usda:import:food_groups','usda:import:nutrients','usda:import:food_item_nutrients', 'usda:import:weights']
namespace :usda do
namespace :import do
task :food_items => :environment do
puts "Importing Food Items..."
fname = File.join(RAILS_ROOT,"/db/usda_sr21/FOOD_DES.txt")
require 'fastercsv'
task 'usda:import' => ['usda:import:food_items','usda:import:food_groups','usda:import:nutrients','usda:import:food_item_nutrients', 'usda:import:weights']
namespace :usda do
namespace :import do
task :food_items => :environment do
puts "Importing Food Items..."
fname = File.join(RAILS_ROOT,"/db/usda_sr21/FOOD_DES.txt")
@avescodes
avescodes / .projections.json
Created February 12, 2018 18:27
Projectionist Projections for Phoenix 1.3
{
"lib/*.ex": {
"type": "module",
"alternate": "test/{}_test.exs"
},
"test/*_test.exs": {
"type": "test",
"alternate": "lib/{}.ex"
},
@avescodes
avescodes / resources.md
Created June 28, 2012 19:26 — forked from alandipert/resources.md
Clojure training additional resources
#!/usr/bin/env bash
pattern=$1
PORTS=""
if [ -z "$pattern" ]; then
PORTS=$(lsof -iTCP -sTCP:LISTEN)
else
PORTS=$(lsof -iTCP -sTCP:LISTEN | grep "$pattern")
fi
@avescodes
avescodes / core.clj
Last active May 9, 2016 07:58
Minimal Pedestal service without default interceptors or dev tooling machinery. Automatically reloads changes.
(ns my-todo.core
(:require [io.pedestal.http :as http]
[io.pedestal.http.route :refer [router]]
[io.pedestal.http.route.definition :refer [defroutes]]))
(defn hello-world [context]
{:status 200
:body "Hello, world!"
:headers {}})