Skip to content

Instantly share code, notes, and snippets.

View max's full-sized avatar
🏔️

Max Schoening max

🏔️
View GitHub Profile
@max
max / elysia-example.ts
Created November 25, 2023 23:14
elysia-example
import { Elysia, ErrorHandler, t } from "elysia";
import { logger } from "./lib/logger";
import bearer from "@elysiajs/bearer";
import config from "./lib/config";
import swagger from "@elysiajs/swagger";
import { OverlandSchema } from "./lib/overland";
class UnauthorizedError extends Error {
code = "UNAUTHORIZED";
status = 403;
@max
max / gist:5708466
Created June 4, 2013 18:54
Flat UI Colors as Sass variables
// I needed flatuicolors.com as Sass variables...
// In your console, run:
$('.color').get().map(function(el) { return "$" + el.classList[1] + ": " + el.getAttribute('data-clipboard-text') + ';' }).join('\r\n');
// Output:
// $turquoise: #1abc9c;
// $emerland: #2ecc71;
// $peter-river: #3498db;
// $amethyst: #9b59b6;
// $wet-asphalt: #34495e;
@max
max / content.md
Created September 11, 2020 15:07
Gist from Drafts

This is a wonderful Gist!

@max
max / mailer.rb
Last active March 23, 2020 16:44
A simple Ruby script to send mass emails
require 'mail'
require 'csv'
FILE = ARGV[0]
Mail.defaults do
delivery_method :smtp, {
address: '',
port: 587,
domain: '',
user_name: '',
name: My Cron Action
on:
schedule:
- cron: '*/15 * * * *'
jobs:
hello:
runs-on: ubuntu-latest
steps:
# If you need access to the source code of the repo
- uses: actions/checkout@v1
@max
max / i.sh
Last active April 24, 2019 17:33
#!/usr/bin/env sh
set -e
echo "Fetching fonts from Apple..."
curl -o /tmp/SF-Font.dmg https://developer.apple.com/design/downloads/SF-Font.dmg
hdiutil attach -nobrowse -quiet -noverify -noautoopen -mountpoint /Volumes/SF-Font /tmp/SF-Font.dmg
echo "Installing fonts..."
cp -R /Volumes/SF-Font/. /Library/Fonts/

The error handling for async/await with try/catch always bugs me. Go to the rescue?

function to(promise) {
  return promise
    .then(res => [null, data])
    .catch(err => [err])
}

async function doIt() {
<!DOCTYPE html>
<meta charset="utf-8">
<title>Radio Buttons</title>
<style>
input[type=radio] {
height: 16px;
opacity: 0;
position: absolute;
width: 16px;
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app