Skip to content

Instantly share code, notes, and snippets.

View hssm's full-sized avatar
🐙
oink

Houssam Salem hssm

🐙
oink
  • Melbourne, Australia
View GitHub Profile
@hssm
hssm / latch.html
Last active February 14, 2016 02:01
Auto-scroll page to bottom when new content is added, but stop auto-scrolling if user scrolls up
<!DOCTYPE html5>
<html>
<head>
<meta charset="utf-8" />
<title>Latch to bottom unless scrolled up</title>
<script>
document.addEventListener("DOMNodeInserted", function () {
var b = document.body;
// Additional padding/border to account for in calculations
@hssm
hssm / visibility_test.html
Last active July 7, 2016 05:07
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.
<html>
<head>
<meta charset="utf-8">
<style>
.box {
width: 80px;
height: 80px;
padding: 5px;
line-height: 2em;
text-align: center;
@hssm
hssm / about.md
Last active July 7, 2016 05:10
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
hssm / keybase.md
Created June 9, 2018 06:30
keybase.md

Keybase proof

I hereby claim:

  • I am hssm on github.
  • I am hssm (https://keybase.io/hssm) on keybase.
  • I have a public key ASA3sybSj_5DSHPJcAGaI5JYY3j8byuD3_RgitmbvcYWdgo

To claim this, I am signing this object:

@hssm
hssm / 1 - Core template.md
Last active August 24, 2023 21:05
Japanese core deck template

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 collection.media directory and rename it to _VLPGothic.ttf.

Front side: