Skip to content

Instantly share code, notes, and snippets.

View cliss's full-sized avatar

Casey Liss cliss

View GitHub Profile
@cliss
cliss / NSArray+CLinq.h
Last active December 11, 2015 00:39
NSArray category that extends it with abilities inspired by Microsoft LINQ. See Readme.md below. Update 13/1/13: Heavily modified as per @jamiepinkham's recommendations. Thanks!
//
// NSArray+CLinq.h
//
// Created by Casey Liss on 12/1/13.
// Copyright (c) 2013 Casey Liss. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef id(^CLSelector)(id source);
@cliss
cliss / gist:4505625
Last active December 10, 2015 22:58 — forked from twobitlabs/gist:4226365
// block typedef:
typedef void(^Block)();
typedef void(^ConditionalBlock)(BOOL);
typedef NSString*(^BlockThatReturnsString)();
typedef NSString*(^ConditionalBlockThatReturnsString)(BOOL);
// block property with typedef:
@property(copy)Block theBlock;
@cliss
cliss / ParseOrDefault.cs
Last active October 11, 2015 07:07
ParseOrDefault<T>
#region Fields
private static Dictionary<Type, MethodInfo> _tryParseMethods = new Dictionary<Type, MethodInfo>();
#endregion Fields
#region Methods
/// <summary>
/// Invokes a TryParse(string, out T) method on the given input.
@cliss
cliss / mtnlion.sh
Created July 25, 2012 11:26
Mountain Lion Availability Checker
#!/bin/sh
#
# Modified source from here: http://pastie.org/4328940
# As linked to from here: http://www.tuaw.com/2012/07/24/maniacally-cuckoo-for-mountain-lion-app-store-checker-shell-scr/
#
# REQUIRES growl notify, available here: http://growl.info/downloads
#
##########################################
URL='http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?fcId=489264329&mt=12'
@cliss
cliss / NSURL+QueryAttributes.m
Created June 29, 2012 12:05 — forked from AdamSwinden/NSURL+QueryAttributes.m
NSURL Query Attributes
//
// NSURL+QueryAttributes.m
//
// Created by Adam Swinden on 29/06/2012.
// Copyright (c) 2012 The OTHER Media. All rights reserved.
//
#import "NSURL+QueryAttributes.h"
@implementation NSURL (QueryAttributes)
@cliss
cliss / gist:2959813
Created June 20, 2012 13:07
2012 MacBook Options on $2700 Budget
+---------------+--------------------------+-------------------------+------------------------+
| | 13" MacBook Air | 15" MacBook Pro | 15" Retina MacBook Pro |
| | $2450 | $2790 | $2750 |
+===============+==========================+=========================+========================+
| CPU | 2.0 Dual Core i7 $1500 | 2.3 Quad Core i7 $1800 | 2.3 Quad Core i7 $2200 |
+---------------+--------------------------+-------------------------+------------------------+
| RAM | 8 GB $100 | 16 GB (OWC) $170 | 16 GB $200 |
+---------------+--------------------------+-------------------------+------------------------+
| HD Size/Style | 512 GB SSD $500 | 120 GB SSD (OWC) $140 | 256 GB SSD |
| | | 750 GB 7200 RPM $150 | |
@cliss
cliss / gist:2954118
Created June 19, 2012 13:19
June 2012 MacBook Options
+---------------+------------------+------------------+------------------------+
| | 13" MacBook Air | 15" MacBook Pro | 15" Retina MacBook Pro |
| | $2199 | $2999 | $2999 |
+---------------+------------------+------------------+------------------------+
| CPU | 2.0 Dual Core i7 | 2.3 Quad Core i7 | 2.6 Quad Core i7 |
| RAM | 8 GB | 8 GB | 16 GB |
| HD Size/Style | 512 GB SSD | 512 GB SSD | 512 GB SSD |
| Display Res | 1440x900 | 1680x1050 | 1440x900 effective |
| | | | 2880x1800 actual |
| Availability* | Now | Now | 3-4 weeks |