Skip to content

Instantly share code, notes, and snippets.

View michaelglass's full-sized avatar
🐡
I HAVE A LOT OF MARSHMALLOWS IN MY MOUTH

Michael Glass michaelglass

🐡
I HAVE A LOT OF MARSHMALLOWS IN MY MOUTH
View GitHub Profile
@michaelglass
michaelglass / README
Created January 10, 2024 11:59 — forked from jmatsushita/README
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
@michaelglass
michaelglass / obsidian-daily-note-template.txt
Created August 23, 2023 06:01 — forked from dannberg/obsidian-daily-note-template.txt
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[<% fileDate = moment(tp.file.title, 'YYYY-MM-DD-dddd').subtract(1, 'd').format('YYYY-MM-DD-dddd') %>|Yesterday]] | [[<% fileDate = moment(tp.file.title, 'YYYY-MM-DD-dddd').add(1, 'd').format('YYYY-MM-DD-dddd') %>|Tomorrow]] >>
---
#!/bin/bash
set -euo pipefail
# uncomment to debug
# set -x
echo "1️⃣. Does catalina know to create the nix directory?"
if ! grep nix /etc/synthetic.conf > /dev/null 2>&1; then
echo "nix missing from /etc/synthetic.conf. Adding it (will request sudo)"
echo "nix" | sudo tee -a /etc/synthetic.conf > /dev/null
@michaelglass
michaelglass / alerts_and_confirms.rb
Last active September 24, 2019 10:15
test alerts & confirms in poltergeist & capybara webkit
module AlertConfirmer
class << self
def reject_confirm_from &block
handle_js_modal 'confirm', false, &block
end
def accept_confirm_from &block
handle_js_modal 'confirm', true, &block
end
#!/bin/bash
#
# usage: invalidate-old-elm "src directories space delimeted" BRANCH_TO_COMPARE OPTIONAL_BRANCH_TO_COMPARE_DEFAULTS_TO_HEAD
# git diff --name-only gives us relative paths from git root
# git rev-parse --show-prefix this fetches the current directory's relative prefix to the git root
# we remove the prefix
prefix=$(git rev-parse --show-prefix)
for file in $(git diff --name-only $2 $3 | grep .elm$)
@michaelglass
michaelglass / package-lock.json
Created May 8, 2018 07:56
reproduces node 10 binwarp problems
{
"name": "test_repro",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
class Value
# alias_method is private, wah wah
singleton_class.send(:alias_method, :old_new, :new)
def self.new(*fields, &block)
klass = old_new(*fields, &block)
klass.instance_eval do
# Rails' as_json function calls `to_hash` internally and falls back to using `instance_variables`.
# `instance_variables` returns Value's internal `hash` attribute which we are not interested in.
<!DOCTYPE html>
<html>
<body>
<select id="backgroundColorSelector">
<option value="blue">Blue</option>
<option value="yellow">Yellow</option>
<option value="red">Red</option>
<option value="coral">Coral</option>
</select>
@michaelglass
michaelglass / README.md
Last active June 3, 2016 16:10
form assets

After downloading, running elm-make in the extracted directory should yield a renderable example.html.