Skip to content

Instantly share code, notes, and snippets.

View ahmedelgabri's full-sized avatar
🤔
...

Ahmed El Gabri ahmedelgabri

🤔
...
View GitHub Profile
@WebReflection
WebReflection / handle-event-doodle.md
Last active April 12, 2024 09:54
The `handleEvent` ASCII doodle

About This Gist

This gist summarizes the handleEvent(event) pattern features, something standard, something described by me many times, written in my tiny book, tweeted about, and yet it's something most Web developers ignore.

The handleEvent ASCII Doodle

                  ┌---------------------------------┐
var handler = {   | any object that inherits or     |
@sophiebits
sophiebits / reducer-with-effects.js
Last active July 29, 2020 12:10 — forked from davidkpiano/reducer-with-effects.js
An idea for actor-model-based effects with reducers
import {
useReducerWithEffects,
emitEffect,
} from 'react';
// In a component
const UserComponent = () => {
function fetchUserEffect(id, parentRef) {
const controller = new AbortController();
@yegappan
yegappan / VimScriptForPythonDevelopers.MD
Last active January 12, 2024 10:51
Vim script for Python Developers

Vim Script for Python Developers

This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m

@swyxio
swyxio / cloudos.md
Last active May 3, 2023 12:23
Cloud Operating Systems and Reconstituting the Monolith. tweet responses: https://twitter.com/swyx/status/1226257539886669825?s=20
interface Circle {
type: 'circle';
radius: number;
}
interface Square {
type: 'square';
width: number;
}
@IanColdwater
IanColdwater / twittermute.txt
Last active May 23, 2024 18:37
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@lencioni
lencioni / array.includes.js
Last active February 17, 2020 14:01
Webpack module replacements for shims/polyfill packages
module.exports = function arrayIncludes(arr, search, fromIndex) {
return arr.includes(search, fromIndex);
};
@tsutsu
tsutsu / README.md
Last active February 2, 2020 03:13

This is an example of a script for new systems, which 'mounts' dotfiles from a cloud-synced directory, and also moves junk out of the homedir into the places where it "should" live as per various filesystem standards (Linux FHS, FreeDesktop.org, macOS, etc.), replacing the origins with symlinks to the new locations.

The script is designed to be idempotent; it could theoretically be run on startup.

Various locations are hard-coded. Please take this script only as inspiration; don't try to run it directly.

@tsutsu
tsutsu / README.md
Last active January 31, 2020 18:11
More Stupid Bash Tricks

More Stupid Bash Tricks

Before we get started, let's make a ~/.bash directory

Bash expects just a few files in your homedir, but is fine with these files being symlinks. As such, I instead create a subdir, ~/.bash, and then symlink ~/.bashrc to ~/.bash/bashrc and ~/.bash_profile to ~/.bash/bash_profile. This gives you a new namespace (the ~/.bash dir) to pollute with little files, which we're going to do plenty of below.

@RobertAKARobin
RobertAKARobin / python.md
Last active June 13, 2024 04:24
Python Is Not A Great Programming Language