Skip to content

Instantly share code, notes, and snippets.

View randallreedjr's full-sized avatar

Randall Reed, Jr. randallreedjr

View GitHub Profile
def index
urls = %w[http://cltampa.com/blogs/potlikker http://cltampa.com/blogs/artbreaker http://cltampa.com/blogs/politicalanimals http://cltampa.com/blogs/earbuds http://cltampa.com/blogs/dailyloaf http://cltampa.com/blogs/bedpost]
@final_images = []
@final_urls = []
urls.each do |url|
blog = Nokogiri::HTML(open(url))
images = blog.xpath('//*[@class="postBody"]/div[1]//img/@src')
images.each do |image|
@final_images << image
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Solarized Color Scheme/Solarized (light).tmTheme",
"fade_fold_buttons": false,
"font_face": "Inconsolata",
"font_size": 16,
"highlight_line": true,
"ignored_packages":
[
@randallreedjr
randallreedjr / .bash_profile
Last active April 20, 2016 21:29
My great bash profile
# Configuring Our Prompt
# ======================
# if you install git via homebrew, or install the bash autocompletion via homebrew, you get __git_ps1 which you can use in the PS1
# to display the git branch. it's supposedly a bit faster and cleaner than manually parsing through sed. i dont' know if you care
# enough to change it
# This function is called in your prompt to output your active git branch.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
> cd /usr/local/Library/Formula/
> git co 08a087e4c240fa5e1c1a35495393bf164b3c25f7 elasticsearch.rb
> brew upgrade elasticsearch
> launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
> launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
@randallreedjr
randallreedjr / ruby_abstraction_in_loops_1.rb
Last active March 22, 2016 16:59
First code sample for post Ruby Abstraction in Loops
array = [1,2,3]
current_index = 0
squares = []
loop do
if current_index < array.size
squares << array[current_index] ** 2
current_index += 1
else
break
@randallreedjr
randallreedjr / ruby_abstraction_in_loops_2.rb
Created March 6, 2016 22:30
Second code sample for post Ruby Abstraction in Loops
array = [1,2,3]
current_index = 0
squares = []
while current_index < array.size
squares << array[current_index] ** 2
current_index += 1
end
squares
# => [1,4,9]
@randallreedjr
randallreedjr / ruby_abstraction_in_loops_3.rb
Created March 6, 2016 22:33
Third code sample for post Ruby Abstraction in Loops
array = [1,2,3]
squares = []
array.each do |element|
squares << element ** 2
end
squares
# => [1,4,9]
@randallreedjr
randallreedjr / ruby_abstraction_in_loops_4.rb
Created March 6, 2016 22:35
Fourth code sample for post Ruby Abstraction in Loops
squares = []
#do some code where squares is modified
return squares
@randallreedjr
randallreedjr / ruby_abstraction_in_loops_5.rb
Created March 6, 2016 22:36
Fifth code sample for post Ruby Abstraction in Loops
array = [1,2,3]
array.collect do |element|
element ** 2
end
# => [1,4,9]
@randallreedjr
randallreedjr / ruby_abstraction_in_loops_6.rb
Created March 6, 2016 22:38
Sixth code sample for post Ruby Abstraction in Loops
def square_array(array)
array.collect {|element| element**2}
end