Skip to content

Instantly share code, notes, and snippets.

@salcode
salcode / composer.json
Created April 22, 2015 18:25
I'd prefer not to define a version (in this case 0.1.1) in the Hash-Link-Scroll-Offset WordPress plugin package, since I always want the latest version from the master branch. Is there a better way to setup this WordPress Plugin that lives on GitHub in my composer.json file?
{
"repositories":[
{
"type":"composer",
"url":"http://wpackagist.org"
},
{
"type": "package",
"package": {
"name": "WebDevStudios/Hash-Link-Scroll-Offset",
How to use
[button link='http://linktosomething.com' color='orange']My Button Text![/button]
@salcode
salcode / .gitignore
Last active February 19, 2025 22:44
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@salcode
salcode / test-add-query-arg-output.php
Created December 9, 2014 03:24
mu-plugin file that replaces the content of a page with an example demonstrating add_query_arg() does not urlencode parameters.
<?php
add_action( 'the_content', 'test_add_query_arg_output' );
function test_add_query_arg_output( $content ) {
return add_query_arg(
array(
'var_key' => 'key_value',
'another_var' => 'My Value'
),
home_url()
@salcode
salcode / instructions-CVE-2014-6271.txt
Created September 24, 2014 20:25
Updating Bash to Address CVE-2014-6271 with yum
# SSH into server
# change to root account using `su` (if you're not already logged in as root)
# Test for vulnerability
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
# If you see this output, you're not vulnerable and logout now
# bash: warning: x: ignoring function definition attempt
# bash: error importing function definition for `x'
# this is a test
@salcode
salcode / error-log.js
Created June 10, 2014 15:15
jQuery error_log() function that creates a div on the page and outputs the contents into it. Useful when troubleshooting IE8 javascript
// BEGIN DEV JS CODE for error_log
jQuery(document).ready( function($) {
$log = $('<div><h3>Log</h3></div>').css({
'position': 'absolute',
'top': 0,
'left': 0,
'width': 300,
'border': '1px solid red',
'background': 'white',

Checklist for Design to Development Handoff

Developer Pre-Design Questions

[ ] Do you have a preferred grid system? || I'd like to use this grid system.
[ ] What fonts do we have available to us? || I'd like to use this font (and include a URL).

Checklist before Handoff to Development

@salcode
salcode / fe-google-sitemap-plugin-https-fix.php
Created April 24, 2014 17:09
Filter to force sitemap.xsl to load via http protocol (rather than https) for http://wordpress.org/plugins/google-sitemap-plugin/
add_filter( 'plugins_url', 'fe_google_sitemap_plugin_https_fix', 10, 3 );
function fe_google_sitemap_plugin_https_fix( $url, $path, $plugin ) {
if ( 'sitemap.xsl' !== $url ) {
return $url;
}
if ( 'https://' === substr( $url, 0, 8 ) ) {
// the url begins with https, which we do NOT want
// change url to start with http instead of https
$url = 'http' . substr( $url, 5 );
@salcode
salcode / centos-patch-heartbleed
Created April 8, 2014 13:29
Patch Heartbleed on Cent OS
# SSH into the server as root
# confirm Linux version CentOS 6.5
cat /etc/*-release
# clear metadata (ensure we get the latest release)
yum clean metadata
# update openssl
yum update openssl
@salcode
salcode / sort.php
Created April 8, 2014 01:12
WordPress Burbs Sort Posts by Custom Meta Value
<?php
// short code to display by meta_key job_title
add_shortcode( 'burbs_sort_test', 'burbs_sort_test' );
function burbs_sort_test() {
global $post;
echo '<pre>';
$atts = array(
'post_type' => 'post',
'order' => 'ASC',