fio is an I/O tool meant to be used both for benchmark and stress/hardware verification.
Linux:
class List | |
include Enumerable | |
def each | |
yield 1 | |
yield 2 | |
end | |
#... | |
end |
class SortAlogrithm | |
def quick_sort | |
#... | |
puts "quick_sort" | |
end | |
def bubble_sort | |
#... | |
puts "bubble_sort" | |
end | |
end |
# create a new object | |
object = Object.new | |
# dup this object, dog is a object | |
dog = object.clone | |
# define a function ONLY for this object | |
def dog.sit | |
print "I`m sitting\n" | |
end |
module Decorator | |
def initialize(decorated) | |
@decorated = decorated | |
end | |
def method_missing(method,*args) | |
# empty? is a method; ?: is a tri-operator | |
args.empty? ? @decorated.send(method):@decorated.send(method,args) | |
end |
#include <iostream.h> | |
#include <stdlib.h> | |
/**/ | |
const int NUM = 6; | |
void Swap(int &a,int &b) | |
{ | |
int t = 0; | |
t = a; | |
a = b; | |
b = t; |
#!/usr/bin/env ruby | |
class String | |
def levenshtein(other) | |
range_self_end = self.size | |
range_other_end = other.size | |
data = | |
(0..range_self_end).map {|s| | |
(0..range_other_end).map {|t| | |
t + s unless t>0 && s>0 |