Skip to content

Instantly share code, notes, and snippets.

@aoirint
aoirint / sample.tex
Created April 23, 2017 11:26
pLaTex サンプル
\documentclass[a4j]{jsarticle}
% コメント
\begin{document}
\section{節名はここ}
本文1
\subsection{入れ子の節1}
本文2
@aoirint
aoirint / operator.pl
Last active May 20, 2017 11:46
Perlの練習
system('chcp 65001');
system('cls');
sub neg {
return -$_[0];
}
sub add {
return($_[0] + $_[1]);
}
@aoirint
aoirint / calendar.js
Last active June 17, 2017 01:37
実行月の日曜始まり5週カレンダーをテーブル出力するJS
<!DOCTYPE html>
<script>
function ADate(year, month, date) {
this.year = year;
this.month = month;
this.date = date;
}
var today = new Date();
@aoirint
aoirint / calendar.js
Last active June 17, 2017 01:56
Ver.2 実行月の日曜始まり5週カレンダーを出力するJS / 週単位で配列に入れるようにした
function ADate(year, month, date) {
this.year = year;
this.month = month;
this.date = date;
}
var today = new Date();
var year = today.getFullYear();
var month = today.getMonth() +1;
var lastMonth = new Date(year, month-1, 0);
@aoirint
aoirint / calendar.js
Last active June 17, 2017 02:26
Ver.3 実行月の日曜始まり5週カレンダーを出力するJS / もっとシンプルに。中心に来る週を指定できるように
var Calendar = {};
Calendar.create = function(year, month, baseWeek, amplitude) {
if (amplitude == undefined) amplitude = 2;
var weeks = {};
weeks['amplitude'] = amplitude;
weeks['weekCount'] = amplitude*2 +1;
for (var i=0; i<weeks['weekCount']; i++) {
@aoirint
aoirint / Calendar.js
Last active June 17, 2017 02:57
Ver.4 実行月の日曜始まり5週カレンダーを出力するJS / カレンダープロトタイプ化、クリックイベント
var Calendar = function(year, month, baseWeek, amplitude) {
if (amplitude == undefined) amplitude = 2;
var weeks = [];
var weekCount = amplitude*2 +1;
for (var i=0; i<weekCount; i++) {
var week = [];
var weekI = baseWeek +i-amplitude;
var weekTop = new Date(year, month-1, 7*(weekI-1)+1);
@aoirint
aoirint / fibo.py
Created July 20, 2017 05:43
Pythonでフィボナッチ数列のテスト
def fibo(i):
if i == 1:
return 0
if i == 2:
return 1
return fibo(i-1) + fibo(i-2)
for i in range(1, 31):
print(fibo(i))
@aoirint
aoirint / fibo.pl
Last active July 20, 2017 12:33
Perlでフィボナッチ数列のテスト
sub fibo {
local($i) = $_[0];
if ($i == 1) { return 0; }
if ($i == 2) { return 1; }
return &fibo($i-1) + &fibo($i-2);
}
for (local($i)=1; $i<31; $i++) {
@aoirint
aoirint / fibo.rb
Created July 20, 2017 12:22
Rubyでフィボナッチ数列のテスト
def fibo(i)
if i == 1 then
return 0
end
if i == 2 then
return 1
end
return fibo(i-1) + fibo(i-2)
end
@aoirint
aoirint / fibo.c
Created July 20, 2017 12:38
Cでフィボナッチ数列のテスト
#include "stdio.h"
int fibo(int i) {
if (i == 1) return 0;
if (i == 2) return 1;
return fibo(i-1) + fibo(i-2);
}
// int main(int argc, char *argv[]) {
int main(void) {