Skip to content

Instantly share code, notes, and snippets.

@jamiedumont
jamiedumont / composite_component.ex
Last active August 24, 2020 11:51
"Typeahead" style autocomplete in LiveView form
defmodule RecordWeb.CompositeComponent do
use RecordWeb, :live_component
alias Record.Movements
alias Record.Core.Composite
import Ecto.Changeset
def update(assigns, socket) do
movement = case input_value(assigns.composite_form, :movement_id) do
nil -> nil
movement_id -> Movements.get_movement!(movement_id)
@jamiedumont
jamiedumont / nord.js
Last active May 1, 2019 11:27
Nord theme for Blink.sh
cursor = "#d8dee9";
//cursor_foreground = "#2e3440";
foreground = "#d8dee9";
//foreground_bold = "#d8dee9";
background = "#2e3440";
//highlight = "#4c566a";
color0 = "#3b4252";
black = '#0a0f14';
red = '#c23127'; // red
green = '#2aa889'; // green
yellow = '#edb442'; // yellow
blue = '#195466'; // blue
magenta = '#4e5166'; // pink
cyan = '#33859e'; // cyan
white = '#99d1ce'; // light gray
lightBlack = '#10151b'; // medium gray
lightRed = '#d26936'; // red
@jamiedumont
jamiedumont / system76_colours.scss
Created August 11, 2018 07:24
System76 colours
// Pop uses the System76 palette
$almost_white: #f2f2f2;
$warm_gray: #574f4a;
$dark_gray: #574e4a;
$dark_neutral_gray: #333;
$light_gray: #aaa;
$literally_black: #000;
$medium_gray: #888;
$white: #fff;
@jamiedumont
jamiedumont / pop_os.vim
Created August 11, 2018 07:13
Pop!_OS theme for Vim
" Author: Jamie Dumont <jamiedumont@icloud.com>
" Version: 0.1.0
" License: MIT
" Theme constructed using the same format as vim-gotham, built by
" Andrea Leopardi - https://github.com/whatyouhide/vim-gotham
" Bootstrap ===================================================================
hi clear
@jamiedumont
jamiedumont / gotham.js
Last active February 1, 2017 09:09
Gotham theme for Blink SH
black = '#0a0f14';
red = '#c23127'; // red
green = '#2aa889'; // green
yellow = '#edb442'; // yellow
blue = '#195466'; // blue
magenta = '#4e5166'; // pink
cyan = '#33859e'; // cyan
white = '#99d1ce'; // light gray
lightBlack = '#10151b'; // medium gray
lightRed = '#d26936'; // red
@jamiedumont
jamiedumont / haversine-distance.js
Created January 13, 2016 15:13
High performance JS function to return distance between two points using Haversine formula
function distance(lat1, lon1, lat2, lon2) {
var deg2rad = Math.PI / 180;
lat1 *= deg2rad;
lon1 *= deg2rad;
lat2 *= deg2rad;
lon2 *= deg2rad;
var diam = 12742; // Diameter of the earth in km (2 * 6371)
var dLat = lat2 - lat1;
var dLon = lon2 - lon1;
var a = (