Skip to content

Instantly share code, notes, and snippets.

View kovpas's full-sized avatar

Pavel 'Pasha' Mazurin kovpas

View GitHub Profile
@berikv
berikv / gifify
Last active December 21, 2021 16:51
Transform a movie file to a gif. Specialised for demo's of Mobile app screen recordings.
#!/bin/bash
FFMPEG=$(command -v ffmpeg)
INFILE=$1
OUTFILE="${INFILE}.gif"
TMPFILE="${INFILE}_gifify_palette.png"
if ! $FFMPEG -L > /dev/null 2>&1; then
echo "Run: brew install ffmpeg"
exit 1
@kean
kean / Promise.swift
Last active February 15, 2019 05:15
Micro Promise under 100 sloc in Swift
// The MIT License (MIT)
//
// Copyright (c) 2016 Alexander Grebenyuk (github.com/kean).
import Foundation
public class Promise<T> {
private var state: State<T> = .pending(Handlers<T>())
private var queue = DispatchQueue(label: "com.github.kean.Promise")
@chrismiles
chrismiles / reveal.py
Last active September 2, 2021 00:26
Lazy script to wrap Reveal lib load/start commands in one LLDB command.
""" File: reveal.py
Add to ~/.lldbinit:
command script import ~/.lldb-scripts/reveal.py
Q: Want to automatically load the Reveal lib on launch while debugging from Xcode?
A: In Xcode:
Add a Symbolic Breakpoint
Symbol: "UIApplicationMain"
Action: Debugger Command with value "reveal"

Greetings, NSHipsters!

As we prepare to increment our NSDateComponents -year by 1, it's time once again for NSHipster end-of-the-year Reader Submissions! Last year, we got some mind-blowing tips and tricks. With the release of iOS 7 & Mavericks, and a year's worth of new developments in the Objective-C ecosystem, there should be a ton of new stuff to write up for this year.

Submit your favorite piece of Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

Here are a few examples of the kind of things I'd like to see:

  • Using NSStringFromSelector(@selector()) as a safer way to do KVC / KVO / NSCoding.
  • Panic's [rather surprising discovery about the internals of the Lightning Digital AV Adapter](http://www.panic.com/blog/the-lightning-di
@darcyliu
darcyliu / gist:6326095
Created August 24, 2013 04:38
UIMotionEffect Demo
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect frame = self.view.bounds;
for (NSInteger i=0; i<10; i++) {
CGFloat left = (frame.size.width-100)/2+i%2*10;
CGFloat top = (frame.size.height-100)/2+i%3*10;
@ajamaica
ajamaica / gist:5893344
Created June 30, 2013 01:03
UIInterpolatingMotionEffect
UIInterpolatingMotionEffect *mx = [[UIInterpolatingMotionEffect alloc]
initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
mx.maximumRelativeValue = @-39.0;
mx.minimumRelativeValue = @39.0;
UIInterpolatingMotionEffect *mx2 = [[UIInterpolatingMotionEffect alloc]
initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
mx2.maximumRelativeValue = @-39.0;
mx2.minimumRelativeValue = @39.0;
// Created by Alex Gordon on 11/02/2013.
#import <Foundation/Foundation.h>
#pragma mark Objects
static BOOL respondsTo(id x, SEL s) {
if (!x || !s)
return NO;
return [x respondsToSelector:s];
@idStar
idStar / automation.sh
Created September 2, 2012 23:48
UIAutomation test script invocation from the command line. Works with Xcode 4.4.1 and the iOS Simulator.
#!/bin/bash
# automation.sh
# Created by @idStar - Sohail Ahmed - September 2, 2012
# This script launches the UIAutomation Instrument targeting a pre-existing iOS Simulator app, from the command line.
# Works with Xcode 4.4.1 on Mountain Lion
#
# Usage:
# automation <"App Name.app"> <"testFile.js"> <"base test script path"> <"base iOS Simulator path"> <"results output directory">
#
@nicklockwood
nicklockwood / ARCHelper.h
Last active November 20, 2018 10:02
ARC Helper
//
// ARC Helper
//
// Version 2.2
//
// Created by Nick Lockwood on 05/01/2012.
// Copyright 2012 Charcoal Design
//
// Distributed under the permissive zlib license
// Get the latest version from here:
@avar
avar / 30-income-calculon.pl
Last active August 15, 2024 15:13
Calculate your income in The Netherlands with and without a 30% ruling.
# To check if this is up-to-date with the tax rates go to
# http://www.expatax.nl/tax-rates-2016.php and see if there's anything
# newer there.
#
# I make no guarantees that any of this is correct. I calculated this
# at the time and have been updating it when new tax rates come along
# because people keep finding this useful.
#
# There's also an interactive JS version of this created by
# @stevermeister at