Skip to content

Instantly share code, notes, and snippets.

Ferdinand Prantl prantlf

Block or report user

Report or block prantlf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
prantlf / color-conversion-algorithms.js
Created Feb 25, 2019 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
View color-conversion-algorithms.js
* Converts an RGB color value to HSL. Conversion formula
* adapted from
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
prantlf /
Last active Dec 3, 2018 — forked from stonehippo/
Installing a new Ruby with rbenv on Mac OS

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

prantlf / Mac OSX Setup - Brew
Created Nov 15, 2018 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
View Mac OSX Setup - Brew
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
# Install Xcode first -
# Install Xcode command line tools.
xcode-select --install
prantlf / can-be-seen.js
Last active Sep 2, 2018
Check, that an element can be really seen in the browser window
View can-be-seen.js
// Checks, that the element is not only visible in DOM,
// but that it can be really seen either in the window,
// or only in the visible part of the windows (viewport).
// The centre of the element has to be seen, at least.
function canBeSeen (element, inViewPort) {
// Filter out hidden elements
if (element.offsetHeight === 0) {
return false
// Get extents of the viewport
prantlf /
Last active Sep 2, 2018 — forked from vanquang9387/
Japanese default css font family

Most Japanese websites use default font sets provided on Windows, Mac or Ubuntu. The latest ones are Meiryo, Hiragino Kaku Gothic Pro and Noto. For older versions such like Windows XP, it is good to add former default fonts MS Gothic(or MS Mincho)/Osaka. Older Linux versions may include Takao fonts.

Some old browsers could not understand those font names in English, some others do not recognize the names in Japanese, so it is safe to write both in Japanese and English.

Meiryo and Hiragino's order is, because Mac users may have Meiryo from MS-Office, and Hiragino is more familiar and matching well on Mac, better by starting Hiragino series.

So the current recommended practice is like this:

font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, メイリオ, Meiryo, "MS Pゴシック", "MS PGothic", "MS ゴシック" , "MS Gothic", "Noto Sans CJK JP", TakaoPGothic, sans-serif;
prantlf / ttc2ttf
Created Jul 19, 2018 — forked from lilydjwg/ttc2ttf
Convert .ttc to several .ttf files into the current directory
View ttc2ttf
#!/usr/bin/env python2
import sys
import fontforge
def main(file):
for font in fontforge.fontsInFile(file):
f ='%s(%s)' % (file, font))
f.generate('%s.ttf' % font)
prantlf /
Created Jun 18, 2018
Upgrade npm dependencies semi-automatically
git pull --all && ncu -au && npm i && npm test
git commit -a -m "chore: Upgrade development npm module dependencies" && git push --all
prantlf / npm.log
Created Jun 18, 2018
vnu-jar@dev cannot be found
View npm.log
ferdipr@de08365:~/0 npm i vnu-jar@dev --verbose --no-color
npm info it worked if it ends with ok
npm verb cli [ '/home/ferdipr/.nvm/versions/node/v8.11.2/bin/node',
npm verb cli '/home/ferdipr/.nvm/versions/node/v8.11.2/bin/npm',
npm verb cli 'i',
npm verb cli 'vnu-jar@dev',
npm verb cli '--verbose',
npm verb cli '--no-color' ]
npm info using npm@6.1.0
npm info using node@v8.11.2
prantlf / selenium.test.js
Last active Mar 28, 2018
Script to reproduce the chromedriver process not stopping for
View selenium.test.js
const selenium = require('selenium-standalone')
const webdriverio = require('webdriverio')
const configuration = {
version: '3.8.1',
baseURL: '',
drivers: {
chrome: {
version: '2.37',
arch: process.arch,
prantlf / jquery.ajaxIntercept.js
Last active Sep 2, 2018
Intercepts AJAX calls issued against a base URL and redirect them to other service
View jquery.ajaxIntercept.js
// jQuery.ajaxIntercept 0.2.0
// Copyright (c) 2017 Ferdinand Prantl
// Licensed under the MIT license.
// Allows intercepting AJAX calls issued against a base URL
// and either redirect them to some other service, or compose
// the response by a custom asynchronous callback
You can’t perform that action at this time.