Skip to content

Instantly share code, notes, and snippets.

View komagata's full-sized avatar

Masaki Komagata komagata

View GitHub Profile
diff -r 8045199a28c0 views/index.haml
--- a/views/index.haml Tue Jun 08 21:43:26 2010 +0900
+++ b/views/index.haml Wed Jun 09 18:58:22 2010 +0900
@@ -76,6 +76,9 @@
%dt 2010-05-17
%dd <a href="http://help-me-hackers.com/">Help me, hackers!</a> - komagata, machida
+ %dt 2010-06-09
+ %dd <a href="http://hamcutlet.fjord.jp/">Ham Cutlet</a> - komagata, machida
+
#!/bin/sh
wget "http://hamcutlet.fjord.jp/?url=$1" -O -
【あ】:あまり調子に乗ってると裏世界でひっそり幕を閉じる
%
【い】:今のがリアルでなくて良かったな、リアルだったらお前はもう死んでるぞ
%
【う】:うるさい、気が散る。一瞬の油断が命取り
%
【え】:FFではナイトだがリアルではモンクタイプだからな
%
【お】:おれの怒りが有頂天になった
%
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
char cmd[] = "ruby -e \"puts 'ruby!'\"";
system(cmd);
return 0;
}
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
require 'dm-validations'
require 'dm-validations-i18n'
DataMapper.setup(:default, 'sqlite::memory:')
class Employee
include DataMapper::Resource
class Foo
@@foo = 'foo!'
end
puts Foo.send(:class_variable_get, '@@foo') # foo!
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
enable :run
get '/' do
'<form method="post"><input type="text" name="foo" /></form>'
end
#!/usr/bin/env ruby
def shell(cmd)
puts cmd
system cmd
end
# homebrew
shell "sudo ruby -e \"$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)\""
@komagata
komagata / popstate
Created January 28, 2011 02:28
popstate
<!DOCTYPE html>
<html>
<head>
<title>Test Site</title>
</head>
<body>
<script type="text/javascript">
window.onpopstate = function(event) {
alert('popstate');
};
@komagata
komagata / ml
Created February 5, 2011 15:35
MTA *sending only*
#!/usr/bin/env ruby
to = ARGV[0]
body = ARGV[1]
length = 30
subject = body.split(//u)[0, length].to_s
IO.popen("mail -s '#{subject}' #{to}", 'r+') {|io| io.puts body }