This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
static void printAry(int* ary, int aryNum); | |
static void sort(int ary[], int left, int right); | |
int main (int argc, char *argv[]) { | |
int ary[] = {8,4,3,7,6,5,2,1}; | |
const int aryNum = sizeof(ary) / sizeof(ary[0]); |
This file contains hidden or 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
def sort(list:List[Int]):List[Int] = { | |
if (list.size == 1) { return list } | |
val mid = list.size / 2 | |
val left = sort(list.take(mid)) | |
val right = sort(list.drop(mid)) | |
merge(left, right) | |
} | |
def merge(left:List[Int], right:List[Int]):List[Int]= { | |
if (left.isEmpty || right.isEmpty) { |
This file contains hidden or 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) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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/, '') |