Skip to content

Instantly share code, notes, and snippets.

View meredevelopment's full-sized avatar

Mere Development meredevelopment

View GitHub Profile
@meredevelopment
meredevelopment / results.twig
Created November 6, 2019 11:45
Using the t() function in Craft 3 CMS to show "# result" or "# results" based on count. Plurals.
{% set searchQuery = craft.app.request.getParam('q') %}
{% set entries = craft.entries()
.search(searchQuery)
.orderBy('score')
.all() %}
{% if entries|length %}
<p>
{{ '{resCount,plural,
one{# result}
@meredevelopment
meredevelopment / .vimrc
Created April 26, 2018 09:14
Simple Vim config for remote servers
set tabstop=4 shiftwidth=4 softtabstop=4 expandtab "set tab, backspace and indent width to 4 spaces.
set shiftround "round-up indents to a multiple of shiftwidth.
set listchars=tab:▸\ ,eol:¬,trail:~,extends:>,precedes:<,nbsp:• "set/add invisibles characters.
set list "make whitespace visible.
set number "add line numbers.
set hlsearch "highlight search terms.
set nowrap "set non-wraping lines.
set backspace=indent,eol,start "allow backspace to pass end of lines etc.
set autoindent "autoindent on LF.
set copyindent "copy previous indentation when autoindenting.
@meredevelopment
meredevelopment / App.vue
Last active March 5, 2018 13:21
Benjamin doesn't understand scope...
<template>
<div id="app">
<ComponentOne/>
</div>
</template>
<script>
import {store} from './store.js'
import ComponentOne from './ComponentOne'
@meredevelopment
meredevelopment / installwp.sh
Last active April 11, 2016 14:42
WP-CLI local dev installer snippet
#!/bin/bash
# Requires WP-CLI. Assumes WP-CLI is in your $PATH.
# Set the default LOC, TITLE, EMAIL, USER & PASSWORD as you like.
# Set the DB user and pass (line 11) to a user that has permissions to create DBs.
# run with ./installwp.sh in most cases.
read -p "Locale? (en_GB): " -e LOC
[ -z "${LOC}" ] && LOC='en_GB'
wp core download --locale=$LOC
@meredevelopment
meredevelopment / OrderAfterDiscountsRates.php
Last active November 26, 2015 23:26 — forked from msigley/OrderAfterDiscountsRates.php
Shopp Shipping Order Rates based on sub total after discounts
<?php
/**
* Order Amount After Discounts Tiers
*
* Provides shipping calculations based on order amount ranges
*
* @author Jonathan Davis, Matthew Sigley, Ben Hutchings
* @version 1.3
* @copyright Ingenesis Limited, 27 April, 2008
* @package shopp

Website Contract [month] [year]

Description of this Contract

This contract is not meant to trick or deceive you; the intention is purely to protect both parties. I have tried to keep the wording as plain as possible, but if anything is unclear, please let me know and I will be more than happy to clarify it with you. Also, until you sign it, please feel free to request to change bits of it to suit your requirements.

In short, [client name] is contracting me, [my name], to [description of my role] between [start date and finish date].

By signing this, you are confirming that you have the power and ability to enter into this contract on behalf of [client's company].

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@meredevelopment
meredevelopment / ShoppParentCatsWidget.php
Created August 28, 2013 07:14
Add this to functions.php in your WordPress Theme for
if ( class_exists('WP_Widget') && ! class_exists('ShoppParentCategoriesWidget') ) {
class ShoppParentCategoriesWidget extends WP_Widget {
function __construct () {
parent::__construct(false,
$name = __('Shopp Parent Categories','Shopp'),
array('description' => __('A list or dropdown of the store\'s parent categories','Shopp'))
);
}

Clearing Checkout Address Fields and Disabling Browser Autocomplete

For Shopp sites that make use of Customer Accounts, a returning customer that logs in will have their shipping and billing address pre-populated when they reach the checkout. For customers who have not purchased before, or for Shopp sites that do not use Customer Accounts, address information can often be inserted automatically by the browser's Form Autocomplete feature. There are occasions when one or both of these 'features' are not desired, for example:

  • The merchant finds that people frequently forget to enter an updated shipping address.
  • A site is used by customers who usually need to enter new shipping address details, for example a head-office ordering items for delivery to area offices.
  • A site is used in an area where multiple customers will be using the same terminal and browser, and autoco

Web Development Contract

Revised date: 15/08/2013

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.