Skip to content

Instantly share code, notes, and snippets.

Stefan Lange Stoffo

  • @frnde GmbH
  • Hamburg, Germany
Block or report user

Report or block Stoffo

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
Stoffo /
Last active May 8, 2019
Checks The GitHub API for Pull Requests to Review and changes the color of Anybar
#!/usr/bin/env bash
change_anybar_color () {
echo -n $1 | nc -4u -w0 localhost 1738

Keybase proof

I hereby claim:

  • I am stoffo on github.
  • I am stoffo ( on keybase.
  • I have a public key ASCC5nWvlLdxecypFg5Romc7u2GSeEu7bZzCVk4iCF-5Gwo

To claim this, I am signing this object:

Stoffo / TypeHintingArrayOfObjects.php
Last active Oct 12, 2016
PHPDoc type hinting for array of objects
View TypeHintingArrayOfObjects.php
interface CheckInterface
public function check();
* @var $foo CheckInterfaceInterface[]
Stoffo / palindrome.js
Last active Dec 10, 2015
Checks if String is a palindrome.
View palindrome.js
function palindrome(str) {
// Convert to lower case and replace everything what's not a letter or a number.
var x = str.toLowerCase().replace(/[^a-z0-9]/g, '');
//convert string to array, turn it around and put it back together an match it against filtered string:
return x.split('').reverse().join('') === x;
Stoffo / EcmaScript6_Examples.js
Created Dec 7, 2015
A few simple Examples in EcmaScript6 to play around with.
View EcmaScript6_Examples.js
const PI = 3.1415926535;
function foo(a = 123, b = '') {
return PI
function bar(a, b, c, ...x) {
return x.length;
View Detect visibility change of Browser Window in JavaScript
var defaultTitle = document.title;
// subscribe to visibility change events
document.addEventListener('visibilitychange', function () {
// fires when user switches tabs, apps, goes to homescreen, etc.
if (document.visibilityState === 'hidden') {
document.title = 'Baby, Come Back!'
// fires when app transitions from prerender, user returns to the app / tab.
if (document.visibilityState === 'visible') {
Stoffo / counter_increment.html
Created Nov 23, 2015
A simple example how CSS Counters work
View counter_increment.html
ul {
counter-reset: foo;
li:before {
counter-increment: foo;
content: 'Count: ' counter(foo);
Stoffo / detect_arrow_keys.js
Last active Oct 29, 2015
simple event handler to map keycodes of arrow keys to functions.
View detect_arrow_keys.js
$(window).on('keyup', function (e) {
switch (e.keyCode) {
case 37:
case 39:
Stoffo / remove_documents_mongodb.js
Created Oct 29, 2015
Remove Documents older than x days in MongoDB
View remove_documents_mongodb.js
var date = new Date();
var daysToDeletion = 120;
var deletionDate = new Date(date.setDate(date.getDate() - daysToDeletion));
var db = db.getSiblingDB('db')
printjson(db.messages.find({insertDate : {$lt : deletionDate}}).count());
Stoffo / twig_file_date_extension.php
Last active Oct 30, 2018
Twig Function to get the file mtime in template for HTTP Caching
View twig_file_date_extension.php
$function_filedate = new Twig_SimpleFunction(
* @param $file_path
* This function generates a new file path with the last date of filechange
* to support better better client caching via Expires header:
* i.e:
You can’t perform that action at this time.