Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mattyohe
mattyohe / gist:1193584
Created September 4, 2011 21:58
Simple sorting of an array of dictionaries using the NSComparator block
NSMutableArray *mutArry = [[NSMutableArray alloc] init];
// Fill array with 20 dictionaries that each contain a NSNumber for key "num"
for(int i = 0;i<20;i++){
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:arc4random()%100], @"num", nil];
[mutArry addObject:dict];
}
@mattyohe
mattyohe / gist:1370876
Created November 16, 2011 18:21
My Drupal 7 Profiler script that corrects taxonomy vocabulary and loads terms from an xml file
<?php
!function_exists('profiler_v2') ? require_once('libraries/profiler/profiler.inc') : FALSE;
profiler_v2('ppc_test');
/**
* Implement hook_install().
*
@mattyohe
mattyohe / Evil.m
Created February 2, 2012 01:47 — forked from PsychoH13/Evil.m
Debauching ObjC's dot-syntax and blocks in ObjC
#import <Foundation/Foundation.h>
@interface NSString (Evil)
@property(assign, setter=initWithString:) NSString *initWithString;
@property(assign, readonly) NSString *test;
@property(assign, readonly) NSArray *(^split)(NSString *);
@end
int main(int argc, char *argv[])
{
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
#
# Do NOT simply read the instructions in here without understanding
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
# make ls display colors, reinforce with CLICOLOR and LSCOLORS
export CLICOLOR=1
# LSCOLORS order: DIR, SYM_LINK, SOCKET, PIPE, EXE, BLOCK_SP
# CHAR_SP, EXE_SUID, EXE_GUID, DIR_STICKY, DIR_WO_STICKY
# a = black, b = red, c = green, d = brown, e = blue,
# f = magenta g = cyan, h = light gray, x = default
@mattyohe
mattyohe / gist:2624831
Created May 6, 2012 22:30
Stringify the the value of a macro and turn that into an NSString constant
#define DERP 1234
#define MACRO_NAME(str) @ #str
#define STRINGIFY(str) MACRO_NAME(str)
NSLog(@"%@",MACRO_NAME(DERP));
NSLog(@"%@",STRINGIFY(DERP));
// Output:
@mattyohe
mattyohe / gist:3094710
Created July 12, 2012 00:30
Script for mogenerator
PATH=$PATH:/usr/local/bin
cd MyApp
mogenerator -m MyApp.xcdatamodeld/MyApp.xcdatamodel/ --output-dir Classes --template-var arc=true
@mattyohe
mattyohe / OCPDFGen.podspec
Created August 16, 2012 03:08
Podfile at root of your project
Pod::Spec.new do |s|
s.name = "OCPDFGen"
s.version = "0.1"
s.summary = "Wheee!"
s.homepage = "https://github.com"
s.license = '???'
s.author = { "mattyohe" => "" }
s.source = { :git => "git://github.com/ocrickard/OCPDFGen.git", :commit => "bcf26e3e4b" }
s.source_files = 'OCPDFGen/*'
s.dependency 'DTCoreText', '~> 1.0.1'
Pod::Spec.new do |s|
s.name = 'TouchXML'
s.version = '0.2'
s.license = 'Simplified BSD License'
s.summary = "TouchXML is a lightweight replacement for Cocoa's NSXML* cluster of classes."
s.homepage = 'https://github.com/TouchCode/TouchXML'
s.author = { 'Jonathan Wight' => 'schwa@toxicsoftware.com' }
s.source = { :git => 'https://github.com/TouchCode/TouchXML.git', :commit => '7bd9f17adb5642' }
s.source_files = 'Source/**/*.{h,m}'
s.requires_arc = true
@mattyohe
mattyohe / floatsign.sh
Created October 12, 2012 20:07
A small bash script to re-sign iOS applications.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
#
# Extended by Ronan O Ciosoig January 2012
#
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),