Skip to content

Instantly share code, notes, and snippets.

View hiroshi's full-sized avatar
🏠
Working from home

Hiroshi Saito hiroshi

🏠
Working from home
View GitHub Profile
@hiroshi
hiroshi / file0.sql
Created August 30, 2012 02:44
ActiveRecord :binary type のカラムを psql でテキストに変換して見る ref: http://qiita.com/items/1f5a92b3537624ae897e
SELECT encode(bin,'escape') FROM t;
@hiroshi
hiroshi / file1.txt
Created April 27, 2012 02:50
Associative Object は自動で release, property は自分で release ref: http://qiita.com/items/c262c9b9f8e1044ac2e4
$ clang main.m -o main -framework Cocoa && ./main
-[Container dealloc]
-[Content dealloc] property
-[Content dealloc] associatedObject
Fetching https://dl-ssl.google.com/android/repository/addons_list-1.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Fetching URL: https://dl-ssl.google.com/android/repository/repository-6.xml
Validate XML: https://dl-ssl.google.com/android/repository/repository-6.xml
Parse XML: https://dl-ssl.google.com/android/repository/repository-6.xml
Found SDK Platform Android 1.1, API 2, revision 1 (Obsolete)
Found SDK Platform Android 1.5, API 3, revision 4
Found SDK Platform Android 1.6, API 4, revision 3
@hiroshi
hiroshi / file0.txt
Created March 15, 2012 08:39
Xcode デバッガで [NSUserDefaults standardUserDefaults] みたいなクラスメソッドを使えないで困ったとき ref: http://qiita.com/items/3197
(lldb) po [NSUserDefaults standardUserDefaults]
error: Couldn't prepare the expression for execution in the target
(lldb) po [(Class)objc_getClass("NSUserDefaults") standardUserDefaults]
(id) $17 = 0x0644e5a0 <NSUserDefaults: 0x644e5a0>
@hiroshi
hiroshi / iOSMoviePlayButton.pjs
Created December 11, 2011 13:21
iOSMoviePlayButton.pjs
/* @pjs transparent=true; */
void setup() {
//int m = 5.2; // mergin
int s = 100; // size
size(s, s);
background(0, 0, 0, 0);
// background transparent circle
noStroke();
fill(0, 0, 0, 100);
ellipse(s/2, s/2, s, s);
@hiroshi
hiroshi / Makefile
Created December 1, 2011 04:59
Makefile for Testflight upload
# Testflight web interface doesn't allow input non-ASCII characters (e.g. Japanese) with Safari!
BROWSER = Google Chrome
TESTFLIGHT_TEAM_TOKEN_FILE = ./.testflight_team_token
TESTFLIGHT_TEAM_TOKEN_URL = https://testflightapp.com/dashboard/team/edit/?next=/api/doc/
TESTFLIGHT_TEAM_TOKEN = $(shell cat $(TESTFLIGHT_TEAM_TOKEN_FILE))
TESTFLIGHT_API_TOKEN_FILE = ~/.testflight_api_token
TESTFLIGHT_API_TOKEN_URL = https://testflightapp.com/account/\#api-token
TESTFLIGHT_API_TOKEN = $(shell cat $(TESTFLIGHT_API_TOKEN_FILE))
TESTFLIGHT_NOTES = 'This build was uploaded via the upload API'
#TESTFLIGHT_OTHER_OPTIONS = -F replace=True
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"SampleTable";
if (!tweetMessages) {
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.text = @"loading...";
cell.textLabel.textColor = [UIColor grayColor];
return cell;
}
@hiroshi
hiroshi / Gitの手順.md
Created June 24, 2011 04:34 — forked from anonymous/Gitの手順
デザイナー向けのGitの手順。詳しくは http://kuroigamen.com にいろいろあります。
  1. リモートリポジトリをローカルにクローン(複製)します。

    git clone #{リモートリポジトリのURL}

  2. クローンしたディレクトリへ移動(Change Directry)

    cd #{ローカルパス}

  3. 必要なGemを一気にインストール

@hiroshi
hiroshi / gist:1001866
Created June 1, 2011 06:16
Rails 3.0 app + Mongoid による MongoHQ へのアクセスの実験

メモ - Mongoid による MongoHQ へのアクセスの実験

Rails app への Mongoid 導入

ruby/rails で MongoDB を使うときのメジャーな選択肢として MongoMapper, Mongoid がありますが、

  • Mongoid の方が後発、
  • Mongoid の方が 2011/6 の段階で rails 3 対応、ドキュメントなどが充実しているらしい などの理由により、 Mogoid を使います。 (あまり詳しく調べてませんが、問題が発生したら乗り換えることもそんなに難しくないはず)
class ApplicationController < ActionController::Base
...
# FORCE to implement content_for in controller
def view_context
super.tap do |view|
(@_content_for || {}).each do |name,content|
view.content_for name, content
end
end
end