Skip to content

Instantly share code, notes, and snippets.

View stephenfeather's full-sized avatar

Stephen Feather stephenfeather

View GitHub Profile
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active April 28, 2026 15:21
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
// there are many json-schema validators available, I prefer ajv
let Ajv = require('ajv')
let ajv = Ajv({ allErrors:true })
let swagger = require('./docs/my-swagger-definition')
// validation middleware
let validateSchema = (parameters) => {
return (req, res, next) => {
let errors = []
parameters.map(param => {
@joepie91
joepie91 / promises-faq.md
Last active June 25, 2023 09:02
The Promises FAQ - addressing the most common questions and misconceptions about Promises.
@Phoenix2k
Phoenix2k / distance_between.js
Last active February 27, 2023 19:07
JavaScript: Distance between two coordinates
/**
* Distance between two coordinates
*
* @author Salvador Dali
*
* @param { number } lat_1 - Latitude of first point
* @param { number } lon_1 - Longitude of first point
* @param { number } lat_2 - Latitude of second point
* @param { number } lon_2 - Longitude of second point
*
@tankbar
tankbar / functions.php
Created March 30, 2017 12:58
Add PDF to WooCommerce Order Email
<?php
add_filter( 'woocommerce_email_attachments', 'attach_terms_conditions_pdf_to_email', 10, 3);
function attach_terms_conditions_pdf_to_email ( $attachments , $id, $object ) {
$your_pdf_path = get_template_directory() . '/terms.pdf';
$attachments[] = $your_pdf_path;
return $attachments;
}
@jessedobbelaere
jessedobbelaere / userstyle.css
Last active June 1, 2017 19:14
Flowdock Classic (<May 2017) theme
/**
* On 2017-05-30, Flowdock did some UI changes. This is an attempt to ease the pain.
* Save this file as userstyle.css and put it inside ~/Library/Application Support/Flowdock/, then hit CMD+R to reload Flowdock.
*
* https://gist.github.com/jessedobbelaere/95c02699b2e0acd35762d204797b74f9
* @author Jesse Dobbelaere (@JesseDobbelaere)
*/
/* Improve the font */
body {
@tankbar
tankbar / wc-add-images-order-email-table.php
Created September 29, 2017 12:20 — forked from bekarice/wc-add-images-order-email-table.php
Add images to WooCommerce emails
// Edit order items table template defaults
function sww_add_wc_order_email_images( $table, $order ) {
ob_start();
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
wc_get_template( $template, array(
'order' => $order,
'items' => $order->get_items(),
'show_download_links' => $show_download_links,
@ajself
ajself / rotatable.swift
Last active May 27, 2024 12:11
Rotate UIViewControllers that conform to a protocol
/*
This is an update to an example found on http://www.jairobjunior.com/blog/2016/03/05/how-to-rotate-only-one-view-controller-to-landscape-in-ios-slash-swift/
The code there works, with some updating to the latest Swift, but the pattern isn't very Swifty. The following is what I found to be more helpful.
*/
/*
First, create a protocol that UIViewController's can conform to.
This is in opposition to using `Selector()` and checking for the presence of an empty function.
*/
@robinsloan
robinsloan / shh.rb
Last active August 18, 2023 12:09
Disable RTs from all the people you follow on Twitter.
require "rubygems"
require "twitter"
# get these from apps.twitter.com
CONSUMER_KEY = "foo"
CONSUMER_SECRET = "bar"
OAUTH_TOKEN = "blee"
OAUTH_TOKEN_SECRET = "baz"
TWITTER_USER = "your_username" # needs to be the one associated with keys above
@webseo-onilne
webseo-onilne / flatsome3-custom-post-type-support.php
Last active April 14, 2026 08:33
Integrate custom post types into Flatsome 3 page builder application using a child theme; providing: (1.) Page Builder Editor support for custom post types, and (2.) Integration with page builder post element components.
<?php
/**
* Integrate custom post types into Flatsome 3 page builder application using a child theme.
*
* This will provide:
*
* 1. Page Builder Editor support for custom post types
* 2. Integration with page builder post element components
**/