Skip to content

Instantly share code, notes, and snippets.

View jcampbell05's full-sized avatar

James Campbell jcampbell05

View GitHub Profile
@cyberdelia
cyberdelia / fabfile.py
Created April 3, 2010 14:05
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@shazron
shazron / sim-run.sh
Created October 25, 2011 21:53
Run Xcode Simulator project from the command line
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# Shazron Abdullah 2011
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
PROJECTNAME=$1
@bignerdranch
bignerdranch / BNRTimeBlock.h
Created March 9, 2012 13:51
Timing Utility Post 20120308
CGFloat BNRTimeBlock (void (^block)(void));
@thinkerbot
thinkerbot / README.md
Created May 7, 2012 02:06
A shell script transpiler

Provides a mechanism to write portable shell scripts in a higher-level language.

Ruby may be used to describe shell scripts in code. For example shell commands may be represented as methods and command pipelines as method chains. The method calls are translated into shell script. Zero or more script files may be generated in this process.

Cursor objects can be used to mark the locations in the final script where a given shell expression is to be added. For example one cursor could mark where options are defined in a 'getopts' command, another could mark where the option

; ModuleID = 'hello'
@.str = private constant [14 x i8] c"Hello, World!\00"
declare i32 @puts(i8* nocapture) nounwind
define i32 @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0))
ret i32 0
}
@MrRooni
MrRooni / gist:4988922
Created February 19, 2013 19:16
UITableView and NSFetchedResultsController: Updates Done Right
@interface SomeViewController ()
// Declare some collection properties to hold the various updates we might get from the NSFetchedResultsControllerDelegate
@property (nonatomic, strong) NSMutableIndexSet *deletedSectionIndexes;
@property (nonatomic, strong) NSMutableIndexSet *insertedSectionIndexes;
@property (nonatomic, strong) NSMutableArray *deletedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *insertedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *updatedRowIndexPaths;
@end
@bradleyboy
bradleyboy / nginx.conf
Last active March 22, 2022 19:46
nginx rewrite setup for Koken
# Enable gzip. Highly recommending for best peformance
gzip on;
gzip_comp_level 6;
gzip_types text/html text/css text/javascript application/json application/javascript application/x-javascript;
# By default, do not set expire headers
expires 0;
# Set expires header for console CSS and JS.
# These files are timestamped with each new release, so it is safe to cache them agressively.
@titanous
titanous / 0-nsprogress.mm
Last active December 17, 2015 11:49
NSProgress classdump from Foundation.framework and usage in Chrome
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
@protocol NSProgressPublisher <NSObject>
- (oneway void)appWithBundleID:(id)arg1 didAcknowledgeWithSuccess:(BOOL)arg2;
- (oneway void)pause;
- (oneway void)cancel;
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active May 27, 2024 12:11
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@pyrmont
pyrmont / nginx.conf
Created August 26, 2013 15:40
This configuration file is designed to run the CMS Koken. If you just want a simple config file, use this instead: https://gist.github.com/pyrmont/6342859
daemon off;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /usr/local/etc/nginx/mime.types; # Update if necessary