Skip to content

Instantly share code, notes, and snippets.

@arunthampi
arunthampi / gestures_with_buttons.m
Created November 8, 2010 14:26
If you want to handle button events separately from tap gestures
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
return ([[touch.view class] isSubclassOfClass:[UIButton class]]) ? NO : YES;
}
- (NSMutableAttributedString *)attributedStringFromMarkup:(NSString *)markup {
NSMutableAttributedString * mutableAttrString = [[[NSMutableAttributedString alloc] initWithString:@""] autorelease];
NSString * nextTextChunk = nil;
NSString * defaultFont = @"Georgia";
NSString * boldFont = @"Georgia-Bold";
NSString * headingFont = @"Gill-Sans";
CGFloat defaultFontSize = 18.0;
CGFloat headingFontSize = 22.0;
//
// jQuery Slug Generation Plugin by Perry Trinier (perrytrinier@gmail.com)
// Licensed under the GPL: http://www.gnu.org/copyleft/gpl.html
jQuery.fn.slug = function(options) {
// Only do something if the element exists
if(this.length != 0) {
var settings = {
slug: 'slug', // Class used for slug destination input and span. The span is created on $(document).ready()
hide: true // Boolean - By default the slug input field is hidden, set to false to show the input field and hide the span.
##################################################
Install the passenger gem
##################################################
$ gem install passenger
##############################################################################
Install the Passenger-Nginx module
Choose all default options. (1. for Passenger to compile and install nginx)
##############################################################################
class CompetitionTest < ActiveSupport::TestCase
# Of course, you define a factory for Competition using FactoryGirl
# (outside the scope of this Gist)
subject { Factory(:competition) }
should_validate_uniqueness_of :permalink
end
class UserTest < ActiveSupport::TestCase
should "act as authenticated" do
module = Authlogic::ActsAsAuthentic::Login::Methods
User.included_modules.include?(module)
end
end
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH=$PATH:~/.scripts/
alias sshp='ssh -p 3456'
alias scpp='scp -P 3456'
alias ssho='ssh -p 443'
alias scpo='scp -P 443'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.082 0.087 0.109</string>
<key>InsertionPoint</key>
<string>1.000 1.000 1.000</string>
$ brew install postgresql
==> Downloading http://ftp2.uk.postgresql.org/sites/ftp.postgresql.org/source/v8.4.2/postgresql-8.4.2.tar.bz2
######################################################################## 100.0%
==> ./configure --enable-thread-safety --with-bonjour --with-python --with-perl --with-gssapi --with-krb5 --with-openssl --with-libxml --with-libxsl
==> make install
==> Caveats
If this is your first install, create a database with:
initdb /usr/local/var/postgres
Automatically load on login with:
require 'rubygems'
require 'friendly'
Friendly.configure :adapter => "mysql",
:host => "localhost",
:user => "root",
:password => "",
:database => "friendly_development"
class BlogPost