Skip to content

Instantly share code, notes, and snippets.


Houssam Salem hssm

View GitHub Profile

Keybase proof

I hereby claim:

  • I am hssm on github.
  • I am hssm ( on keybase.
  • I have a public key ASA3sybSj_5DSHPJcAGaI5JYY3j8byuD3_RgitmbvcYWdgo

To claim this, I am signing this object:

hssm / 1 - Core
Last active Jan 8, 2020
Japanese core deck template
View 1 - Core

Anki template for the popular Japanese Core (2k 6k 10k etc) decks.

I highgly recommend you use the VL PGothic font. Download it, extract it, and place the VL-PGothic-Regular.ttf file inside your directory and rename it to _VLPGothic.ttf.

Front side:

hssm /
Last active Jul 7, 2016
A solution and demo for deciding if text should be black or white depending on the background color it is being placed on to guarantee readability.

Do you need a way to decide if text should be black or white depending on the background it is drawn on? This gist contains a simple and effective solution with a demonstration.

The color choice is calculated by hand-crafted rules derived by mere human inspection. Don't like how it works for a certain range? You can easily tweak the numbers for that range.

hssm / visibility_test.html
Last active Jul 7, 2016
An early attempt at deciding on a text color to ensure visibility using some approaches I found on SO. It doesn't work very well.
View visibility_test.html
<meta charset="utf-8">
.box {
width: 80px;
height: 80px;
padding: 5px;
line-height: 2em;
text-align: center;
hssm / latch.html
Last active Feb 14, 2016
Auto-scroll page to bottom when new content is added, but stop auto-scrolling if user scrolls up
View latch.html
<!DOCTYPE html5>
<meta charset="utf-8" />
<title>Latch to bottom unless scrolled up</title>
document.addEventListener("DOMNodeInserted", function () {
var b = document.body;
// Additional padding/border to account for in calculations
You can’t perform that action at this time.