Skip to content

Instantly share code, notes, and snippets.

Andrew Sardone andrewsardone

Block or report user

Report or block andrewsardone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andrewsardone
andrewsardone / gist:3751168
Created Sep 19, 2012
How does UIKit get pixels onto the screen?
View gist:3751168

UIView Drawing Model

-[UIView setNeedsDisplay]

You have some kind of custom UIView which implements some awesome drawing in -[UIView drawRect:]. In order to have UIKit draw it for you, you send the -[UIView setNeedsDisplay] to the view object to queue it up for drawing.

-[CALayer setNeedsDisplay]

     *------------*           *------------*
     |            |           |            |
View NSObject+PropertyListing.h
//
// NSObject+PropertyListing.h
// PropertyFun
//
// Created by Andrew Sardone on 8/27/10.
//
#import <Foundation/Foundation.h>
View gist:3740504

CGRectDivide is handy for slicing up a rectangle.

Example of getting a slice and the remaining area of a rectange.

CGRect rect = CGRectMake(0, 0, 240, 150);
  
CGRect remainder, slice;
    
CGRectDivide(rect, &slice, &remainder, 120, CGRectMinYEdge);
View screen-crash-course.md

GNU Screen Crash Course

Introduction

A real quick GNU screen crash course with the key features I use.

man screen

  • Emulates terminals in a full-screen window manager
  • Detachable, so shell sessions aren't attached to a login process
@andrewsardone
andrewsardone / gist:1334566
Created Nov 2, 2011
A quick cheat sheet for using Bundler
View gist:1334566

Bundler project setup

Create a Gemfile at root of your project

source :rubygems
gem "jekyll"

Install gems via bundler to a local vendor directory:

View gist:1367501

@property(<atomicity>, <writability>, <setter semantics>)

<atomicity>

nonatomic – Specifies that accessors are nonatomic. By default, accessors are atomic.

<writability>

readwrite – Indicates that the property should be treated as read/write. This attribute is the default.

View gist:1231981
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset %C(cyan)%an%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
View using-calca-for-design.md

Using Calca for design

Below, the variables and examples were taken verbatim from [Using Soulver for design][sfd].

I'm just posting this as a reference, and example of sharing plain text documents for use within Calca. [sfd]: http://bjango.com/articles/soulver/

Variables and examples

iPhoneW = 320
@andrewsardone
andrewsardone / gist:3889904
Last active Feb 22, 2016
A quick cheat sheet for using CocoaPods
View gist:3889904

CocoaPods project setup

Create a Podfile at the root of your project

platform :ios, '5.0'

pod 'AFNetworking'
pod 'OHAttributedLabel'
@andrewsardone
andrewsardone / bookmarklet.js
Created Dec 17, 2013
Tweetbot bookmarklet. I'm sure other people have better, more robust ones, but this bookmarklet works for me.
View bookmarklet.js
javascript:(function()%7Bwindow.open(location.href.replace(%2Fhttps%3A%5C%2F%5C%2F(mobile.)%3Ftwitter.com%5C%2F%2F%2C%20%22tweetbot%3A%2F%2F%22).replace(%22statuses%22%2C%20%22status%22)%2C%20%22_self%22)%7D)()
You can’t perform that action at this time.