Skip to content

Instantly share code, notes, and snippets.

View yoshitsugu's full-sized avatar
🐐
bleat

Kota Yoshitsugu yoshitsugu

🐐
bleat
View GitHub Profile
@yoshitsugu
yoshitsugu / dice_ewsn.rb
Last active December 20, 2015 11:09
dice
class Dice
attr_accessor :coords
def initialize
@coords = [[0,0,1],[1,0,0],[0,-1,0],[0,1,0],[-1,0,0],[0,0,-1]]
end
def top
@coords.each_with_index{|coord,i|
if coord == [0,0,1]
return i+1
@yoshitsugu
yoshitsugu / proxy.rb
Created August 7, 2013 09:16
proxy with webrick
#!/usr/bin/env ruby
require 'webrick'
require 'webrick/httpproxy'
require 'uri'
# プロキシサーバオブジェクトを作る
s = WEBrick::HTTPProxyServer.new(
# バインドアドレス(デフォルト:nil)
@yoshitsugu
yoshitsugu / init.el
Created August 9, 2013 09:55
emacsで選択範囲をFireFoxでgoogle検索 ref: http://qiita.com/yoshitsugu@github/items/9d78915b24bcbff7222f
(defun search-region-by-google ()
"search by google"
(interactive)
(shell-command-on-region (region-beginning) (region-end) "read WORD ; firefox \"http://www.google.com/search?q=$WORD\""))
; C-c sに割り当て
(global-set-key "\C-cs" 'search-region-by-google)
@yoshitsugu
yoshitsugu / to_ruby_hash.php
Created November 6, 2013 08:40
PHPのArrayをRubyのHashに変換。 PHP Array to Ruby Hash
function to_ruby_hash($array){
$result = "{";
foreach($array as $key => $value){
$result .= "\"".$key."\" => ";
if(is_array($value)){
$result .= to_ruby_hash($value).",\n";
}else{
$result .= "\"".$value."\",";
}
}
@yoshitsugu
yoshitsugu / thunderbird.md
Last active December 30, 2015 05:49
ThunderBirdが重いのでglobal検索のインデックスを消す
@yoshitsugu
yoshitsugu / file0.txt
Created December 25, 2013 08:19
crontab のコマンドは1000文字超えてはいけない ref: http://qiita.com/yoshitsugu/items/ce3d072018f63721a148
* * * * * echo "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeef" > /tmp/e.txt
gem list --no-versions > /tmp/gemlist
rbenv global 2.1.0
gem install `cat /tmp/gemlist`
@yoshitsugu
yoshitsugu / copy_file_name_on_clipboard.el
Created December 27, 2013 08:23
現在開いているバッファのファイル名をクリップボードに挿入
(defun put-file-name-on-clipboard ()
"Put the current file name on the clipboard"
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
default-directory
(buffer-file-name))))
(when filename
(with-temp-buffer
(insert filename)
(clipboard-kill-region (point-min) (point-max)))
@yoshitsugu
yoshitsugu / codereview.org
Created January 7, 2014 01:42
grit git native

grit/lib/grit/git.rb

source

def native(cmd, options = {}, *args, &block)
  args     = args.first if args.size == 1 && args[0].is_a?(Array)
  args.map!    { |a| a.to_s }
  args.reject! { |a| a.empty? }

  # special option arguments
  env = options.delete(:env) || {}
@yoshitsugu
yoshitsugu / wiki_apps.org
Last active July 28, 2016 05:05
Ruby Toolbox -- Wiki Apps

Wiki Appsまとめ

Gollum

  • https://github.com/gollum/gollum
  • gitリポジトリからwikiを構成する
  • MarkDown, GitHub Flavored Markdown, Orgなどいろいろな記法が使える
    • 特にEmacs使う人はOrgが使えるのがありがたい

セットアップ

$ gem install gollum
$ bundle install