Skip to content

Instantly share code, notes, and snippets.

@dominicfreeston
dominicfreeston / nine_slice.rb
Created March 16, 2023 22:02
nine-slice (stretching) for dragonruby
def nine_slice sprite
x = sprite.x
y = sprite.y
w = sprite.w
h = sprite.h
path = sprite.path
t_x = sprite.tile_x
t_y = sprite.tile_y
o_w = sprite.tile_w
o_h = sprite.tile_h
@dominicfreeston
dominicfreeston / AppearanceContainer.swift
Last active August 9, 2023 22:41
SwiftUI Transparent List Wrapper - Works in iOS 14
/// Wraps its content in a HostingViewController that has the backgroundColor of UITableView appearance
/// within it set to .clear, thus working around the issue where SwiftUI Lists always have white backgrounds,
/// without inadvertently affecting the appearance of all UITableViews in the app.
/// Setting the listRowBackground explicitly is still required, setting that to clear won't work.
struct ListAppearanceContainer<Content>: View, UIViewControllerRepresentable where Content: View {
let content: Content
class AppearanceContainerViewController<Content>: UIHostingController<Content> where Content: View {}
init(_ content: () -> Content) {
@dominicfreeston
dominicfreeston / browser-reloader-mac.clj
Last active May 12, 2022 21:33
Reload browser on file change (MacOS/AppleScript/babashka)
#!/usr/bin/env bb
(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/fswatcher "0.0.3")
(require '[pod.babashka.fswatcher :as fw])
(def app (or (second *command-line-args*) "Safari"))
(println "will reload" app)
@dominicfreeston
dominicfreeston / browser-reloader-ubuntu.clj
Last active May 12, 2022 21:30
Reload browser on file-change (Ubuntu/xdotool/babashka)
#!/usr/bin/env bb
(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/fswatcher "0.0.3")
(require '[pod.babashka.fswatcher :as fw])
(println "select window to reload")
;; This will block the script until the user has selected a window
(def browser-window (:out (shell/sh "xdotool" "selectwindow")))
@dominicfreeston
dominicfreeston / org.jenkins-agent.plist
Last active August 29, 2015 14:25
Jenkins Slave LaunchAgent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StandardOutPath</key>
<string>/Users/jenkins/jenkins-logs/jenkins-agent-out.log</string>
<key>StandardErrorPath</key>
<string>/Users/jenkins/jenkins-logs/jenkins-agent-out-err.log</string>
<key>KeepAlive</key>
<true/>

Keybase proof

I hereby claim:

  • I am dominicfreeston on github.
  • I am dominicfreeston (https://keybase.io/dominicfreeston) on keybase.
  • I have a public key whose fingerprint is 4395 0568 2404 E509 5920 183A A600 5535 CC88 382B

To claim this, I am signing this object: