Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@orta
orta / fish_lazy_commits.sh
Created March 21, 2016 09:14
Fish versions of my bash commands from Lazy Automation
# http://artsy.github.io/blog/2016/03/02/Lazily-Automation/
function git_branch_info
git branch ^/dev/null | grep \* | sed 's/* //'
end
function branch
git checkout master;
git pull upstream master;
git checkout -b $argv[1]
@Catfish-Man
Catfish-Man / sethack.m
Created March 11, 2016 06:21
Demonstrating the trick of using stack-allocated mimics and sets for lookup tables instead of heap allocated keys and dictionaries
// Compile with clang -framework Foundation sethack.m
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
/*
CFHashBytes from http://www.opensource.apple.com/source/CF/CF-1153.18/CFUtilities.c
*/
#define ELF_STEP(B) T1 = (H << 4) + B; T2 = T1 & 0xF0000000; if (T2) T1 ^= (T2 >> 24); T1 &= (~T2); H = T1;
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
@protocol MFBPreviewableCollectionView
- (nullable NSIndexPath *)mfb_previewableCollectionIndexPathForItemAtPoint:(CGPoint)point;
- (CGRect)mfb_previewableCollectionItemRectForIndexPath:(NSIndexPath *)indexPath;
@natecook1000
natecook1000 / nshipster-new-years-2016.md
Last active July 10, 2018 19:24
NSHipster New Year's 2016

Greetings and salutations, NSHipsters!

As the year winds down, it's a tradition here at NSHipster to ask you, dear readers, to offer up your favorite tricks and tips from the past year as gifts to your fellow hipsters. With iOS 9, El Capitan, brand new watch- and tvOS's, and the open-sourcing of some minor Apple-related tech, there's bound to be lots to share.

Submit your favorite piece of Swift or @objc trivia, helpful hints, unexpected discoveries, useful workarounds, useless fascinations, or anything else you found cool this year. Just comment below!

If you need inspiration, try [the list from last year][2015], or [from the year before][2014], or [from the year before that][2013].

@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
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: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@clementgenzmer
clementgenzmer / FBAnimationPerformanceTracker.h
Last active September 18, 2023 23:02
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
YapDatabaseViewGroupingWithObjectBlock groupingBlock = ^NSString *(NSString *collection, NSString *key, id object) {
if (![object isKindOfClass:[MealLogRemote class]]) {
return nil;
}
return "all"; // we only need one section/group in this case
};
YapDatabaseViewSortingWithObjectBlock sortingBlock = ^NSComparisonResult (NSString *group, NSString *collection1, NSString *key1, MealLogRemote *obj1,
NSString *collection2, NSString *key2, MealLogRemote *obj2){
// we don't need sorting but this using a sorting for a view is mandatory, lets sort it by date
@figgis
figgis / Makefile
Last active April 8, 2020 08:15
ffmpeg qp values
# use pkg-config for getting CFLAGS and LDLIBS
FFMPEG_LIBS= libavdevice \
libavformat \
libavfilter \
libavcodec \
libswresample \
libswscale \
libavutil \
CFLAGS += -Wall -g
@phatmann
phatmann / ImageAttachment
Created March 22, 2015 22:23
NSTextAttachment that scales and aligns image
// Created by Tony Mann on 3/22/15.
// Copyright (c) 2015 7Actions. All rights reserved.
//
// Adapted from http://ossh.com.au/design-and-technology/software-development/implementing-rich-text-with-images-on-os-x-and-ios/
import UIKit
class ImageAttachment: NSTextAttachment {
var verticalOffset: CGFloat = 0.0