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
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 |
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
=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 |
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
# 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 |
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
=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 |
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 FileUtils | |
require 'fileutils' | |
FileUtils.mv 'test.txt', 'test1.txt' |
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 document_to_string(filename) | |
text = '' | |
File.open(filename) do |f| | |
while line = f.gets | |
text << line | |
end | |
end | |
text | |
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
= 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 [email protected]:USERNAME/refinerycms.git refinerycms |
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 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 |
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
"------------------------------------------------------- | |
" .vimrc from Michael Kohl <[email protected]> | |
" | |
" Last update: Mo 2009-01-26 11:47 | |
" | |
"------------------------------------------------------- | |
"------------------------------------------------------- | |
" TERMINAL ENCODING | |
" ------------------------------------------------------ |