Skip to content

Instantly share code, notes, and snippets.

View jessedc's full-sized avatar

Jesse Collis jessedc

View GitHub Profile
@jessedc
jessedc / ViewController.h
Last active August 29, 2015 13:56
Demonstrates the stricter behaviour of Xcode 5.1 in regards to overloading objective C property declarations in subclasses. -Wobjc-property-synthesis
#import <UIKit/UIKit.h>
@interface REABaseViewController : UIViewController
@property (nonatomic, readonly, strong) NSObject *anObject;
@end
@interface REAViewController : REABaseViewController
//error: auto property synthesis will not synthesize property 'anObject'
//because it is 'readwrite' but it will be synthesized 'readonly' via
//another property [-Werror,-Wobjc-property-synthesis]
@jessedc
jessedc / python_env.md
Last active August 29, 2015 14:00
Setting up a python development environment on OSX without needing to use sudo

Assumptions

Using sudo for local development tooling is a bad idea. This is the bare minimum to get your python environment up and running so you can install pip and virtualenv at the user level and then continue to use [virtualenv][1] to get your own project environments running.

  • OSX 10.9+
  • You have homebrew installed
  • /usr/loca/bin is part of your $PATH

Find where the system python version is

@jessedc
jessedc / wwdc-2014.mdown
Last active August 29, 2015 14:02
WWDC 2014 Sessions

Tuesday

Attended/Watched / Not Attended

  • 09:00 - 401 What's New in Xcode 6 / 201 Advanced Topics in Internationalization
  • 10:15 - 202 What's New in Cocoa Touch
  • 11:30 - 204 What's New in Cocoa / 412 Localizing with Xcode 6
  • 14:00 - 402 Introduction to Swift / 206 Introducing the Modern WebKit API / 205 Creating App Exentions for iOS and OSX Pt 1.
  • 15:15 - 208 Introducing Cloud Kit / 708 Taking Core Location Indoors / 707 What's new in Foundation Networking
  • 16:30 - 418 Improving Your App With Instruments / 211 Designing Intuttive User Experiences
@jessedc
jessedc / CMInfoAppStoreViewer.h
Created October 19, 2014 21:30
Apple App Store Viewer (iOS 6+)
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface CMInfoAppStoreViewer : NSObject
- (void)displayAppStoreForApp:(CMAppType)app withNavigationController:(UINavigationController *)navigationController;
- (void)displayAppStoreForAppId:(NSNumber *)appNumber iTunesURL:(NSURL *)itunesURL withNavigationController:(UINavigationController *)navigationController;
@end
@jessedc
jessedc / set_build_number.sh
Last active August 29, 2015 14:08
Setting CFBundleVersion to CFBundleShortVersionString plust the git rev list count
buildPlist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}
plist='/usr/libexec/PlistBuddy -c'
CFBundleShortVersionString=`$plist "Print CFBundleShortVersionString" $buildPlist`
gitRevListCount=`git rev-list HEAD --count`
CFBundleVersion="$CFBundleShortVersionString.$gitRevListCount"
CFBuildDate=$(date -u +"%a %b %d %T GMT %Y")
$plist "Set :CFBundleVersion $CFBundleVersion" "$buildPlist"
$plist "Set :CFBuildDate $CFBuildDate" "$buildPlist"
@jessedc
jessedc / tidy-json.sh
Created August 19, 2015 01:44
Tidy up your json with JQ
cat schema/schema.json | jq -M . > schema/schema.json
$cacheDir = './cache/';
$curl_setopt_array = array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_RETURNTRANSFER => true);
if (file_exists($cacheDir.$filename)) {
$timetable_view_file = file_get_contents($cacheDir.$filename);
}else{
$curlR = curl_init($request_url);
if (curl_setopt_array($curlR, $curl_setopt_array)){
$timetable_view_file = curl_exec($curlR);
@jessedc
jessedc / app.php
Last active September 17, 2015 19:46
Bind Guzzle Laravel Lumen
<?php
/**
* FIXME: This really is just for one paritulcar type of jobs,
* not everything we would want to use guzzle for.
**/
$app->bind('\GuzzleHttp\ClientInterface', function ($app) {
return new \GuzzleHttp\Client([
'base_uri' => env('MAIN_SITE_URL'),
'connect_timeout' => 5,
int equi(int A[], int n){
int left = 0;
int right = 0;
int index = -1;
// Sum the array
int i = 0;
for (i = 0; i < n; i++) {
left += A[i];
@jessedc
jessedc / express-stylus.html
Created April 25, 2011 05:57 — forked from bentruyman/express-stylus.html
Using Stylus Middleware with Express
<!doctype html>
<html lang="en">
<head>
<title>My Web Page</title>
<meta charset="utf-8">
<link href="/stylesheets/main.css" rel="stylesheet">
</head>
<body>
</body>
</html>