Skip to content

Instantly share code, notes, and snippets.

View kotp's full-sized avatar
enjoying life

Victor Goff kotp

enjoying life
View GitHub Profile
"-------------------------------------------------------
" .vimrc from Michael Kohl <citizen428@gmail.com>
"
" Last update: Mo 2009-01-26 11:47
"
"-------------------------------------------------------
"-------------------------------------------------------
" TERMINAL ENCODING
" ------------------------------------------------------
@kotp
kotp / gist:203507
Created October 6, 2009 22:19
Short Introduction on what gist is
=begin
You create your code here, and then click on paste... and then others can get
the link that is created, and can potentially fork it and make changes to
their own versions.
=end
def hello_world
"Hello, world!"
end
Command given: rvm 1.8.6,1.8.7,1.9.1 --trace gem install sinatra --no-rdoc --no-ri
1.8.6,1.8.7,1.9.1 --trace gem install sinatra --no-rdoc --no-ri
rvm 0.1.12 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
+ [[ -z ruby ]]
+ [[ ! -z '' ]]
+ [[ ! -z '' ]]
+ [[ 5 -gt 0 ]]
+ rvm_token=gem
vgoff@vgoff-DT01:~$ rvm system
vgoff@vgoff-DT01:~$ rvm info
rvm 0.1.12 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
system:
uname: "Linux vgoff-DT01 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 16:20:31 UTC 2009 i686 GNU/Linux"
shell: "bash"
version: "4.0.33(1)-release"
@kotp
kotp / prompt.rb
Created June 8, 2010 12:51
Prompt module sample
module Prompt
def prompt(prompt = ":> ", chomp = true)
puts self << prompt
chomp ? gets.chomp! : gets
end
end
class String
include Prompt
end
@kotp
kotp / irb_output.rb
Created June 14, 2010 00:15
Method using Block argument
>> my_method(3, "Sang Shin", {:a => " loves ", :b => " Young Shin"}) {|s| puts s }
3
Sang Shin
{:a=>" loves ", :b=>" Young Shin"}
=> [3, "Sang Shin", {:a=>" loves ", :b=>" Young Shin"}]
>> my_method(3, "Sang Shin", {:a => " loves ", :b => " Young Shin"}) {|s| s }
=> [3, "Sang Shin", {:a=>" loves ", :b=>" Young Shin"}]
class Month_Sampler
Months = { 'Jan' => "January", 'Feb' => "February", 'Mar' => "March", 'Apr' => "April",
'May' => "May", 'Jun' => "June", 'Jul' => "July", 'Aug' => "August",
'Sep' => "September", 'Oct' => "October", 'Nov' => "November", 'Dec' => "December"
}
# assign abbreviated and full month names depending on what is provided.
# Because this is a sample short script, I simply fail if wrong input.
def initialize month
fail("Incorrect Month representation (as a string)") unless
@kotp
kotp / dsh.rb
Created July 1, 2010 03:40 — forked from anatman/dsh.rb
def dsh(un, va)
(va.size - 1).downto(1) {|j| va[j] = va[0 .. j].inject(1) { |pr, it| pr * it } }
ar = un.zip va
hs = {}
ar.each {|i| hs[i[0]] = i[1] }
hs
end
= Setup
=== In your browser
login to http://github.com
go to http://github.com/resolve/refinerycms
if you have a fork already, delete it (if you're not going to loose work. This makes it much easier for us to integrate your changes back in)
click on fork
=== In terminal
git clone git@github.com:USERNAME/refinerycms.git refinerycms
@kotp
kotp / analyzer_first.rb
Created May 5, 2011 18:17 — forked from johncrisostomo/analyzer_first.rb
Document Analyzer
def document_to_string(filename)
text = ''
File.open(filename) do |f|
while line = f.gets
text << line
end
end
text
end