Skip to content

Instantly share code, notes, and snippets.

View markmals's full-sized avatar

Mark Malstrom markmals

View GitHub Profile
@markmals
markmals / Emulator.md
Last active October 10, 2023 16:36
Guides for setting up a Linux computer to play video games in emulators
@markmals
markmals / Wiggle.swift
Last active March 30, 2025 12:15
The iOS Home Screen wiggle animation, in SwiftUI
import SwiftUI
extension View {
func wiggling() -> some View {
modifier(WiggleModifier())
}
}
struct WiggleModifier: ViewModifier {
@State private var isWiggling = false
extension Array {
func combine(_ numberOfElements: Int) -> [[Element]] {
guard numberOfElements > 0 else { return [.init()] }
guard let first = first else { return [] }
return Array(dropFirst())
.combine(numberOfElements - 1)
.map { [first] + $0 } +
Array(dropFirst())
.combine(numberOfElements)
@markmals
markmals / transcode.sh
Last active June 16, 2020 01:08
Transcode video files to Apple-compatible HEVC using ffmpeg
if [[ -d "$1" ]]; then
for file in "$1"/**/*(.); do
ext="${file##*.}"
if [[ $ext == "mkv" ]] || [[ $ext == "mp4" ]] || [[ $ext == "avi" ]]; then
transcode "$file"
fi
done
trash "$1"
import tweepy # pip3 install tweepy
import json
from datetime import datetime, timedelta, timezone
CONSUMER_KEY = "**********"
CONSUMER_SECRET = "**********"
def oauthLogin(consumerKey, consumerSecret):
auth = tweepy.OAuthHandler(consumerKey, consumerSecret)
authURL = auth.get_authorization_url()
@markmals
markmals / String+formattedForPlex.swift
Last active October 14, 2018 06:07
Format a file name of a video to the correct Plex format
extension String {
var formattedForPlex: String {
var newName = self
// Remove all text at the end
let regexEndText = "\\d{3,4}p.+"
if let range = newName.range(of: regexEndText, options: .regularExpression) {
newName.removeSubrange(range)
}
@markmals
markmals / Swift Wish List.md
Last active June 12, 2022 21:10
Features I would like to see from Swift and its core ecosystem

Swift Wish List

Features I would like to see from Swift and its core ecosystem, to make it a robust and ergonomic language for all use cases.

  • ❌ = Unimplemented
  • 📜 = Manifesto
  • ⚾️ = Pitch
  • 💍 = Proposal
  • ⛔️ = Partially Implemented / Awaiting Implementation
  • ⚠️ = In Active Review