Skip to content

Instantly share code, notes, and snippets.

View ctrlShiftBryan's full-sized avatar

Bryan Arendt ctrlShiftBryan

View GitHub Profile
@ctrlShiftBryan
ctrlShiftBryan / absynth.ex
Created November 5, 2020 12:53
elixir absinth string key map middle ware
# We are changing absithe here so that it expects maps with string keys instead
# of maps with atom keys when it resolves :user object
#
# Out of the box absinthe is optimized for using with something like ecto
# that would normally use an ecto schema (which have atom keys).
# Instead we are working with api responses and we don't need
# the overhead converting our maps to maps with atom keys.
def middleware(
middleware,
%{identifier: identifier} = field,
@ctrlShiftBryan
ctrlShiftBryan / HowToPaveAMachine.md
Last active November 13, 2022 00:58
How To Prevision OSX
  1. Chrome
  2. VSCode
  1. enable desktop spaces shortcut
  • System Preferences -> Keyboard -> Shortcuts -> Mission Control
  • Move left a space ctrl+shift+h
  • Move right a space ctrl+shift+l
  1. install cascadia code font
require 'digest/md5'
Digest::MD5.hexdigest(File.read('Gemfile.lock'))
@ctrlShiftBryan
ctrlShiftBryan / regex.md
Last active October 29, 2018 01:59
REGEX for SQL DDL
\]\ \[varchar\].+\ (NULL|NOT NULL),
\] \[datetime\].+,
@ctrlShiftBryan
ctrlShiftBryan / how_to.sh
Created June 5, 2018 14:51
Curl Chromedriver
curl -XPOST http://localhost:9515/session -d '{"desiredCapabilities":{"browserName":"chrome", "chromeOptions":{"args":["--headless"]}}}'
@ctrlShiftBryan
ctrlShiftBryan / expose.ex
Created February 26, 2018 15:04
expose private functions in elixir for tests
@compile if Mix.env == :test, do: :export_all
$('.venue:eq(15)').click()
@ctrlShiftBryan
ctrlShiftBryan / how_to.md
Last active January 21, 2018 13:59
resize .dmg

sudo dd if=/dev/sdb of=./sdb.raw VBoxManage convertdd sdb.raw sdb.vdi --format VDI

VBoxManage modifyhd --resize 30000 ~/Documents/VM/Windows10.vdi VBoxManage showhdinfo ~/path/to/vmdrive.vdi

Gparted right Click both sd2 and sd5 and chose "Deactivate". resize the extended (sda2) partition. resize the lvm (sda5) partition.

@ctrlShiftBryan
ctrlShiftBryan / pure_functions.js
Created January 10, 2018 14:27
Pure Functions.
//this is not a pure function because it has a 'hidden input' of the current date.
function addDay(days) {
var currentDate = new Date();
return currentDate.setDate(currentDate.getDate() + days);
}
//this is not a pure function because it has a 'hidden output' of the times called.
var timesCalled = 0;
function addDay(days, currentDate) {
@ctrlShiftBryan
ctrlShiftBryan / delete_files_older_than.md
Created December 21, 2016 13:46
delete files older than

find /path/to/files* -mtime +5 -exec rm {} ;