Skip to content

Instantly share code, notes, and snippets.

@jamesan
jamesan / url_encode.rb
Created April 14, 2011 11:08
Percent encoding for URI conforming to RFC 3986. Ref: http://tools.ietf.org/html/rfc3986#page-12
require 'liquid'
require 'uri'
# Percent encoding for URI conforming to RFC 3986.
# Ref: http://tools.ietf.org/html/rfc3986#page-12
module URLEncoding
def url_encode(url)
return URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
end
@laiso
laiso / HogeSomeViewController.m
Created September 14, 2011 13:46
[雑記] UIWebViewのスクロールを無効にする
// こんな感じ??
UIWebView* _webView = [[[UIWebView alloc] init] autorelease];
UIScrollView* webScrollView = [[_webView subviews] lastObject];
if([webScrollView respondsToSelector:@selector(setScrollEnabled:)]){
[webScrollView setScrollEnabled:NO];
}
// lastObject がUIScrollView だとは限らない??
UIWebView* _webView = [[[UIWebView alloc] init] autorelease];
@markd2
markd2 / BNRDiggyDict.h
Created March 20, 2012 13:45
Objective-C Literals, part 2 support files.
#import <Foundation/Foundation.h>
@interface BNRDiggyDict : NSObject
// React to object indexing. Would be nice to have a @protocol for this
- (id) objectForKeyedSubscript: (id) key;
- (void) setObject: (id) thing forKeyedSubscript: (id<NSCopying>) key;
// And for fun, it also can react to scalar indexing.
// Returns the N'th key of the top-level collection.
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@melborne
melborne / Plugins.textile
Created May 9, 2012 11:54
Translation of Jekyll Plugins

https://github.com/mojombo/jekyll/wiki/Plugins

Jekyllプラグインシステムのフックは、あなたのサイト向けに特化したコンテンツの生成を可能にします。Jekyllのソースを修正することなく、あなたのサイト用のコードを実行できます。

The Jekyll plugin system hooks allow you to create custom generated content specific to your site. You can run custom code for your site without having to modify the Jekyll source itself.

プラグインのインストール

h2. Installing a plugin

@juno
juno / github-flow.ja.md
Last active April 9, 2021 02:20
GitHub Flow (Japanese translation) Latest version is here: https://gist.github.com/Gab-km/3705015

GitHub Flow

31 Aug 2011

git-flowの問題点 (Issues with git-flow)

私は人々にGitを教えるためにあちこちを飛び回っているが、最近のほぼすべてのクラスやワークショップでgit-flowについてどう思うかを尋ねられた。私はいつも、git-flowは素晴らしいと思うと答えている。何百万ものワークフローを持ったシステム(Git)を提供し、ドキュメントもあるし、よくテストされている。フレキシブルなワークフローは、実に容易なやり方で多くの開発者の役に立つ。標準的なものになりつつあり、開発者はプロジェクトや企業の間を移動しつつこの標準的なワークフローに馴染むことができる。

@katsuyoshi
katsuyoshi / migrate_heorku.rb
Created August 8, 2012 06:54
herokuのmigration
your_app = ARGV[0] || "your_app"
plan = ARGV[1] || "dev"
/(HEROKU_POSTGRESQL_\w+)/ =~ `heroku addons:add heroku-postgresql:#{plan} -a #{your_app}`
db_url = $1
system("heroku addons:add pgbackups -a #{your_app}")
system("heroku maintenance:on -a #{your_app}")
system("heroku pgbackups:capture --expire -a #{your_app}")
system("heroku pgbackups:restore #{db_url} -a #{your_app}")
system("heroku pg:promote #{db_url} -a #{your_app}")
system("heroku maintenance:off -a #{your_app}")
@corosukeK
corosukeK / gist:3293701
Created August 8, 2012 09:17
HTTPLoader
//
// HTTPLoader
//
// Created by Keisuke Kimura on 2012/08/08.
// Copyright (c) 2012年 Keisuke Kimura. All rights reserved.
//
//
// HTTPLoader.h
//
@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
@h5y1m141
h5y1m141 / app.coffee
Created October 15, 2012 00:44
QiitaのiPhoneアプリをTitaniumMobile+CoffeeScript
Qiita = require('qiita')
tableView = require('tableView')
moment = require('lib/moment.min')
momentja = require('lib/momentja')
t = new tableView()
q = new Qiita()
token = Ti.App.Properties.getString('QiitaToken')