This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
puts ARGF.map {|line| | |
f, b, m = line.split(' ').map{|a| a.to_i} | |
(1..m).map {|x| | |
x%f==0||x%b==0 ? (x%f==0 ? (x%b==0 ? 'FB' : 'F') : 'B') : x | |
}.join(' ') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.*; | |
class Str { | |
private static int mMax = 1000000; | |
private static final StringBuilder mBuilder = new StringBuilder(); | |
public static void main(String[] args) { | |
final String a = "foo"; | |
final String b = "bar"; | |
final String c = "baz"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raise StandardError, __FILE__ + " require <filename>" unless ARGV[0] | |
str = '' | |
open(ARGV[0], "r") {|f| str = f.read } | |
print [str].pack('m').gsub(/\n/, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyTime | |
class TimeBase | |
BASE = 60 | |
def initialize i | |
@i = i | |
end | |
def to_i | |
@i | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Event Loaded</title> | |
</head> | |
<script type="text/javascript"> | |
function callback(event) { | |
var res = document.querySelector('#result'); | |
res.innerHTML = res.innerHTML + '<br />' + event.type; | |
} | |
window.addEventListener('load', callback); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; set language environment | |
(defun setlang (type) | |
"Set Language Environment" | |
(interactive "MLang type: ") | |
(let ((langtype (cond ((string= type "utf-8") 'utf-8-unix) | |
((string= type "euc") 'euc-jp-unix)))) | |
(prefer-coding-system langtype) | |
(set-terminal-coding-system langtype) | |
(set-keyboard-coding-system 'utf-8-unix))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'net/ssh' | |
require 'notify' | |
def daemonize(&block) | |
if Process.respond_to? :daemon | |
Process.daemon(&block) | |
else | |
require 'WEBrick' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Test { | |
private $_num; | |
private $_max_process_num = 5; | |
public function __construct($num) { | |
$this->_num = $num; | |
} | |
public function run() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
tq= -> { | |
class TokyuRubyKaigi02 < TokyoRubyKaigi #04 | |
def 概要;<<t | |
TokyuRuby会議は、東京で4回目の開催となるRegional RubyKaigiです。 | |
Rubyに興味を持つエンジニアが集う「Tokyu.rb」主催のLT大会です。 | |
飲み食いしつつ、みんなでLTをして盛り上がろうというイベントです。 | |
※飲酒歓迎ですが、未成年の方、これから運転される方の飲酒を堅くお断りいたします。 | |
(Tokyu.rbはRubyist GCによって成り立っていますので、持ち込んだ食事は食べきりましょう!) | |
t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-1) | |
(define (sort list) | |
(cond ((= (length list) 1) list) | |
(else (let* ((mid (/ (length list) 2)) | |
(left (sort (take list mid))) | |
(right (sort (drop list mid)))) | |
(merge left right))))) | |
(define (merge left right) |