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
hsh = { | |
'a' => 1, | |
'b' => 2, | |
'c' => 3 | |
} | |
hsh = Hash.new | |
hsh['a'] = 1 | |
hsh['b'] = 2 | |
hsh['c'] = 3 |
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 get_items_from_api(page=0, page_size=10) | |
start = page * page_size | |
entire_list = (1..30).to_a | |
slice_of_list = entire_list.slice(start, page_size) | |
slice_of_list | |
end | |
def run_0 |
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
Building native extensions. This could take a while... | |
ERROR: Error installing fast_trie: | |
ERROR: Failed to build gem native extension. | |
current directory: /Users/quentintai/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fast_trie-0.5.1/ext/trie | |
/Users/quentintai/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20201026-42589-1ld0gyx.rb extconf.rb | |
creating Makefile | |
current directory: /Users/quentintai/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/fast_trie-0.5.1/ext/trie | |
make "DESTDIR=" clean |
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
export PS1="\W\[\033[32m\]\$(parse_git_branch)\[\033[00m\]🙊 " | |
# Git branch in prompt. | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
source /usr/local/etc/bash_completion.d/git-completion.bash | |
alias cdp="cd ~/Projects/gSchool/projects" |
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 create_enrollments_hash(district, year, percentage) | |
build_or_check_hash(enrollments, district, year) | |
unless percentage == nil | |
enrollments[district][type][year] = percentage | |
end | |
end | |
def build_or_check_hash(a_hash, *some_keys) | |
temp_hash = a_hash | |
some_keys.each do |key| |
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 going to show you what the ARGV values do | |
# | |
# Just try some of these in console to see what happens: | |
# $ ruby argv.rb 1 | |
# $ ruby argv.rb 1 2 | |
# $ ruby argv.rb hi hello | |
# $ ruby argv.rb 1 hi message.txt | |
variable = ARGV | |
p variable |