Skip to content

Instantly share code, notes, and snippets.

View tenten0213's full-sized avatar
💭
😇

tenten0213 tenten0213

💭
😇
View GitHub Profile
@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"
@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 / 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 / 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 / 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>
# 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"
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Selection</title>
</head>
<body>
<div id="text">
<p>Hello! D3.js</p>
</div>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Data Binding</title>
</head>
<body>
<div id="fruits">
<p>リンゴ</p>
<p>オレンジ</p>
@tenten0213
tenten0213 / josiryoku.xml
Last active December 24, 2015 07:40
女子力
<?xml version="1.0"?>
<settings>
<console>
<colors>
<color id="0" r="240" g="215" b="192"/>
<color id="1" r="38" g="139" b="210"/>
<color id="2" r="133" g="153" b="0"/>
<color id="3" r="42" g="161" b="152"/>
<color id="4" r="220" g="50" b="47"/>
<color id="5" r="211" g="54" b="130"/>
@tenten0213
tenten0213 / data.csv
Created October 7, 2013 07:43
米とさつまいもの収穫量、作付面積をグラフ化
species year ha kg t
Sweet potato 1980 64800 2030 1317000
Sweet potato 1981 65000 2240 1458000
Sweet potato 1982 65700 2110 1384000
Sweet potato 1983 64800 2130 1379000
Sweet potato 1984 64600 2170 1400000
Sweet potato 1985 66000 2310 1527000
Sweet potato 1986 65000 2320 1507000
Sweet potato 1987 64000 2220 1423000
Sweet potato 1988 62900 2110 1326000