##Simply annoying Tweets
Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD
([a-z])/1{4}
Tweet w/ just a single hashtag: #omgthissucks
^ *#[^ ]+$
## DNS | |
@dns = Fog::DNS.new(:provider => 'Linode', :linode_api_key => LINODE_KEY) | |
if @zone = @dns.zones.all.find { |z| z.domain == ZONE } | |
puts "Found zone #{@zone.inspect}" | |
else | |
@zone = @dns.zones.create(:domain => ZONE, :email => ZONE_EMAIL) | |
puts "Creating zone #{@zone.inspect}" | |
end |
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { | |
CGFloat maxY = scrollView.contentSize.height+scrollView.contentInset.bottom; | |
CGFloat botY = scrollView.contentOffset.y+scrollView.frame.size.height; | |
NSLog(@"y = %f, maxY = %f", botY, maxY); | |
if(botY >= maxY) { | |
// load next page | |
} | |
} |
#! /bin/sh | |
# On alternate invocations, this script | |
# saves the path of the source file currently open in Xcode | |
# and restores the file at that path in Xcode. | |
# | |
# By setting Xcode (in Behaviors) to run this script when "Run Starts" | |
# and when "Run Completes", you can prevent it from switching to main.m | |
# when a run finishes. | |
# See http://stackoverflow.com/questions/7682277/xcode-4-2-jumps-to-main-m-every-time-after-stopping-simulator |
So I have a View Controller that responds to user requests for a non-consumable in-app purchase. The VC invokes a method in the app delegate which serves as the SKProductQueueDelegate, so it'll receive confirmation that the IAP succeeded or not. | |
My question is: how would you notify the original VC that it should update the UI and unlock the purchased feature? I'm thinking NSNotification but I'm also considering retaining the VC in the app delegate. |
require "bundler/capistrano" | |
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) | |
require "rvm/capistrano" | |
set :rvm_ruby_string, '1.9.2@sinatroxy' | |
set :rvm_type, :system | |
set :bundle_flags, "--deployment" | |
set :application, "sinatroxy" | |
set :repository, "xxx@yyy:sinatroxy" |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
var str = "Dear diary "this" is a string with quotes." | |
str.replace(/"([^"]*)"/g, "''$1''"); |
When building a new instance of Amazon EC2 choose quick-start-1 as the security group not default | |
#LOCALLY | |
$ capify . | |
$ chmod +x config/unicorn_init.sh | |
$ git add . | |
$ git commit -m "deployment configs" | |
If rebuilding an instance don't forget to remove the ssh keys |
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 |
##Simply annoying Tweets
Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD
([a-z])/1{4}
Tweet w/ just a single hashtag: #omgthissucks
^ *#[^ ]+$