This file contains 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 words | |
File.open('/usr/share/dict/words').to_a.map { |word| word.chomp } | |
end | |
def count | |
puts "There are this many words in the dicshonary #{words.length}" | |
end | |
def search | |
count |
This file contains 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 'active_record' | |
require 'postgres-copy' | |
require 'pg_data_encoder' | |
require 'benchmark' | |
ActiveRecord::Base.establish_connection( | |
:adapter => "postgresql", | |
:host => "localhost", | |
:database => "pg_test" | |
) |
This file contains 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
" set up pathogen, https://github.com/tpope/vim-pathogen | |
filetype off | |
call pathogen#infect() | |
filetype plugin indent on | |
" don't bother with vi compatibility | |
set nocompatible | |
" enable syntax highlighting | |
syntax enable |
This file contains 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
This is a C++ program that sorts lines read from the first arg and writes them to the second arg. | |
#include<string> | |
#include<vector> | |
#include<algorithm> | |
#include<fstream> | |
using namespace std; | |
int main(int argc, char **argv) { |
This file contains 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
<snippet> | |
<content><![CDATA[ | |
gem '${1:gem_name}'${2:, '${3:version}'} | |
]]></content> | |
<tabTrigger>gem</tabTrigger> | |
<scope>source.ruby</scope> | |
</snippet> |
This file contains 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
# Notes on the Object#blank?, Object#present?, and Object#presence methods | |
# Calling .present? on an object will return true if the object is not .blank? | |
# Again, for clarity, an object is present if it is not blank. | |
# Thus | |
"".present? # => false | |
# Because | |
"".blank? # => true |