Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / SCSS.md
Created October 8, 2017 10:15 — forked from jareware/SCSS.md
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

@ipokkel
ipokkel / _mixins.scss
Created October 8, 2017 22:07 — forked from garyharan/_mixins.scss
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;
}
@ipokkel
ipokkel / Array.prototype.compare.js
Created May 10, 2018 14:42 — forked from ain/Array.prototype.compare.js
JavaScript compare() method for Array
Array.prototype.compare = function(array) {
if (!array) {
return false;
}
if (this.length !== array.length) {
return false;
}
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] instanceof Array && array[i] instanceof Array) {
if (!this[i].compare(array[i])) {
@ipokkel
ipokkel / load-my-script-pmpro.php
Created March 13, 2019 12:53 — forked from andrewlimaza/load-my-script-pmpro.php
Load content on confirmation or checkout page for PMPro.
<?php
/**
* Load content for specific pages, checkout or confirmation page
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function load_my_script_for_pmpro() {
global $pmpro_pages;
if ( is_page( $pmpro_pages['checkout'] ) || is_page( $pmpro_pages['confirmation'] ) ) {
@ipokkel
ipokkel / rh_fields_example.php
Created March 25, 2019 05:53 — forked from andrewlimaza/rh_fields_example.php
Register Helper field type example shows an example of every possible field in Register Helper
<?php
/**
* This example is to show you the 'niche' options each Paid Memberships Pro - Register Helper Add-on field can take and how to use it.
* For more information on the Register Helper Add-on please visit https://www.paidmembershipspro.com/add-ons/free-add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
**/
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
@ipokkel
ipokkel / my_pmprorh_init_with_geopicker.php
Created March 26, 2019 04:06 — forked from strangerstudios/my_pmprorh_init_with_geopicker.php
PMPro Register Helper Example to Embed MyGeoPosition.com GeoPicker
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists("pmprorh_add_registration_field"))
{
return false;
}
//define the fields
$fields = array();
@ipokkel
ipokkel / rh_example_location.php
Created March 26, 2019 20:46 — forked from andrewlimaza/rh_example_location.php
Change location where Register Helpers are shown depending if user is logged in or not for Paid Memberships Pro.
<?php
// Show the custom Register Helper Fields in a different location if the user is logged in.
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
@ipokkel
ipokkel / pmpro-redirect-during-checkout.php
Last active July 5, 2019 11:47 — forked from pbrocks/pmpro-redirect-during-checkout.php
An example of how to use `pmpro_checkout_level` to redirect and interject communication with users during checkout. Sample taken from an attempt to prevent downgrading.
<?php // Do not copy
/**
* pmpro_checkout_level Use `pmpro_checkout_level` to redirect and interject communication with users during checkout.
*
* @param array $levels The array created in admin
*
* @return array Output of the array
*/
function pmpro_redirect_during_checkout( $level ) {
@ipokkel
ipokkel / pmpro-file-upload-avatar-register-helper.php
Last active October 11, 2019 13:36 — forked from LMNTL/pmpro-file-upload-avatar-register-helper.php
Upload avatar image from the checkout using the PMPro Register Helper Add On. No other plugins required.
<?php
/*
* Add WP User Avatar from Register Helper field during checkout.
*/
function my_updated_user_meta( $meta_id, $user_id, $meta_key, $meta_value ) {
// Change user_avatar to your Register Helper file upload name.
if ( 'user_avatar' == $meta_key ) {
$filename = $meta_value['fullpath'];
$filetype = wp_check_filetype( basename( $filename ), null );
@ipokkel
ipokkel / my-pmpro-invoice-address.php
Last active October 18, 2019 08:43 — forked from strangerstudios/my_pmpro_invoice_address.php
Add and translate your business address and VAT number to the Membership Invoice and Membership Confirmation pages.
<?php // Do NOT copy this line
// Add this code below to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
add_action( 'pmpro_invoice_bullets_bottom', 'my_pmpro_invoice_address' );
function my_pmpro_invoice_address() {
?>
<li><strong><?php _e( 'Paid To', 'pmpro-customizations' ); ?>:</strong><br />My Business<br />123 The Street<br />City, XX 12345 USA</li>
<li><strong><?php _e( 'VAT Number', 'pmpro-customizations' ); ?>:</strong> BG999999999</li>
<?php