Skip to content

Instantly share code, notes, and snippets.


Krzysztof Zabłocki krzysztofzablocki

View GitHub Profile
skeeet /
Created April 12, 2012 13:35 — forked from MaximKeegan/
Create a RAM disk for using with XCode
# Create a RAM disk with same perms as mountpoint
# Script based on with some additions
# Usage: sudo ./ start
pztrick / fancyimage_tag.rb
Created June 21, 2012 01:33
Jekyll Image plugin that dynamically creates thumbnails and fancyboxes for uploaded images
View fancyimage_tag.rb
# Title: Fancyimage tag for Jekyll
# Authors: Devin Weaver (photos_tag.rb), Brian M. Clapper (img_popup.rb), Patrick Paul (this gist)
# Description: Takes full size image, automagically creates thumbnail at specified size, +fancybox
# Adapted from:
# (photos_tag.rb)
# (img_popup.rb)
# Syntax {% photo filename [tumbnail] [title] %}
alloy /
Created June 28, 2012 12:56
Run iOS unit tests (in a Xcode workspace) when a file changes and *only* those tests related to the changed file. Also trims otest output and colors test results.
piscisaureus /
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

steipete / gist:3933090
Created October 22, 2012 18:13
Simple main thread usage detector that I'm using in PSPDFKit to find performance problems early on.
View gist:3933090
// Smart little helper to find main thread hangs. Enable in appDidFinishLaunching.
// Only available with source code in DEBUG mode.
@interface PSPDFHangDetector : NSObject
+ (void)startHangDetector;
@implementation PSPDFHangDetector
+ (void)startHangDetector {
#ifdef DEBUG
steipete / gist:4233987
Created December 7, 2012 15:32
Print a CGPath
View gist:4233987
extern void CGPathPrint(CGPathRef path, FILE* file);
CGPathPrint(path.CGPath, NULL);
Path 0xb44e380:
moveto (-12, 295)
lineto (115, 295)
lineto (108, -12)
lineto (235, -12)
markd2 / spy.d
Created May 17, 2013 01:56
Look at objective-C messages being sent in an application running in the simulator. "Interesting" symbols (configured in the first BEGIN block, or one provided on the command line) will get stack traces dumped. "ignored" symbols are not logged.
View spy.d
#!/usr/sbin/dtrace -s
/* Run like:
% sudo csh
Prints a line of dashes every 5 seconds to delineate different experiments.
#pragma D option quiet
steipete / PSPDFViewController.h
Last active June 6, 2017 03:56
This method will help to prevent a lot of emails about "weird bugs".
View PSPDFViewController.h
// Defines a yet undocumented method to add a warning if super isn't called.
#if __has_attribute(objc_requires_super)
#define NS_REQUIRES_SUPER __attribute((objc_requires_super))
@interface UIViewController (SubclassingWarnings)
steipete / PSPDFUIKitMainThreadGuard.m
Last active September 20, 2023 10:29
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
View PSPDFUIKitMainThreadGuard.m
// Taken from the commercial iOS PDF framework
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 ( if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
View gist:5760217
In order for this to work you need ffmpeg. I tried with version 1.2.1.
1) Play the video you want to download in the browser
2) Inspect the video element on the page
3) Copy the video url from the page source (something like
4) In this url replace "" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?)
5) Execute `ffmpeg -y -i output.mp4`
6) There is your video :)