Skip to content

Instantly share code, notes, and snippets.

View jsmestad's full-sized avatar
👾

Justin Smestad jsmestad

👾
View GitHub Profile
@Marlinski
Marlinski / BottomSheetScaffold.kt
Created October 23, 2022 21:48
port of BottomSheetScaffold for Material3
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
;; declare it here for Emacs < 28
(defmacro dlet (binders &rest body)
"Like `let' but using dynamic scoping."
(declare (indent 1) (debug let))
;; (defvar FOO) only affects the current scope, but in order for
;; this not to affect code after the main `let' we need to create a new scope,
;; which is what the surrounding `let' is for.
;; FIXME: (let () ...) currently doesn't actually create a new scope,
;; which is why we use (let (_) ...).
`(let (_)
(defface tree-sitter-hl-face:warning
'((default :inherit font-lock-warning-face))
"Face for parser errors"
:group 'tree-sitter-hl-faces)
(defun hook/tree-sitter-common ()
(unless font-lock-defaults
(setq font-lock-defaults '(nil)))
(setq tree-sitter-hl-use-font-lock-keywords nil)
(tree-sitter-mode +1)
@mattes
mattes / rails-google-compute-deploy.md
Last active April 3, 2024 19:47
My own Heroku in 30 mins

Deploy Rails apps to Google Cloud Compute Engine

  • Zero Downtime
  • Graceful shutdowns
  • Via Github Actions
  • Zero infrastructure management overhead

Overview

The general idea is to have Github Actions test, build and deploy a Rails app to Google Cloud Compute Engine.

@kyleVsteger
kyleVsteger / release.Dockerfile
Last active August 8, 2022 18:45
Multistage Elixir 1.11 Phoenix Live View Release Dockerfile
ARG ALPINE_VERSION=3.12.0
FROM hexpm/elixir:1.11.0-erlang-23.1.1-alpine-3.12.0 as builder
ARG APP_VSN="1.0.0"
# Replace `your_app` with your otp application name.
ENV APP_NAME=your_app \
APP_VSN=${APP_VSN} \
MIX_ENV=prod
@GlenCrawford
GlenCrawford / schema_dumper.rb
Created April 17, 2020 13:59
Patching Rails database schema dumps to support multiple PostgreSQL schemas.
# Overrides Rails file activerecord/lib/active_record/schema_dumper.rb to
# include all schema information in the db/schema.rb file, for example, in the
# create_table statements. This allows for a working development database
# to be built from a schema.rb file generated by rake db:schema:dump.
#
# This is essentially a rebuild of the "schema_plus_multischema" gem (which is
# unfortunately only compatible with Rails ~> 4.2).
#
# Tested with Rails 6.0.
@slashdotdash
slashdotdash / README.md
Last active September 2, 2022 12:51
Commanded middleware to enrich commands during dispatch, such as calling an external API.

Commanded middleware for command enrichment

Usage

Add the EnrichCommand middleware to your command router:

defmodule MyApp.Router do
  use Commanded.Commands.Router
 
@pvik
pvik / smartparens-cheatsheet.md
Last active March 17, 2024 03:29
A Cheatsheet for Emacs Smarparens example configuration

An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.

Traversal

C-M-f sp-forward-sexp
C-M-b sp-backward-sexp
@alphapapa
alphapapa / emacs-raise-or-run
Last active February 11, 2020 18:06
emacs-raise-or-run and org-git-add-commit
#!/bin/bash
# ** Vars
# *** Emacs version
if type emacs26 &>/dev/null
then
emacs="emacs26"
emacsclient="emacsclient26"
emacsWindowClass="Emacs"
@cainlevy
cainlevy / mobiledoc.rb
Created April 30, 2018 22:05
parsing mobiledoc in ruby
require 'keyword_struct'
Mobiledoc = KeywordStruct.new(:version, :markups, :atoms, :cards, :sections) do
Markup = Struct.new(:tag, :attrs)
Atom = Struct.new(:name, :text, :payload)
Card = Struct.new(:name, :payload)
# Parses a serialized Mobiledoc into a collection of Ruby objects
def self.parse(str)
json = JSON.parse(str)