Skip to content

Instantly share code, notes, and snippets.

.alert.lecture:before {content:"hello ";}
/* BonBon Buttons 1.1 by simurai.com
1.1 Added unprefixed attributes, :focus style, <button> support
1.0 Released
Usage:
Default button: <a href="" class="button">Label</a>

Using Mongoose pre middleware to systematically hash a User's password

const myuser = new User({
  email: 'jdoe@hotmail.fr',
  password: 'blacky123'
})

myuser.save()
 .then(jdoe =&gt; {
@abernier
abernier / README.md
Last active December 27, 2019 12:33

Express controllers/routes conventions

HTTP Verb Path Controller#Action Used for
GET /photos photos#index display a list of all photos
PUT /photos/:id/valid OR /photos/valid photos#validate tell whether the passed data are valid (204 or 422)
HEAD /photos/:id OR /photos?people=Sam photos#exist tell whether that photo exists (204 or 404)
GET /photos/new photos#new return an HTML form for creating a new photo
POST /photos photos#create create a new photo
@abernier
abernier / playground.rs
Created September 22, 2019 13:26 — forked from rust-play/playground.rs
Code shared from the Rust Playground
struct A {
a : i32,
}
impl A {
fn bind_lifetime_mut(&mut self) -> &i32 {
return &self.a;
}
fn legal(&mut self) -> &i32 {
@abernier
abernier / README.md
Last active September 20, 2019 20:58
👨🏻‍⚕️ irondoctor.sh

irondoctor

👨🏻‍⚕️ will examine your environment and check if you are ready to start the bootcamp!

INSTALL

curl -s -o- https://gist.githubusercontent.com/abernier/a19c2cff04c93642dd623beba6f5543d/raw/irondoctor.sh | bash
  1. Cloner ma branch abernier :
git checkout -b abernier --track origin/develop
git pull origin abernier
  1. définir le fichier .env a partir du template .env-dist
cp .env-dist .env
@abernier
abernier / index.md
Last active April 2, 2022 04:47
React cheatsheet

Custom hooks

function useTimeout(ms = 0) {
  const [ready, setReady] = React.useState(false);
  
  React.useEffect(function () {
    const int = setTimeout(() => setReady(true), ms);
    
    return () => clearTimeout(int);
@abernier
abernier / README.md
Last active September 9, 2019 11:46
ironpairs
  1. Open a terminal and paste the following command ☝️😲WITHOUT EXECUTING IT:

    pbpaste | npx https://gist.github.com/abernier/00ac26ff978aebdfa6f3f65019fe2bf0 10 | pbcopy

    NB: 10 being the number of combinations wanted
  2. In a spreadsheet, copy rows of names:
  3. In the previous terminal, press now ENTER to execute the pasted command at step 0.:
  4. Paste the result into spreadsheet
@abernier
abernier / app.js
Last active February 16, 2019 05:15
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
app.get('/login', (req, res) => res.send('Merci de te logguer'))
app.get('/signup', (req, res) => res.send('Merci de créer ton compte'))
app.listen(port, () => console.log(`Example app listening on port ${port}!`))