Skip to content

Instantly share code, notes, and snippets.

View slothbear's full-sized avatar
๐Ÿ 
Working on Zocalo, club membership/newsletter tracking.

Paul Morganthall slothbear

๐Ÿ 
Working on Zocalo, club membership/newsletter tracking.
View GitHub Profile
@slothbear
slothbear / gist:69a243b2adbe9b39069dd3d63499c8db
Last active April 7, 2026 14:47 — forked from kylejohnston/gist:d403ca7887b482be771e62ebe049ee41
Karabiner Rule: caps l caps lock โ†’ hyper key ยฆ double-tap=f12, long-press=f8
{
"description": "caps lock โ†’ hyper key ยฆ double-tap=f12, long-press=f8",
"manipulators": [
{
"conditions": [
{
"name": "hyper_caps_tap",
"type": "variable_if",
"value": 1
}
import SwiftUI
extension BinaryInteger {
var evenOddDirection: Double {
self.isMultiple(of: 2) ? 1 : -1
}
}
struct ScrollingEmojiView: View {
@State private var direction = 1.0
import SwiftUI
struct ScrollingEmojiView: View {
@Environment(\.accessibilityReduceMotion) var reduceMotion
@State private var isAnimating = false
/*
In Personal Best (getpersonalbest.com) I get a random emoji to represent a workout type,
using an extension to HKWorkoutActivityType. Here I've stubbed it out with a more basic
implementation.

Villager mechanics in 1.14. All this data has been deduced by using the following commands:

/data get entity @e[type=minecraft:villager,limit=1,sort=nearest] Brain.memories
/execute as orlp at orlp run tellraw @s {"nbt":"Brain.memories","entity":"@e[type=villager,sort=nearest,limit=1]"}

A villager is awake from 0-11999 and tries to sleep between 12000 and 23999.

A villager will claim a bed if:

["โœŒ","๐Ÿ˜‚","๐Ÿ˜","๐Ÿ˜","๐Ÿ˜ฑ","๐Ÿ‘‰","๐Ÿ™Œ","๐Ÿป","๐Ÿ”ฅ","๐ŸŒˆ","โ˜€","๐ŸŽˆ","๐ŸŒน","๐Ÿ’„","๐ŸŽ€","โšฝ","๐ŸŽพ","๐Ÿ","๐Ÿ˜ก","๐Ÿ‘ฟ","๐Ÿป","๐Ÿถ","๐Ÿฌ","๐ŸŸ","๐Ÿ€","๐Ÿ‘€","๐Ÿš—","๐ŸŽ","๐Ÿ’","๐Ÿ’™","๐Ÿ‘Œ","โค","๐Ÿ˜","๐Ÿ˜‰","๐Ÿ˜“","๐Ÿ˜ณ","๐Ÿ’ช","๐Ÿ’ฉ","๐Ÿธ","๐Ÿ”‘","๐Ÿ’–","๐ŸŒŸ","๐ŸŽ‰","๐ŸŒบ","๐ŸŽถ","๐Ÿ‘ ","๐Ÿˆ","โšพ","๐Ÿ†","๐Ÿ‘ฝ","๐Ÿ’€","๐Ÿต","๐Ÿฎ","๐Ÿฉ","๐ŸŽ","๐Ÿ’ฃ","๐Ÿ‘ƒ","๐Ÿ‘‚","๐Ÿ“","๐Ÿ’˜","๐Ÿ’œ","๐Ÿ‘Š","๐Ÿ’‹","๐Ÿ˜˜","๐Ÿ˜œ","๐Ÿ˜ต","๐Ÿ™","๐Ÿ‘‹","๐Ÿšฝ","๐Ÿ’ƒ","๐Ÿ’Ž","๐Ÿš€","๐ŸŒ™","๐ŸŽ","โ›„","๐ŸŒŠ","โ›ต","๐Ÿ€","๐ŸŽฑ","๐Ÿ’ฐ","๐Ÿ‘ถ","๐Ÿ‘ธ","๐Ÿฐ","๐Ÿท","๐Ÿ","๐Ÿซ","๐Ÿ”ซ","๐Ÿ‘„","๐Ÿšฒ","๐Ÿ‰","๐Ÿ’›","๐Ÿ’š"]
@viraltux
viraltux / IChing
Last active August 31, 2016 23:32
R function returning six Yin Yang elements coded from 6 to 9 following the traditional method to obtain I Ching hexagrams as explained by Richard Whilhem book. http://aleadeum.com/2013/07/12/the-i-ching-random-numbers-and-why-you-are-doing-it-wrong
IChing = function(N=6){
set = NULL
for(i in 1:N){
sign = 0
hand = 0
for(j in 1:3){
left = sample(1:(48-hand),1)
right = 49-hand-left
pinky = 1 ; right = right - 1
anular = ifelse(left%%4==0,4,left%%4);
@bobbygrace
bobbygrace / trello-css-guide.md
Last active May 28, 2026 22:29
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examplesโ€ฆ check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

โ€œI perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and itโ€™s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.โ€

You often hear updog saying stuff like this. Whoโ€™s updog? Not much, who is up with you?

@tomlokhorst
tomlokhorst / Optional+Unwrap.swift
Last active December 26, 2017 19:50
Unwrap multiple optionals in Swift 1.0
func unwrap<T1, T2>(optional1: T1?, optional2: T2?) -> (T1, T2)? {
switch (optional1, optional2) {
case let (.Some(value1), .Some(value2)):
return (value1, value2)
default:
return nil
}
}
func unwrap<T1, T2, T3>(optional1: T1?, optional2: T2?, optional3: T3?) -> (T1, T2, T3)? {
@patmaddox
patmaddox / authorized_controller.rb
Created August 13, 2014 04:20
RubySteps 012 - Rails - Mini frameworks snippet
module AuthorizedController
# ... full code in the paid lesson
def show
resource = resource_by_id
if resource.viewable_by?(current_user)
render json: resource
else
render text: 'Unauthorized', status: :unauthorized
anonymous
anonymous / manifest.json
Created March 2, 2014 18:39
{
"manifest_version": 2,
"name": "Hacker News styles",
"version": "0.1",
"content_scripts": [{
"matches": ["https://news.ycombinator.com/*"],
"css": ["style.css"]
}]
}