Skip to content

Instantly share code, notes, and snippets.

View paulund's full-sized avatar

Paulund paulund

View GitHub Profile
@paulund
paulund / wordpress-base-custom-data.php
Created September 24, 2013 16:27
A PHP class to handle CRUD functionality in WordPress default tables.
<?php
/**
* Abstract class which has helper functions to get data from the database
*/
abstract class Base_Custom_Data
{
/**
* The current table name
*
* @var boolean
/**
* Continents and Countries MySQL Tables compiled from Wikipedia, Braintree Payments documentation
* and a couple other places I don't recall at the moment. This data is compatible with the Braintree
* Payment API as of Dec 2011
*
* Compiled by Steve Kamerman, 2011
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
@paulund
paulund / sublime-key-binding.txt
Created August 13, 2013 08:38
Sublime settings
[
{ "keys": ["f12"], "command": "goto_definition" },
]
@paulund
paulund / get-view.php
Created August 5, 2013 13:22
Assign variables that can be used inside a view and store the view with populated variable.
<?php
/**
* Get the view file
*
* @param [type] $view [description]
* @param [type] $vars [description]
* @return [type] [description]
*/
public function getView($viewFile, $vars)
{
@paulund
paulund / jquery-password-strength-form.html
Last active December 25, 2015 20:18
jQuery snippet to judge the strength of a password. View the demo of this code snippet http://www.paulund.co.uk/password-strength-indicator-jquery
<form action="" method="post">
<p><label for="passwordInput">Password: <input type="password" id="passwordInput" name="passwordInput"></label></p>
<p><label for="confirmPasswordInput">Confirm Password: <input type="password" id="confirmPasswordInput" name="confirmPasswordInput"></label></p>
<p><div class="" id="passwordStrength"></div></p>
<p><input type="submit" value="Change Password" class="btn"></p>
</form>
@paulund
paulund / basic-html-emmet-output.html
Created July 18, 2013 19:54
Example of using Emmet to create a basic HTML page.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div id="wrapper">
<div id="header">
<div class="logo"></div>
@paulund
paulund / html-email-boilerplate.html
Created July 4, 2013 13:49
A boilerplate when working with HTML emails.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><?php echo $subject; ?></title>
<style type="text/css">
#outlook a {padding:0;}
body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
.ExternalClass {width:100%;}
@paulund
paulund / export-mysql.sql
Created July 3, 2013 12:50
Make database import and export to remote server over SSH. When importing the file make sure it is on a location on the server. When exporting the file make sure you place it in the correct location.
mysqldump -p -u username -h hostname database_name > dbname.sql
@paulund
paulund / add-embed-tweet-meta-box.php
Last active March 13, 2018 04:53
Add custom post meta data input boxes to the WordPress post pages.
<?php
function add_embed_tweet_meta_box() {
add_meta_box(
'paulund_embed_tweet_meta_box', // $id
'Post Embed Tweets Meta Box', // $title
'show_embed_tweet_meta_box', // $callback
'post', // $page
'normal', // $context
'high'); // $priority
}
<?php
// Using the == operator, Strings do not match is printed
if('string1' == 'STRING1')
{
echo 'Strings match.';
} else {
echo 'Strings do not match.';
}