Skip to content

Instantly share code, notes, and snippets.

View salembaira's full-sized avatar
⚒️
Building things

Mohamed Salem BAIRA salembaira

⚒️
Building things
View GitHub Profile
@salembaira
salembaira / next+12.0.2.patch
Created November 11, 2021 12:17
next.js patch to enable decorators and remove console.log in production build
diff --git a/node_modules/next/dist/build/webpack-config.js b/node_modules/next/dist/build/webpack-config.js
index 5fe4dd5..a13e97a 100644
--- a/node_modules/next/dist/build/webpack-config.js
+++ b/node_modules/next/dist/build/webpack-config.js
@@ -736,7 +736,7 @@ async function getBaseWebpackConfig(dir, { buildId , config , dev =false , isSer
)) {
return false;
}
- return /node_modules/.test(excludePath);
+ return /node_modules|tableau-react/.test(excludePath);
@salembaira
salembaira / next.config.js
Last active August 18, 2021 08:28
next.config.js for importing external css files, images and fonts. Easily modified for supporting SASS/LESS. Also includes some production optimizations (services workers, css purging)
const withPlugins = require('next-compose-plugins');
const withImages = require('next-images');
const path = require('path');
const withOffline = require('next-offline');
const withCSS = require('@zeit/next-css');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const withPurgeCss = require('next-purgecss');
const {
PHASE_PRODUCTION_BUILD,
// npm install --save scrollreveal or install like you're used to doing it.
// It doesn't work well if there are multiple instances of ScrollReveal,
// so we have to create a module returning an instance:
// file ScrollReveal.js:
import ScrollReveal from 'scrollreveal'
export default ScrollReveal()
// Then in a component:
import React from 'react'
import sr from './ScrollReveal'
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active August 28, 2025 08:25
React Native Bridging Cheatsheet
@Restuta
Restuta / framework-sizes.md
Last active June 11, 2025 03:17
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}