Skip to content

Instantly share code, notes, and snippets.

@M-ZubairAhmed
M-ZubairAhmed / react-bootstrap-icons.md
Created July 6, 2020 17:11
A simple description on how to use svg in react

If the app uses custom webpack configuration, then loader is needed to handle svgs in your app. Lets use SVGR webpack loader.

yarn add @svgr/webpack --dev

and then in your webpack config file add the following rule :

{
 test: /\.svg$/,
@M-ZubairAhmed
M-ZubairAhmed / prettier.config.js
Created May 2, 2019 15:21
My default personal opiniated prettier config
module.exports = {
endOfLine: 'lf',
semi: false,
singleQuote: true,
tabWidth: 2,
printWidth: 80,
trailingComma: 'all',
jsxBracketSameLine: true,
arrowParens: 'always',
}
@M-ZubairAhmed
M-ZubairAhmed / translation-strings-to-ids.js
Created July 10, 2018 07:19
Simple node program that normalizes string of react int to be used as ids in translation json file
const readline = require('readline');
var ncp = require('copy-paste');
const inputMessage = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
// Promt to enter the string eg.
// This ain't your username, is it?
@M-ZubairAhmed
M-ZubairAhmed / mustApps.md
Last active May 9, 2018 09:11
Apps i use on my Linux

List of must apps i use in my Linux PC

Sorted from top to down in order of installation

Package managers

@M-ZubairAhmed
M-ZubairAhmed / styling-readme.md
Last active March 9, 2018 06:08
Styling Readme

repo image

Styling Readme

Hit Raw to copy the content

Divider line

A clean divider line to segregate your sections.

color-line

@M-ZubairAhmed
M-ZubairAhmed / react-heroku.md
Last active February 19, 2018 14:01
Deploying React app bootstrapped with CRA to Heroku

Creating heroku app with cli

heroku create $APP_NAME --buildpack https://github.com/mars/create-react-app-buildpack.git

with npx

npx heroku-cli create $APP_NAME --buildpack https://github.com/mars/create-react-app-buildpack.git
@M-ZubairAhmed
M-ZubairAhmed / task.js
Created January 22, 2018 15:03
Mod Studio Task
const inputString =
'[ "AND", ["<", "var1", "var2"], [ "OR", [">", "var3", "var4"], ["==", "var5", "var6"] ] ]'
let cleanedString = ''
for (var i = 0; i < inputString.length; i++) {
if (
inputString[i] !== '[' &&
inputString[i] !== ']' &&
inputString[i] !== '"'
) {
@M-ZubairAhmed
M-ZubairAhmed / center.md
Last active November 28, 2017 09:11
Markdown syntax for centering logo, title and subtitle in a repository's readme

Repo's title

repo's subtitle/moto
@M-ZubairAhmed
M-ZubairAhmed / translator.js
Created October 7, 2017 15:19
Extracting all strings from react-intl to single json file
console.log('Extracted all strings from program ', '\n')
import * as fs from 'fs'
import { sync as globSync } from 'glob'
import { sync as mkdirpSync } from 'mkdirp'
const filePattern = './build/messages/**/*.json'
const outputLanguageDataDir = './build/locales/'
console.log('Piping followings ids :')