Skip to content

Instantly share code, notes, and snippets.

#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]);
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) {
(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)
# -*- coding: utf-8 -*-
tq= -> {
class TokyuRubyKaigi02 < TokyoRubyKaigi #04
def 概要;<<t
TokyuRuby会議は、東京で4回目の開催となるRegional RubyKaigiです。
Rubyに興味を持つエンジニアが集う「Tokyu.rb」主催のLT大会です。
飲み食いしつつ、みんなでLTをして盛り上がろうというイベントです。
※飲酒歓迎ですが、未成年の方、これから運転される方の飲酒を堅くお断りいたします。
(Tokyu.rbはRubyist GCによって成り立っていますので、持ち込んだ食事は食べきりましょう!)
t
<?php
class Test {
private $_num;
private $_max_process_num = 5;
public function __construct($num) {
$this->_num = $num;
}
public function run() {
@gom
gom / ssh_tail.rb
Created November 4, 2010 14:25
gem install net-ssh notify
# -*- coding: utf-8 -*-
require 'rubygems'
require 'net/ssh'
require 'notify'
def daemonize(&block)
if Process.respond_to? :daemon
Process.daemon(&block)
else
require 'WEBrick'
;; 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)))
<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);
module MyTime
class TimeBase
BASE = 60
def initialize i
@i = i
end
def to_i
@i
end
@gom
gom / base64.rb
Created April 7, 2011 10:34
A input file encoded to BASE64
raise StandardError, __FILE__ + " require <filename>" unless ARGV[0]
str = ''
open(ARGV[0], "r") {|f| str = f.read }
print [str].pack('m').gsub(/\n/, '')