Skip to content

Instantly share code, notes, and snippets.

@Papillard
Papillard / Gemfile
Last active September 20, 2022 20:12
Longest-Word Rails livecode @lewagon
# Very precious debug gems :)
gem 'binding_of_caller', group: :development
gem 'better_errors', group: :development
@Papillard
Papillard / rails-kickoff.md
Last active December 1, 2021 02:07
Kick-off cheat sheet to set your Rails app @lewagon

This is a kick-off roadmap for the lead-developer, in charge of setup / deployment / collaboration.

Rails new

Create the project locally and on Github

$ rails new YOUR_APP_NAME -T --database=postgresql
$ cd YOUR_APP_NAME
$ git init
@Papillard
Papillard / app.css
Created August 12, 2015 17:03
Playing with Trello API in ajax
body {
text-align: center;
padding: 50px;
font-size: 20px;
}
ul {
list-style: none;
}
ul li {
cursor: pointer;
@Papillard
Papillard / app.js
Created May 18, 2017 09:34
GET repos with AJAX
$(document).ready(function(){
$("#submit").on("click", function(){
// get the username from input
// make a GET request to the API
// inject the response in the page
var userName = $("#username").val();
@Papillard
Papillard / app.js
Created May 18, 2017 09:33
POST gist with AJAX
$(document).ready(function(){
$("#submit").on("click", function(){
var content = $("#content").val();
var gistData = {
"description": "Stupid gist",
"public": true,
"files": {
@Papillard
Papillard / esty_scraper.rb
Last active January 11, 2018 10:42
Scraping Etsy - Reboot batch #100
require 'open-uri'
require 'nokogiri'
puts "Quelle catégorie t'intéresse?"
category = gets.chomp
url = "https://www.etsy.com/search?q=#{category}"
file = open(url)
html_text = file.read
@Papillard
Papillard / cheatsheet.md
Created April 5, 2017 08:31
Bootstrap 4 cheatsheet

Utilities class

  • img-rounded replaced by rounded-circle
  • hidden replaced by invisible (add display: none; on .invisible in the CSS if you need)
  • hidden-xs is replaced by hidden-xs-down
  • hidden-sm hidden-md hidden-lg is equivalent to hidden-sm-up

Grid

  • col-xs-6 is now col-6
  • col-md-offset-2 becomes offset-md-2
@Papillard
Papillard / navbar_transparent.css
Created October 31, 2014 09:59
Transparent navbar for Bootstrap over-ride @lewagon
.navbar-transparent{
background: transparent;
border: none;
}
.navbar-transparent .navbar-nav > li > a,
.navbar-transparent .navbar-nav > li > a:hover
{
color: white;
line-height: 50px;
@Papillard
Papillard / timeout_pub_scraper.rb
Created August 17, 2016 16:12
TimeOut best pubs scraper
require "open-uri"
require "nokogiri"
url = "http://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").each do |bar|
p bar.search("img")[0].attr("src")
p bar.search("h3 a")[0].text
@Papillard
Papillard / interface.rb
Created October 24, 2017 17:05
Final Wishly - Reboot Batch #100
require_relative "utilities"
require_relative "scraping"
puts "Welcome on Wishly!"
wishlist = [{name: "Macbook", checked: true}, {name: "Iphone", checked: false}]
while true
display_menu
action = gets.chomp