Skip to content

Instantly share code, notes, and snippets.

View mackuba's full-sized avatar
🌤️
Playing with Bluesky API

Kuba Suder mackuba

🌤️
Playing with Bluesky API
View GitHub Profile
@mackuba
mackuba / note_compiler.rb
Created June 6, 2020 00:55
Code for formatting hand-written plain text notes into formatted HTML
class NoteCompiler
def build(text, info)
note = NoteContent.new(text, info)
note.compile_html
end
class NoteContent
def initialize(text, info)
@text = text
@info = info
@mackuba
mackuba / log-exclude-bots.rb
Last active September 29, 2020 17:40
Scripts for processing Nginx logs for Piwik
#!/usr/bin/env ruby
require 'optparse'
require 'set'
$buffer = []
$current_day = nil
$validated = Set.new
$invert = false
@mackuba
mackuba / macbook-pro-2016.md
Created January 18, 2017 03:06
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.

Specs

  • MacBook Pro 15", late 2016
  • Core i7 2.9 GHz (4 cores)
@mackuba
mackuba / wwdc16.md
Last active March 5, 2023 21:28
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
mackuba / content_blocker_tips.md
Last active April 19, 2023 13:51
Tips for writing iOS content blockers - HelsinkiOS
  • read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
  • 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 foo.com might not match www.foo.com even though I think it’s supposed to (UPDATE: They've changed it in one of
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
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: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
@mackuba
mackuba / MKAnnotationView-v1.swift
Last active August 17, 2016 12:55
Swift MKAnnotationView WTF
/*
MKAnnotationView has one init listed in its documentation, initWithAnnotation:reuseIdentifier:, so let's override that.
But this causes a runtime exception:
fatal error: use of unimplemented initializer 'init(frame:)' for class 'PulsatingDotMarker'
*/
class PulsatingDotMarker: MKAnnotationView {
let innerCircle: UIView