Skip to content

Instantly share code, notes, and snippets.

View patr1ck's full-sized avatar
🏫
Retooling...

Patrick B. Gibson patr1ck

🏫
Retooling...
View GitHub Profile
@patr1ck
patr1ck / ghost-on-dokku.md
Last active January 21, 2024 05:57
Self-hosting Ghost on Dokku

Ghost on Dokku

Last updated: Jan 20 2024

This guide assumes you already have a functioning Dokku installation, along with the Dokku MySQL plugin and the Dokku letsencrypt plugin. It also assumes you want to use ghost at the root of a domain.

Create your app

dokku apps:create ghostblog.com
@patr1ck
patr1ck / KeyboardListener.swift
Last active February 21, 2018 22:55
A simple extension for handling keyboard shows/hides
//
// KeyboardListener.swift
//
// Created by Patrick B. Gibson on 7/16/16.
//
import UIKit
protocol KeyboardListener: AnyObject {
var view: UIView! { get }

Keybase proof

I hereby claim:

  • I am patr1ck on github.
  • I am patr1ck (https://keybase.io/patr1ck) on keybase.
  • I have a public key whose fingerprint is 198B 2618 BC9C 418D 0AEB 0A7C 145B D15C 8361 DB5B

To claim this, I am signing this object:

@patr1ck
patr1ck / ternary.swift
Created January 2, 2017 01:58
Ternary Swift 3 Operators Example
import Foundation
precedencegroup GreaterBPrecedence {
associativity: left
higherThan: LogicalConjunctionPrecedence
}
precedencegroup EqualBPrecedence {
associativity: left
higherThan: GreaterBPrecedence
@patr1ck
patr1ck / Additions.swift
Created August 25, 2016 20:46
Swift (2.3) Snippets
extension CollectionType {
/// Returns the element at the specified index iff it is within bounds, otherwise nil.
subscript (safe index: Index) -> Generator.Element? {
return indices.contains(index) ? self[index] : nil
}
}
extension Int {
func times(thing: Void -> Void) -> Void {
for _ in 0..<self {
@patr1ck
patr1ck / main.swift
Last active August 25, 2016 20:43
Polymorphic Function Returns in Swift
// In Swift, functions can be defined with identical parameter types, but different return types.
func isHello(string: String) -> Bool {
if string == "Hello" {
return true
} else {
return false
}
}
@patr1ck
patr1ck / Info.plist
Created June 19, 2013 20:19
This script open all videos on the developer.apple.com/wwdc/videos page. Put these two files in a directory called WWDCAccordionSmash.safariextz, and open in Safari.
<?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>Author</key>
<string>Patrick B. Gibson</string>
<key>Builder Version</key>
<string>8536.30.1</string>
<key>CFBundleDisplayName</key>
<string>WWDC Accordion Smash</string>

Keybase proof

I hereby claim:

  • I am patr1ck on github.
  • I am patr1ck (https://keybase.io/patr1ck) on keybase.
  • I have a public key whose fingerprint is 2BF0 3AAF EB33 4E47 C823 2F1F 98D8 5AFE 2729 A3D5

To claim this, I am signing this object: