Skip to content

Instantly share code, notes, and snippets.

Avatar

terukazu kosuga tkosuga

View GitHub Profile
@tkosuga
tkosuga / gist:dfb7dd3dd1123dc160e0
Last active Aug 29, 2015
UbuntuにMeteor製Slack風オンラインチャットRocket.Chatの導入手順
View gist:dfb7dd3dd1123dc160e0
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs npm
$ curl https://install.meteor.com/ | sh
$ git clone https://github.com/RocketChat/Rocket.Chat.git
$ cd Rocket.Chat
$ meteor
@tkosuga
tkosuga / gist:5584957
Created May 15, 2013
font awesomeの導入
View gist:5584957
@font-face {
font-family: 'FontAwesome';
src: url('/font/fontawesome-webfont.eot?v=3.0.1');
src: url('/font/fontawesome-webfont.eot?#iefix&v=3.0.1') format('embedded-opentype'),
url('/font/fontawesome-webfont.woff?v=3.0.1') format('woff'),
url('/font/fontawesome-webfont.ttf?v=3.0.1') format('truetype');
font-weight: normal;
font-style: normal;
}
/* Font Awesome styles
@tkosuga
tkosuga / gist:5584638
Last active Dec 17, 2015
modalを起動するところ。
View gist:5584638
<div class="entry">
<div>
<h4>
<a href="<%= item.link %>" style="color:#2D6BC4;" target="_blank" rel="nofollow">
<%= item.title %>
</a>
<a href="http://b.hatena.ne.jp/entry/<%= item.link %>" target="_blank" rel="nofollow">
<img src="http://b.hatena.ne.jp/entry/image/<%= item.link %>" alt="">
</a>
@tkosuga
tkosuga / gist:5584607
Last active Dec 17, 2015
twitter bootstrapでのajaxなmodalの説明
View gist:5584607
<div class="modal-header" style="padding-bottom: 0; ">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i></button>
<ul class="nav nav-tabs" id="<%= detail.object_id %>_tab" style="padding-bottom: 0px; margin-bottom: 0px;">
<li><a href="#<%= detail.object_id %>_all" data-toggle="tab">全て</a></li>
<li><a href="#<%= detail.object_id %>_have_comment" data-toggle="tab">コメントあり</a></li>
</ul>
</div>
@tkosuga
tkosuga / gist:5584429
Last active Dec 17, 2015
twitter bootstrapのAjax tab切り替え説明
View gist:5584429
<ul class="nav nav-tabs" id="entry_tab">
 <li><a href="#hot_entries" data-toggle="tab">ホットエントリー</a></li>
<li><a href="#interest_entries" data-toggle="tab">インタレスト</a></li>
<li><a href="#favorites" data-toggle="tab">お気に入り</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="hot_entries">
 <h3>Loading...</h3>
</div>
@tkosuga
tkosuga / gist:5564062
Created May 12, 2013
はてなブックマークのマイページ。インタレストのヘッダー部分。
View gist:5564062
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml"
xml:lang="ja"
lang="ja">
<head>
<script type="text/javascript">
var __rendering_time = (new Date).getTime();
</script>
@tkosuga
tkosuga / gist:5564059
Created May 12, 2013
はてなマイページのマイホットエントリー。ヘッダー部分。
View gist:5564059
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml"
xml:lang="ja"
lang="ja">
<head>
<script type="text/javascript">
var __rendering_time = (new Date).getTime();
</script>
@tkosuga
tkosuga / gist:5517672
Created May 4, 2013
hokkaido-photo.tkosuga.jpのページキャッシュ部分
View gist:5517672
caches_action :index, :cache_path => :cache_path.to_proc, :expires_in => 2.hours
caches_action :spring, :cache_path => :cache_path.to_proc, :expires_in => 2.hours
caches_action :summer, :cache_path => :cache_path.to_proc, :expires_in => 2.hours
caches_action :autumn, :cache_path => :cache_path.to_proc, :expires_in => 2.hours
caches_action :winter, :cache_path => :cache_path.to_proc, :expires_in => 2.hours
def cache_path
controller_name + "/" + action_name + "?page=" + (params[:page] || 1).to_s
end
@tkosuga
tkosuga / gist:5517667
Last active Dec 16, 2015
lib/flickraw/api.rbをlib/flickraw/api_ext.rbな感じでcache。キャッシュ先でMarshal.dump/loadしてます。
View gist:5517667
# lib/flickraw/api.rb
def call(req, args={}, &block)
rest_path = FlickRaw.secure ? REST_PATH_SECURE : REST_PATH
http_response = @oauth_consumer.post_form(rest_path, @access_secret, {:oauth_token => @access_token}, build_args(args, req))
process_response(req, http_response.body)
end
You can’t perform that action at this time.