File: gist.rb

package info (click to toggle)
tdiary-contrib 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,772 kB
  • sloc: ruby: 17,305; javascript: 8,263; lisp: 562; xml: 451; php: 61; sql: 40; makefile: 18
file content (16 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# show code snippet via gist.github.com
#
# usage:
#   gist(gist_id)
#     - gist_id: The id of the code snippet on gitst.github.com (e.g. 2056 for http://gist.github.com/2056)
#
# Copyright (c) KAKUTANI Shintaro <http://kakutani.com/>
# Distributed under the GPL

def gist( gist_id )
	gist_snippet_url = "http://gist.github.com/#{gist_id}"
	return (<<-EOS).chomp
<div class="gist_plugin"><script src="#{gist_snippet_url}.js"></script>
<noscript><a href="#{gist_snippet_url}">gist:#{gist_id}</a></noscript></div>
	EOS
end