Skip to content

Instantly share code, notes, and snippets.

View DerAndereAndi's full-sized avatar
💭
Learning ...

Andreas Linde DerAndereAndi

💭
Learning ...
View GitHub Profile
@DukeyToo
DukeyToo / expressjs benchmark 2012-4-11
Created April 11, 2012 19:47
ab benchmarks on EC2 medium instance
ubuntu@domU-12-31-39-0C-49-FB:~$ ab -n 8000 -c 250 -k http://localhost:8001/middleware
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 800 requests
Completed 1600 requests
Completed 2400 requests
Completed 3200 requests
@0xced
0xced / UIDevice+HostUUID.h
Created April 15, 2012 22:26
Alternative iOS device unique identifier
#import <UIKit/UIKit.h>
@interface UIDevice (HostUUID)
- (NSString *) xcd_uniqueIdentifier;
@end
@bjhomer
bjhomer / 0_explanation.md
Created April 23, 2012 19:32
Putting "*.m diff=objc" in <repo_root>/.gitattributes

Running echo "*.m diff=objc" >> .gitattributes in a git repo tells git to use the obj-c diff algorithm when running git diff. For the most part, this isn't much different from the standard diff algorithm. However, it adds one key benefit.

In a unified git diff, added lines are prefixed with a +, and removed lines are prefixed with a -. Unchanged lines are provided for context, and have no prefix. As added context, though, unified diffs have a @@-prefixed line at the beginning of each hunk. Minimally, the @@ lines specify which lines in the file are being changed. It can also contain a label, if git can determine an appropriate label for that section of code.

By default, the label on a hunk context line is the name of the enclosing C function. That works great for C-ish code, but completely misses Obj-C method signatures. As a result, when diffing Obj-C files, the context label is either empty, or falls back to the last C-ish declaration it could find. This is usually entirely useless.

Adding

@jonathanpenn
jonathanpenn / device_uuid.rb
Created May 15, 2012 03:37
Ruby script that fetches the UUID of the first iOS device plugged into your machine
#!/usr/bin/env ruby
ioreg = `ioreg -w 0 -rc IOUSBDevice -k SupportsIPhoneOS`
device_uuid = ioreg[/"USB Serial Number" = "([0-9a-z]+)"/] && $1
if device_uuid
puts device_uuid
else
puts "No device detected."
exit 1
@alloy
alloy / gist:2888157
Created June 7, 2012 10:45
Somebody who is contacting everyone that has ever commented on a project that he has problems with.

FROM SENDER:

Hi,

Sorry to disturb you, 

I have some (big) problems to compile MTLocation framework and i would like to know if you have a workable example to share with me.

I saw your comment on github...
@damianjsullivan
damianjsullivan / Xcode4HockeyAppIntegration.sh
Created July 3, 2012 17:19 — forked from SpacyRicochet/Xcode4HockeyAppIntegration.sh
Automatic HockeyApp Upload XCode Script
#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#
# Inspired by original script by incanus:
# https://gist.github.com/1186990
#
# Rewritten by martijnthe:
# https://gist.github.com/1379127
#
@benchester
benchester / script.php
Created August 1, 2012 11:07
jenkins post-build script for uploading to HockeyApp
<?php
// USAGE:
// php script.php -t "title" -b "bundleID" -p "platform" -r "release type"
$new_url = "https://rink.hockeyapp.net/api/2/apps/new";
function getMyBundleID()
{
// framework folder, there shouldn't be more than one
foreach (glob("*.framework") as $framework) {}
@jonathanpenn
jonathanpenn / gist:3792241
Created September 27, 2012 04:58
Using to-many predicates with UIAutomation
// Based on this discussion:
// https://twitter.com/listrophy/statuses/251074683594747904
// To setup:
// Create an application that has a tableView with a couple cells in it, one of
// which has the "coffee" in it's label
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
@Gi-lo
Gi-lo / gist:4279932
Created December 13, 2012 21:11
Easily create GET NSURLs in Objective-C. (Used in https://github.com/Gi-lo/GCXHTTPOperation )
- (NSURL *)URLWithString:(NSString *)string andQueryValuesForKeys:(NSString *)value, ... {
if (!value) {
return [NSURL URLWithString:string];
}
NSMutableString *queryString = [NSMutableString string];
NSString *argument = nil;
NSUInteger argumentCount = 0;
va_list argumentList;
@krzysztofzablocki
krzysztofzablocki / gist:4396302
Last active November 24, 2021 19:17
Set symbol breakpoint on objc_msgSend then setup this debug command to log all methods called in iOS Simulator. If you want to do device debugging change esp+4 register to r0, esp+8 to r1 Found long ago somewhere on stackoverflow.
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )