Skip to content

Instantly share code, notes, and snippets.

@markd2
markd2 / bool.m
Created May 7, 2012 19:14
Playing with different scenarios with Objective-C's BOOL type
#import <Foundation/Foundation.h>
// clang -g -Wall -framework Foundation -o bool bool.m
// Are these two integers different? YES if so, NO if not
// (even though it says YES and NO, it LIES! Can actualy return a range
// of non-YES values)
static BOOL different (int thing1, int thing2) {
@colinmcardell
colinmcardell / NSLog replacement (DLog, ALog, ULog).
Created March 7, 2013 21:08
Replacement for NSLog similar to http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ This is plenty available elsewhere with a number of variations...
// DLog will output like NSLog only when the DEBUG variable is set
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(...)
#endif
// ALog will always output like NSLog
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
@mattt
mattt / uiappearance-selector.md
Last active June 4, 2024 13:28
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@ryanolf
ryanolf / instructions
Created May 6, 2013 23:21
Installing pyBSDDB (bsddb3) 5.3.0 on Windows
@echo off
setlocal
rem Update the local copy of the DB libs and stuff.
rem This copies the necessary libs and headers and exe
rem files into the python module tree.
rem Set DBDIR to the base directory of the DB source.
rem e.g. it should have the folder "build_windows" in it.
@nuthinking
nuthinking / UIView+CustomTimingFunction.h
Created November 11, 2013 15:59
UIView Custom Timing Functions
//
// UIView+CustomTimingFunction.h
// Instants
//
// Created by Christian Giordano on 16/10/2013.
// Copyright (c) 2013 Christian Giordano. All rights reserved.
//
#import <UIKit/UIKit.h>
@mmick66
mmick66 / UICollectionViewFlowLayoutCenterItem.m
Last active August 2, 2022 10:06
UICollectionViewFlowLayout with arbitrary sized Paging
#import "UICollectionViewFlowLayoutCenterItem.h"
@implementation UICollectionViewFlowLayoutCenterItem
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
{
CGSize collectionViewSize = self.collectionView.bounds.size;
CGFloat proposedContentOffsetCenterX = proposedContentOffset.x + self.collectionView.bounds.size.width * 0.5f;
CGRect proposedRect = self.collectionView.bounds;
@staltz
staltz / introrx.md
Last active July 27, 2024 04:59
The introduction to Reactive Programming you've been missing
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active June 17, 2024 06:08
The best FRP iOS resources.

Videos

@kevinzhow
kevinzhow / vpnserver.sh
Last active March 19, 2019 12:59
OnClickVPNServer
#!/usr/bin/env bash
echo 'deb http://shadowsocks.org/debian wheezy main' >> /etc/apt/sources.list
# Pre-requisites
sudo apt-get -y update
sudo apt-get -y install pptpd
sudo apt-get -y install fail2ban
sudo apt-get -y install shadowsocks-libev
@ColinEberhardt
ColinEberhardt / gist:b4bf4e4566ffa88afcda
Created March 20, 2015 08:14
Pipe forward operator and curried free functions = fluent interface
// meet Stringy - a simple string type with a fluent interface
struct Stringy {
let content: String
init(_ content: String) {
self.content = content
}
func append(appendage: Stringy) -> Stringy {