Skip to content

Instantly share code, notes, and snippets.

@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
@Abban
Abban / get_mail.php
Last active February 26, 2022 15:50
Library for importing from IMAP and parsing the message.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Get Mail
*
* IMAP library for CodeIgniter. Requires Datamapper (http://datamapper.wanwizard.eu/)
*
* @package Get Mail
* @author Web Together (http://webtogether.ie)
* @version 0.9
@Abban
Abban / Mover.cs
Created August 5, 2015 11:21
Simple 2D Waypoint Movement in Unity
using UnityEngine;
using System.Collections;
public class Mover : MonoBehaviour
{
public Waypoint[] wayPoints;
public float speed = 3f;
public bool isCircular;
// Always true at the beginning because the moving object will always move towards the first waypoint
public bool inReverse = true;
@Abban
Abban / handleUpload.php
Last active October 13, 2020 06:39
jQuery AJAX file uploads. Code for the following blog post: http://abandon.ie/notebook/simple-file-uploads-using-jquery-ajax
<?php // You need to add server side validation and better error handling here
$data = array();
if(isset($_GET['files']))
{
$error = false;
$files = array();
$uploaddir = './uploads/';
@Abban
Abban / InventoryItemTest.php
Last active January 31, 2020 13:01
Integration Tests for Abban's Test
<?php namespace GildedRose\Tests;
use GildedRose\InventoryItem;
use GildedRose\InventoryItemLegendary;
use GildedRose\InventoryItemTicket;
use GildedRose\Program;
use PHPUnit\Framework\TestCase;
class InventoryItemTest extends TestCase
@Abban
Abban / cookie.php
Last active January 4, 2019 21:48
WP Config for multiple environments. Code is for this blog post: http://abandon.ie/wordpress-configuration-for-multiple-environments/
@Abban
Abban / Windows-Mobile-Sucks.php
Created October 22, 2012 16:28
PHP function to check if the current user agent is IEMobile/9.0 device
/**
* Is Windows Mobile
*
* Check to see if the user agent is a Windows Mobile
*
* @return boolean
*/
function is_windows_mobile(){
return strstr($_SERVER['HTTP_USER_AGENT'], 'IEMobile/9.0');
@Abban
Abban / is-old-android.php
Created October 23, 2012 16:09
PHP Function to check Android version from the user agent.
/**
* Is Old Android
*
* Check to see it the user agent is Android and if so then
* check the version number to see if it is lower than 4.0.0
* or passed parameter
*
* @param string $version
* @return boolean
*/
@Abban
Abban / db.php
Last active April 26, 2017 14:03
Add web environments to Anchor CMS
<?php
switch (WEB_ENV)
{
case 'local':
case 'development':
case 'staging':
case 'preview':
return array(
@Abban
Abban / button.css
Last active October 14, 2016 08:11
CSS to add a white or black alpha hover state on any colour button. This allows a single hover state to be applied to buttons of multiple colours without having to manually set colours.
.orange{ background: #ff7a4d; }
.blue{ background: #7396ff; }
.button {
display: inline-block;
*display: inline;
color: #ffffff;
text-decoration: none;
padding: 6px 10px;
position: relative;