Skip to content

Instantly share code, notes, and snippets.

View nouman91's full-sized avatar

Nouman Waheed nouman91

View GitHub Profile
@kyleshevlin
kyleshevlin / memoizedHandlers.js
Created January 22, 2021 00:26
Using React.useMemo to create a `handlers` object
// One of my new favorite React Hook patternms is to create handler
// functions for a custom hook using `React.useMemo` instead of
// `React.useCallback`, like so:
function useBool(initialState = false) {
const [state, setState] = React.useState(initialState)
// Instead of individual React.useCallbacks gathered into an object
// Let's memoize the whole object. Then, we can destructure the
// methods we need in our consuming component.
@threepointone
threepointone / feature-flags.md
Last active May 24, 2023 11:03
Feature flags: why, how, all that

(I'm enjoying doing these raw, barely edited writeups; I hope they're useful to you too)

Feature flags

This is my own writeup on feature flags; for a deep dive I'd recommend something like Martin Fowler's article (https://martinfowler.com/articles/feature-toggles.html).

So. Feature flags. The basic idea that you'll store configuration/values on a database/service somewhere, and by changing those values, you can change the user experience/features for a user on the fly.

Let's say that you're building a new feature, called 'new-button' which changes the color of buttons, which is currently red, to blue. Then you'd change code that looks like this -

@nouman91
nouman91 / my-travels.md
Last active September 3, 2021 19:11
Useful libraries and solution I found

My travels

I have been working in JavaScript area for over five years, and in those years I have come across various different problems and implemented solutions for them. I have also studied JavaScript extensively and used many of open source libraries. My aim with this gist is to share my knowledge with you. In this gist I will be sharing many different useful resources which I have used and studied over the years.

Table of Contents

  • Design system
  • Front-end libraries
  • General purpose libraries
  • Back-end libraries
  • Unit test cases libraries

Frontend Masters: AWS for Frontend Engineers

You should have the following completed on your computer before the workshop:

  • Install the AWS CLI.
  • Have Node.js installed on your system. (Recommended: Use nvm.)
    • Install yarn with brew install yarn.
  • Create an AWS account. (This will require a valid credit card.)
  • Create a Travis CI account. (This should be as simple as logging in via GitHub).
@rosario
rosario / composing-software.md
Created January 17, 2018 16:13 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series
@dexteryy
dexteryy / universal-js-monorepo.md
Last active September 29, 2022 21:26
A monorepo structure for large-scale Universal JS projects

The evolutionary path is: monolithic backend-web-framework-based repo -> multi repos with shared infra -> monorepo contains shared infra

The tool support is becoming matured (Yarn Workspace, VSCode's Multi Root Workspaces)

[monorepo]/
 ├── universal-js-app project for product A/
 │    ├── node_modules/
 │    ├── common/
@tzmartin
tzmartin / embedded-file-viewer.md
Last active September 17, 2024 05:29
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active September 22, 2024 14:57
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@robmiller
robmiller / git-cleanup-repo
Last active February 27, 2024 10:09
A script for cleaning up Git repositories; it deletes branches that are fully merged into `origin/master`, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <rob@bigfish.co.uk>
# Adapted from the original by Yorick Sijsling
git checkout master &> /dev/null
# Make sure we're working with the most up-to-date version of master.
git fetch