Skip to content

Instantly share code, notes, and snippets.

View haraldmartin's full-sized avatar
🌝

Martin Ström haraldmartin

🌝
View GitHub Profile
# 2010-10-01
#
# Mac OS X 10.6.3
# Homebrew 0.7
# Xcode 3.2.4
# Git 1.7.3.1
# RVM 1.0.12
# Ruby 1.8.7, 1.9.2
# Passenger 2.2.15
# MySQL 5.1.49
// By Henrik Nyh <http://henrik.nyh.se> 2010-06-12 under the MIT license.
#import <Foundation/Foundation.h>
@interface SearchBarStyler : NSObject {
}
+(void)enableReturnKeyWithNoText:(UISearchBar *)searchBar;
@end

Rounded rectangle with gradient background on the iPhone, NSTokenFieldCell style.

Screenshot

Unlike my previous implementation, this one is drawn inside a single view using Core Graphics. It can thus be used for optimized, fast-scrolling cells per Apple's TableViewSuite sample.

The gradient shades are changed from that implementation, too, and the border itself is gradiented (by drawing a smaller rectangle inside a larger one that becomes the border).

You need to include the uicolor-utilities category by Ars Technica.

// AKToken
// By Henrik Nyh <http://henrik.nyh.se> 2010-03-22 under the MIT license.
#import <UIKit/UIKit.h>
@interface AKToken : UIView {
}
#!/bin/sh -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo "<h1>hi mom!</h1>" | browser
if [ -t 0 ]; then
cat <<usage
Usage: browser
<!--[if IE]>
<script>
document.write(...);
</script>
<![endif]-->
<!--[if !IE]><!-->
<script defer="defer">
document.write(...);
</script>
// cocoa NSString URI encode addition
@interface NSString (HUAdditions)
- (NSString *)URISafeString;
@end
@implementation NSString (HUAdditions)
- (NSString*)URISafeString {
return (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
}
@end
/*
Copyright (c) 2009 Remy Demarest
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js)
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
Bluepill.application("app_name") do |app|
app.process("app_name") do |process|
process.start_command = "cd /u/apps/app_name/current && /usr/local/bin/unicorn_rails -c /u/apps/app_name/current/config/unicorn.conf.rb -E production -D"
process.stop_command = "kill -QUIT `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`"
process.restart = "kill -USR2 `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`"
process.stdout = process.stderr = "/u/apps/app_name/current/log/unicorn.log"
process.pid_file = "/u/apps/app_name/current/tmp/pids/unicorn.pid"
process.checks :mem_usage, :every => 10.seconds, :below => 250.megabytes, :times => [3, 5]
process.uid = "app"
process.gid = "app"