Skip to content

Instantly share code, notes, and snippets.

View marcusficner's full-sized avatar

Marcus Ficner marcusficner

View GitHub Profile
@paulrehkugler
paulrehkugler / gist:9647085
Created March 19, 2014 17:37
Default Protocol Method Implementation in Objective-C
// SomeProtocol.h
@protocol SomeProtocol <NSObject>
- (void) protocolMethod;
@end
// NSObject+SomeProtocolDefaultImplementation.h
@interface NSObject(SomeProtocolDefaultImplementation)
@twobitlabs
twobitlabs / gist:4226365
Created December 6, 2012 17:35
Blocks cheat sheet
// http://cocoawithlove.com/2009/10/ugly-side-of-blocks-explicit.html has a nice breakdown of the syntax--it helps to think of the ^ as similar to a pointer dereference symbol *
// block typedef:
typedef void(^Block)();
typedef void(^ConditionalBlock)(BOOL);
typedef NSString*(^BlockThatReturnsString)();
typedef NSString*(^ConditionalBlockThatReturnsString)(BOOL);
// block property with typedef:
@kentbrew
kentbrew / node-on-ec2-port-80.md
Last active February 4, 2024 19:14
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);