Skip to content

Instantly share code, notes, and snippets.

View qnoid's full-sized avatar
💭
I have been raised by women. My single mother, my grandma, my godmother.

Markos Zoulias Charatzas qnoid

💭
I have been raised by women. My single mother, my grandma, my godmother.
View GitHub Profile
@interface Item : NSObject
{
@private
UIImage *image;
NSString *value;
NSString *when;
}
@property(nonatomic, retain) UIImage *image;
@property(nonatomic, retain) NSString *value;
@qnoid
qnoid / hashtable
Created April 7, 2011 15:33
graphical representation of a hashtable
9
6 7
3 4 5
[0, 1, 2] //buckets
^ ^ ^
0 1 2 //bucket index
|---3---| //hashtable length
@qnoid
qnoid / HttpsURLConnectionFactory.java
Created September 10, 2011 09:48
Provides access to secure url connections; given certificate as specified by java.security.cert.CertificateFactory#generateCertificate
/*
* This file is under the license Attribution-ShareAlike 3.0 Unported
* (CC BY-SA 3.0) http://creativecommons.org/licenses/by-sa/3.0/
*
* You are free:
* to Share - to copy, distribute and transmit the work
* to Remix - to adapt the work
*
* Under the following conditions:
*
@qnoid
qnoid / changelog.sh
Created August 1, 2012 16:11
Generate sane changelog between revisions
# show the log between two revisions | sort unique to remove all but one blank and '---' lines | awk to NOT match any lines starting with rXXXXX denoting revision information
#$1, $2 range revision arguments
#!/usr/bin/env bash
svn log -r $1:$2 | sort -u | awk '!/(^r[0-9]*)/'
@qnoid
qnoid / gist:3923802
Created October 20, 2012 16:17
How to trace and debug an iOS crash (Part 1)

There has been a crash.

While preparing for an iOS release, observed a crash on an iPad (iOS 4.3.3, WiFi). The crash was fairly consistent to be considered random but once in a while, it would work as expected. On the other hand, an iPad 3 (iOS 5.1, WiFi/3G) wouldn't exhibit the same behaviour.

The crash was triggered at the completion block of an [AFHTTPRequestOperation][1] while parsing a (JSON) response with an empty body to a NSDictionary using [JSONKit][2].

This was an unexpected behaviour since an empty body response was not defined in the request/response contract.

FACTS

  1. iPad 4.3.3 WiFi
@qnoid
qnoid / gist:3926817
Created October 21, 2012 12:10
How to trace and debug an iOS crash (Part 2)

Dead end

[Having reached a dead end][7], decided to take a look at the client side in an effort to understand more about the request/response cycle.

First thing was to enable logging for the headers and body of both the [request][1] and the [response][2].

> GET /foo HTTP/1.1  
> "Accept-Encoding" = gzip;  
> "Accept-Language" = [languages];  
> Range = "foo=0-10";  

> "User-Agent" = "[App Bundle Id]/ (unknown, iPhone OS 4.3.3, iPad, Scale/1.000000)";

@qnoid
qnoid / User Identity.markdown
Created November 10, 2012 00:49
A post about user identity that is thought provoking on user authorisation and security, or just utter bullshit.

User identity

Disclaimer: I am no security expert.

Use case

Provide a way for a user to identify himself before remotely accessing a multi-user software that requires to associate the user with her data.

Introduction

@qnoid
qnoid / gist:4052818
Created November 10, 2012 22:45
Mockups on user identity

Mockups on user identity

[A video of an iOS implementation is available][8].

User identity

[The idea of a user identity][7] is a simple one with a goal to eliminate the requirement of a user entering a password. Any other requirement, including storing, transmitting and hashing should stay the same.

Introduction

As soon as a software is installed that supports user identities, a user is presented with a screen to identify.

@qnoid
qnoid / gist:4315284
Created December 17, 2012 02:04
"Those who cannot remember the past are condemned to repeat it." - George Santayana

Last Thursday it was the 3rd annual startups Christmas party at TechCube. Just one day prior, a cofounder from a Scottish startup had walked away after being offered to sign an investment deal.

Negotiations had been going on for months. No one can last that long, unless has substantial savings, takes a loan, his partner/family supports him or has a part time job to cover his living expenses.

It wasn't an easy decision. When you sacrifise that much for that long, it's hard letting go. You have doubts. Doubts about the choice you are about to make. You feel its weight on your shoulders; growing heavy. Accumulated by the moral obligation to your cofounders and people that have invested time in you.

The deal would keep the startup on life support and earn a title. Something to put on a résumé. A badge of honour. Not what you had in mind when you embarked on this endeavour. Signing it would mean lying to yourself, your cofounders, your investors. Far from what you had asked for in the first place.

@qnoid
qnoid / gist:4674581
Created January 30, 2013 16:47
Adds the ability to do a "pod clean" that will remove the Podfile.lock, the ./Pods and xcworkspace under a project.
#pod clean
pod() {
if [ $1 == "clean" ]
then
xcworkspace=$(find . -maxdepth 1 -name *.xcworkspace)
if [ -z $xcworkspace ]
then
echo "Already clean"
else
echo "Will remove Podfile.lock, Pods/ and $xcworkspace"