most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
class GradientView < UIView | |
def initWithFrame(frame) | |
if super | |
rgb = CGColorSpaceCreateDeviceRGB() | |
ptr = Pointer.new(:float, 8) | |
ptr[0] = 1.0 | |
ptr[1] = 0.0 | |
ptr[2] = 0.0 | |
ptr[3] = 1.0 | |
ptr[4] = 0.0 |
require 'rubygems' | |
require 'nokogiri' | |
require 'httparty' | |
doc = Nokogiri(HTTParty.get('http://www.gutenberg.org/wiki/Harvard_Classics_(Bookshelf)')) | |
ids = doc.css('a').select{|a| a.attr('title') =~ /ebook:/ }.map do |a| | |
a.attr('title') =~ /ebook:(\d+)/ | |
{:title => a.text, :id => $1 } | |
end.compact.uniq |
.packages | |
*.pyc |
//Throw this on your UITableViewDelegate (probably your UITableViewController) to achieve the "keyboard dismisses when I tap away" effect. | |
//Your users will thank you. A lot. | |
- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView { | |
[self.view endEditing:YES]; | |
} | |
//The endEditing: method on UIView comes to us from a category that UITextField adds to UIKit that makes the view or any subview that is the first responder resign (optionally force), that's what the "YES" bit is. |
class User < ActiveRecord::Base | |
devise :database_authenticatable, :openid_authenticatable, :recoverable, :rememberable, :trackable, :validatable | |
# Handle creation of user authenticated via OpenID | |
def self.create_from_identity_url(identity_url) | |
User.new(:identity_url => identity_url) | |
end | |
# Set email as a required field from the Open ID provider |
require 'rubygems' | |
require 'simplegeo' # gem install sg-ruby | |
require 'nokogiri' # gem install nokogiri | |
require 'typhoeus' # gem install typhoeus | |
require 'sinatra' # gem install sinatra | |
## | |
# About: | |
# This little script, sacca.rb allows you to save a gowalla user's checkins to a layer on SimpleGeo. | |
# it's using PubSubHubbub (Gowalla's hub is at http://hub.gowalla.com/) to subscribe to the Atom feed |
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | |
################################## | |
# Edit these | |
set :application, "example_node_app" | |
set :node_file, "hello_world.js" | |
set :host, "ec2-174-129-114-66.compute-1.amazonaws.com" | |
ssh_options[:keys] = [File.join(ENV["HOME"], ".ec2", "default.pem")] | |
set :repository, "git://gist.github.com/479007.git" | |
set :branch, "master" |
The regex patterns in this gist are intended to match any URLs, | |
including "mailto:[email protected]", "x-whatever://foo", etc. For a | |
pattern that attempts only to match web URLs (http, https), see: | |
https://gist.github.com/gruber/8891611 | |
# Single-line version of pattern: | |
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |