add some words.
more words here...
#In Ruby: | |
class Foo | |
attr_accessor :bar | |
end | |
f = Foo.new | |
f.bar = 'baz' | |
f.bar # => 'baz' |
package main | |
import "fmt" | |
func main() { | |
v := []int{1,2,3,4,5,6,7,8} | |
mv := new(MeanValue) | |
/*mvFunc := mv.exec()*/ | |
nmv := new(MeanValue) | |
nmvFunc := nmv.exec() |
var obj1 = { | |
name: 'alsotang', | |
method: function() { | |
console.log(this.name); | |
} | |
}; | |
var obj2 = { | |
name: 'freewind' | |
}; |
import zlib | |
import base64 | |
filename = '1.jpg' | |
with open(filename, 'rb') as f: | |
data = f.read() | |
print len(data) | |
bdata = base64.encodestring(data) | |
print len(bdata) | |
zdata = zlib.compress(bdata) |
from Crypto.Cipher import AES | |
import os | |
BLOCK_SIZE = AES.block_size | |
key = os.urandom(BLOCK_SIZE) | |
cipher = AES.new(key) | |
def pad(data): |
collatz = Hash.new do |h, k| | |
if k == 1 | |
1 | |
elsif k.even? | |
h[k] = h[k/2]+1 | |
else | |
h[k] = h[3*k+1] + 1 | |
end | |
end |
var _ = require('lodash'); | |
var families = []; | |
for (var i = 0; i < 100000; i++) { | |
var family = []; | |
for (var j = 0; j < 3; j++ ) { | |
// 0 是女孩 1 是男孩 | |
var gender = Math.random() >= 0.5 ? 1 : 0; | |
family.push(gender); |
var should = require('should'); | |
var Benchmark = require('benchmark'); | |
var suite = new Benchmark.Suite(); | |
var lambdaLifting = function () { | |
var x = 10; | |
function fn() { | |
return x + 1; | |
} |
var count = 0; | |
setInterval(function () { | |
count++; | |
var el = document.querySelector('.count-number') | |
el.innerHTML = count; | |
}, 100) | |
// add 10k elements to body | |
setTimeout(function () { | |
for (var i = 0; i < 10000; i++) { |