Skip to content

Instantly share code, notes, and snippets.

somone said this would be easy. someone LIED.

Norcross norcross

somone said this would be easy. someone LIED.
View GitHub Profile
pento / php-block.js
Last active Mar 23, 2021
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
View php-block.js
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
* Here's where we register the block in JavaScript.
westonruter /
Last active Apr 2, 2019
vvv-ssh: Seamlessly and quickly connect to VVV over SSH
$( dirname $0 )/vvv-ssh $( basename $0 ) $@
ramiabraham / gravatar.php
Last active Feb 2, 2016
Get gravatar img src in non-WP context
View gravatar.php
function gravatar_img_src() {
$emails = array();
# Gravatar is all about dem jpg's
$file_extension = '.jpg';
# add a size via query here, eg 250, 400
$file_size = '?size=250px';
View svg-utils.php
function iti_get_svg_markup( $svg_id = 0 ) {
// get the file name of the svg
$svg_id = absint( $svg_id );
$svg_file = get_post_meta( $svg_id, '_wp_attached_file', true );
// locate the file on disk
$upload_dir = wp_upload_dir();
$upload_basedir = trailingslashit( $upload_dir['basedir'] );
johnbillion /
Last active Apr 21, 2021
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here:

kevinelliott /
Last active Oct 22, 2020
Mac OS X 10.11 El Capitan Setup

Mac OS X 10.11 El Capitan

Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist Note that I expect this to change significantly as I install El Capitan several times.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

jjeaton / .gitignore
Created Aug 5, 2015
WordPress root .gitignore. Ignore everything and then opt-in (exclude from the ignore) for your custom code.
View .gitignore
# This is a template .gitignore file for git-managed WordPress projects.
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
# See the comments below for more info on how to add exceptions for your
ericandrewlewis / gist:95239573dc97c0e86714
Last active Mar 12, 2021
Setting up a WordPress site on AWS
View gist:95239573dc97c0e86714

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

dannyb195 / gist:2c74017c52ef7d625c35
Created May 28, 2015
Inserting content after WP in-content paragraph (not really tested)
View gist:2c74017c52ef7d625c35
$content = get_post( 1558 );
$content = $content->post_content;
$content_array = explode( "\n", $content );
echo 'before<pre>';
echo '</pre>';
foreach ( $content_array as $k => $v ) {
jtsternberg / ajax-endpoint.js
Last active Feb 1, 2021
Proof of concept for avoiding admin-ajax for ajax callback requests. Also see Thomas Griffin's excellent post: AND Josh Pollock's excellent post:
View ajax-endpoint.js
$('body').on( 'click', '.some-button', function(){
$.ajax( ajax_endpoint_data.api_url, {
type : 'POST',
dataType : 'json',
data : {
action: 'ajax_action',
some_data: 'some_value'