Skip to content

Instantly share code, notes, and snippets.

@hpohlmeyer
hpohlmeyer / .gitconfig
Last active March 29, 2018 18:04
dotfiles
[user]
name = Henning Pohlmeyer
email = [email protected]
[alias]
# Basics
co = checkout
ci = commit
cm = commit -m
st = status
br = branch
@hpohlmeyer
hpohlmeyer / line-interpolation.js
Created December 11, 2017 12:55
Get a point on a line, defined by two other points
// Line Interpolation
function createLineInterpolationFunction(p1, p2) {
const slope = (p2.y - p1.y) / (p2.x - p1.x);
const yIntercept = p1.y - (slope * p1.x);
return (x) => slope * x + yIntercept;
}
// Example
const getY = createLineInterpolationFunction({ x: 200, y: 20}, { x: 1440, y: 60 });
const point = { x: 100, y: getY(100) };
@hpohlmeyer
hpohlmeyer / hide-domain.md
Last active July 16, 2017 13:08
Prevent a domain from being indexed and listed on by search engines

Hide domain from search engines

Preventing the url from being indexed through the robots.txt is not enough. It may still be listed by search engines, unless you add the right header to you file, in the .htaccess.

Both files have to be put into the root directory of your domain.


@hpohlmeyer
hpohlmeyer / calculateIsoGrid.js
Last active May 24, 2017 12:07
2:1 isometric grid calculator
/**
* Calculate a 2:1 iso grid for specific sizes.
*
* @author Henning Pohlmeyer
*
* @param {number} smallestValue The smalles value to use in the grid.
* @return {object} The grid spacing value and rotate and
* shear values for each plane.
*/
function calculateIsoGrid(smallestValue) {
@hpohlmeyer
hpohlmeyer / essential-sketch-plugins.md
Last active August 23, 2017 07:47
Essential Sketch Plugins
@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.
// =============================================================================
ffmpeg -i {{INPUT VIDEO}} -movflags faststart -an -vf scale=976:-2 -pix_fmt yuv420p {{OUTPUT FILE}}
@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);
});
@hpohlmeyer
hpohlmeyer / gist:3bdaeae022f51f179320
Created June 23, 2015 20:56
Unicode Basic Latin + Latin 1 letters regex
[A-Za-zÀ-ÖØ-öø-ÿ]
@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: