Skip to content

Instantly share code, notes, and snippets.

@supermarin
supermarin / combine-throttle-bug.swift
Created February 3, 2020 14:48
Smallest reproduction of Combine's throttle() timing bug
// Bug initially observed when throttling a frequent signal out of a socket.
// When throttled to .seconds(1), there were around 50 ticks in a 60 second interval.
//
// This example eliminates the frequent source and just uses a 1-second timer,
// throttled by a 1-seconds throttle function.
//
// Expected behavior: 60 ticks in a minute
// Acutal behavior: ~33 ticks in a minute
import Combine
import Foundation
Incident Identifier: D27A2F5A-9A2D-4470-9E21-1482AE1949E0
CrashReporter Key: 5198ebb12a2742430c65705de40ce9a9c18a70cc
Hardware Model: iPhone11,2
Process: Hello [17272]
Path: /private/var/containers/Bundle/Application/8EC26856-2582-4E2F-9C82-F213FF98CC3F/Hello.app/Hello
Identifier: com.hello.ios
Version: 3 (0.1)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
@supermarin
supermarin / snippet.m
Created October 23, 2018 20:17
fetching cached configuration using dispatch groups and early return
@interface ViewController ()
@end
@implementation ViewController
static dispatch_queue_t serialq;
static dispatch_queue_t concurrentq;
- (void)getConfigurationWithCompletion:(void (^)(NSString *))completionBlock {
static NSString *configuration;
@supermarin
supermarin / delete-contacts.swift
Last active March 22, 2016 07:40
Delete useless contacts from your address book
//
// main.swift
// deleteshit
//
// Created by Marin Usalj on 3/21/16.
// Copyright © 2016 supermar.in. All rights reserved.
//
import Foundation
import AddressBook
@supermarin
supermarin / -
Created September 24, 2015 01:36
#!/usr/bin/perl
#
# PackageApplication
#
# Copyright (c) 2009-2012 Apple Inc. All rights reserved.
#
# Package an iPhone Application into an .ipa wrapper
#
use Pod::Usage;
@supermarin
supermarin / .env
Last active April 2, 2024 13:57
Colored `man` pages on OSX
# ZSH / BASH users
# Add this to your .env, .bashrc, .zshrc, or whatever file you're using for environment
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
@supermarin
supermarin / unfuck.conf
Created April 17, 2014 22:20
Tmux defaults that everyone should have in
# unfuck the terminal colors
set -g default-terminal "screen-256color"
# unfuck the Esc
set -s escape-time 0
# unfuck mouse scrolling
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# unfuck copy and paste
@supermarin
supermarin / gist:10398301
Last active August 29, 2015 13:58
RSpec 3.0 beta
master $ rake ci
rspec -v
3.0.0.beta2
rspec spec --color
.......FF......................................................................................................
Failures:
1) XCPretty::Formatter initializes with unicode
Failure/Error: @formatter.use_unicode?.should be_true
### Keybase proof
I hereby claim:
* I am supermarin on github.
* I am supermarin (https://keybase.io/supermarin) on keybase.
* I have a public key whose fingerprint is 3273 1825 4E09 CEA1 DCFA 9451 8BE5 6326 1DA7 6B98
To claim this, I am signing this object:
# Reveal
command script import ~/.lldb/reveal.py