Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env ruby
require 'date'
s = Time.now
result = $stdin.readline.chomp
e = Time.now
if result =~ /いちごましまろ/
puts "いちごましまろ(#{ e - s}秒)"
else
@thata
thata / grep-gems
Created February 18, 2009 02:24
grep-gems
#! /bin/sh
# grep-gems
#
# (1) grep rubygems sources.
# > grep-gems "def select_tag"
#
# (2) open source.
# > grep-gems "def select_tag"
# 1 /usr/lib/ruby/gems/1.8/gems/foo/a.rb
function inspect(obj) {
var name;
var result = "";
for(name in obj) {
if (typeof obj[name] !== 'function') {
result = result + name + " : " + obj[name] + "\n";
}
}
return result;
}
@thata
thata / gist:2814918
Created May 27, 2012 16:09
Arduino IDEにEmacs風のキーバインドを追加するパッチ
diff --git a/app/src/processing/app/syntax/InputHandler.java b/app/src/processing/app/syntax/InputHandler.java
index 9a11d38..764cc06 100644
--- a/app/src/processing/app/syntax/InputHandler.java
+++ b/app/src/processing/app/syntax/InputHandler.java
@@ -73,6 +73,9 @@ public abstract class InputHandler extends KeyAdapter
public static final ActionListener CLIPBOARD_CUT = new clipboard_cut(); // [fry]
public static final ActionListener CLIPBOARD_COPY = new clipboard_copy();
public static final ActionListener CLIPBOARD_PASTE = new clipboard_paste();
+ public static final ActionListener BEGIN_LINE = new begin_line();
+ public static final ActionListener END_LINE = new end_line();
package jp.co.esm.myscalatra.domain
import org.squeryl._
import org.squeryl.PrimitiveTypeMode._
import jp.co.esm.myscalatra.domain.model._
import org.squeryl.adapters.PostgreSqlAdapter
object Schema extends Schema {
val users = table[User]("users")
@thata
thata / .ctags
Created October 19, 2012 01:57
Scalaのタグを生成するため以下を~/.ctagsに設定する
--langdef=Scala
--langmap=Scala:.scala
--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\1/o,objects/
--regex-Scala=/^[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/\1/t,traits/
--regex-Scala=/^[ \t]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/r,cclasses/
--regex-Scala=/^[ \t]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/a,aclasses/
--regex-Scala=/^[ \t]*def[ \t]*([a-zA-Z0-9_=]+)[ \t]*.*[:=]/\1/m,methods/
--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
--regex-Scala=/[ \t]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/v,variables/
@thata
thata / dot.vimrc
Created October 29, 2012 00:52
htkymtksの.vimrc
" vundle
set nocompatible
filetype off
set rtp+=~/.vim/vundle.git/
call vundle#rc()
Bundle 'unite.vim'
Bundle 'rails.vim'
Bundle 'git://github.com/vim-ruby/vim-ruby.git'
@thata
thata / project.pbxproj
Created December 6, 2012 09:17
GradientSample
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
7A27F2E316709B860065C7FC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A27F2E216709B860065C7FC /* UIKit.framework */; };
@thata
thata / gist:4519094
Created January 12, 2013 16:31
keyとvalueからなるタブ区切りの文字列を読み込んでdictionaryへセットするサンプル
NSString *data = [NSString stringWithContentsOfFile:@"/tmp/a"
encoding:NSUTF8StringEncoding
error:nil];
NSArray *lines;
// 行に分解
lines = [data componentsSeparatedByString:@"\n"];
// コメント行を取り除く
lines = [lines filteredArrayUsingPredicate:
[NSPredicate predicateWithBlock:^BOOL(NSString *line, NSDictionary *bindings) {
line = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
@thata
thata / gist:4982337
Last active December 13, 2015 22:08

Hello

ハロー

World

ワールド