This file contains hidden or 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 | |
| # run this from your home directory | |
| mkdir -p projects | |
| cd projects | |
| git clone git://github.com/technomancy/emacs-starter-kit.git | |
| cd .. | |
| ln -s projects/emacs-starter-kit .emacs.d |
This file contains hidden or 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 Jay | |
| def talk | |
| puts 'hi' | |
| end | |
| end | |
| def make_say(msg, &b) | |
| Jay.send(:alias_method, :orig_talk, :talk) | |
| Jay.send(:define_method, :talk) { puts msg } | |
This file contains hidden or 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 Jay | |
| def a; puts 'a' end | |
| end | |
| class Jay | |
| define_method(:b) { puts 'b' } | |
| end | |
| Jay.class.send(:define_method, :c) { puts 'c' } |
This file contains hidden or 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
| gem "sinatra", "0.9.4" | |
| gem "scrappy", "0.1", :git => "git://internal.com/scrappy/mainline.git" |
This file contains hidden or 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
| require 'rubygems' | |
| require 'sinatra' | |
| configure do | |
| set :data, "none" | |
| end | |
| before do | |
| content_type 'text/plain', :charset => 'utf-8' | |
| request.env['PATH_INFO'].gsub!(/\/$/,'') |
This file contains hidden or 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 debug_line(*list) | |
| ret = "Debug: " | |
| 0.step(list.length - 2, 2) do |x| | |
| label, value = list[x,x+2] | |
| ret += "#{label} = '#{value}', " | |
| end | |
| puts ret | |
| end | |
| debug_line("a", 10, "b", 20) |
This file contains hidden or 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
| irb(main):011:0> a = "abcd" | |
| => "abcd" | |
| irb(main):012:0> a[1,1] = a[2,1] | |
| => "c" | |
| irb(main):013:0> a | |
| => "accd" |
This file contains hidden or 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
| # myapp.rb | |
| require 'rubygems' | |
| require 'sinatra' | |
| get '/' do | |
| 'Hello world!' | |
| end |
This file contains hidden or 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
| Yes sorry. | |
| Basically what we are trying is to constraint the effect of the raw frequency (saturate the frequency). | |
| In Lucene this is carried out with the root square of the frequency, another classical approach | |
| is to use the log. With both approaches we avoid giving a linear 'importance' to the frequency. | |
| BM25 is a bit tricky, it parametrises the 'saturation' of the frequency with a parameter k1, with the | |
| equation weight(t)/(weight(t)+k1). Usually k1 is fixed to 2, but it can be fixed by collection. |
This file contains hidden or 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 | |
| # backup your delicious bookmarks | |
| curl -k --user `cat password.txt` -o backup.xml -O 'https://api.del.icio.us/v1/posts/all' |