Skip to content

Instantly share code, notes, and snippets.

View bhubr's full-sized avatar

Benoît Hubert bhubr

View GitHub Profile
@bhubr
bhubr / DevEnvironmentMacOS-en.md
Last active September 3, 2019 09:46
Setup MacOS for web development

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 / wilders.csv
Last active August 30, 2019 14:06
Fake Wilders
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 / sortObjects.js
Created September 5, 2019 10:06
Sort array of objects by any field, including nested fields
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 / ruby.md
Created September 9, 2019 05:53
Ruby on Mac with RVM

Ruby on Mac

source $(rvm 2.3.0 do rvm env --path)

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;

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.

@bhubr
bhubr / express-server.js
Last active November 21, 2022 11:55
Express quickstart
// 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();
@bhubr
bhubr / setup-eslint-react-app.md
Last active October 14, 2019 09:40
Steps to setup ESLint with Airbnb style guide from default React App
  • 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 / instructions.md
Last active March 17, 2020 10:16
MySQL client installation on Ubuntu

MySQL client installation on Ubuntu

Since MySQL has been acquired by Oracle, who made licensing changes to the product, major Linux distributions have started adopting MariaDB instead, and don't ship MySQL by default.

Follow these steps to install Oracle MySQL on your Ubuntu machine.

Add the MySQL APT Repository

apt is Ubuntu's software installer. It works with "repositories" where software packages are stored. First you have to tell it where MySQL's repositories are.