Skip to content

Instantly share code, notes, and snippets.

View eduwass's full-sized avatar
:octocat:
working remotely

Edu Wass eduwass

:octocat:
working remotely
View GitHub Profile
@eduwass
eduwass / functions.php
Last active January 11, 2018 03:14
Lower password strength requirements in WooCommerce
<?php
// Allow Weaker passwords
add_filter( 'woocommerce_min_password_strength', 'uh_oh_weakpasswords' );
function uh_oh_weakpasswords() {
return 1;
}
@eduwass
eduwass / functions.php
Created January 17, 2017 17:18
WooCommerce Product Bundles - Check if cart contains a Product Bundle Container
<?php
/**
* Checks if the cart contains a product bundle
* @return [bool]
*/
function cart_contains_product_bundle(){
global $woocommerce;
$contains_product_bundle = false;
if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
// if cart has items
@eduwass
eduwass / commands.md
Last active December 21, 2016 13:50
Docker cheatsheet

Stop / remove all Docker containers

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Remove dangling Docker images

docker rmi $(docker images -q -f dangling=true)
@eduwass
eduwass / _grid.scss
Created June 22, 2016 13:47
Skeleton Custom Grid (SASS)
/*
* Skeleton V2.0.4 (Customised Grid Only)
* Sass Version by Seth Coelen https://github.com/whatsnewsaes
*
* Customised by Edu Wass
* Includes:
* - breakpoint variables
* - offset classes
* - push/pull classes
* - visibilty classes
@eduwass
eduwass / functions.php
Created May 3, 2016 19:18
Hide WooCommerce subscriptions text (in product and cart pages) from products with a set Price but no Subscription Fee
// Define which products we should hide the subscription text for
function should_hide_subscription_text($product){
$is_subscription = (get_class($product) == 'WC_Product_Variable_Subscription');
$has_price = (intval($product->subscription_price)>0);
$has_fee = (intval($product->subscription_sign_up_fee)>0);
if($is_subscription && $has_price && !$has_fee){
return true;
} else {
return false;
}
@eduwass
eduwass / 0. Custom Date Formats in Rails.md
Last active February 12, 2025 06:25
Custom Date Formats in Rails

Custom Date Formats in Rails

Quick guide on printing pretty dates in Rails

@eduwass
eduwass / gulpfile.js
Created November 23, 2015 10:04
Gulp task to SSH into production server and retrieve mysqldump
////////////////////////////////////////////////////////////////////
// Run: 'gulp download-db' to get latest SQL dump from production //
// File will be put under the 'dumps' folder //
////////////////////////////////////////////////////////////////////
// Load stuff
'use strict'
var gulp = require('gulp')
var GulpSSH = require('gulp-ssh')
var fs = require('fs');
@eduwass
eduwass / setup.sh
Last active January 3, 2020 18:27
Flynn Install : Single node ( for Ubuntu 14.04 x64 @ DigitalOcean droplet )
#!/bin/bash
# This script will automatically set up a single node Flynn Cluster on your linux box
# Fresh Flynn install with domain provided by the xip.io service
# Tested with Base Image: Ubuntu 14.04 x64 @ DigitalOcean droplet
# @date 16 Nov 2015
# @author Edu Wass (eduwass at gmail com)
echo '---- START SETUP ----'
@eduwass
eduwass / functions.php
Created September 18, 2015 13:54
ACF Post Object field and WPML (show posts of both languages => disabling filtering)
<?php
/* Customize the ACF Post Object queries, so they return posts in both languages */
function customize_acf_query( $args, $field, $post )
{
if($field['type']=='post_object'){
$args['orderby'] = 'title';
$args['suppress_filters'] = true; // Suppress filters so WPML doesn't filter to only 1 lang
return $args;
}
@eduwass
eduwass / aux-functions.php
Created September 16, 2015 09:35
Programmatically copy over the content of another post in Wordpress
<?php
/**
* Duplicates a post & its meta into another
* @param [int] $post_id The Post you want to clone
* @param [int] $destination_id The Post where you want to copy to
*/
function copy_post($post_id, $destination_id) {
$title = get_the_title($post_id);
$oldpost = get_post($post_id);