Skip to content

Instantly share code, notes, and snippets.

Sébastien Saunier ssaunier

Block or report user

Report or block ssaunier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View game.py
# init tableu des mains (ROCK, PAPER, SCISSORS)
# règle du jeu ?
# initialiser MAX_SCORE à 3
# initialiser score ordi à 0
# initialiser score joueur à 0
# lancer le jeu
# ordinateur fait son choix (random)
@ssaunier
ssaunier / index.html
Created Jul 8, 2018
Bootstrap HTML boilerplate
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
@ssaunier
ssaunier / importpdb.sublime-snippet
Created Jul 5, 2018
Python debugger snippet for Sublime Text
View importpdb.sublime-snippet
<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 / application.scss
Last active Dec 4, 2017
Boilerplate CSS code for React Giphy
View application.scss
#root > div {
display: flex;
height: 100vh;
}
.left-scene {
flex: 0 0 60%;
position: sticky;
display: flex;
flex-direction: column;
@ssaunier
ssaunier / user_binding.json
Created Dec 3, 2017
Sublime Key Bindings for using Emmet inside Babel JavaScript files. Sublime > Preferences > Key Bindings
View user_binding.json
[
{ "keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
[
{ "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
{ "match_all": true, "key": "selection_empty" },
{ "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
{ "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
{ "match_all": true, "key": "is_abbreviation" }
]
}
@ssaunier
ssaunier / cache.yml
Last active Apr 22, 2019
Speed up the AWS Elastic Beanstalk of your Rails deployment with bundle/assets caching
View cache.yml
# .ebextensions/cache.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/02a_set_cache.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
set -xe
@ssaunier
ssaunier / timeout_pub_scraper.rb
Last active Nov 8, 2017 — forked from Papillard/timeout_pub_scraper.rb
TimeOut best pubs scraper
View timeout_pub_scraper.rb
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
View flats.json
[
{
"name": "Charm at the Steps of the Sacre Coeur/Montmartre",
"imageUrl": "https://raw.githubusercontent.com/lewagon/flats-boilerplate/master/images/flat1.jpg",
"price": 164,
"priceCurrency": "EUR",
"lat": 48.884211,
"lng": 2.346890
},
{
View buddies.rb
# Usage: run `ruby buddies.rb`
begin
require "round_robin_tournament"
rescue LoadError
puts "Could not find gem 'round_robin_tournament'"
puts "Install it with:"
puts
puts " gem install round_robin_tournament"
exit 1
@ssaunier
ssaunier / README.md
Created Sep 6, 2017
Quick caching in Rails (backed by Redis, with Heroku Redis Cloud add-on)
View README.md

Add this line to your Gemfile and run bundle install

# Gemfile
gem "redis"

Create a new initializer to have a global $redis variable at hand:

You can’t perform that action at this time.