Skip to content

Instantly share code, notes, and snippets.

View randallreedjr's full-sized avatar

Randall Reed, Jr. randallreedjr

View GitHub Profile
@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
> 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 / .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)/'
{
"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":
[
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