Skip to content

Instantly share code, notes, and snippets.

View regisfoucault's full-sized avatar

Régis Foucault regisfoucault

View GitHub Profile
@urcadox
urcadox / Filters.scala
Created November 18, 2016 11:30
Play 2.5 HTTPS redirection on Clever Cloud
package controllers
import javax.inject._
import play.api._
import play.api.http.DefaultHttpFilters
import play.api.mvc._
import play.api.Environment
import scala.concurrent.{ExecutionContext, Future}
import akka.stream.Materializer
@bendc
bendc / display-fade.html
Created June 22, 2016 03:01
Transitioning the opacity of a hidden element
<!doctype html>
<meta charset="utf-8">
<title>Example</title>
<style>
div {
width: 100px;
height: 100px;
background: black;
animation-duration: .5s;

Intercom user_hash

Remember that your secret key should never be exposed to the public

  • So Javascript code below should only be used for testing unless modified and used to run on a server
@julienrf
julienrf / SurgicalUpdate.scala
Last active September 29, 2021 21:38
Surgical updates in Slick
import slick.lifted.TupleShape
import slick.driver.H2Driver.api._
import scala.concurrent.Await
import scala.concurrent.duration.DurationInt
import scala.concurrent.ExecutionContext.Implicits.global
object Example {
val db = Database.forConfig("db")
@davegurnell
davegurnell / anorm.scala
Last active June 5, 2024 14:26
A short guide to Anorm
/*
Overview
--------
To run a query using anorm you need to do three things:
1. Connect to the database (with or without a transaction)
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator
3. Call one of the methods on `SqlQuery` to actually run the query
@Kartones
Kartones / postgres-cheatsheet.md
Last active September 20, 2024 08:36
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@viktorklang
viktorklang / Future-retry.scala
Last active July 23, 2023 23:48
Asynchronous retry for Future in Scala
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.

Happy Freelancing

Je m’appelle Thibaut Assus, j’ai 30 ans, je suis freelance en développement web et ma technologie de prédilection est le Ruby on Rails. J’ai maintenant un peu d’expérience dans le domaine du freelancing et ce document a pour but de partager avec vous une partie de cette expérience.

Mon parcours de développeur Ruby

@willurd
willurd / web-servers.md
Last active September 21, 2024 09:18
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000