Skip to content

Instantly share code, notes, and snippets.

View ssaunier's full-sized avatar

Sébastien Saunier ssaunier

View GitHub Profile
@ssaunier
ssaunier / imdb.yml
Created March 4, 2023 09:48 — forked from dmilon/imdb.yml
Rails search lecture seeds
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
@ssaunier
ssaunier / importpdb.sublime-snippet
Created July 5, 2018 15:11
Python debugger snippet for Sublime Text
<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 -->
@ssaunier
ssaunier / timeout_pub_scraper.rb
Last active November 8, 2017 17:15 — forked from Papillard/timeout_pub_scraper.rb
TimeOut best pubs scraper
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
@ssaunier
ssaunier / db.rake
Last active January 8, 2021 11:46 — forked from abstractcoder/import.rake
Rake task to back up heroku database and restore it locally.
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}`
@ssaunier
ssaunier / cookiebot.js
Last active December 24, 2015 03:59 — forked from jeresig/cookiebot.js
clickInterval = setInterval(function(){
// Click the large cook as fast as possible!
$("#bigCookie").click();
// Sometimes a golden cookie will appear to give you a bonus
// Click that too!
$("#goldenCookie").click();
}, 1);