Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@garyharan
garyharan / _mixins.scss
Created May 5, 2011 15:46
Useful scss mixins (rounded corners, gradients, text-field, button)
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}
@strangerstudios
strangerstudios / pmpro_international_address_hooks.php
Last active December 28, 2021 04:38
Using Paid Memberships Pro hooks to enable international addresses
<?php
/*
Add this code to your theme's functions.php file to update the checkout page to support international credit cards.
*/
/*
First we need to enable international addresses. We just use the pmpro_international_addresses hook and return true.
This will add a "countries" dropdown to the checkout page.
*/
function my_pmpro_international_addresses()
{
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@tsi
tsi / newsite
Last active May 27, 2018 09:39
Bash script to create virtual hosts and prepare your drupal directory.
#!/bin/bash
# This script creates virtual hosts and prepares your mysql DB and drupal directory.
# you should put it under /usr/local/bin/
# and run it with sudo newsite
# Set the path to your localhost
www=/var/www
echo "Enter directory name under $www"
read sn
@strangerstudios
strangerstudios / gist:3100680
Created July 12, 2012 20:18
Hidden Levels for Paid Memberships Pro
<?php
/*
Plugin Name: PMPro Hidden Levels
Plugin URI: http://www.paidmembershipspro.com/pmpro-hidden-levels/
Description: With this plugin, select levels are removed from the levels page but still available for checkout if you visit the checkout URL directly.
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@jonathantneal
jonathantneal / README.md
Created September 19, 2012 06:34
Polyfill the EventListener interface in IE8

EventListener Polyfill

Is IE8 your new IE6? Level the playing field with polyfills.

This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.

addEventListener

addEventListener registers a single event listener on a single target.

@jareware
jareware / SCSS.md
Last active October 12, 2024 17:11
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@strangerstudios
strangerstudios / pmpro-cancel-on-billing-failure.php
Last active December 3, 2020 14:30
Cancel PMPro subscriptions when a recurring payment fails.
/*
Cancel subscriptions when a recurring payment fails. As of PMPro version 1.5.9.1, failed payments reported via Stripe webhook, PayPal IPN handler, or Authorize.net silent post kick off the pmpro_subscription_payment_failed action.
Also make sure to edit the default billing_failure.html email to mention that users are cancelled upon failure. To do so, copy paid-memberships-pro/email/billing_failure.html into themes/{active theme}/paid-memberships-pro/email/ and edit the text to suit your need.
Note: This cancels on the first failure. To cancel only when cancelling at Stripe, see this gist: https://gist.github.com/strangerstudios/5093710
*/
function my_pmpro_subscription_payment_failed($order)
{
//cancel the membership
@strangerstudios
strangerstudios / pmpro_email_filter_example.php
Last active October 31, 2020 01:22
Edit all PMPro email properties at once via pmpro_email_filter.
/*
Edit email templates.
Other fields to change:
* $email->email
* $email->from
* $email->fromname
* $email->subject
* $email->template
* $email->body
@jonathantneal
jonathantneal / function.php
Last active October 9, 2017 07:26
Render Menu
<?php
/**
* Render_Menu
* -----------------
* Render a menu using simple, semantic HTML
*
* Usage: new Render_Menu(@name)
*
* @name (string) name of the menu ("main-navigation")