Skip to content

Instantly share code, notes, and snippets.

View quasel's full-sized avatar
🙃
Don't worry be happy!

Bernhard quasel

🙃
Don't worry be happy!
View GitHub Profile
@quasel
quasel / .htaccess
Created January 24, 2017 14:01 — forked from jdevalk/.htaccess
These three files together form an affiliate link redirect script.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule (.*) ./index.php?id=$1 [L]
</IfModule>
@quasel
quasel / gist:bd8fe8e7e903812be3c5155381e332ba
Created November 17, 2016 18:52 — forked from GaryJones/gist:8430080
References for Why Not to Use Singleton Design Pattern
http://www.youtube.com/watch?v=-FRm3VPhseI Google's Clean Code Talks
http://blog.gordon-oheim.biz/2011-01-17-Why-Singletons-have-no-use-in-PHP/
http://sebastian-bergmann.de/archives/882-Testing-Code-That-Uses-Singletons.html
http://eamann.com/tech/making-singletons-safe-in-php/
http://hakre.wordpress.com/2012/06/10/the-missing-patterns-of-the-php-manual/#p2
http://blogs.msdn.com/b/scottdensmore/archive/2004/05/25/140827.aspx
http://www.phptherightway.com/pages/Design-Patterns.html ("You should be wary when using the singleton pattern, as by its very nature it introduces global state into your application, reducing testability.")
http://www.practicaldesignpatternsinphp.com/ ("The Singleton Pattern is perhaps the most well known - and most often misused - pattern in all of PHP design pattern development. Its simplicity, combined with its seeming benefits makes it a widely-used (and overused) pattern. The Singleton is not so much a recommended pattern, as a pattern I recommend you shy away from.")
http://www.sli
@quasel
quasel / CPT-Admin-Fields.php
Created October 25, 2016 22:00 — forked from jamesgol/CPT-Admin-Fields.php
Pods CPT Admin Fields
<?php
/**
* Name: CPT Admin Fields
*
* Description: Allow adding fields to the CPT editor table.
*
* Version: 2.3
*
* Category: Advanced
*
@quasel
quasel / style.css
Last active October 1, 2016 11:54 — forked from grantambrose/style.css
Grid layout for the Beaver Builder theme blog in one easy step
@media only screen and (min-width: 992px) {
/* BLOG LAYOUT TO CONVERT IT TO A GRID with 2 blog posts across the row */
.fl-archive .fl-post{width:48%;float:left;margin-left:4%;}
.fl-archive .fl-post:nth-child(odd){margin-left:0;clear:both;}
}
@media only screen and (min-width: 1200px) {
@quasel
quasel / gist:ef385b8349d482cf9f035ff7de9b9d87
Created September 29, 2016 21:22 — forked from MrDys/gist:3512455
Link directly to an open modal window in Bootstrap
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
Make sure your modal has an id:
<div class="modal" id="myModal" ... >
Then stick this bit of Javascript at at the end of your document:
*/
$(document).ready(function() {
@quasel
quasel / Beaver Builder Theme Hooks Map Functions
Created September 20, 2016 14:03 — forked from cobaltapps/Beaver Builder Theme Hooks Map Functions
Paste the following into your Beaver Builder Child Theme's functions.php file to enable an action hooks map on the front-end of your site, visible only to logged in admins.
// Display BB action hooks on front-end of site (visible to logged in admins only)
function bb_theme_hooks_map() {
if ( ! current_user_can( 'administrator' ) )
return;
$hooks = bb_theme_hooks_array();
foreach ( $hooks as $hook => $value ) {
@quasel
quasel / Beaver Builder Theme Page HTML
Created September 20, 2016 14:02 — forked from cobaltapps/Beaver Builder Theme Page HTML
A stripped down mock-up of what a standard page's HTML looks like when the Beaver Builder Theme is active.
<body class="page page-id-623 page-template page-template-my-templates page-template-testing-template page-template-my-templatestesting-template-php logged-in admin-bar no-customize-support fl-preset-default fl-full-width" itemscope="itemscope" itemtype="http://schema.org/WebPage">
<div class="fl-page">
<header class="fl-page-header fl-page-header-fixed fl-page-nav-right">
<div class="fl-page-header-wrap">
<div class="fl-page-header-container container">
@quasel
quasel / functions.php
Created August 21, 2016 17:40 — forked from cliffordp/functions.php
How to remove (dequeue) The Events Calendar's and PRO's styles.
<?php
// If you use this snippet as-is, ALL of The Events Calendar (i.e. "Core") and Pro add-on styles will NOT be loaded.
// (although there may be some $handles that I didn't detect... especially from widgets, shortcodes, and the like... no guarantess ;-)
// Comment out the line of each style you DO want to load.
// Note the comments within each array regarding the Display style options -- https://theeventscalendar.com/knowledgebase/wp-admin-settings-overview/#display
// The Display styles are "stacked".
// In other words, the Skeleton files are always loaded, and the Full styles are loaded when Tribe Events Styles (i.e. Theme) is selected.
// However, the commented .css example file names can change, e.g. 'full.min.css' instead of 'skeleton.min.css' or 'theme-mobile.min.css' instead of 'full-mobile.min.css'
//
@quasel
quasel / add-to-cart.php
Created July 31, 2016 16:36 — forked from lukecav/add-to-cart.php
Display Product Variations in the Shop Loop
<?php
/**
* Loop Add to Cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/loop/add-to-cart.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@quasel
quasel / font-awesome.php
Created July 29, 2016 16:15 — forked from justintadlock/font-awesome.php
PHP array of Font Awesome icons.
<?php
// Font Awesome v. 4.6.
function jt_get_font_icons() {
return array(
'fa-glass' => 'f000',
'fa-music' => 'f001',
'fa-search' => 'f002',
'fa-envelope-o' => 'f003',