Skip to content

Instantly share code, notes, and snippets.

Natan Rolnik natanrolnik

Block or report user

Report or block natanrolnik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Withable.swift
/// Withable is a simple protocol to make constructing
/// and modifying objects with multiple properties
/// more pleasant (functional, chainable, point-free)
public protocol Withable {
public extension Withable {
/// Construct a new instance, setting an arbitrary subset of properties
init(with config: (inout Self) -> Void) {
davimacedo /
Last active Jan 27, 2020
Example of importing data with cloud functions. See a live example at
curl -X POST \
-H "X-Parse-Application-Id: LL9oIdzIkmwl5xyowQQu0fTmXyUWfet9RuAzwHfj" \
-H "X-Parse-REST-API-Key: R3S8PYQKuzeV4c8MUeO5ved46C50MEp56boDHW1O" \
-H "Content-Type: application/json" \
-d @data.json \
View UIView+Snapshots.swift
import UIKit
// Snapshot utilities
extension UIView {
func snapshotView(view: UIView, afterUpdates: Bool) -> UIView {
let snapshot = view.snapshotViewAfterScreenUpdates(afterUpdates)
snapshot.frame = convertRect(view.bounds, fromView: view)
return snapshot
henrik /
Last active Jan 20, 2020
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.


Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)
ssh henroku dokku
steipete / UIPopoverPresentationController+PSPDFAdditions.m
Last active Jun 27, 2016
If you're annoyed about the incorrect arrow presentation on popovers ( use this category. Oh, and file a radar! I did.
View UIPopoverPresentationController+PSPDFAdditions.m
@implementation UIPopoverPresentationController (PSPDFAdditions)
+ (void)load {
PSPDFSwizzleMethodImplementation(self, @selector(containerViewWillLayoutSubviews), ^(UIPopoverPresentationController *_self) {
// Refresh bar button view internals
[_self pspdf_updateBarButtonView];
((void( *)(id, SEL))objc_msgSend)(_self, PSPDFPrefixedSelector(containerViewWillLayoutSubviews));
mackuba /
Last active Apr 9, 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
View Simple Scrolling UIStackView
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at
// @twostraws
import UIKit
alvesjtiago / gist:e2c61eb288c9d488a8cc
Last active Aug 29, 2015
Remove alpha channel and transparencies from images for AppStore screenshots.
View gist:e2c61eb288c9d488a8cc
# Run the following code on a folder that contains all your images
for f in *.png; do convert "$f" -background white -alpha remove -flatten -alpha off "$f"; done
jpsim / MyTableViewController.m
Created Aug 19, 2014
Grouped UITableView using Realm
View MyTableViewController.m
// Copyright 2014 Realm Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
irace / gist:927f843cb0f683a7f2c2
Created Aug 13, 2014
New iOS 8 APIs don't allow you to use a custom presentation controller for compact devices, in conjunction with a popover on "normal" size class devices
View gist:927f843cb0f683a7f2c2
// ViewController.m
// PopoverPresentationControllerExample
// Created by Bryan Irace on 8/8/14.
// Copyright (c) 2014 Bryan Irace. All rights reserved.
#import "CustomCompactPresentationController.h"
#import "ViewController.h"
You can’t perform that action at this time.