あまり深く理解してないので識者のツッコミ大歓迎
取り敢えず最低限だけ
# 補完を有効にする| module Jekyll | |
| module Tags | |
| class HighlightBlock < Liquid::Block | |
| def render_codehighlighter(context, code) | |
| #The div is required because RDiscount blows ass | |
| <<-HTML | |
| <div> | |
| <pre class='#{@lang}'><code class='#{@lang}'>#{h(code).strip}</code></pre> | |
| </div> | |
| HTML |
| # -*- encoding: utf-8 -*- | |
| require 'benchmark' | |
| class Character < Struct.new(:name, :level, :point) | |
| def to_s | |
| "%s:\tlv:%d\tpt:%d" % values | |
| end | |
| end | |
| 0 00 0000000 | |
| 01011011111110 | |
| 010111111111000 | |
| 0111111111111110 | |
| 011111111111100 | |
| 01113113111111110 | |
| 0101310011111110 | |
| 00100031133100 |
| module Sinatra | |
| module Flash | |
| module Style | |
| def styled_flash(key=:flash) | |
| return "" if flash(key).empty? | |
| id = (key == :flash ? "flash" : "flash_#{key}") | |
| close = '<a class="close" data-dismiss="alert" href="#">×</a>' | |
| messages = flash(key).collect {|message| " <div class='alert alert-#{message[0]}'>#{close}\n #{message[1]}</div>\n"} | |
| "<div id='#{id}'>\n" + messages.join + "</div>" | |
| end |
| Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled. | |
| Using the code from twitter bootstrap documentation page, this code is customized for table header. | |
| Create the table with following layout - | |
| <table class="table-fixed-header"> | |
| <thead class="header"> | |
| <tr> | |
| <th>Column 1</th> | |
| <th>Column 2</th> | |
| <th>Column 3</th> |
| $! raise された例外オブジェクト | |
| $" require で読み込まれたファイルの配列 | |
| $# | |
| $$ 現在のプロセス ID | |
| $% | |
| $& 正規表現にマッチした箇所の文字列 | |
| $' 正規表現にマッチした箇所より後ろの文字列 | |
| $( | |
| $) | |
| $* Ruby スクリプトに指定された引数。ARGV と同じ |
Ruby の HTTP クライアントライブラリ Faraday が便利そう
API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた
[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた
This is a plugin meant for Jekyll.
Example use:
Easily embed a YouTube video. Just drop this file in your _plugins directory.
{% youtube oHg5SJYRHA0 %}