Skip to content

Instantly share code, notes, and snippets.

@halostatue
halostatue / async_assigns.ex
Created June 15, 2023 03:43 — forked from aglassman/async_assigns.ex
LiveView - Async Assigns Helper
defmodule AsyncAssigns do
import Phoenix.LiveView, only: [connected?: 1, assign: 2, assign: 3]
@doc """
Provides ability to assign default values to the socket, and kick off a
process that will send a message to the LiveView. The message payload will
be assigned as specified.
## Usage
Add the following lines to a specific LiveView, or to the web module
@halostatue
halostatue / safari-nomodule.js
Created October 28, 2022 23:23 — forked from samthor/safari-nomodule.js
Safari 10.1 `nomodule` support
/*
* Copyright 2017 Google LLC
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@halostatue
halostatue / obsidian-web-clipper.js
Last active January 11, 2022 05:29 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([
import("https://unpkg.com/turndown@7.0?module"),
import("https://unpkg.com/@tehshrike/readability@0.2"),
]).then(([{ default: Turndown }, { default: Readability }]) => {
const vault = ""; /* Optional vault name */
const folder = prompt(
"Folder: ",
"Clippings/",
); /* Optional folder name such as "Clippings/" */
const tags = `#clippings ${prompt("Tags", "#to_read")}`; /* Optional tags */
@halostatue
halostatue / mjml-2-mjml-and-txt.sh
Created August 6, 2020 13:39 — forked from brasilikum/mjml-2-mjml-and-txt.sh
turn mjml into html and txt.
# Check if mjml is installed
if ! [ -x "$(command -v mjml)" ]; then
echo 'Error: mjml is not installed. Install with "npm install -g mjml"' >&2
exit 1
fi
# Check if html-to-text is installed
if ! [ -x "$(command -v html-to-text)" ]; then
echo 'Error: html-to-text is not installed. Install with "npm install -g html-to-text"' >&2
exit 1
fi
@halostatue
halostatue / service-checklist.md
Created September 20, 2016 18:19 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?