Skip to content

Instantly share code, notes, and snippets.

View kyontan's full-sized avatar
♨️

kyontan kyontan

♨️
View GitHub Profile
@kyontan
kyontan / ruby_tips.rb
Created October 28, 2012 13:56
Rubyちょこまか
# ロードパスにカレントディレクトリを追加
$:.unshift File.dirname(__FILE__)
or
require './hoge.rb'
#true になる物を全て返す
String#scan
#Mechanizeでauthの警告を出さない
agent.add_auth(URI("http://example.com"),"username","password")
@kyontan
kyontan / sample.tex
Created October 28, 2012 14:24
Texメモ
%%A4で上下左右の余白を20mmにする
%% 高さの設定
\setlength{\textheight}{\paperheight} % ひとまず紙面を本文領域に
\setlength{\topmargin}{-5.4truemm} % 上の余白を20mm(=1inch-5.4mm)に
\addtolength{\topmargin}{-\headheight} %
\addtolength{\topmargin}{-\headsep} % ヘッダの分だけ本文領域を移動させる
\addtolength{\textheight}{-40truemm} % 下の余白も20mmに
%% 幅の設定
\setlength{\textwidth}{\paperwidth} % ひとまず紙面を本文領域に
@kyontan
kyontan / gist:3968745
Created October 28, 2012 14:29
Gnuplotめも
EPSに出力する場合
gnuplot > set terminal postscript enhanced eps (color)
gnuplot > set output '出力ファイル名'
gnuplot > (以降、プロットの操作)
度の扱いをラジアン⇒度数法へ
gnuplot> set degree angle
gnuplot> set logscale y
@kyontan
kyontan / gist:4093196
Created November 17, 2012 04:04
Sinatraメモ
helpers do
include Rack::Utils
alias_method :h, :escape_html
def csrf_token
Rack::Csrf.csrf_token(env)
end
def check_csrf
unless params[Rack::Csrf.csrf_field] == session['csrf.token']
@kyontan
kyontan / gist:7678042
Last active April 23, 2024 05:46
游書体を加えたCSS font-family
/* ヒラギノ角ゴ */
font-family: "ヒラギノ角ゴ Pro", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif;
/* ヒラギノ明朝 */
font-family: "ヒラギノ明朝 Pro", "Hiragino Mincho Pro", "MS P明朝", "MS PMincho", serif;
/* From: 游明朝体・游ゴシック体のCSSでの利用 - Qiita [キータ]
* http://qiita.com/shinnn/items/5be7e8106189311559c1
*/
@kyontan
kyontan / Gemfile
Created December 23, 2013 09:58
Using rack-cache on Sinatra
gem "rack-cache", require: "rack/cache"
@kyontan
kyontan / gist:8616088
Created January 25, 2014 13:06
CSS 溢れた文字列を"..."で省略
{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@kyontan
kyontan / gist:8616126
Last active January 4, 2016 11:39
clearfix micro
.cf:after {
content: "";
display: table;
clear: both;
}
@kyontan
kyontan / README.md
Last active August 29, 2015 13:56
Refrection and Refraction Simulator using Xwindow

反射・屈折のシミュレータ

ソースの質に関してはお察しください

コンパイル方法

  • Mac ( XQuartz が必要です。 ここからダウンロードしてください。)
clang++ reflection_reflaction.cpp -std=c++11 -I /usr/X11R6/include -L /usr/X11R6/lib -l X11
// Rounding methods implementation in C
// 2014 kyontan No Rights Reserved (CC0)
// https://creativecommons.org/publicdomain/zero/1.0/deed.ja
/* Supporting methods
- ceil (round up)
- floor (round down)
- truncate (round towards zero)
- round off (round half up)
- JIS Z8401:1999 round (round to the nearest even)