Skip to content

Instantly share code, notes, and snippets.

View bouyagas's full-sized avatar
🏠
Working from home

Mohamed Bouyagui Gassama bouyagas

🏠
Working from home
View GitHub Profile
@bouyagas
bouyagas / FizzBuzz.js
Created June 4, 2018 08:51 — forked from jaysonrowe/FizzBuzz.js
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);
@bouyagas
bouyagas / jsPrime
Created May 23, 2018 02:19 — forked from sarathsaleem/jsPrime
JavaScript Prime number with recursion
function isPrime(n, hn) {
if (hn === 0 || n === 1) {
return true;
}
hn = hn || parseInt(n / 2);
if (n % hn === 0 && hn !== 1) {
return false;
} else {
return isPrime(n, hn - 1);
}
@bouyagas
bouyagas / jsPrime
Created May 23, 2018 02:19 — forked from sarathsaleem/jsPrime
JavaScript Prime number with recursion
function isPrime(n, hn) {
if (hn === 0 || n === 1) {
return true;
}
hn = hn || parseInt(n / 2);
if (n % hn === 0 && hn !== 1) {
return false;
} else {
return isPrime(n, hn - 1);
}
@bouyagas
bouyagas / median.js
Created May 23, 2018 02:18 — forked from caseyjustus/median.js
calculate the median of an array with javascript
function median(values) {
values.sort( function(a,b) {return a - b;} );
var half = Math.floor(values.length/2);
if(values.length % 2)
return values[half];
else
return (values[half-1] + values[half]) / 2.0;
(function(f) {
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f()
} else if (typeof define === "function" && define.amd) {
define([], f)
} else {
var g;
if (typeof window !== "undefined") {
g = window
} else if (typeof global !== "undefined") {
@bouyagas
bouyagas / webpack4upgrade.md
Created March 20, 2018 07:20 — forked from gricard/webpack4upgrade.md
Just some notes about my attempt to upgrade to webpack 4

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
added 1 package, removed 20 packages and updated 4 packages in 13.081s
@bouyagas
bouyagas / excerpt_package.json.txt
Created March 13, 2018 09:17 — forked from nash403/excerpt_package.json.txt
Node/Npm script to force update project dependencies (command: npm run update:packages)
“scripts”: {
“update:packages”: “node wipe-dependencies.js &&
rm -rf node_modules && npm update --save-dev
&& npm update --save”
},
@bouyagas
bouyagas / webpackProgrammaticConfig.js
Created March 7, 2018 09:46 — forked from jwietelmann/webpackProgrammaticConfig.js
File that exports separate webpack configs for frontend and backend
var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var deepMerge = require('deep-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
// BEGIN CONFIG TOOLS
// Set up config merging function.
var merge = deepMerge(function(target, source, key) {
@bouyagas
bouyagas / node-folder-structure-options.md
Created October 24, 2017 07:45 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@bouyagas
bouyagas / .eslintrc.json
Created October 17, 2017 05:24 — forked from coryhouse/.eslintrc.json
.eslintrc.json file for "Building a JavaScript Development" Pluralsight course
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"