Skip to content

Instantly share code, notes, and snippets.

View tobaco's full-sized avatar

Torsten Baldes tobaco

View GitHub Profile
@elidickinson
elidickinson / utmstrip.js
Last active May 24, 2016 08:29 — forked from paulirish/utmstrip.user.js
Strips visible utm_ strings off URLs on your site, but makes sure Google Analytics tracks them first
// utmstrip.js strips utm_* strings from the URL bar of your site, but afer Google Analytics
// has had a chance to grab them. Based on Paul Irish's utm-stripping user script.
//
// Source: https://gist.github.com/elidickinson/9128677
//
// Install Notes:
// - This script should run *after* you have added all your "_trackPageview" or "_trackEvent"
// calls to the _gaq variable.
// - It doesn't matter of Google Analtyics has actually finished loading yet, but if you
// you tell it to strip the utm_* strings before _trackPageview sees them, it won't know
@brandonkelly
brandonkelly / templating.md
Last active March 11, 2025 21:41
Templating in EE vs. Craft
@thelinmichael
thelinmichael / add-album-as-playlist-button
Created July 24, 2013 13:01
Add album as playlist in your library using a customised button.
<html>
<head>
</head>
<body>
<script>
require(['$api/library#Library', '$api/models', '$views/buttons#Button'], function(Library, models, Button) {
// Get album from URI
var album = models.Album.fromURI("spotify:album:077sbxjWiHIO8FsnVO5i8m");
var album2 = models.Album.fromURI("spotify:album:2OMDL0qyQF7nk2tRJE8RmD");
@franz-josef-kaiser
franz-josef-kaiser / wpmail_exceptions.php
Last active May 28, 2024 07:30
WP Mail Error/Exception handling and SMTP settings
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) PHPMailer Exceptions & SMTP
* Description: WordPress by default returns <code>FALSE</code> instead of an <code>Exception</code>. This plugin fixes that.
*/
add_action( 'phpmailer_init', 'WCMphpmailerException' );
function WCMphpmailerException( $phpmailer )
{
@outflux3
outflux3 / search-processor.php
Created June 1, 2013 13:42
search-processor. processwire
<?php
// check if there are GET variables present in the URL
if(count($input->get)) {
$selector = '';
if($input->get->application) {
$application = $sanitizer->pageName($input->get->application);
$appid = $pages->get("template=product-options, name=$application");
@outflux3
outflux3 / search-form.php
Created June 1, 2013 13:40
Processwire sample search form based on skyscrapers search
<form name='search' id='product-search' method='get' action='<?php echo $config->urls->root?>speaker-finder/'>
<ul id="row1">
<li>
<label for='search_app'>Application</label>
<select id='search_app' name='application' onchange="$(this.form).trigger('submit')">
<option value=''>Any</option><?php
// generate the application options, checking the whitelist to see if any are already selected
foreach($pages->get(1016)->children('include=all') as $app) {
$selected = $app->name == $input->whitelist->application ? " selected='selected' " : '';
@gmyx
gmyx / README
Last active October 1, 2018 11:50 — forked from joelambert/README
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@benpsnyder
benpsnyder / ie8-grid-foundation-4.css
Last active December 14, 2015 10:38 — forked from hatefulcrawdad/ie8-grid-foundation-4.css
a .scss version with a 24 col grid
//
// Grid Variables
//
$total-columns: 24 !default;
// Grid Calculation for Percentages
@function gridCalc($colNumber, $totalColumns) {
@return percentage(($colNumber / $totalColumns));
}
@joncave
joncave / endpoints.php
Created June 7, 2012 19:41
WP_Rewrite endpoints demo
<?php
/*
Plugin Name: WP_Rewrite endpoints demo
Description: A plugin giving example usage of the WP_Rewrite endpoint API
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/
Author: Jon Cave
Author URI: http://joncave.co.uk/
*/
function makeplugins_endpoints_add_endpoint() {
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"