Skip to content

Instantly share code, notes, and snippets.

View klarstil's full-sized avatar
🏠
Working from home

Stephan Pohl klarstil

🏠
Working from home
View GitHub Profile
$ npm install --save missionlog
import Plugin from 'src/plugin-system/plugin.class';
// Import logger
import { log } from '@missionlog';
// Initializing the logger
log.init({ initializer: 'INFO' }, (level, tag, msg, params) => {
console.log(`${level}: [${tag}] `, msg, ...params);
});
@klarstil
klarstil / README.md
Last active January 12, 2017 08:23
How to get external high def (>1080p) displays to work on Mac OS X

Using a high definition display on Mac OS X can be a pain to set up due to the fact that the system recognizes the monitor as a television and therefor forces the monitor in the YCbCr mode. There's a solution for the problem called EDID patching which forces the monitor into the RGB mode.

First of all, when are you using a version of Mac OS X which protects your system (>=El Captain), you have to disable the System Integry Protection before we can continue. To do so, you have to boot your Mac into the Recovery mode using the shortcut CMD + R right after the startup chime. Select a language, go to Utilities in the menu bar and open up the terminal. Now insert the following command and reboot your Mac:

csrutil disable
reboot

Please keep in mind we're disabling a security feature - make sure you know what you're doing

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@klarstil
klarstil / README.md
Last active August 29, 2015 14:05
HowTo Install Ruby 1.8.7 under Mac OS X 10.9.x

HowTo Install Ruby 1.8.7 under Mac OS X 10.9.x

  • First off all make sure, that you've installed XCode and Homebrew.
  • Install openssl and libyaml using brew:
brew update && brew install openssl libyaml
  • After that you can install rbenv:
brew install rbenv ruby-build
@klarstil
klarstil / index.html
Created August 26, 2014 10:45
A Pen by Stephan Pohl.
<ul class="shopping-world--container">
<div class="grid--sizer"></div>
<div class="gutter--sizer"></div>
<li class="shopping-world--entry w2"></li>
<li class="shopping-world--entry"></li>
<li class="shopping-world--entry"></li>
<li class="shopping-world--entry"></li>
<li class="shopping-world--entry"></li>
<li class="shopping-world--entry"></li>
<li class="shopping-world--entry"></li>
var randomDate = function() {
var now = new Date(),
minMonth = 1, maxMonth = now.getMonth(),
minDay = 1, maxDay = 26,
randMonth, randDay, date;
randMonth = Math.floor(Math.random() * (maxMonth - minMonth + 1) + minMonth);
randDay = Math.floor(Math.random() * (maxDay - minDay + 1) + minDay);
date = new Date(2013, randMonth, randDay);
@klarstil
klarstil / dot-animation.js
Created July 10, 2013 10:06
Simple dot animation
;(function($) {
var flashingDots = function(el) {
var dots = el.data('default-value') || el.html(),
i = 0;
if(!el.data('default-value')) {
el.data('default-value', el.html());
}
return {
el: el,
;(function($) {
/**
* Formats a given number (or number as a string)
*
* @param {Number|String} num
* @param {Object} [userOpts] User configuration
* @returns {String|Boolean}
*/
var formatNumber = function(num, userOpts) {
var defaults = {