Skip to content

Instantly share code, notes, and snippets.

config.assume_ssl = true
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
...
# based on https://github.com/Purple-Devs/health_check/issues/25#issuecomment-432819017
config.ssl_options = { redirect: { exclude: ->(request) { request.path == '/up' } } }
# and/or
@patricksimpson
patricksimpson / Space.jsx
Last active October 18, 2022 23:30
Just an idea
const Space = ({
margin,
marginRight,
marginLeft,
marginTop,
marginBottom,
padding,
bottom,
top,
left,
@patricksimpson
patricksimpson / simple-date.js
Last active January 19, 2022 23:52
date string to local
function dateToLocal(date) {
let localOffset = new Date().getTimezoneOffset() * 60 * 1000;
let d = new Date(Date.parse(date));
return new Date(d.getTime() + localOffset);
}
{
"createdBy": "Redirector v3.5.3",
"createdAt": "2021-10-16T12:28:52.532Z",
"redirects": [
{
"description": "Medium -> Scribe",
"exampleUrl": "https://medium.com/@user/post-123456abcdef",
"exampleResult": "https://scribe.rip/@user/post-123456abcdef",
"error": null,
"includePattern": " *medium.com/(.*)",
#!/bin/sh
dir=app
files=*.js
output=dist.js
find $dir/$files -exec cat {} \; > $output
while true; do
watch -d -g ls -lR $dir/$files
! undo any meta keys already set
clear Mod1
! keycodes 63 and 71 are the left and right COMMAND buttons adjacent to the spacebar; set them to be control keys
keycode 63 = Control_L
keycode 71 = Control_R
! keycodes 66 and 69 are the option/alt keys; assign them as Meta keys
keycode 66 = Escape NoSymbol Escape
keycode 69 = Meta_R
xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
xmodmap -e "keycode 133 = Alt_L"
xmodmap -e "keycode 37 = Control_L"
xmodmap -e "keycode 64 = Control_L"
{
"name": "test",
"version": "1.0.0",
"description": "Hello.",
"main": "index.js",
"scripts": {
"cachebust": "cachebust"
},
"author": "",
"license": "ISC",
#!/usr/bin/env ruby
$prefix = 'com.apple.TimeMachine.'
$host = 'rsync'
$repo = 'laptop'
# Where the snapshot will be mounted.
$mount = "#{Dir.home}/borg"
$ref_file = "#{Dir.home}/.borg-snapshot"
# Define exclusions here.
# https://borgbackup.readthedocs.io/en/latest/usage/help.html#borg-help-patterns
$exclude_file = "#{Dir.home}/.borg-exclude.txt"