Skip to content

Instantly share code, notes, and snippets.

View NikhilMath's full-sized avatar

Nikhil Math NikhilMath

View GitHub Profile
@NikhilMath
NikhilMath / replace-text-with-js.md
Last active March 28, 2023 17:31
Replace Old Text with New Text with JS

How to replace bad text on a website's DOM with text you want with JS

This is almost always a bandage solution, but if you need a quick fix, use this gist:


Here's a sample JavaScript code that uses the replace method to replace a specific text with another text on a web page:

// replace "oldText" with "newText"
document.body.innerHTML = document.body.innerHTML.replace(/oldText/g, "newText");
@NikhilMath
NikhilMath / Bootstrap-5-Media-Queries.md
Last active March 24, 2023 17:26
Bootstrap 5 Media Query to add to the bottom of CSS

Bootstrap 5 Media Queries

/* ------------------------- Bootstrap Media Queries ------------------------ */
/* X-Small devices (portrait phones, less than 576px) */
/* No media query for `xs` since this is the default in Bootstrap */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 36rem) {
}
@NikhilMath
NikhilMath / banish-ds_store.md
Created March 24, 2023 17:02
How to Banish .DS_store in Your Repo on macOS

How to Banish .DS_store in Your Repo on macOS

Step 1 - (Skip to Step 2 if you don't have .DS_store currently in your repo)

Paste this into your terminal while you're in your directory to remove existing .DS_Store files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

Step 2

Add this line: .DS_store to the file .gitignore, which can be found at the top level of your repository (or create the file if it isn't there already). You can do this easily with this command in the top directory: