Skip to content

Instantly share code, notes, and snippets.

@adactio
adactio / updateDateTimes.js
Last active September 11, 2023 05:10
Periodically update the text of `datetime` elements with the relative time elapsed.
(function (win, doc) {
'use strict';
if (!doc.querySelectorAll || !win.Intl || !win.Intl.RelativeTimeFormat) {
// doesn't cut the mustard.
return;
}
var rtf = new Intl.RelativeTimeFormat('en', {
localeMatcher: 'best fit',
numeric: 'always',
style: 'long'
@ttscoff
ttscoff / toot.rb
Last active April 28, 2023 04:58
Scans RSS feed for latest post and creates Mastodon toot
#!/usr/bin/env ruby -W1
# frozen_string_literal: true
# This script scans an RSS feed for the latest post, and if
# it hasn't already been posted to Mastodon, creates a new
# toot with a link to it.
require 'json'
require 'optparse'
require 'rss'
@chockenberry
chockenberry / ql.sh
Last active March 4, 2024 23:40
QuickLook for macOS shell
#!/bin/sh
# usage:
# ql /tmp/file.jpg
# cat /tmp/file.jpg | ql
# cal -h | ql
if [ -z "$*" ]; then
cat > /tmp/ql.stdin
mime_type=$(file --brief --mime-type /tmp/ql.stdin)
@kentcdodds
kentcdodds / session.server.ts
Created November 18, 2021 21:04
Authentication in Remix applications
import * as bcrypt from "bcrypt";
import { createCookieSessionStorage, redirect } from "remix";
import { db } from "./db.server";
export type LoginForm = {
username: string;
password: string;
};
@henrik242
henrik242 / Global macOS hotkeys for Google Meet, Spotify and others using AppleScript and Fastscripts.md
Last active July 5, 2024 22:12
Global macOS hotkeys for Google Meet, Spotify and others using AppleScript and Fastscripts
@alexlouden
alexlouden / 0_usage.js
Last active October 31, 2019 11:33
Custom styled scrollbars
import React from 'react'
import useCustomScrollbars, { scrollbarWidth } from './useCustomScrollbars'
const Container = React.forwardRef(({ bg, children, ...props }, ref) => {
const [localRef, scrollbarsShown, scrollbarStyles] = useCustomScrollbars(
children,
ref,
bg
)
@merlinmann
merlinmann / twitter-bios.md
Last active April 24, 2024 06:29
bios - Merlin likes to change his Twitter bio for some reason. #runx

Good Twitter Bios runx

Bios

The bar is in the globe.

This is a factory, not a circus.

I weigh less than a slice of bread.

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@joho
joho / staff_development.md
Created April 20, 2016 05:38
Follow on resources from a work talk I gave related to developing staff.
@synic
synic / emacs.md
Created October 15, 2015 00:12
Fixing dired in spacemacs

First, add dired+ to dotspacemacs-additional-packages, then...

Before user-config in .spacemacs:

(defvar ao/v-dired-omit t
  "If dired-omit-mode enabled by default. Don't setq me.")

(defun ao/dired-omit-switch ()
 "This function is a small enhancement for `dired-omit-mode', which will