Skip to content

Instantly share code, notes, and snippets.

@yannski
yannski / movies.json
Created June 29, 2012 18:20
movies.json
[{"id":"4fede17c312f912796000034","cover_url":null,"description":null,"rating":6.3,"title":"L'affaire Gordji, histoire d'une cohabitation"},{"id":"4fede17f312f912796000035","cover_url":null,"description":"Documentary telling the true story of the sinking of the liner Laconia by a German U-boat in 1942 through the eyes of six survivors.","rating":6.8,"title":"Le naufrage du Laconia - partie 1"},{"id":"4fede181312f912796000036","cover_url":null,"description":"Documentary telling the true story of the sinking of the liner Laconia by a German U-boat in 1942 through the eyes of six survivors.","rating":6.8,"title":"Le naufrage du Laconia - partie 2"},{"id":"4fede184312f912796000037","cover_url":"http://ia.media-imdb.com/images/M/MV5BMjAyMTg0MjgwOV5BMl5BanBnXkFtZTcwNTEzODY4Mw@@._V1._SX94_SY140_.jpg","description":"The extraordinary story of three Rwandan kids who walk 3000 miles to the Soccer World Cup in South Africa...","rating":6.2,"title":"Africa United"},{"id":"4fede186312f912796000038","cover_url":"http://ia.
@yannski
yannski / Dockerfile
Last active May 5, 2021 09:33
Using docker and docker-compose for Ruby on Rails development with PostgreSQL
FROM ruby:3.0.1
ARG USER_ID
ARG GROUP_ID
RUN addgroup --gid $GROUP_ID user
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
RUN apt-get update -qq
@yannski
yannski / Dockerfile
Last active May 4, 2021 14:40
Using docker and docker-compose for Ruby on Rails development, no database version
FROM ruby:3.0.1
ARG USER_ID
ARG GROUP_ID
RUN addgroup --gid $GROUP_ID user
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
RUN apt-get update -qq
<? echo "Hello World" ?>
version: '2'
services:
web:
build: .
links:
- redis
- webpack
ports:
- 2400:2400
volumes:
//Add this to fetch the SCALINGO_MYSQL_URL
$url = parse_url(getenv("SCALINGO_MYSQL_URL"));
$db['default'] = array(
'dsn' => '',
'hostname' => $url["host"],
'username' => $url["user"],
'password' => $url["pass"],
'database' => substr($url["path"], 1),
'dbdriver' => 'mysqli',
@yannski
yannski / env
Created June 8, 2017 13:02
env file example
DATABASE_URL=mysql2://dbuser:secret@127.0.0.1/dbuser
DATABASE_URL_TEST=mysql2://dbuser:secret@127.0.0.1/dbuser
DEFAULT_HOST=localhost:3000
require "sinatra"
get '/' do
html = ""
filenames = Dir.glob("articles/*.txt").sort.reverse
filenames.each{|filename|
html += article_as_html(filename, 100)
}
return layout(html)
end
require "sinatra"
get '/' do
html = ""
filenames = Dir.glob("articles/*.txt").sort.reverse
filenames.each{|filename|
html += article_as_html(filename, 100)
}
return layout(html)
end
require "sinatra"
get '/' do
html = '<html><head><title>Mon blog</title><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"></head><body>'
html += '<div class="container"><div class="row"><div class="col-12">'
# récupération de la liste des noms de fichiers, triée par ordre alphabétique inverse
filenames = Dir.glob("articles/*.txt").sort.reverse
filenames.each{|filename|
# on lit le contenu du fichier