Skip to content

Instantly share code, notes, and snippets.

View tenten0213's full-sized avatar
💭
😇

tenten0213 tenten0213

💭
😇
View GitHub Profile
# encoding: utf-8
require 'net/http'
require 'open-uri'
require 'nokogiri'
require 'json'
GITHUB_URL = "https://github.com"
WIKI_URL = GITHUB_URL + "/" + "mbostock/d3/wiki/"
API_URL = WIKI_URL + "API-Reference"
@tenten0213
tenten0213 / index.html
Last active December 22, 2015 13:08
Canvasを画像にしてPDFにする
<!doctype html>
<html>
<head>
<title>Pie Chart</title>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
</head>
<body>
<canvas id="canvas" height="450" width="450"></canvas>
<button type="button" onclick="createPDF()">Create PDF</button>
<iframe frameborder="0" width="450" height="450"></iframe>
@tenten0213
tenten0213 / attr2.rb
Last active December 16, 2015 21:49
おまじないについて その2
class Foo
# attr_*はModuleのprivate methodなので、レシーバは省略する
# ClassはModuleを継承していて、FooはClassを継承している
# ので、Moduleのprivate methodのattr_accessorがFooの中で利用可能
attr_accessor :value
end
foo = Foo.new
foo.value = 'z'
puts foo.value #=> z
@tenten0213
tenten0213 / attr.rb
Last active December 16, 2015 19:59
おまじないについて その1
class Hoge
def value=(value)
@value = value
end
def value
@value
end
end
hoge = Hoge.new
hoge.value= 'x'
@tenten0213
tenten0213 / deathStar.user.js
Created February 27, 2013 04:20
文章に☆を付けられるのが嫌だったので、置換するスクリプトを作成。
var TARGET_URL = "https:\/\/www\.skipaas\.com\/";
(function(){
function deathStar(elem){
var children = elem.childNodes;
var child;
for(var i=0; i < children.length; i++){
child = children.item(i);
if(child.nodeType == 3){ // テキストノード
child.nodeValue = child.nodeValue.replace(/☆/g, "。");
@tenten0213
tenten0213 / ChangeLocation.groovy
Created October 19, 2012 08:01
JenkinsでSVNのロケーションを切り替えるスクリプト。
class ChangeLocation{
static void main(args){
if (args.size()==2) {
println "config.xmlを読込み、SVNサーバーのロケーションを書き換えます。"
println "置換前:"+ args[0]
println "置換後:"+ args[1]
println "JOB完了後、Jenkinsの管理から設定の再読み込みを行なってください。"
new File("C:/Jenkins/jobs/").eachFile {
def target = it.toString()+"\\config.xml"