Skip to content

Instantly share code, notes, and snippets.

View a7madgamal's full-sized avatar

Ahmed Hassanein a7madgamal

View GitHub Profile
@a7madgamal
a7madgamal / tasker.js
Last active October 6, 2023 00:02
Tasker Gists
const logs = [];
function logAndExit() {
setLocal("debugtext", logs.join("\n"));
exit();
}
if (typeof todoist_header !== "string") {
logs.push("missing todoist_header!");
logAndExit();
@a7madgamal
a7madgamal / all_events_listener.js
Created August 29, 2023 00:35
listen to all js events
Object.keys(window).forEach((key) => {
if (/^on/.test(key)) {
const name = key.slice(2);
console.log(name);
window.addEventListener(name, (event) => {
const tag = event[Symbol.toStringTag];
// exclude noisy ones
if (!['TransitionEvent', 'MouseEvent', 'PointerEvent', 'AnimationEvent'].includes(tag)) {
console.log(event);
@a7madgamal
a7madgamal / typescript.ts
Last active May 18, 2022 21:30
Typescript intro
////////////////////////////////////////////////////////////////////////////////
// Booleans
////////////////////////////////////////////////////////////////////////////////
const trueOrFalse: boolean = true;
// trueOrFalse = 3
// TS is smart, no need to type EVERYTHING!
const alsoTrueOrFalse = true;
// alsoTrueOrFalse = 3
@a7madgamal
a7madgamal / example-1.ts
Created March 16, 2021 18:57
medium-article-typescript
//test
@a7madgamal
a7madgamal / google-meet-friendly ascii art.txt
Created January 25, 2021 11:16
ascii art for Google Meet
┈┈┈┈┈┈▕▔╲
┈┈┈┈┈┈┈▏▕
┈┈┈┈┈┈┈▏▕▂▂▂
▂▂▂▂▂▂╱┈▕▂▂▂▏
▉▉▉▉▉┈┈┈▕▂▂▂▏
▉▉▉▉▉┈┈┈▕▂▂▂▏
▔▔▔▔▔▔╲▂▕▂▂▂I
@a7madgamal
a7madgamal / Change Do not disturb DND setting on Macos Big Sur using the terminal.md
Last active July 29, 2023 22:24
Change Do not disturb DND setting on Macos Big Sur using the terminal

defaults read com.apple.ncprefs.plist dnd_prefs

turn on: defaults write com.apple.ncprefs.plist dnd_prefs -data 62706C6973743030D60102030405060708080A08085B646E644D6972726F7265645F100F646E64446973706C6179536C6565705F101E72657065617465644661636574696D6543616C6C73427265616B73444E445875736572507265665E646E64446973706C61794C6F636B5F10136661636574696D6543616E427265616B444E44090808D30B0C0D070F1057656E61626C6564546461746556726561736F6E093341C2B41C4FC9D3891001080808152133545D6C828384858C9499A0A1AAACAD00000000000001010000000000000013000000000000000000000000000000AE

turn off: defaults write com.apple.ncprefs.plist dnd_prefs -data 62706C6973743030D5010203040506070707075B646E644D6972726F7265645F100F646E64446973706C6179536C6565705F101E72657065617465644661636574696D6543616C6C73427265616B73444E445E646E64446973706C61794C6F636B5F10136661636574696D6543616E427265616B444E44090808080808131F3152617778797A7B0000000000000101000000000000000B0000000000000000000000000000007C

@a7madgamal
a7madgamal / sync_git_branches.sh
Last active January 18, 2019 10:32
stash changes > fetch all branches > pull all branches from remote > merge each local branch with master > pop stash > enjoy!
#!/usr/bin/env bash
I="\e[96m"
E="\e[90m"
echo -e "🤖$I starting sync.. $E";
CURRENT_BRANCH="`git rev-parse --abbrev-ref HEAD`"
STASH_RESULT="`git stash push -u -m AUTO_STASH | grep Saved`"
if [ -n "$STASH_RESULT" ]; then
@a7madgamal
a7madgamal / .gitconfig
Created December 17, 2018 15:52 — forked from arnauldvm/.gitconfig
Git sync all local tracking branches with remotes
[alias]
tracking = "!f() { git for-each-ref --format '%(refname:short):%(upstream:short)' 'refs/heads' | grep -Ev ':$'; }; f"
is-clean-workdir = "!f() { git diff --stat --exit-code || { echo \"Workdir dirty\"; exit 1; }; }; f"
is-clean-index = "!f() { git diff --stat --cached --exit-code || { echo \"Index dirty\"; exit 2; }; }; f"
is-clean = "!f() { git is-clean-workdir && git is-clean-index; }; f"
co-merge = "!f() { local=\"$1\"; remote=\"$2\"; git checkout \"$local\"; git merge --ff-only \"$remote\"; }; f"
current-branch = rev-parse --abbrev-ref HEAD
sync = "!f() { git stash push -u -m AUTO_STASH && git is-clean || { echo Aborting sync.; exit 1; }; current=$(git current-branch); git fetch --all; git tracking | while IFS=: read local remote; do echo \"Merging $local with $remote\"; git co-merge \"$local\" \"$remote\"; done 3>&1 1>&2 2>&3 | grep -iE --color 'fatal|$' 3>&1 1>&2 2>&3; git checkout \"$current\"; git stash pop; }; f"
yarn run v1.9.2
$ prettier '**/*.{js,jsx,json,css,scss,less,md,ts,tsx}' --write
__mocks__/fileMock.js 30ms
__mocks__/mocks.js 9ms
__mocks__/styleMock.js 4ms
.stylelintrc.js 5ms
app/FakeRouting.ts 213ms
app/src/common/actionCreators/accessToken.ts 13ms
app/src/common/actionCreators/config.ts 7ms
app/src/common/actionCreators/requestsTimestamp.ts 7ms