Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@AdamGerthel
AdamGerthel / ocr.php
Created December 3, 2014 17:21
Generate BankGiro/PlusGiro OCR numbers via PHP
<?php
/**
* OCR Number generation function
*
* @param string $base_number
* The base number that you wish to use for the OCR nr. Can be any number,
* but usually consists of client ID combined with invoice ID or similar.
* @param boolean $length
* Use length if you want the OCR number to add a length
@AdamGerthel
AdamGerthel / jquery.equalRowHeights.js
Created September 22, 2014 11:19
equalRowHeights
/**
* jQuery equalRowHeights plugin.
*
* This is a small plugin that handles equalHeights in a reponsive
* way, meaning that it handles rows as well.
*
* Code from http://codepen.io/micahgodbolt/pen/FgqLc
*
*/
@AdamGerthel
AdamGerthel / apache-https-htaccess-rewrite
Created August 22, 2014 09:56
Move all visitors to HTTPS version of site
# Move all visitors to HTTPS version of site
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@AdamGerthel
AdamGerthel / disable_ajax.js
Created March 11, 2014 08:42
Useful snippet for theming Drupal ajax throbbers. Execute it in the console and it stops all future ajax requests from working. The throbbers will be displayed but never removed.
XMLHttpRequest = function(){};
XMLHttpRequest.prototype = {
open: function(){},
send: function(){}
};
@AdamGerthel
AdamGerthel / localstorage.html
Last active April 15, 2017 21:07
Local Storage example
<!doctype html>
<html>
<head>
<title>Local Storage Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<style>
body {
font-family: arial;
}
@AdamGerthel
AdamGerthel / my-manifest.pp
Last active August 29, 2015 13:56
My personal manifest for OddBoxen
class people::myGitHubUsername {
# Homebrew
package { "couchdb":
ensure => present
}
# NodeJS modules
nodejs::module { 'hoodie-cli':
node_version => 'v0.10'
@AdamGerthel
AdamGerthel / rpaf.ini
Last active December 21, 2015 00:18
Apache mod_rpaf configuration used in combination with Varnish. When using Varnish the $SERVER variable remote_addr is set to the Varnish server IP instead of the client ip (site visitor). If Varnish is configured to send X-Forwarded-For headers containing the client IP, then mod_rpaf can use that information and set remote_addr to the client IP…
<IfModule rpaf_module>
RPAFenable On
# When enabled, take the incoming X-Host header and
# update the virtualhost settings accordingly:
RPAFsethostname On
# Define which IP's are your frontend proxies that sends
# the correct X-Forwarded-For headers:
RPAFproxy_ips 123.123.123.123 10.0.0.2 127.0.0.1