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
@kotp
kotp / .vimrc
Created January 2, 2017 14:39 — forked from fweep/.vimrc
Vim configuration for interacting with cscope databases (focus on Ruby).
if has("cscope")
"TODO: turn this all into a plugin.
set nocscopetag
set cscopequickfix=s-,c-,d-,i-,t-,e-
set nocscopeverbose
if filereadable(".git/cscope.out")
cscope add .git/cscope.out
endif
set cscopeverbose
@kotp
kotp / For_Goff.rb
Created March 2, 2012 06:14 — forked from anonymous/For_Goff.rb
It's a description
=begin
notes: I need to use readlines method....also I need to make a method that accepts user input or accepts a directory as an arg and maybe includes input validation to make sure that the directory includes "' '" or maybe easier include the single quotes in the method...
end
read_source_lines_from_file_to_a = File.read('C:\Users\demon002\text.txt').each_line.to_a
read_source_lines_from_file_to_a[5] = "test test inserted word test test"
File.open('C:\Users\demon002\text.txt', "w") do |inst|
inst.puts read_source_lines_from_file_to_a.to_s
end
@kotp
kotp / arrays2.rb
Created February 21, 2012 22:52 — forked from AudreyJean/arrays2.rb
sort without using the built in SORT method
# a little program to accept a list of words, sort them without using the sort method, and output them in alphabetical order
i, j = 0, 0 # initialization of index variables
words, words2 = [], []
a_word = 'a' # dummy initialization to get into the until loop below
puts "Type a word and press <Enter> (Enter a blank line to quit):"
# Loop to accept an unspecified number of words-- creates original array
until a_word.empty?
a_word = gets.chomp
unless a_word.empty?
words.push a_word
@kotp
kotp / LeapYear.rb
Created December 29, 2011 06:34 — forked from odiepus/LeapYear.rb
Leap Year with Minutes In Year
=begin
doctest: leap_year? for 1900 and 1999 and 2001 is false
>> leap_year?(1900)
=> false
>> leap_year?(1999)
=> false
>> leap_year?(2001)
=> false
doctest: leap_year? for 1904, 1996 and 2000 are true
@kotp
kotp / gist:1528866
Created December 28, 2011 17:53 — forked from anonymous/gist:1528862
move file
# require FileUtils
require 'fileutils'
FileUtils.mv 'test.txt', 'test1.txt'
@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
= 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 / 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
"-------------------------------------------------------
" .vimrc from Michael Kohl <citizen428@gmail.com>
"
" Last update: Mo 2009-01-26 11:47
"
"-------------------------------------------------------
"-------------------------------------------------------
" TERMINAL ENCODING
" ------------------------------------------------------