This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @function isMobile | |
* @description a jQuery function to detect mobile devices | |
* @param userAgents [array] | |
* @return object | |
*/ | |
var userAgents = ['iPad', 'iPhone', 'Android', 'IEMobile', 'BlackBerry']; | |
function isMobile(userAgents) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the default timezone using a GMT offset | |
$offset = -5; // GMT offset | |
$is_DST = FALSE; // observing daylight savings? | |
$timezone_name = timezone_name_from_abbr('', $offset * 3600, $is_DST); // e.g. "America/New_York" | |
date_default_timezone_set($timezone_name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CreatePlane | |
// Credit: http://wiki.unity3d.com/index.php?title=CreatePlane | |
// 1. Using the inspector, create a new C# script. | |
// 2. Name the script "CreatePlane" and place it in a folder titled "Editor". | |
// 3. A new menu option titled "Custom Plane" will appear in "GameObject > Create Other". | |
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
/*********************************************************************** | |
* Notes | |
***********************************************************************/ | |
/* | |
* Attach this script to an empty game object to give it an icon in the | |
* Scene View. The icon file, as set by the "name" variable, should reside | |
* in the project's "Assets/Gizmos" folder. See this page for more details: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
/*********************************************************************** | |
* Notes | |
***********************************************************************/ | |
/* | |
* This is a boilerplate controller for a 2D or 2.5D platform game. | |
* To that end, this controller allows for movement along the X and Y | |
* axes only. There is built-in support for jumping, double jumping, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// return an array of years relative to the current year | |
function getCreditCardExpiryYears($yearsFromNow = 10) | |
{ | |
if ( ! is_numeric($yearsFromNow)) $yearsFromNow = 10; | |
$thisYear = date('Y'); | |
$untilYear = $thisYear + $yearsFromNow; // e.g. 2012 + 10 = 2022 | |
$years = array(); | |
for ($i = $thisYear; $i <= $untilYear; $i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// return an array of years (relative to the current year) using an age range | |
function getYearsByAgeRange($minAge = 0, $maxAge = 0) | |
{ | |
if ( ! is_numeric($minAge) || ! is_numeric($maxAge) || $minAge > $maxAge) return; | |
$thisYear = date('Y'); | |
$maxYear = $thisYear - $minAge; // e.g. 2012 - 11 = 2001 | |
$minYear = $thisYear - $maxAge; // e.g. 2012 - 105 = 1907 | |
$years = array(); |