Skip to content

Instantly share code, notes, and snippets.

@amereservant
amereservant / convert_urls.php
Created July 7, 2015 23:18
Convert URLs To Links Without RegEx - PHP
<?php
/**
* Convert URLs To Links Without RegEx
*
* @author David Miles
* @link https://gist.github.com/amereservant
*
* After trying several RegEx patterns to try and match URLs and all of them failing to
* accurately match them, I decided to take a simplier approach. Since URLs are continuous
* strings and begin with a given string (http in this case), All I had to do was use simple
@amereservant
amereservant / I2C_LCD_Display_Demo.ino
Last active January 16, 2019 03:00
Demo code for IIC/I2C Serial Interface Adapter Module For 1602 LCD Display - mklec
/**
* I2C/IIC LCD Serial Adapter Module Example
* Tutorial by http://mklec.com
*
* Instructions at http://blog.mklec.com/how-to-use-iici2c-serial-interface-module-for-1602-lcd-display
*
* This uses the Liquid Crystal library from https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads GNU General Public License, version 3 (GPL-3.0)
* Pin Connections:
* SCL = A5
* SDA = A4
@amereservant
amereservant / base64_encode.php
Last active December 18, 2015 13:29
How to Base64 Encode images using PHP for both inline image elements and for CSS rules.
<?php
/**
* Base64 Encode images with PHP
*
* This example shows how to use PHP to Base64 encode images for both inline image
* elements as well as for CSS background image properties.
*
* @link https://gist.github.com/amereservant/5790788
*/
function base64_encode_image($filename='',$filetype='')
@amereservant
amereservant / my_wp_settings.class.php
Last active December 18, 2015 11:59
A simple Wordpress plugin/theme options class. This is basically from the Codex and I just modified it to use class properties to make customizing it a little simpler.
<?php
/**
* Plugin/Theme Options
*
* @link http://codex.wordpress.org/Creating_Options_Pages#Example_.232
* @link https://gist.github.com/amereservant/5779754
* @requires Wordpress 3.5.1 =<
*/
class wctest
{
@amereservant
amereservant / biblebooks.php
Last active January 5, 2021 21:05
Simple PHP array of the Books of the Bible
<?php
$books = array(
1 => 'Genesis',
2 => 'Exodus',
3 => 'Leviticus',
4 => 'Numbers',
5 => 'Deuteronomy',
6 => 'Joshua',
7 => 'Judges',
8 => 'Ruth',
<?php
// Exit if accessed directly
if ( !defined('ABSPATH')) exit;
/**
* Blog Template
*
Template Name: Blog Excerpt (summary)
*
@amereservant
amereservant / index.php
Created October 2, 2012 06:08
Youtube API - Keywords
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Youtube API Test</title>
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
</head>
<body>
@amereservant
amereservant / index.html
Created February 9, 2012 14:46
HTML5 Template
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title></title>
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="style.css" />
<!--
@amereservant
amereservant / style.css
Created November 16, 2011 05:37
My Default Template
/* Reset and set defaults
-------------------------------------------------------------------------------*/
html, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section, time, mark, audio, video { margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent }
article, aside, figure, footer, header, hgroup, nav, section { display:block }
img, object, embed { max-width:100% }
/* force a vertical scrollbar to prevent a jumpy page */
html { overflow-y:scroll }
@amereservant
amereservant / auth.php
Created October 22, 2011 23:10
phpFlickr API Detailed Example HowTo
<?php
/* Last updated with phpFlickr 3.1
*
* Edit these variables to reflect the values you need. $default_redirect
* and $permissions are only important if you are linking here instead of
* using phpFlickr::auth() from another page or if you set the remember_uri
* argument to false.
*/
// Include configuration file