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
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
@window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds | |
@window.rootViewController = GoogleViewController.alloc.init | |
@window.makeKeyAndVisible | |
true | |
end | |
end |
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
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
alert = UIAlertView.new | |
alert.message = t('start') | |
alert.show | |
true | |
end | |
def t(key) | |
NSBundle.mainBundle.localizedStringForKey(key, value:nil, table:nil) |
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
require 'tempfile' | |
# usage: | |
# pc = PDFComposer.new(file_or_content1[, file_or_content2 ...]) | |
# content = pc.compose # compose all into content | |
# pc.compose(to_file_path) # output to 'to_file_path' :-) | |
class PDFComposer | |
def initialize(*args) | |
@sources = args.flatten |
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
# facebootstrap: Rails3 template | |
app_h_name = app_name.gsub(/_/, '-') | |
app_c_name = app_name.classify | |
ruby_version = '1.9.3-p286' | |
repository_path = "[email protected]:chsh/#{app_h_name}.git" | |
target_branch = 'develop' # or master etc... | |
deploy_server = '[YOUR DEPLOY SERVER]' | |
target_mode = 'edge' # or 'live' or 'develop' etc... | |
# additional_path = '/usr/pgsql-9.1/bin' |
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
require 'rubygems' | |
require 'axlsx' | |
rows = [ | |
[1, "abc", Date.parse('2012/6/28')], | |
[2, "xyz"] | |
] | |
pkg = Axlsx::Package.new | |
pkg.workbook do |wb| |
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
# Add geometry calculation support. | |
# extend this module for ActiveRecord model. | |
module GeometrySupport | |
def by_distance_from_center(center, opts = {}) | |
opts.reverse_merge! :meters => 500 | |
cp = LatLng.from(center).to_point | |
sw_ne = boundary_from_meters(center, | |
opts[:meters]).map {|ll| ll.to_point} | |
cc = ComplexCondition.new |
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
#!/bin/sh | |
pfx='rel' | |
d=`date +%Y%m%d%H%M%S` | |
git flow release start $pfx-$d | |
git flow release finish -m"Release:$d" $pfx-$d |
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
* Install Xcode | |
App Store -> Search Xcode -> Download -> Install | |
* Install Command line tools | |
Launch Xcode -> Preferences -> Downloads -> Install command line tools | |
* Install Homebrew | |
$ ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go) | |
* Install rbenv ruby-build |
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 ApplicationHelper | |
def content_with_cache(key, content) | |
controller.read_fragment(key) || | |
controller.write_fragment(key, content) | |
end | |
end |
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
location ~ \.php$ { | |
include fastcgi_params; | |
fastcgi_pass unix:/tmp/php-fpm.www.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
fastcgi_param SERVER_PORT 80; | |
fastcgi_param SERVER_NAME yourserver.com; | |
expires 2h; | |
} |