Skip to content

Instantly share code, notes, and snippets.

View ScottPhillips's full-sized avatar

Scott Phillips ScottPhillips

  • Los Angeles, CA
View GitHub Profile
@ScottPhillips
ScottPhillips / Widget_Setup.php
Created January 21, 2013 16:03
OOP Style Widgets for Wordpress
class Widget_Setup
{
public $widget_class = '';
public $admin_styles = array();
public $admin_scripts = array();
public $front_styles = array();
public $front_scripts = array();
public $script_defaults = array(
'handle' => '',
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@ScottPhillips
ScottPhillips / README.md
Created January 25, 2017 02:51 — forked from petehamilton/README.md
Set up a Raspberry Pi to load a web dashboard

Dashboards on Raspberry Pi

curl -L 'http://git.io/h1iuxQ' | sh
@ScottPhillips
ScottPhillips / wordpress-fetch-rss-feed.php
Created July 29, 2012 20:11
Fetch RSS Feed in WordPress
<?php
include_once(ABSPATH . WPINC . '/feed.php');
if(function_exists('fetch_feed')) {
$feed = fetch_feed('http://example.com/feed/');
if (!is_wp_error($feed)) : $feed->init();
$feed->set_output_encoding('UTF-8'); // set encoding
$feed->handle_content_type(); // ensure encoding
$feed->set_cache_duration(21600); // six hours in seconds
@ScottPhillips
ScottPhillips / google-plus-feed.php
Created August 18, 2012 02:41 — forked from ocean90/google-plus-feed.php
WordPress Page Template to build a feed of your Google+ stream
<?php
/**
* Template Name: Google+ Feed
*/
/**
* A WordPress page template for a Google+ feed.
*
* @author Dominik Schilling
301 moved permanently (redirect):
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com');
die();
?>
302 moved temporarily(redirect):
<?php
header('Location: http://www.example.com');
@ScottPhillips
ScottPhillips / remote-image-cache.php
Created July 7, 2012 07:16
Cache remote image using PHP
<?php
function cache_image($image_url){
//replace with your cache directory
$image_path = 'path/to/cache/dir/';
//get the name of the file
$exploded_image_url = explode("/",$image_url);
$image_filename = end($exploded_image_url);
$exploded_image_filename = explode(".",$image_filename);
$extension = end($exploded_image_filename);
//make sure its an image
@ScottPhillips
ScottPhillips / gist:4138804
Created November 24, 2012 07:43 — forked from dbushell/gist:4131104
Animate scrolling to an element or offset
/*!
* requires jQuery
* usage:
* Scroller.to({ offset: 100 });
* Scroller.to({ target: $('#main') });
*
* advanced usage (with additional easing function not provided here)
* Scroller.to({ target: $('#main'), delay: 500, multiplier: 1.5, easing: 'easeOutQuad' });
*/
var Scroller = (function()
@ScottPhillips
ScottPhillips / cache-json.php
Created July 18, 2012 23:52
Cache Remote JSON Feed
<?php
/**
* API Request Caching
*
* Use server-side caching to store API request's as JSON at a set
* interval, rather than each pageload.
*
* @arg Argument description and usage info
*/
@ScottPhillips
ScottPhillips / app.blade.php
Created April 6, 2017 05:28 — forked from emmerink/app.blade.php
Laravel Blade layout for Twitter Bootstrap 4
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="/favicon.ico">
<!-- CSRF Token -->