Skip to content

Instantly share code, notes, and snippets.

View keithpickett's full-sized avatar

Keith Pickett keithpickett

View GitHub Profile
@Otto42
Otto42 / decode.php
Last active October 31, 2022 04:54
Decode a file with encoded strings
<?php
// Decodes files that have a bunch of strings with things like "\x6d" and "\155" and such in them.
// Meat of the code from https://stackoverflow.com/questions/13774215/convert-hex-code-into-readable-string-in-php
// run me like so on command line:
// php decode.php < encoded.php > output.php
function decode_code($code)
{
return preg_replace_callback('@\\\(x)?([0-9a-f]{2,3})@',
function ($m) {
if ($m[1]) {
@jamescmartinez
jamescmartinez / slack_delete.rb
Last active January 4, 2021 21:28
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@VjWoo
VjWoo / th_shipping_options.php
Created February 23, 2015 14:52
Shipping Options plugin
<?php
/*
Plugin Name: TH Shipping Options
Plugin URI: NA
Description: TH Shipping Options plugin
Version: 1.0.0
Author: Vj
Author URI: www.wooforce.com
*/
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active April 5, 2022 10:30
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@alettieri
alettieri / Vagrantfile
Last active February 3, 2021 19:41
Vagrantfile and LAMP provisioning script. This is a set of scripts composed for a WordPress meetup talk. http://www.meetup.com/wordpress-sf/events/144084162/ The vagrantfile will build a lucid32 machine, then kicks off some provision scripts: provision.sh: Install LAMP stack, Ruby, SASS and Compass. apache.sh Updates the default apache config fi…
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@BFTrick
BFTrick / gettext-filter-multiple.php
Last active March 30, 2023 07:18
Use the gettext WordPress filter to change any translatable string.
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Sale!' :
$translated_text = __( 'Clearance!', 'woocommerce' );
@hansspiess
hansspiess / template-contact.php
Created October 3, 2013 19:42
Wordpress: Simple Contact Form
<?php
/*
Template Name: Kontakt
*/
?>
<?php /* other template code goes here... */ ?>
<?php
@mikejolley
mikejolley / gist:6713608
Last active September 5, 2018 10:59
WooCommerce Shipping Method Skeleton Plugin
<?php
/*
Plugin Name: Your Shipping plugin
Plugin URI: http://woothemes.com/woocommerce
Description: Your shipping method plugin
Version: 1.0.0
Author: WooThemes
Author URI: http://woothemes.com
*/
@pmeissner
pmeissner / layout.jade
Created August 15, 2013 17:04
Wireframe layout template file.
- var site_url = 'https://s3.amazonaws.com/creative_loupe/website/demos/wireframing'
- var site_name = 'Wireframing Inc'
- var layout = ''
- var section = ''
- var sidebar_content = ''
block vars
doctype
//if IE 8
/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .lt-ie9 .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }