Skip to content

Instantly share code, notes, and snippets.

@abernier
abernier / README.md
Last active May 26, 2020 15:20
ironunits
.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: '[email protected]',
  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);