Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
codeswimmer / ycombinator.clj
Created March 6, 2013 20:33 — forked from z5h/ycombinator.clj
Applicative-Order Y Combinator (Clojure Version)
; Stumbling towards Y (Clojure Version)
;
; (this tutorial can be cut & pasted into your IDE / editor)
;
; The applicative-order Y combinator is a function that allows one to create a
; recursive function without using define.
; This may seem strange, because usually a recursive function has to call
; itself, and thus relies on itself having been defined.
;
; Regardless, here we will stumble towards the implementation of the Y combinator.
#!/usr/bin/env python
'''
optparse_testing.py
some recipes from http://www.alexonlinux.com/pythons-optparse-for-human-beings
'''
import optparse
parser = optparse.OptionParser()
# basics
@codeswimmer
codeswimmer / pgessays.py
Created November 18, 2012 18:04 — forked from olasitarska/pgessays.py
Builds epub book out of Paul Graham's essays.
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
import re, ez_epub, urllib2, genshi
@codeswimmer
codeswimmer / gist:3973781
Created October 29, 2012 14:15 — forked from 0x8badf00d/gist:3973770
UIAlertViewStylePlainTextInput
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Alert Message" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert textFieldAtIndex:0].borderStyle = UITextBorderStyleRoundedRect;
[alert show];
@codeswimmer
codeswimmer / AsyncURLWrapper.h
Created September 22, 2012 06:28 — forked from akkabin/AsyncURLWrapper.h
AsyncURLWrapper
#import <Foundation/Foundation.h>
@class AsyncURLWrapper;
@protocol AsyncURLWrapperDelegate <NSObject>
@optional
- (void) didFinish: (NSData*) data sender: (AsyncURLWrapper*) urlWrapper response: (NSHTTPURLResponse*) response;
- (void) didFail: (NSError*) error sender: (AsyncURLWrapper*) urlWrapper;
- (void) beforeRetry: (NSError*) error sender: (AsyncURLWrapper*) urlWrapper;
- (void) didUpdateProgress: (float) percentCompleted sender: (AsyncURLWrapper*) urlWrapper;
@codeswimmer
codeswimmer / gist:3745450
Created September 18, 2012 19:55 — forked from carlosmcevilly/gist:3738897
how to print the path of the currently selected Xcode
xcode-select -print-path
@codeswimmer
codeswimmer / gist:3740956
Created September 18, 2012 02:40 — forked from xhezairbey/gist:3740944
The Unfollow Manifesto

At some point in the past, I've decided to follow you on Twitter or any other social network, because you appeared to be a person whose postings I might be interested in.

But recently you noticed me unfollowing you.

Now you're confused/sad/angry. Don't be. Because here are the three simple rules I adhere to.

  1. You may unfollow me at any given time, because what I post might not be your cup of tea. It's okay, no hard feelings. I won't take that as an insult. (Really.) I assume we're still cool outside said service, unless of course I wrote some horrible shit that offended you, in which case I am probably sorry.
@codeswimmer
codeswimmer / UIImage+Retina4.h
Created September 14, 2012 22:38 — forked from dingyi/UIImage+Retina4.h
Swizzled UIImage imageNamed for iPhone 5
//
// UIImage+Retina4.h
// StunOMatic
//
// Created by Benjamin Stahlhood on 9/12/12.
// Copyright (c) 2012 DS Media Labs. All rights reserved.
//
#import <UIKit/UIKit.h>
@codeswimmer
codeswimmer / ExampleClass.m
Created September 13, 2012 17:47
Macro for creating your "shared instance" using GCD
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
//
// iTahDoodleAppDelegate.m
// iTahDoodle
//
// Created by Henry Brock on 8/25/12.
// Copyright (c) 2012 brockbackups. All rights reserved.
//
#import "iTahDoodleAppDelegate.h"
NSString *docPath()