Skip to content

Instantly share code, notes, and snippets.

@hpohlmeyer
hpohlmeyer / debug-function.php
Created December 31, 2014 15:22
My PHP debug function.
<?php
/**
* Debug function
*
* @param mixed $data The data, that should be debugged.
* @param bool $dump (default: false) Show var_dump output.
* @param bool $console (default: false) Print debug message to the console.
* @return void
*/
function debug($data, $dump = false, $console = false) {
@hpohlmeyer
hpohlmeyer / loop-operators.js
Created January 2, 2015 17:17
loop operator tests
/*
* i--
* Range: 9…0
* After Loop: -1
* Decrementation: After while condition check; before loop body.
*/
var i = 10;
while (i--) {…}
/*
@hpohlmeyer
hpohlmeyer / gist:fde8742dfc8c07f6a463
Last active August 29, 2015 14:13
A use case for Sass variable name interpolation
// I am using flat variables, following the SUIT naming convention. Every
// variable should be available in the global space for reference of single
// values, whithout the need to rely on mixins.
//
// I know this can be done with maps and mixins, but that would require to
// ignore the variable naming scheme, I use for every other variable in the
// project.
$--bpMobileRangeMax: 334px;
$--bpMobileRangeMin: null;
@hpohlmeyer
hpohlmeyer / _breakpoint-mixin.scss
Last active August 29, 2015 14:14
Breakpoint Mixin
/// Breakpoint Mixin
///
/// @author Henning Pohlmeyer
///
/// @content
///
/// @param {Number} $min - The minimum breakpoint range
/// @param {Number} $max [null] - The maximum breakpoint range
/// @param {Number} $ppi [null] - Exclude screens below a screen density of $ppi
/// @param {String} $type [screen] - Add a media type other than screen (e.g. print)
@hpohlmeyer
hpohlmeyer / encoded-code-search.sh
Created February 28, 2015 11:39
Search for encoded code
# Hackers often base64 encode malicious code to make it
# harder to find. Try these commands on your sites root folder
# to find base64 occurences. Look out for large code blocks
# in the output and check the code.
# You can search in php files only, but if the site is not too
# huge, I would recommend to search through all your files.
# 1. option
# Use this option for Linux based systems, where grep -r is
# available. The use command are:
@hpohlmeyer
hpohlmeyer / gist:3bdaeae022f51f179320
Created June 23, 2015 20:56
Unicode Basic Latin + Latin 1 letters regex
[A-Za-zÀ-ÖØ-öø-ÿ]
@hpohlmeyer
hpohlmeyer / key-navigation-debug.js
Created July 7, 2015 16:19
Function to debug keyboard navigation
document.addEventListener('keyup', function () {
console.log(document.activeElement);
});
ffmpeg -i {{INPUT VIDEO}} -movflags faststart -an -vf scale=976:-2 -pix_fmt yuv420p {{OUTPUT FILE}}
@hpohlmeyer
hpohlmeyer / point-helper.js
Created March 6, 2017 21:03
Point calculation helper functions
// =============================================================================
// POINT CALCULATION HELPER FUNCTIONS
//
// This is a collection of various mathematical helper functions, for manipula-
// ting points and measuring angles and distances.
//
// Inside a function, no other function form the list is used, to ensure you can
// use the indipendently.
// =============================================================================