Skip to content

Instantly share code, notes, and snippets.

@supermarin
supermarin / combine-throttle-bug.swift
Created Feb 3, 2020
Smallest reproduction of Combine's throttle() timing bug
View combine-throttle-bug.swift
// 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
View upload.crash
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 Oct 23, 2018
fetching cached configuration using dispatch groups and early return
View snippet.m
@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 Mar 22, 2016
Delete useless contacts from your address book
View delete-contacts.swift
//
// main.swift
// deleteshit
//
// Created by Marin Usalj on 3/21/16.
// Copyright © 2016 supermar.in. All rights reserved.
//
import Foundation
import AddressBook
View -
#!/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 Apr 21, 2021
Colored `man` pages on OSX
View .env
# 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 Apr 17, 2014
Tmux defaults that everyone should have in
View unfuck.conf
# 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 Aug 29, 2015
RSpec 3.0 beta
View gist:10398301
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
View gist:9966278
### 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:
View .lldbinit
# Reveal
command script import ~/.lldb/reveal.py