Skip to content

Instantly share code, notes, and snippets.

View ax-sh's full-sized avatar
💭
Currently looking for remote work.

Axmin Shrestha ax-sh

💭
Currently looking for remote work.
View GitHub Profile
@ax-sh
ax-sh / add-p.md
Created August 8, 2022 16:39 — forked from mattlewissf/add-p.md
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@ax-sh
ax-sh / seedData.js
Created April 24, 2022 12:11 — forked from mandiwise/seedData.js
Generate seed data for Auth0 and MongoDB.
// Usage (from `server` directory):
// $ node -r dotenv/config -r esm src/scripts/seedData.js <PASSWORD>
import faker from "faker";
import gravatarUrl from "gravatar-url";
import mongoose from "mongoose";
import auth0 from "../config/auth0";
import initMongoose from "../config/mongoose";
import Post from "../models/Post";
@ax-sh
ax-sh / svg_paths_cheatsheet.md
Created April 24, 2022 11:24 — forked from spoike/svg_paths_cheatsheet.md
Cheatsheet for SVG paths

Cheatsheet for SVG Path Data

Straight line commands

+------------+-------------------+--------+
| *M* or *m* | moveto            | (x y)+ |
+------------+-------------------+--------+
| *Z* or *z* | close path        | (none) |
+------------+-------------------+--------+
[
{
"id": "how-much-should-i-pay-for-a-jacket",
"title": "thing How Much Should I Pay For A Leather Jacket?",
"tags":[1,2,3],
"category":"thing",
"image_url":"https://picsum.photos/200/300"
},
const chunker = (arr, size) => arr.reduce(
(acc, _, i) => (i % size ? acc : [...acc, arr.slice(i, i + size)]),
[]);
@ax-sh
ax-sh / fetchHTML
Last active September 20, 2020 18:36
const fetchHTML = (url)=>fetch(url).then(x=>x.text()).then(html=>new DOMParser().parseFromString(html, 'text/html'));