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
def anagram?(s1, s2) | |
hash = Hash.new(0) | |
s1.each_char do |c| | |
hash[c] += 1 | |
end | |
s2.each_char do |c| | |
hash[c] -= 1 | |
end | |
hash.values.uniq == [0] | |
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
# Project Euler 26 | |
def recurring(number) | |
remainders = Hash.new(0) | |
value = 1 | |
position = 0 | |
length = 0 | |
while value != 0 && remainders[value] == 0 | |
remainders[value] = position |
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
1 | |
00:00:04,829 --> 00:00:09,829 | |
Credit to: Sakti Tandi [1st Indonesian-Script] | |
English. Subs. and. Re-Sync. by npdv-iD | |
2 | |
00:00:19,043 --> 00:00:21,168 | |
You know there are more people | |
with genius IQ living in China |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <hdf5.h> | |
double ** | |
Plain_init(int x, int y) { | |
double **plain = malloc(sizeof(double*)*x); | |
double *space = malloc(sizeof(double)*x*y); | |
for (int i = 0; i < x; i++) { | |
plain[i] = space + i * y; |
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
本對照表已經移到 https://github.com/g0v/tisa-map/blob/master/pod/cpc%3C-%3Estd.txt | |
請至該處取得新版本 | |
-------------------------------------------------------------------------------- | |
CPC841 | 6201電腦軟體設計業 | |
CPC842 | | |
CPC843 | 6202電腦系統整合服務業 | |
CPC844 | 6209其他電腦系統設計服務業 | |
CPC845+849 | 6312資料處理、網站代管及相關服務 | |
-------------------------------------------------------------------------------- | |
CPC83104** | 7729其他運輸工具設備租賃業 |
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
class Numeric | |
Q = ["B", "K", "M", "G", "T", "P", "Z"] | |
def humanize | |
index = ( (Math.log(self)/Math.log(10-10**-12)).to_i / 3 ).to_i # to_i to round down | |
return [ self/10.0**(index*3), Q[index] ].join | |
end | |
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
Makefile | |
*.o | |
*.so | |
mkmf.log |
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
a.out |
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
grammar Foo | |
rule top | |
value? { | |
def to_ruby | |
elements.to_ruby | |
end | |
} | |
end | |
rule value | |
array / object / primitive |
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 | |
$:.unshift(".") | |
require "treetop" | |
require "lisp" | |
require "pp" | |
pp LispParser.new.parse("1.1").calculate | |
pp LispParser.new.parse("( )").calculate | |
pp LispParser.new.parse("(+)").calculate | |
pp LispParser.new.parse("(-)").calculate |