This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example custom UIView implementation | |
------------------------------------ | |
Used as a custom UITableView header cell. | |
*/ | |
- (id)initWithFrame:(CGRect)frame { | |
if ((self = [super initWithFrame:frame])) { | |
userName = [[UILabel alloc] initWithFrame:CGRectMake(70, 16, (self.bounds.size.width - 70), 28)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int (^minusOne)(int); | |
minusOne = ^(int myNumber) { | |
return myNumber - 1; | |
}; | |
NSLog(@"%d", minusOne(3)); // Will print: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
int main(int argc, char *argv[]) { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"LapTimerAppDelegate"); | |
[pool release]; | |
return retVal; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'webrick' | |
include WEBrick | |
s = HTTPServer.new(:Port => 3000, :DocumentRoot => Dir::pwd) | |
['INT', 'TERM'].each { |sig| trap(sig) { s.shutdown } } | |
s.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
class CategoryListBlock < Liquid::Block | |
include Liquid::StandardFilters | |
def render(context) | |
categories = context.registers[:site].categories.keys | |
result = [] | |
context.stack do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
// Fade the page, hide the 'Not found' message a little, there's still hope! | |
$('#title, #page').css('opacity', 0.3); | |
// If the JSON is taking its time or fail then reset | |
var timeout = setTimeout(function(){ | |
$('#page, #title').css('opacity', 1); | |
}, 2000); | |
// Get the JSON. Using jQuery. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.customfile = function(opts){ | |
var options = $.extend({ text: 'Upload file' }, opts), | |
wrapper = $('<div />').addClass('jq-link-file-field-wrapper'), | |
hitarea = $('<div />').addClass('jq-link-file-field-hitarea'), | |
link = $('<a />').attr({'class': 'jq-link-file-field-link', href: 'javascript:void(0);'}).html(options['text']); | |
this.after(wrapper.append(hitarea.append(link))); | |
wrapper.css('position', 'relative').prepend(this); | |
this.css({opacity: 0.0, 'z-index': 100}); hitarea.css({'z-index': 10}); | |
$([this[0], hitarea[0]]).css({position: 'absolute', left: 0, top: 0, display: 'block'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* _mixins.scss | |
* ============ | |
* Some mixins I am using at work. Giving < CSS3 support where I can. | |
* | |
*/ | |
$golden-ratio: 1.61803399; // Everyone is doing it | |
$base-spacing: 20px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@reward = place.rewards.active | |
@reward = at_place ? @reward.cellar_door.first : @reward.regular.first | |
# better? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)closeThisViewController { | |
// Lets retain an instance of the current navigation controller | |
UINavigationController *navController = [self.navigationController retain]; | |
// When this is called self.navigationController is no longer available | |
[self.navigationController popViewControllerAnimated: YES]; | |
// To talk to that previous VC here's what you do | |
[[navController topViewController] doSomethingHere:YES]; |
OlderNewer