Skip to content

Instantly share code, notes, and snippets.

View basimhennawi's full-sized avatar

Basim Hennawi basimhennawi

View GitHub Profile
@besLisbeth
besLisbeth / heaps.js
Last active August 17, 2022 02:22
MinHeap, MaxHeap, and MedianHeap data structures
// This code was taken from the "JavaScript Data Structures and Algorithms" by Sammie Bae
// from the repository https://github.com/Apress/js-data-structures-and-algorithms,
// refactored to classes, and fixed the problem of adding '0' as the node value
// (it's not working correctly in the origin repository)
class Heap {
items = [];
constructor(values){
@vasanthk
vasanthk / System Design.md
Last active May 6, 2024 13:07
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet
@mrichie
mrichie / gist:2849763
Created June 1, 2012 07:06 — forked from rrobe53/gist:976610
Node.js File Extension Content Type
exports.ext = function () {
var extTypes = {
"3gp" : "video/3gpp"
, "a" : "application/octet-stream"
, "ai" : "application/postscript"
, "aif" : "audio/x-aiff"
, "aiff" : "audio/x-aiff"
, "asc" : "application/pgp-signature"
, "asf" : "video/x-ms-asf"
, "asm" : "text/x-asm"
@marians
marians / german-porter-stemmer.js
Created April 26, 2011 14:06
German Porter Stemmer in JavaScript
/* by Joder Illi, Snowball mailing list */
function stemm(word) {
/*
Put u and y between vowels into upper case
*/
word = word.replace(/([aeiouyäöü])u([aeiouyäöü])/g, '$1U$2');
word = word.replace(/([aeiouyäöü])y([aeiouyäöü])/g, '$1Y$2');
/*
and then do the following mappings,