Skip to content

Instantly share code, notes, and snippets.

View andrewsardone's full-sized avatar

Andrew Sardone andrewsardone

View GitHub Profile
@andrewsardone
andrewsardone / gist:3751168
Created September 19, 2012 18:03
How does UIKit get pixels onto the screen?

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]

     *------------*           *------------*

| | | |

@andrewsardone
andrewsardone / gist:6969549
Last active November 21, 2022 07:45
Elixir doctests
defmodule AndrewEnum do
@moduledoc """
A reimplementation of the standard `Enum` module.
"""
@doc """
Invokes the given `fun` for each item in the `collection`.
Returns `:ok`.
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"
@andrewsardone
andrewsardone / gist:3889904
Last active January 31, 2020 17:07
A quick cheat sheet for using CocoaPods

CocoaPods project setup

Create a Podfile at the root of your project

platform :ios, '5.0'

pod 'AFNetworking'
pod 'OHAttributedLabel'
//
// NSObject+PropertyListing.h
// PropertyFun
//
// Created by Andrew Sardone on 8/27/10.
//
#import <Foundation/Foundation.h>
@andrewsardone
andrewsardone / gist:3740504
Created September 17, 2012 23:58
CGRectDivide

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, &amp;slice, &amp;remainder, 120, CGRectMinYEdge);
@andrewsardone
andrewsardone / screen-crash-course.md
Created August 26, 2011 13:10
GNU Screen Crash Course

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 November 2, 2011 19:06
A quick cheat sheet for using Bundler

Bundler project setup

Create a Gemfile at root of your project

source :rubygems
gem "jekyll"

Install gems via bundler to a local vendor directory:

@andrewsardone
andrewsardone / gist:1367501
Created November 15, 2011 16:27
Objective-C @Property declaration cheat sheet – http://git.io/objcproperty

@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.

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