Skip to content

Instantly share code, notes, and snippets.

Joshua Canfield jcanfield

Block or report user

Report or block jcanfield

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jcanfield
jcanfield / wp-modifydb.php
Created Mar 29, 2012
Serialized PHP Search and Replace
View wp-modifydb.php
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
View gist:dbea452188b9f93419ff352117972791
195.114.173.153 # ns1.internetia.pl - Netia
195.116.55.69 # ns2.internetia.pl - Netia
8.8.8.8 # google-public-dns-a.google.com - Google
8.8.4.4 # google-public-dns-b.google.com - Google
208.67.222.222 # resolver1.opendns.com - OpenDNS
208.67.220.220 # resolver2.opendns.com - OpenDNS
208.67.222.220 # resolver3.opendns.com - OpenDNS
208.67.220.222 # resolver4.opendns.com - OpenDNS
149.156.1.3 # nms.cyf-kr.edu.pl
149.156.4.11 # info.cyf-kr.edu.pl
@jcanfield
jcanfield / index.html
Created Jul 28, 2012
DublinCore, Facebook Meta Tag and Geolocation Meta Tags (HTML5)
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lonely Women Cooks For Nobody</title>
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/">
<meta name="DC.title" content="Lonely Women Cooks For Nobody<">
<meta name="DC.creator" content="William Clinton (http://www.man-has-his-needs.com/">
<meta name="DC.subject" content="Politics">
@jcanfield
jcanfield / gistrepo-shorten.sh
Created Sep 29, 2012
Git.io Generator (Bash Script)
View gistrepo-shorten.sh
#!/bin/bash
##
## Usage: gist-shorten.sh gistID urlshortenedname
echo "--> Creating git.io address for your Gist..."
curl -i http://git.io -F "url=https://gist.github.com/$1" \
-F "code=$2"
echo "--> Created http://git.io/$2 ..."
@jcanfield
jcanfield / sources.list
Created Apr 27, 2017
Ubuntu 16.10 Sources for APT
View sources.list
# Ubuntu Sources List Generator
>>> NEWS: Now available on SSL
>>> Replace your /etc/apt/sources.list with the following one. For adding GPG keys of new repos, see instruction (if available) in the sources.list below itself.
## curl https://repogen.simplylinux.ch/txt/yakkety/sources_dccbf34a40895c1d9b7a7e7d24ee21dbbbccc385.txt | sudo tee /etc/apt/sources.list
#------------------------------------------------------------------------------#
# OFFICIAL UBUNTU REPOS #
@jcanfield
jcanfield / msie-vmwarefusion-osx.bash
Created Apr 3, 2013
Download the latest VMWare Fusion images from Modern.IE for Internet Explorer Testing. This bash script is primitive and simple. Anybody who would like to expand on this is more than welcome to.
View msie-vmwarefusion-osx.bash
#!/bin/bash
# Download all VMWare Fusion machines from Modern.IE Website to test your Website/Web Application in Microsoft Internet Explorer on Mac OSX. All VM's and other VM's for Windows and Linux and other Virtual Manager's such as VirtualBox can be found at http://modern.ie/
# Don't have cURL or want to learn more, visit http://curl.haxx.se/.. are you really a Developer? First part of that sentence comes from the MS site.
read -p "--> Downloading Internet Explorer 6-10 on Windows XP/7/8 Appliances for VMWare Fusion. Large downloads ahead. (Press Enter to continue)."
echo "--> Download Internet Explorer 6 on Microsoft Windows XP Appliance for VMWare Fusion."
curl --progress-bar -O "http://virtualization.modern.ie/vhd/IEKitV1_Final/VMWare_Fusion/IE6_XP/IE6.XP.For.MacVMware.sfx"
echo "--> Download Internet Explorer 8 on Microsoft Windows XP Appliance for VMWare Fusion."
@jcanfield
jcanfield / webhook-mailer.php
Created Jun 3, 2012 — forked from boucher/webhook-mailer.php
Stripe Webhook PHP Example
View webhook-mailer.php
<?php
// SETUP:
// 1. Customize all the settings (stripe api key, email settings, email text)
// 2. Put this code somewhere where it's accessible by a URL on your server.
// 3. Add the URL of that location to the settings at https://manage.stripe.com/#account/webhooks
// 4. Have fun!
// set your secret key: remember to change this to your live secret key in production
// see your keys here https://manage.stripe.com/account
@jcanfield
jcanfield / cache.htaccess
Created Aug 10, 2012 — forked from kurtpayne/cache.htaccess
.htaccess caching rules
View cache.htaccess
<IfModule mod_mime.c>
# Text
AddType text/css .css
AddType application/x-javascript .js
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType text/plain .txt
AddType text/xml .xml
@jcanfield
jcanfield / gist:4522839
Created Jan 13, 2013
htaccess Configuration for Wordpress (Developed for a client project and utilizes Caching, Correct Timezones, ETAG Configuration, Compression and Basic Rewrites.
View gist:4522839
# .htaccess for some-website.com
# By Joshua Canfield (Code Clarity)
# Features include Page Caching by FilesMatch, mod_expires & mod_header. Also uses old website 301 Redirections
# Sets Timezone to Mountain
SetEnv TZ America/Denver
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
@jcanfield
jcanfield / 404.html
Created Oct 11, 2012
404 Not Found Template (via SusyBird.net and Modified)
View 404.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Error</title>
<style>
::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
::selection { background: #fe57a1; color: #fff; text-shadow: none; }
html { padding: 30px 10px; font-size: 20px; line-height: 1.4; color: #737373; background: #f0f0f0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
html, input { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
You can’t perform that action at this time.