Skip to content

Instantly share code, notes, and snippets.

View alvaromartinezmajado's full-sized avatar

Álvaro Martínez Majado alvaromartinezmajado

View GitHub Profile
@nylen
nylen / README.md
Last active December 20, 2021 09:05
Fix MySQL errors with WordPress + DigitalOcean managed MySQL

When running WordPress or ClassicPress using a DigitalOcean managed MySQL database you may experience errors like the following:

Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'dbname.wp_posts.post_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by for query SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/themename/404.php'), the_widget, WP_Widget_Archives->widget, wp_get_archives

>Expression #1 of ORDER BY clause is not in SELECT list, references column 'dbname.wp_posts.post_date' which is not in SELECT list; this is incompatible with DISTINCT fo

#!/bin/bash
# Regolith aka Un-Bedrock
# "But what if we need to hand it off to another agency?" No more!
# This script converts a Bedrock site to a normal WordPress structure.
# Run it from the root of a Bedrock project.
# Created by Nathan Knowler and Daniel Roe
echo "Converting Bedrock to a normal WordPress file structure..."
@oscaralexander
oscaralexander / get.php
Last active March 9, 2017 14:33
Get a value from an associative array or object, or return default.
<?php
/**
* Get a value from an associative array or object, or return default.
*
* @param string $key Dot-separated path to key you wish to extract.
* @param array|object $hash Associative array or object.
* @param mixed $default Value to return if key is non-existent.
* @param bool $is_int Only return key if value is integer.
* @return mixed
@Rich-Harris
Rich-Harris / service-workers.md
Last active July 10, 2024 17:04
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@talaia
talaia / tips-on-add_image_size-cropping.php
Last active March 20, 2016 17:14
Cropping problem with add_image_size
<?php
/*
We found a lot of problems when trying to crop images through the Wordpress' add_image_size function.
Finally, we found out that the stupidest solution was the good for us: we just deleted a dash
from the string at the first parameter. We had 'foto-portada' witch didn't work, and now, 'fotoportada', wokring well.
It's kinda weird.
@pgooch
pgooch / plugin-settings.html
Created October 20, 2012 21:33
Use the default wordpress media uploader into your plugin.
<!-- This is just the code for the button and hidden input -->
<input id="backdrop_upload_button" value="Upload/Select Image" type="button" class="button" />
<input type="hidden" name="the_image" id="the_image" value="<?= $settings['the_image'] ?>" />
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@Rarst
Rarst / r-debug.php
Last active February 3, 2024 17:30
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/