Skip to content

Instantly share code, notes, and snippets.

View bizz84's full-sized avatar

Andrea Bizzotto bizz84

View GitHub Profile
@evadne
evadne / gist:4544569
Last active August 14, 2023 05:04
Todd Laney’s enhancements to Sticky Headers + UICollectionViewFlowLayout
//
// StickyHeaderLayout.h
// Wombat
//
// Created by Todd Laney on 1/9/13.
// Copyright (c) 2013 ToddLa. All rights reserved.
//
// Modified from http://blog.radi.ws/post/32905838158/sticky-headers-for-uicollectionview-using THANKS!
//
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
//
// ViewController.m
// AVPlayerCaching
//
// Created by Anurag Mishra on 5/19/14.
// Sample code to demonstrate how to cache a remote audio file while streaming it with AVPlayer
//
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
@staltz
staltz / introrx.md
Last active July 2, 2024 03:45
The introduction to Reactive Programming you've been missing
@tomlokhorst
tomlokhorst / Optional+Unwrap.swift
Last active December 26, 2017 19:50
Unwrap multiple optionals in Swift 1.0
func unwrap<T1, T2>(optional1: T1?, optional2: T2?) -> (T1, T2)? {
switch (optional1, optional2) {
case let (.Some(value1), .Some(value2)):
return (value1, value2)
default:
return nil
}
}
func unwrap<T1, T2, T3>(optional1: T1?, optional2: T2?, optional3: T3?) -> (T1, T2, T3)? {
@ColinEberhardt
ColinEberhardt / gist:984907adbf8236077c1f
Last active June 15, 2016 23:22
Links from my talk at SwiftSummit
Silverlight and ReactiveExtensions article:
http://blog.scottlogic.com/2010/12/02/exploring-reactive-extensions-rx-through-twitter-and-bing-maps-mashups.html
My Ray Wenderlich author page, contains quite a few ReactiveCocoa and MVVM articles:
http://www.raywenderlich.com/u/ColinEberhardt
ObjC block syntax - say no more!
http://fuckingblocksyntax.com
Twitter app with sentiment analysis
@FranDepascuali
FranDepascuali / AssociatedObjects.swift
Last active April 7, 2022 18:37
Full implementation
private var AssociatedKey: UInt = 0
private final class AssociatedObjectBox<T> {
let value: T
init(_ x: T) {
value = x
}
}
@mackuba
mackuba / wwdc16.md
Last active March 5, 2023 21:28
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra

/*
* Protocol, extension and base class to load any UIView from nib in Interface Builder or programmatically.
* Example sage:
* @IBDesignable class MyView: UIViewNibLoadable {
* // IBOutlets, IBActions, other view logic here
* }
*
* let myView = MyView() // will load from MyView.xib and attach all outlets / actions
*/