Skip to content

Instantly share code, notes, and snippets.

@Akiyah
Akiyah / jsdoit.css
Created March 8, 2014 16:39
forked: レイトレーシング練習
html {
height:100%;
}
body {
margin: 0;
padding: 0;
background: gray;
width:100%;
height:100%;
@Akiyah
Akiyah / jsdoit.html
Created April 13, 2014 16:03
月毎や年毎で見比べる forked: Dygraphの練習
<script src="http://dygraphs.com/1.0.1/dygraph-combined.js"></script>
<div id="graphdiv"></div>
<div id="graphdiv_m"></div>
<div id="graphdiv_y"></div>
@Akiyah
Akiyah / example_1_1.r
Last active August 29, 2015 14:04
Barron's Ap Statisics Topic One:Graphical DisplayをRでやってみる
png("example_1_1.png", width=600, height=600)
dotchart(c(5,5,2,6,10,7),labels=c("Tennis", "Soccor", "Hockey", "Football", "Basketball", "Baseball"))
dev.off()
@Akiyah
Akiyah / jsdoit.css
Created September 3, 2014 15:41
forked: レイトレーシング練習
html {
height:100%;
}
body {
background: gray;
width:100%;
height:100%;
overflow : hidden;
}
@Akiyah
Akiyah / README
Last active August 29, 2015 14:06
forked: レイトレーシング練習
todo:
* -影をぼんやりさせる-
* 押しているモノも表示する
* へこみ関数の最適化(押した感じにする)
* シワをつける(丸くする)
* -倍精度で計算する-
x <- rnorm(20)
y <- rnorm(20)
p <- -0.9
u <- x + 2
v <- p * x + sqrt(1 - p**2) * y + 2
u <- (u - min(u)) / (max(u) - min(u))
v <- (v - min(v)) / (max(v) - min(v))
@Akiyah
Akiyah / gist:deec63e776b23322066d
Created November 6, 2014 03:22
override operator "+" in R
"+" <- function(e1, e2=NA) {
if (is.character(e1) & is.character(e2)) {
return(paste0(e1, e2))
}
ifelse(is.na(e2), base::"+"(e1), base::"+"(e1, e2))
}
1+2+3
#=> [1] 6
"f"+"g"+"h"
@Akiyah
Akiyah / gist:e8e0e3be7e98ae0eaabf
Created December 10, 2014 10:31
二項分布と正規分布とポアソン分布のずれをアニメーションにする
s <- 100
index_h <- 500^(((1:s)-1)/(s-1))
index <- as.integer(c(index_h, rev(index_h)))
for (i in 1:length(index)) {
png(sprintf("plot_%04d.png", i), width=500, height=500)
np <- index[i]
n <- 1000
p <- np/n
q <- 1 - p
x <- 0:n
@Akiyah
Akiyah / function_dsl.r
Created December 16, 2014 01:02
jibanyan_equation_edit
# plus
"%+%" <- function(f, g) {
return(paste0("(", f, ") * (", g,")"))
}
# minus
m <- function(f) {
paste0( "-(", f, ")" )
}
@Akiyah
Akiyah / jsdoit.css
Created January 24, 2015 04:47
2015-01-24 1st
* {
margin: 0;
padding: 0;
border: 0;
}
body {
background: #ddd;
font: 30px sans-serif;
}