Skip to content

Instantly share code, notes, and snippets.

View tylerreed's full-sized avatar

Tyler Reed tylerreed

View GitHub Profile
@tylerreed
tylerreed / wp_video_thumbnails.php
Last active March 11, 2022 02:19
A snippet of code to create static featured images for a WordPress post using a YouTube or Vimeo video URL. I have used this code for several projects where video posts or embedded videos needed to be static images in order to be more mobile friendly as well as for improve page load times when used as a featured image for the post.
<?php
/*
A snippet of code to create static featured images for a WordPress post using
a YouTube or Vimeo video URL. I have used this code for several projects where
video posts or embedded videos needed to be static images in order to be more
mobile friendly as well as for improved page load times when used as a featured
image for the post.
I have added comments where it might be neccessary to modify the code or where
there is room for improvement. There are two primary functions to be used
@tylerreed
tylerreed / buildRequestURL.php
Created December 11, 2012 18:54
Build a Request URL from an Array
<?php
/* Example of $url and $params */
$url = 'http://api.host.com/';
$params['key1'] = 'value1';
$params['key2'] = 'value2';
/* --------------------------- */
function buildRequestURL( $url, $params ) {
$request_url = $url . '?';
@tylerreed
tylerreed / mxit.php
Created December 11, 2012 18:46
Mxit - Get Headers
<?php
public function getMxitHeaders() {
if ( ! empty( $_SERVER["HTTP_X_MXIT_USERID_R"] ) ) {
$mxit->useragent = $_SERVER["HTTP_X_DEVICE_USER_AGENT"];
$mxit->contact = $_SERVER["HTTP_X_MXIT_CONTACT"];
$mxit->nick = $_SERVER["HTTP_X_MXIT_NICK"];
$mxit->userid = $_SERVER["HTTP_X_MXIT_ID_R"]; // Deprecated (soon to be discontinued)
$mxit->mxitid = $_SERVER["HTTP_X_MXIT_USERID_R"];
$mxit->login = $_SERVER["HTTP_X_MXIT_LOGIN"];
@tylerreed
tylerreed / controller.php
Created November 25, 2011 01:16
Valums AJAX File Uploader for CodeIgniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class My_Controller extends CI_Controller {
public function upload_files()
{
if ($this->input->get('qqfile'))
{
$file = $this->input->get('qqfile');
}