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
#!/bin/bash | |
echo "Bash version ${BASH_VERSION}..." | |
cd ~/.vim/bundle | |
for plugin in ~/.vim/bundle/* | |
do | |
echo "Updating $plugin" | |
( cd $plugin; git pull --rebase origin master ) | |
echo "DONE!" |
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
# consult the signal flow graph for a ringing digital filter at | |
# http://i.stack.imgur.com/49pxl.jpg | |
require 'wavefile' | |
Frequency = 50 | |
SampleRate = 44_100 | |
DecayFactor = 0.15 | |
fc = 2 * Math.sin((Math::PI * Frequency)/SampleRate) |
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
expected: "/hi\0,f\0\0@I\x0F\xD0" | |
got: "/hi\0,f\0\0@I\x0F\xD0" (using ==) |
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
r͞equ͟ire "f͠ile͝uţils҉"̷ | |
requir͠e ͘"rb̴ćo͏n͠f̢i͝g"͢ | |
́m͝ód͡u͘l̀e ͠Cap̢y͞b͏ar̕a͜W̴èb̢ḱi͘t͏B̨ui̶l͟d̵e͟r͡ | |
̨ ̶ ext҉en̛d ͏self͞ | |
̀ ͏ d͠e͜f ̨ḿa͘k͜e҉_bi͏n | |
̴ ̷ ͝ ́ĘNV͞['M̴AKE̕'͞]͝ ͘||͏ ҉'ma͡k͢e' | |
҉e͞nd̶ | |
͢ |
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
# http://ruby-doc.org/core-1.9.3/Object.html#method-i-method | |
# http://ruby-doc.org/core-1.9.3/Method.html | |
> User.method(:first) | |
=> #<Method: Class(ActiveRecord::Querying)#first> | |
> User.method(:first).arity | |
=> -1 | |
User.method(:first).source_location | |
=> ["/Users/aberant/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.2/lib/active_record/querying.rb", | |
4] |
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
# this only works in 1.8 | |
module People | |
extend self | |
def self.base | |
Object | |
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
var fork = require('child_process').fork; | |
if (process.argv[2] == 'son') { | |
setTimeout(function() { | |
process.send({ result: 'hi dad' }); | |
process.exit(0); | |
}, 1000); | |
} else { | |
var child = fork(__filename, [ 'son' ]); | |
child.on('message', function(m) { |
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
insert query update delete getmore command flushes mapped vsize res faults locked % idx miss % qr|qw ar|aw netIn netOut conn time | |
888 0 0 0 21 2 0 158g 160g 40.5g 8 22.4 0 0|0 0|0 627k 3k 81 10:31:35 | |
495 0 0 0 16 2 0 158g 160g 40.5g 4 89.8 0 12|14 12|15 315k 2k 81 10:31:36 | |
1451 0 0 0 19 2 0 158g 160g 40.5g 14 53.9 0 0|0 0|0 1m 3k 81 10:31:37 | |
919 2 0 0 28 2 0 158g 160g 40.5g 9 23.4 0 13|5 13|6 645k 5k 81 10:31:39 | |
1165 1 0 0 15 2 0 158g 160g 40.5g 11 74.9 0 9|12 9|13 825k 3k 81 10:31:40 | |
102 3 0 0 9 2 0 158g 160g 40.5g 4 99.8 0 1|26 1|27 54k |
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
BOB = 3 #=> 3 | |
BOB.freeze #=> 3 | |
BOB = 4 # (irb):4: warning: already initialized constant BOB #=> 4 | |
BOB #=> 4 |
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
Benchmark.bm(10) do |x| | |
x.report("find all") {(1..10000).each { User.find_all_by_id( [99999])}} | |
x.report("find rescue") {(1..10000).each {User.find([9999]) rescue [] }} | |
end | |
user system total real | |
find all 3.200000 0.350000 3.550000 ( 4.630230) | |
find rescue 4.820000 0.380000 5.200000 ( 6.329360) |
NewerOlder