Skip to content

Instantly share code, notes, and snippets.

@tsu-nera
tsu-nera / pomo
Created February 1, 2014 05:08
pomodor timer
#!/usr/bin/env ruby
# coding: utf-8
def check_usage
unless ARGV.length == 1
puts "USAGE pomo -b:5min timer start"
puts "USAGE pomo -t:25min timer start"
puts "USAGE pomo -i:3min timer start"
exit
end
@tsu-nera
tsu-nera / stepcounter.sh
Created February 17, 2014 13:00
StepCounter
#!/bin/sh
CURDIR=`pwd`
java -cp ~/repo/stepcounter/eclipse-plugin/jp.sf.amateras.stepcounter/lib/stepcounter.jar jp.sf.amateras.stepcounter.Main -format=csv -output=${CURDIR}/count.csv -encoding=UTF-8 $@
#include<iostream>
using namespace std;
void foo() {
cout << "Hello Thread!" << endl;
}
int main() {
foo();
#include<iostream>
#include<unistd.h>
#include<thread>
using namespace std;
void foo() {
cout << "Hello Thread!" << endl;
sleep(5);
}
@tsu-nera
tsu-nera / config.yml
Created February 26, 2014 13:04
RubyでのYamlファイルの扱い方。
set:
key: 30
val: 40
@tsu-nera
tsu-nera / tkwindow.rb
Created February 26, 2014 16:27
TkWindowの学習
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require "tk"
# http://d.hatena.ne.jp/octech/20080304/1204601383
class TkWindow_Base
def initialize()
@@wdg_txt = TkText.new().pack
@@wdg_txt.insert('end', "Editしてください")
@@wdg_txt.state 'disabled'
@tsu-nera
tsu-nera / yalmScannerWithComment.rb
Created February 27, 2014 15:49
yalmをスキャンする。行末の#も読み込む。
# -*- coding: utf-8 -*-
require 'strscan'
class yalmScannerWithComment
attr_reader :params
def initialize(file_path)
@file_path = file_path
@params = readParams()
end
BEGIN
END
alias
alias_error
aref
aref_field
arg_ambiguous
arg_paren
args_add
args_add_block
@tsu-nera
tsu-nera / *compilation*
Created March 1, 2014 08:15
ripperで定数とメソッド抽出
-*- mode: compilation; default-directory: "~/repo/ruby-study/lib/ruby_parse/" -*-
Compilation started at Sat Mar 1 17:02:08
ruby sexp.rb
{:methods=>
[{:def=>"method1",
:fcalls=>
[{"fcall"=>"foo", "params"=>["1", "2", "Hello", "3"]},
{"fcall"=>"bar", "params"=>["1", "2", "Hello", "4"]}]},
{:def=>"method2",
@tsu-nera
tsu-nera / rkk-sjis.rb
Created March 1, 2014 11:47
rspec-kickstarterをshift-jisデ動かす
#!ruby
class RspecKickStarter
attr_accessor :file_name, :temp_path_utf8
def initialize(file_path)
@file_path = file_path
@file_name = File.basename(file_path)
@temp_file_utf8 = "temp_" + @file_name
@temp_path_utf8 = "lib/" + @temp_file_utf8