Search   Feed   Browse   Add
Feed items 1 - 6 of 6 for June 2008

DZone Snippets: Ntk's Code Snippets

DZone Snippets: Ntk's Code Snippets

Compile & install Nginx web server - June 18, 2008

Requirement on Mac OS X: Xcode See: - http:en.wikipedia.orgwikiNginx - http:wiki.codemongers.comNginxGettingStarted - http:wiki.codemongers.comNginxInstallOptions - http:wiki.codemongers.comNginxCommandLine - http:wiki.codemongers.comNginxConfiguration export PATH="usrlocalbin:usrlocalsbin:usrbin:bin:usrsbin:sbin" mkdir -p DesktopNginx cd DesktopNginx curl -L -O http:sysoev.runginxnginx-0.7.2.tar.gz tar -xzf nginx-0.7.2.tar.gz curl -L -O...
http://snippets.dzone.com/posts/show/5668

Basic WEBrick setup for local web server - June 17, 2008

Put the following functions and aliases into your .bash_login (or alternatives). unset -f webrick_local function webrick_local() declare root_dir="$HOMEDesktopwww" binmkdir -p "$root_dirWEBrickLog" binchmod 0754 "$root_dir" "$root_dirWEBrickLog" usrbintouch "$root_dirWEBrickLogwebrick.pid" "$root_dirWEBrickLogwebrick_ruby.pid" binchmod 0644 "$root_dirWEBrickLogwebrick.pid" "$root_dirWEBrickLogwebrick_ruby.pid" usrbintouch "$root_dirindex.html" binchmod 0754...
http://snippets.dzone.com/posts/show/5659

Binary radix trie in Ruby - June 11, 2008

From: http:www.matasano.comlogbasic-uncommented-crappy-binary-radix-trie Author: Thomas Ptacek cf. also http:www.matasano.comlog1009aguri-coolest-data-structure-youve-never-heard-of !usrlocalbinruby -w class Fixnum def to_b(l = 8) "0'" + self.to_s(2).rjust(l, "0") end def set(i) if((self & (1 return true else return false end end def bdiff(x) ret = -1 32.downto(0) do i ...
http://snippets.dzone.com/posts/show/5634

The Towers of Hanoi in Ruby - June 8, 2008

based on: The shortest and "mysterious" TH algorithm, http:hanoitower.mkolar.orgshortestTHalgo.html Further references: - http:en.wikipedia.orgwikiTower_of_Hanoi - http:hanoitower.mkolar.orgHTonWebE.html - http:www.google.comsearchq=towers%20of%20hanoi%20Apostolos%20Syropoulos - http:www.kernelthread.comhanoi - http:www.kernelthread.comhanoihtmlrb.html n = 5 x = 1 ar = start_time = Time.now while x fr=(x&x-1)%3; to=((xx-1)+1)%3; ar.push(fr,to) puts "move..
http://snippets.dzone.com/posts/show/5618

Basic Trie data structure in Ruby - June 7, 2008

Inspired by http:www.rubyquiz.comquiz103.html cf. also http:en.wikipedia.orgwikiTrie !usrlocalbinruby -w require 'pp' class Hash def deep_merge!(second) cf. http:snippets.dzone.compostsshow4146 merger = proc key,v1,v2 Hash === v1 && Hash === v2 v1.merge(v2, &merger) : v2 self.merge!(second, &merger) end def nested_hash(array) node = self array.each do i nodei=Hash.new if nodei.nil node = nodei end self end ..
http://snippets.dzone.com/posts/show/5616

Anagram finder in Ruby - June 5, 2008

first create a word list file at UsersSharedwords: mkdir -p UsersShared sudo chmod 1777 UsersShared sudo cp usrsharedictwords UsersSharedwords sudo chown $(logname):$(logname) UsersSharedwords sudo chmod 666 UsersSharedwords or cd UsersShared curl -L -o words http:pragdave.pragprog.comdatawordlist.txt --------------------------------------------- cat anagram.rb !usrlocalbinruby -w Based on: Solving Anagrams in Ruby, http:lojic.comblog20071022solving-anagrams-in-ruby Author: Brian..
http://snippets.dzone.com/posts/show/5593
Available Archives
- May (3 items)
- June (6 items)
- July (1 item)
Sponsored Links
© 2008 FeedCapsule.com  |  Contact