Skip to content

Instantly share code, notes, and snippets.

@bogas04
bogas04 / ternary-jsx.js
Created October 27, 2021 11:52
A babel plugin to replace all `cond && <Jsx />` to `cond ? <Jsx /> : null`
/**
* A simple babel plugin that replaces all logical expressions used within JSX to use ternary operator
* ast explorer: https://astexplorer.net/#/gist/ce3b67aad0896abb10f89e8bf6805819/288e7e77857ae203296e6ee81b1235ff3f4e7b20
*/
module.exports = function (babel) {
const {types: t} = babel;
return {
name: 'ternary-jsx', // not required
visitor: {
@bogas04
bogas04 / rollup.config.js
Created March 22, 2020 16:02
Rollup config for a component library
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import postcss from "rollup-plugin-postcss-modules";
import babel from "rollup-plugin-babel";
import autoprefixer from "autoprefixer";
import { terser } from "rollup-plugin-terser";
import packageFile from "./package.json";
import * as path from "path";
@bogas04
bogas04 / a11y.md
Last active March 12, 2020 08:29
Accessibility Tips

Accessibility

Had a discussion with Rahul Dhawani about a11y. The solution to the linter telling you to add tabIndex/onKeyDown/role isn't to follow it (lol), but to evaluate whether we need a button here or an anchor, or we simply need to wrap the inner callback with our function. Linter doesn't know what is your usecase, so it tries best to make your div accessible, but that's just patch work. Before I share suggestions, I would like to share why we should care:

Makes customers happy

  • Someone using a keyboard, a screen reader or with some disability would be happy you cared for them.

Free benefits by using HTML properly!

# Install lerna globally
npm i -g lerna
# Change directory to your work folder
cd ~/Work
# Make the folder you want to keep your monorepo in
mkdir portal-web
# Change directory to monorepo folder

So you bought a ColorOS powered phone (Oppo/Realme) and aren't liking the decisions made by OS.

Launcher

I use Customized Pixel Launcher which allows me to hide apps from App Drawer and get notification drawer by swiping down on homescreen. That pretty much makes the phone look like stock android.

Bloatware Apps

The second thing you would want to do is uninstall useless apps that can't be disabled.

/*
* Use const > let > var
* Use functional way whenever possible
* Optimize only when necessary (you test and find the bottleneck part).
* Prefer pure functions that return rather than mututate global values.
* Destructing to write cleaner code
* Spread rest for clean code
* Object short hands
* Promises, Promise.all, Promise.race
* async await is good!
@bogas04
bogas04 / sumo-logic-questions.md
Last active May 16, 2024 21:38
SumoLogic Interview Questions - Senior Software Engineer (UI)

Sept 2017

Following are the details of the interview questions asked by SumoLogic (Noida) for Senior Software Engineer (UI) role. I did clear the interviews and was offered the position with a very handsome package.

Round 0

The round began with the very first call from the Abhishek Porwal, the Tech Recruiter of the firm. He very briefly explained about the company, its work, culture & about the position they were intending to inteview me for.

I was really nervous and excited at the same time. This was my first frontend-related as well as lateral job interview.

@bogas04
bogas04 / share.js
Created September 22, 2017 15:34
Web Share API Example
async handleClick (e) {
// feature detection
if ('share' in navigator) {
try {
await navigator.share({
title: 'Click-bait title #6314',
url: 'http://www.theuselessweb.com/'
});
} catch (err) {
console.error(err);
Devnaagri Gurulipi Punjabi Unicode
k
K
g
G
|
c
C
j
@bogas04
bogas04 / esnextbin.md
Created February 17, 2016 07:54
esnextbin sketch