Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tanatana
tanatana / nikki.txt
Created October 15, 2011 04:58 — forked from teenst/nikki.txt
真の日記
ここに日記を書いても許されますか.
今日の日記
曇り空,時々雨
作業する為に学校きた.研究室でやろうと思ったけれど,防災センターの端にあるオープンスペースを使う事にした.
人目があるというか,いい意味で落ち着かないのでいろいろと捗った.集中はできない.
history 1 | grep padrino | wc -l
@tanatana
tanatana / gist:3851452
Created October 8, 2012 08:44
ディレクトリ以下を再帰的に見て各ファイルの中からhogeをさがす
find . | xargs grep hoge
@tanatana
tanatana / gist:3891233
Created October 15, 2012 07:38
RubyのMatrixの拡張 []= と to_s
class Matrix
# m[i,j] = x
def []=(i,j,x)
@rows[i][j]=x
end
# m.to_s
def to_s(separator = ", ")
str = ''
self.row_size.times do |i|
@tanatana
tanatana / gist:3943839
Created October 24, 2012 04:30
クックパッドエンジニア
ruby -e 'str = ""; 140.times do str += "クックパッドエンジニア".split(//).sample end; p str'
@tanatana
tanatana / gist:3943906
Created October 24, 2012 04:43
マークザッカーバーグ
ruby -e 'puts "マークザッカーバーグ".split(//).sort_by{rand}.join'
@tanatana
tanatana / gist:3953027
Created October 25, 2012 14:50
なんか普通な気がしてきた
tl.each do |status|
urls = status.entities.urls
if !urls.empty?
mongo_status = Status.new(status)
mongo_status.save
end
end
statuses = Status.all()
statuses.each do |status|
@tanatana
tanatana / yokubou.rb
Created October 27, 2012 12:03 — forked from teenst/yokubou.rb
子の欲求
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
year = ["正月の着物","リクルートスーツ","卒業式の制服","入学式のスーツ","春物の服","長靴と雨合羽","水着","浴衣","半袖Tシャツ","秋物の服","カラータイツとコート","サンタコス"]
month=rand(12)
puts "子,#{month+1}月に曰く,#{year[month]}着た女の子とデートしたい"
@tanatana
tanatana / halloween.rb
Created October 30, 2012 14:14
トリック オア
# -*- coding: utf-8 -*-
require 'nokogiri'
require 'open-uri'
random = 'http://ja.wikipedia.org/wiki/Special:Randompage'
page = Nokogiri::HTML(open(random))
puts "トリック オア #{page.search('title').text.split(" ")[0]}"
@tanatana
tanatana / gist:4006599
Created November 3, 2012 08:33
アアッッアアッッッーアッアアーー
puts gets.split(//).map{|c|c=["ア","ッ","ー"].sample}.join