Skip to content

Instantly share code, notes, and snippets.

View SalahHamza's full-sized avatar

Hamza SalahHamza

View GitHub Profile
@SalahHamza
SalahHamza / install_ngrok.md
Last active April 25, 2024 16:05
How to install ngrok on linux subsystem for windows
@SalahHamza
SalahHamza / http_and_web_servers.md
Last active April 13, 2023 12:37
Udacity's HTTP & Web Servers course notes (ud303)

HTTP & Web Servers

These are the course notes for the HTTP & Web Servers Udacity course, some parts of the notes are taken from the book HTTP: The definitive Guide.

Requirements

Command Line:

You'll be using the command line a lot in this course. A lot of the instructions in this course will ask you to run commands on the terminal on your computer. You can use any common terminal program —

@SalahHamza
SalahHamza / version_controll.md
Last active December 13, 2022 06:55
Udacity's Version Control With Git course notes (ud123)

Version Control

What Is Version Control

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.

There are two main types of version control system models:

  • the centralized model - all users connect to a central, master repository
  • the distributed model - each user has the entire repository on their computer
@SalahHamza
SalahHamza / concurrent-mode-suspense.js
Last active January 15, 2022 18:53
Concurrent Mode Suspense example
/**
* The issues I found are the following:
* 1) No 'fallback', the benefit of suspense is to render as early as possible.
* 2) The component fetching the data should "suspend", fetching user profile in a useEffect
* Doesn't do that.
* 3) The suspense should wrap the componenet fetching the data (i.e. SuspensefulUserProfile).
*
* Extra notes:
* - Making a request for each profile separately is definitely something to be avoided,
@SalahHamza
SalahHamza / Local PR test and merge.md
Created March 31, 2019 00:53 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@SalahHamza
SalahHamza / 0-github-actions.md
Created December 8, 2020 17:43 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@SalahHamza
SalahHamza / ID.js
Created November 20, 2019 20:08
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`
@SalahHamza
SalahHamza / import_heroku_pg.md
Created September 13, 2019 16:21
Import a Heroku PG dump into local machine

Import a Heroku PG dump into local machine

Follow these 4 simple steps in your terminal (Heroku Dev Center): Create a backup copy of your database:

$ heroku pg:backups capture DATABASE_NAME

Download the copy from Heroku (to your local machine) using curl:

$ curl -o latest.dump `heroku pg:backups public-url`