Skip to content

Instantly share code, notes, and snippets.

I'm planning on either writing this up in detail or maybe doing a screencast about screencasting, but I'll give a short version here.

On sound quality:

This matters a lot. In decreasing order of importance:

  1. Remove echo. You have to hear this to understand. Set up a mic in front of your mouth and record a sentence. Then, put a thick comforter over you and the mic and say it again at the same distance. Listen to
@Domon
Domon / line_count_benchmark.rb
Last active June 9, 2017 03:29 — forked from guilhermesimoes/line_count_benchmark.rb
Ruby Benchmark: Counting the number of lines of a file
# gem install benchmark-ips
require "benchmark/ips"
path = "path/to/a_big_file"
Benchmark.ips do |x|
x.report("read + each_line") { File.read(path).each_line.count }
x.report("open + each_line") { File.open(path, "r").each_line.count }
x.report("open + readlines") { File.open(path, "r").readlines.length }
Linux carglecloud0 2.6.32-21-server #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04.1 LTS
Welcome to the Ubuntu Server!
* Documentation: http://www.ubuntu.com/server/doc
System information as of Sun Apr 3 15:39:25 CST 2011
System load: 0.0 Swap usage: 0% Users logged in: 0
Usage of /: 0.3% of 905.57GB Temperature: 30 C
Linux carglecloud0 2.6.32-21-server #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04.1 LTS
Welcome to the Ubuntu Server!
* Documentation: http://www.ubuntu.com/server/doc
System information as of Sun Apr 3 15:39:25 CST 2011
System load: 0.0 Swap usage: 0% Users logged in: 0
Usage of /: 0.3% of 905.57GB Temperature: 30 C
ruby-1.9.2-p0 adella:benchmarks$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
ruby-1.9.2-p0 adella:benchmarks$ php -v
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
ruby-1.9.2-p0 adella:benchmarks$ cat foo.rb
msg = "Hello world"
heffalump:~ james$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.1]
heffalump:~ james$ php -v
PHP 5.3.4 (cli) (built: Jan 17 2011 21:54:20)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
heffalump:~ james$ cat foo.rb
msg = "Hello world"
google.pacman ||
function () {
var a = true,
e = false,
g = {},
i = [1, 4, 2, 8],
l = {
0 : {
axis: 0,
increment: 0
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal