Skip to content

Instantly share code, notes, and snippets.

Learning SwiftUI

Kuba Suder mackuba

Learning SwiftUI
View GitHub Profile
mackuba /
Last active Mar 29, 2022
How to create toolbar buttons in AppKit

Creating toolbar buttons

Recently I was writing a post about NSButton styles on my blog, and when I got to the part about toolbar buttons (Textured Rounded), I realized that I actually had no idea how to create a toolbar in AppKit, so I had to do some research first. I found some help in this sample project from Apple and this project on GitHub, and then I did some experiments with different combinations of things to see what works where.

This could probably be a whole separate blog post on its own (and maybe I'll make this into one), but for now I've put it here to not make that main article even longer.

Here's what I've found:

There are a few different kinds of buttons you can put in the toolbar:

mackuba / download_wwdc.rb
Last active Sep 12, 2021
Script for downloading all WWDC videos from a JSON feed
View download_wwdc.rb
#!/usr/bin/env ruby
# 06/2021:
# 11/2020:
# 5/2019:
# 8/2017:
# 5/2016:
require 'fileutils'
require 'json'
mackuba /
Created Nov 2, 2020
Script to hide cookier banner in Deezer's Electron app
set -e
set -x
cd /Applications/
mackuba / note_compiler.rb
Created Jun 6, 2020
Code for formatting hand-written plain text notes into formatted HTML
View note_compiler.rb
class NoteCompiler
def build(text, info)
note =, info)
class NoteContent
def initialize(text, info)
@text = text
@info = info
View wwdc_video_links.json
mackuba / log-exclude-bots.rb
Last active Sep 29, 2020
Scripts for processing Nginx logs for Piwik
View log-exclude-bots.rb
#!/usr/bin/env ruby
require 'optparse'
require 'set'
$buffer = []
$current_day = nil
$validated =
$invert = false
mackuba /
Created Jan 18, 2017
MacBook Pro 2016 - an iOS developer's review

MacBook Pro 2016 - an iOS developer's review

Here are some thoughts about my new MacBook Pro that I've been using for the last few weeks (the Santa Claus from DHL brought it to me just before Christmas), hopefully this will help someone who's considering getting one.

Note: this is written from the perspective of a person who switched to the MBP from a 2015 13" MacBook Air (i7) and also has a 2012 21" iMac. Your experiences will obviously be different if you have e.g. a fairly recent 15" Retina MacBook Pro.


  • MacBook Pro 15", late 2016
  • Core i7 2.9 GHz (4 cores)
mackuba /
Last active Dec 7, 2019
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).

OSX → macOS 10.12 Sierra

mackuba /
Last active Oct 27, 2021
Tips for writing iOS content blockers - HelsinkiOS
  • read this first:
  • start by adding a new extension target to your iOS app of type “content blocker”
  • launch the app using the main target’s scheme + a call to SFContentBlockerManager.reloadContentBlockerWithIdentifier() with the extension’s id in application:didFinishLaunchingWithOptions: to auto-reload the blocker in development mode
  • if you don’t call reloadContentBlockerWithIdentifier() then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving)
  • use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
  • things like periods in the url-filter regexp need to be escaped with double backslashes, e.g. facebook\\.net
  • if you use if-domain, it needs to be an array, even for one element
  • domain might not match even though I think it’s supposed to (UPDATE: They've changed it in one of
mackuba /
Last active Dec 28, 2020
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them:

OS X El Capitan

  • split view - two apps side by side on full screen