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
movies: | |
- title: "Superman" | |
year: 1978 | |
director_slug: donner | |
synopsis: | | |
An alien orphan is sent from his dying planet to Earth, | |
where he grows up to become his adoptive home's first and greatest superhero. | |
- title: "Batman v Superman: Dawn of Justice" | |
year: 2016 | |
director_slug: snyder |
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[import pdb; pdb.set_trace()]]></content> | |
<tabTrigger>pdb</tabTrigger> | |
<scope>source.python</scope> | |
<description>import pdb</description> | |
</snippet> | |
<!-- USAGE --> | |
<!-- 1. Go to Tools -> New 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
require "open-uri" | |
require "nokogiri" | |
url = "https://www.timeout.com/london/bars-and-pubs/the-100-best-bars-and-pubs-in-london" | |
html_file = open(url) | |
doc = Nokogiri::HTML(html_file) | |
doc.search(".feature-item").take(12).each do |bar| | |
p bar.search("img")[0].attr("src") # image_url | |
p bar.search("h3 a")[0].text # name |
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 :db do | |
desc "Backs up heroku database and restores it locally." | |
task import_from_heroku: [ :environment, :create ] do | |
HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote. | |
c = Rails.configuration.database_configuration[Rails.env] | |
heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil | |
Bundler.with_clean_env do | |
puts "[1/4] Capturing backup on Heroku" | |
`heroku pg:backups capture DATABASE_URL#{heroku_app_flag}` |