Skip to content

Instantly share code, notes, and snippets.

@Krishna
Krishna / gist:4247608
Created December 10, 2012 00:09 — forked from BenedictC/gist:4246759
A marco for creating enums with values which can be logged (inspired by http://rentzsch.tumblr.com/post/37512716957/enum-nsstring and long train journey).
#define EMKStringableEnum(ENUM_NAME, ENUM_VALUES...) \
\
typedef enum { \
ENUM_VALUES \
} ENUM_NAME; \
\
\
\
static NSString * ENUM_NAME##ToString(long enumValue) { \
@Krishna
Krishna / gist:4204033
Created December 4, 2012 13:46 — forked from futureperfect/gist:1097449
Alan Kay's talk at Creative Think seminar, July 20, 1982
Alan Kay's talk at Creative Think seminar, July 20, 1982
Outline of talk: Metaphors, Magnetic Fields, Snobbery and Slogans
The best way to predict the future is to invent it.
Humans like fantasy and sharing:
Fantasy fulfills a need for a simpler, more controllable world.
Sharing is important - we're all communication junkies. We have an incredible bandwidth
#import "LCYThing.h"
@interface LCYThing (Transmogrify)
- (void) turnIntoCat;
@end
@Krishna
Krishna / face_detector.rb
Created December 8, 2011 15:42 — forked from pvinis/face_detector.rb
run with "macruby face_detector.rb" or "macruby face_detector.rb https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc7/304055_10150415385415891_522505890_10347873_1682210515_n.jpg?dl=1" for a photo of me with woody and buzz lightyear :p
framework 'Cocoa'
class NSColor
def toCGColor
color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace)
## approach #1
# components = Array.new(4){Pointer.new(:double)}
# color_RGB.getRed(components[0],
# green: components[1],
# blue: components[2],
@Krishna
Krishna / ebooks.md
Created December 2, 2011 16:23 — forked from roidrage/ebooks.md
Self-published and awesome
@Krishna
Krishna / emailAddresses.m
Created October 14, 2011 16:26 — forked from 0xced/README.md
ABGetMe implementation for iOS
// Application must link with the MessageUI framework
NSArray* AccountEmailAddresses(void)
{
NSMutableArray *addresses = [NSMutableArray array];
@try
{
NSString *MailAccountProxy = [[NSArray arrayWithObjects:@"Mail", @"Account", @"Proxy", nil] componentsJoinedByString:@""];
NSString *MFMailAccountProxy = [@"MF" stringByAppendingString:MailAccountProxy];
Class MailAccountProxyClass = NSClassFromString(MFMailAccountProxy) ?: NSClassFromString(MailAccountProxy);
SEL reloadAccounts = NSSelectorFromString([[NSArray arrayWithObjects:@"reload", @"Accounts", nil] componentsJoinedByString:@""]);
@Krishna
Krishna / scribbles painting
Created March 3, 2011 16:14 — forked from lorenbrichter/scribbles painting
Bezier OpenGL code stuff via atebits
#include "Painting.h"
#include "Bezier.h"
#include "ProgressOp.h"
#include <math.h>
#include <sys/time.h>
#include <float.h>
#define MAX_ZOOM 12.0
#define MIN_ZOOM -40.0
@Krishna
Krishna / gist:754656
Created December 25, 2010 03:24
Invoking with rocco on an Objective-C file
rocco --language=objective-c --comment-chars=/// ktext.h
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script src="http://api.simile-widgets.org/timeline/2.3.1/timeline-api.js?bundle=true" type="text/javascript"></script>
<script>
var tl;
function onLoad() {
var eventSource = new Timeline.DefaultEventSource();