Skip to content

Instantly share code, notes, and snippets.

View hieblmedia's full-sized avatar

Reinhard Hiebl // OverTheClock hieblmedia

View GitHub Profile
@hieblmedia
hieblmedia / .htaccess
Last active June 8, 2021 09:00
no-index header (X-Robots-Tag) + robots.txt for Develop/Testing/Stating subdomains
# Set X-Robots-Tag
<If "%{HTTP_HOST} =~ /^(develop|dev|test|testing|stage|staging)\./">
Header set X-Robots-Tag "noindex, nofollow"
</If>
<IfModule mod_rewrite.c>
# Enable URL rewriting
RewriteEngine On
# ....
@hieblmedia
hieblmedia / matchBreakpoint.js
Created May 7, 2020 17:05
Javascript to check (Bootstrap 4) breakpoints based on CSS variables
function matchBreakpoint(breakpoint) {
var value = window.getComputedStyle(document.documentElement).getPropertyValue('--breakpoint-' + breakpoint);
return window.matchMedia("(min-width: " + value + ")").matches;
}
// Example:
// matchBreakpoint('md') ? 'its md' : 'meh';
// You can also use this if you provide CSS variables with --breakpoint-[breakpoint] in your custom CSS or on other frameworks.
// It's simple to adapt.
@hieblmedia
hieblmedia / ffmpeg-minimalist-build-nvenc-static.md
Created January 18, 2017 01:03
This gist will show you how to build a minimalist, statically-linked ffmpeg binary under the ~/bin subdirectory on your home on Ubuntu 16.04LTS.

Minimalist static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Original guide with a standard build is here.

With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.

First, prepare for the build and create the work space directory:

cd ~/

@hieblmedia
hieblmedia / php.bat
Created December 4, 2015 23:25
Dynamic PHP executabe for wampserver depend on current enabled version. [tested on Windows10 with Wampserver3_x86]
@REM This file detects the current enabled PHP version of wampserver (http://www.wampserver.com/) and executes the enabled php.exe and all parameters are passed
@REM Copy this file to WAMPSERVERPATH\bin\php
@REM Now you can add WAMPSERVERPATH\bin\php to your Windows Environment-Variable "PATH". Now you can use "php" global. For example "php -v".
@REM You can show the current PHP version with "php -v"
@setlocal enableextensions enabledelayedexpansion
@echo off
set serverPath="%~dp0\..\.."
set file="!serverPath!\wampmanager.conf"
@hieblmedia
hieblmedia / gist:29c93d3b45e4da97147c
Created February 20, 2015 15:37
Detect Adblock using user and log in Analytics
// Found here: http://www.labnol.org/internet/adblock-with-google-analytics/28819/
window.onload = function() {
// Delay to allow the async Google Ads to load
setTimeout(function() {
// Get the first AdSense ad unit on the page
var ad = document.querySelector("ins.adsbygoogle");
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {
@hieblmedia
hieblmedia / .gitignore
Last active September 11, 2024 13:03
Gitignore - Exclude all except specific subdirectory
#
# If all files excluded and you will include only specific sub-directories
# the parent path must matched before.
#
/**
!/.gitignore
###############################
# Un-ignore the affected subdirectory
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
@hieblmedia
hieblmedia / prototype.bind.polyfill.js
Created January 23, 2014 11:48
Function.prototype.bind Polyfill (Performace optimized: http://grab.by/2ANj)
/**
* Polyfill for Function.prototype.bind
* (bind)[https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind]
* (You don't need to use $.proxy)[http://www.aaron-powell.com/javascript/you-dont-need-jquery-proxy]
* Credits: taken from bind_even_never in this discussion: https://prototype.lighthouseapp.com/projects/8886/tickets/215-optimize-bind-bindaseventlistener#ticket-215-9
*/
if (typeof Function.prototype.bind !== "function") {
Function.prototype.bind = function(context) {
var fn = this, args = Array.prototype.slice.call(arguments, 1);
return function(){