Skip to content

Instantly share code, notes, and snippets.

View murtuzaalisurti's full-sized avatar
:octocat:
breaking and fixing code

Murtuzaali Surti murtuzaalisurti

:octocat:
breaking and fixing code
View GitHub Profile
@murtuzaalisurti
murtuzaalisurti / git-aliases.md
Created July 14, 2024 14:50 — forked from colmarius/git-aliases.md
A list of useful git aliases

Intro

Bellow follows a list of aliases, split between beginner and advanced.

To start using them right away you should place the aliases you like most in a file like ~/.zsh/git. Now all that remains is to add the following line to your ~/.zshrc or ~/.bashrc:

. ~/.zsh/git # git aliases
@murtuzaalisurti
murtuzaalisurti / git-aliases.md
Created July 14, 2024 14:47 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
const markdownIt = require("markdown-it")();
module.exports = (...data) => {
const images = data.flatMap((arg, index) => {
if (index === data.length - 1) {
return [];
}
return [
{

Do not use forEach with async-await

TLDR: Use for...of instead of forEach in asynchronous code.

The problem

Array.prototype.forEach is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)

For example, the following forEach loop might not do what it appears to do:

@murtuzaalisurti
murtuzaalisurti / dock.sh
Created July 30, 2023 18:15
An example shell script to execute docker commands using flags!
#!/usr/bin/env bash
usage() {
echo "Usage:
$0 [-b] [-r containerName imageName] [-c (up | down)] [-s (containerName | id)] [-x (containerName | id)] [-d (containerName | id)] [-h]
example: $0 -b --- [to build the image]
$0 -c up --- [to create and start a container using docker compose]
-h: help
@murtuzaalisurti
murtuzaalisurti / findStyles.js
Created December 4, 2022 13:02 — forked from macbookandrew/findStyles.js
List unique CSS properties for all DOM elements
/**
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer}
*
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file}
*
* @author AndrewRMinion Design (https://andrewrminion.com)
* @version 1.1
*
@murtuzaalisurti
murtuzaalisurti / after-prefixing.css
Last active June 23, 2022 11:07
How to vendor-prefix and minify your CSS?
*{
margin: 0;
box-sizing: border-box;
-webkit-text-size-adjust: auto;
-moz-text-size-adjust: auto;
text-size-adjust: auto;
}
eleventyConfig.addLiquidShortcode("codepen", function (url) {
const url_array = url.split("/");
const profile_url_array = url_array.filter((string, index) => {
return (index < (url_array.length - 2)) ? true : false
})
const username = profile_url_array[profile_url_array.length - 1];
const user_profile = profile_url_array.join("/");