> 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
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 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 |
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
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] |
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
array = [1,2,3] | |
squares = [] | |
array.each do |element| | |
squares << element ** 2 | |
end | |
squares | |
# => [1,4,9] |
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
squares = [] | |
#do some code where squares is modified | |
return squares |
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
array = [1,2,3] | |
array.collect do |element| | |
element ** 2 | |
end | |
# => [1,4,9] |
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 square_array(array) | |
array.collect {|element| element**2} | |
end |
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
html { | |
background: url(images/bg.jpg) no-repeat center center fixed; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
namespace :coffee do | |
desc "Compile coffeescript source file into javascript" | |
task :compile, :input_file, :output_file do |t, args| | |
filename = args.input_file | |
coffee_file = File.open(filename, "r") | |
js_contents = CoffeeScript.compile(coffee_file) | |
coffee_file.close | |
output_filename = args.output_file | |
output = File.open("public/static/#{output_filename}","w" ) |
OlderNewer