Skip to content

Instantly share code, notes, and snippets.

Benoît Hubert bhubr

Block or report user

Report or block bhubr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bhubr
bhubr / setup-eslint-react-app.md
Last active Oct 14, 2019
Steps to setup ESLint with Airbnb style guide from default React App
View setup-eslint-react-app.md
  • Create the app: npm init react-app my-react-app && cd my-react-app

  • Setup ESLInt (for the last point I choose JSON so that I can copy-paste the generated file to package.json: npx eslint --init

    • How would you like to use ESLint? To check syntax, find problems, and enforce code style
    • What type of modules does your project use? JavaScript modules (import/export)
    • Which framework does your project use? React
    • Does your project use TypeScript? No
    • Where does your code run? Browser
    • How would you like to define a style for your project? Use a popular style guide
    • Which style guide do you want to follow? Airbnb (https://github.com/airbnb/javascript)
@bhubr
bhubr / express-server.js
Last active Oct 13, 2019
Express quickstart
View express-server.js
// yarn add express body-parser cookie-parser morgan cors
// yarn add --dev nodemon
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const morgan = require('morgan');
const app = express();
View Uninstalling_Node.js.md
View Installing_Node.js.md

Installing Node.js

On Linux/MacOS

Note for Linux users: before going further, run which curl in the terminal. If it shows something (e.g. /usr/bin/curl), you're good! Otherwise, run sudo apt install -y curl (Ubuntu/Debian) to install cURL.

Note for zsh users (Linux or MacOS): in the following installation instructions, replace bash with zsh on the 1st line, and ~/.bashrc with ~/.zshrc on the 2nd.

You are going to use NVM (Node Version Manager). Here's a summary of what you have to do (see installation instructions on the NVM repo for more details). Run these commands in your terminal.

View create-movie.sql
CREATE TABLE `movie` (
`id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`poster` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`comment` varchar(1500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `movie` ADD PRIMARY KEY (`id`);
ALTER TABLE `movie` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
@bhubr
bhubr / ruby.md
Created Sep 9, 2019
Ruby on Mac with RVM
View ruby.md

Ruby on Mac

source $(rvm 2.3.0 do rvm env --path)
@bhubr
bhubr / sortObjects.js
Created Sep 5, 2019
Sort array of objects by any field, including nested fields
View sortObjects.js
function resolve(obj, key) {
let val = obj;
const bits = key.split('.');
while (bits.length && val) {
const bit = bits.shift();
val = val[bit];
}
return val;
}
@bhubr
bhubr / wilders.csv
Last active Aug 30, 2019
Fake Wilders
View wilders.csv
Isabelle Brunel Biarritz France 2017 Java
Thibaut Bouchet Biarritz France 2017 Java
Emmanuelle Mercier Biarritz France 2017 JavaScript
Stéphanie Maillard Biarritz France 2017 Java
Eugène Didier Biarritz France 2017 PHP
Michelle Legros Biarritz France 2017 Java
Catherine Marin Biarritz France 2017 Java
Benoît Descamps Biarritz France 2017 PHP
Robert Delorme Biarritz France 2017 PHP
Charlotte Tanguy Biarritz France 2017 PHP
@bhubr
bhubr / DevEnvironmentMacOS-en.md
Last active Sep 3, 2019
Setup MacOS for web development
View DevEnvironmentMacOS-en.md

Development Environment Setup on MacOS

We're going to install and configure essential (and not-so-essential) tools for web development on MacOS.

MacOS being a Unix derivative, and the Open Source community being very active, you can get all the tools that make Linux a great OS for development.

If you want to go further, take a look at:

@bhubr
bhubr / commands.sh
Created Jul 24, 2019
install wifi lenovo
View commands.sh
sudo apt-get install build-essential dkms git
git clone -b 4.18 https://github.com/jeremyb31/ideapad-laptop.git
sudo dkms add ./ideapad-laptop
sudo dkms install ideapad-laptop/1.0
echo "options ideapad_laptop override_has_hw_rfkill_switch=0" | sudo tee /etc/modprobe.d/ideapad_laptop.conf
You can’t perform that action at this time.