Skip to content

Instantly share code, notes, and snippets.

View codearachnid's full-sized avatar
🎯
Focusing

Timothy Wood codearachnid

🎯
Focusing
View GitHub Profile
@oodavid
oodavid / README.md
Last active April 6, 2024 18:45 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@ryanflorence
ryanflorence / static_server.js
Last active March 13, 2024 08:05
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@feedmeastraycat
feedmeastraycat / get_post_id_by_meta_key_and_value.php
Created July 7, 2012 11:32
WordPress: Get post id by meta key and value
<?php
if (!function_exists('get_post_id_by_meta_key_and_value')) {
/**
* Get post id from meta key and value
* @param string $key
* @param mixed $value
* @return int|bool
* @author David M&aring;rtensson <david.martensson@gmail.com>
*/
function get_post_id_by_meta_key_and_value($key, $value) {
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {
@splorp
splorp / comment-blacklist-for-wordpress.md
Last active November 26, 2023 08:47
Comment Blacklist Keywords for WordPress

Comment Blacklist for WordPress

Notice!

As of November 5th, 2013, this version of the blacklist will no longer be updated.

I have migrated the project to a full Git repository in order to better track changes, bugs, and feedback.

Check out Comment Blacklist for WordPress on GitHub.

<?php
// The field accepts a value with this structure
$value = [
'address' => '123 Example St, Townsville XYZ 1234, Country',
'lat' => - 38.1486228,
'lng' => 144.360414,
'zoom' => 14,
'place_id' => 'Ei0xMjMgTW9vcmFib29sIFN0LCBHZWVsb25nIFZJQyAzMjIwLCBBdXN0cmFsaWEiMBIuChQKEgmX0JaIHBTUahFyH_LC9sYD8hB7KhQKEglDz-DYDxTUahECZY8QisCjzg',
'street_number' => 123,
@aaemnnosttv
aaemnnosttv / gravity-forms-select-optgroupify.php
Created October 5, 2018 09:58
GravityForms filter to allow for grouping select choices into labelled groups using special choice options.
<?php
/**
* Filter for GravityForms to group select field choices by a special "optgroup" choice.
*
* Simply add a new choice with a value of 'optgroup' to the dropdown to start a group of options.
* All following choices will be grouped under it using its label for the group.
* Any number of groups can be created, as each optgroup choice will start a new group.
* Supports field placeholder & ungrouped options, but must be before the first group.
*
* This snippet can be added to your theme's functions.php, or a custom plugin.
<?php
/**
* Plugin Name: Deny Giant Image Uploads
* Description: Prevents Uploads of images greater than 3.2MP
* Author: TJNowell
* Author URI: http://tomjn.com
* Plugin URI: http://tomjn.com/164/clients-who-upload-huge-camera-photos-decompression-bombs/
* Version: 1.1
*/
@seemly
seemly / shortcode-extended.php
Last active May 12, 2023 15:02
Enable the use of ACF shortcodes within the native Query Loop gutenberg block.
<?php
/**
* Shortcode Extended
*
* @package ShortcodeExtended
* @author Chris Sparshott
* @copyright 2022 Chris Sparshott
* @license GPL-2.0-or-later
*