Skip to content

Instantly share code, notes, and snippets.

View ambercouch's full-sized avatar

Richard Arnold ambercouch

View GitHub Profile
@ambercouch
ambercouch / site-lang-selector.html
Created January 9, 2018 12:13
Craft Locale Switcher
<nav class="locale-switch">
<ul class="locale-switch__list">
{% set locales = craft.i18n.getSiteLocales() %}
{% for locale in locales %}
{% set entryURL = craft.config.siteUrl[locale.id] %}
{% if entry is defined %}
{% set entryLocal = craft.entries.id(entry.id).locale(locale.id).first %}
@ambercouch
ambercouch / retina-mq.css
Last active January 16, 2018 07:10
CSS Media queries that detect screen resolution
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
/* Retina-specific stuff here */
}
/* 1.25 dpr */
@media
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi){
@ambercouch
ambercouch / acDefer.js
Last active January 27, 2018 10:35
A javascript function that performs a test until it passes or for a set number of time. Useful for wait for jQuery to load.
function acDefer(successMethod, failMethod, testMethod, pause, attempts) {
var defTest = function () {
return window.jquery;
};
var defFail = function () {
console.log('jQuery not load');
}
var defSuccess = function () {
console.log('jQuery load');
}
@ambercouch
ambercouch / functions.php
Last active June 26, 2022 14:38
Allow access for WordPress editor to the Flamingo CF7 database
<?php
function fl_map_meta_cap($meta_caps){
$meta_caps = array(
'flamingo_edit_contact' => 'delete_pages',
'flamingo_edit_contacts' => 'delete_pages',
'flamingo_delete_contact' => 'delete_pages',
'flamingo_delete_contacts' => 'delete_pages', //May not be a thing???
'flamingo_edit_inbound_message' => 'delete_pages',
'flamingo_edit_inbound_messages' => 'delete_pages',
@ambercouch
ambercouch / contact-form-7-default-form.html
Last active December 31, 2021 18:54
A default contact form for contact form 7
<div class="c-contact-form__content" >
<label class="c-contact-form__label" >
<span class="c-contact-form__label-text" >
Your Name <small>(required)</small>
</span>
<span class="c-contact-form__input-wrapper" >
[text* your-name placeholder "Name"]
</span>
</label>
<label class="c-contact-form__label">
/*
BEM BLOCK .bem-template
*/
.bem-template{
display: block;
}
//BEM BLOCK MODIFIER FALLBACK .bem-template--
@ambercouch
ambercouch / Increase phpMyAdmin upload limit
Last active September 18, 2018 15:08
phpMyAdmin on Scotchbox
vagrant ssh
sudo su
nano /etc/php/7.0/apache2/php.ini
#use the sort cut to find the setting 'memory_limit' and update
[ctrl]+[w]memory_li
memory_limit 1024M
#use the sort cut to find the setting 'post_max_size' and update
[ctrl]+[w]post_max
@ambercouch
ambercouch / functions.php
Last active September 12, 2017 20:17
WP Dequeue Extras
<?php
function wpdocs_dequeue_extras() {
if (current_user_can( 'update_core' )) {
return;
}
wp_deregister_style('dashicons');
wp_deregister_script( 'admin-bar' );
wp_deregister_style( 'admin-bar' );
wp_deregister_script( 'wp-embed' );
@ambercouch
ambercouch / Contract Killer 3.md
Created May 17, 2017 09:00 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@ambercouch
ambercouch / general.php
Last active January 9, 2018 14:50
Craft locales with their own domains, Plus dev domains
<?php
/**
* General Configuration
*
* All of your system's general configuration settings go in here.
* You can see a list of the default settings in craft/app/etc/config/defaults/general.php
*/