Skip to content

Instantly share code, notes, and snippets.

@chrishannah
chrishannah / table.swift
Created June 8, 2018 08:43
Example code for the post "Hiding Extra Separators on a UITableView" on blog.chrishannah.me
import PlaygroundSupport
import UIKit
class DataSource: NSObject, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@chrishannah
chrishannah / Blogs.opml
Created January 27, 2021 17:14
Current RSS subscriptions as of 27/01/2021
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
<head>
<title>Bloggers</title>
</head>
<body>
<outline title="Personal" text="Personal">
<outline text="Blog – Cal Newport" type="rss" htmlUrl="https://www.calnewport.com" xmlUrl="https://feeds.feedburner.com/StudyHacks" title="Blog – Cal Newport" />
<outline type="rss" title="Matt Gemmell" text="Matt Gemmell" htmlUrl="http://mattgemmell.com/" xmlUrl="https://mattgemmell.com/atom-nosponsor.xml?utm_source=MattGemmell.com+Members&amp;utm_campaign=311f4cf54b-Writers_Life_Newsletter_0073&amp;utm_medium=email&amp;utm_term=0_3fbd89148b-311f4cf54b-135530901" />
<outline xmlUrl="http://kylesethgray.com/rss/" htmlUrl="https://kylesethgray.com/" text="Kyle Seth Gray" title="Kyle Seth Gray" type="rss" />
@chrishannah
chrishannah / iOS Icon Sizes.md
Last active February 15, 2022 23:43
A list containing all the icon names and sizes for iOS and watchOS.

iOS 12 Icon Sizes

(Taken from Xcode 10)

iPhone

iPhone Notification (iOS 7-12) 20pt

  • 2x - 40px
  • 3x - 60px
@chrishannah
chrishannah / InsetLabel.swift
Last active March 12, 2022 14:01
A simple subclass of UILabel that allows you to add content insets to pad the content.
import UIKit
class InsetLabel: UILabel {
var contentInsets = UIEdgeInsets.zero
override func drawText(in rect: CGRect) {
let insetRect = UIEdgeInsetsInsetRect(rect, contentInsets)
super.drawText(in: insetRect)
}
@chrishannah
chrishannah / ghost-mass-post-delete.sh
Created December 31, 2022 17:23
A bash script that allows you to mass delete blog posts from a Ghost blog via a text file of post ids.
#!/usr/bin/env bash
# Admin API key goes here
KEY="this is your admin api key"
# Split the key into ID and SECRET
TMPIFS=$IFS
IFS=':' read ID SECRET <<<"$KEY"
IFS=$TMPIFS