Skip to content

Instantly share code, notes, and snippets.

@LouisLandry
LouisLandry / keybase.md
Created January 12, 2015 19:42
keybase.md

Keybase proof

I hereby claim:

  • I am LouisLandry on github.
  • I am louislandry (https://keybase.io/louislandry) on keybase.
  • I have a public key whose fingerprint is AF99 1C9F 967B C76A AD14 67FE 78CA 2E81 D590 D314

To claim this, I am signing this object:

@LouisLandry
LouisLandry / country.sql
Created October 6, 2012 18:46
A basic country table.
--
-- Table structure for table `country`
--
DROP TABLE IF EXISTS country;
CREATE TABLE country (
country_id int(11) NOT NULL auto_increment,
zone_id int(11) NOT NULL default '1',
country_name varchar(64) default NULL,
country_3_code char(3) default NULL,
@LouisLandry
LouisLandry / bytes.php
Created October 5, 2012 20:18
Quick function to make byte size human readable.
/**
* Convert bytes to human readable format.
*
* @param integer bytes Size in bytes to convert
*
* @return string
*/
function bytesToSize($bytes, $precision = 2)
{
$kilobyte = 1024;
@LouisLandry
LouisLandry / base36.php
Created October 5, 2012 19:09
Base36 Encode/Decode functions.
<?php
function base36_encode($base10){
return base_convert($base10,10,36);
}
function base36_decode($base36){
return base_convert($base36,36,10);
}
@LouisLandry
LouisLandry / identity.php
Created July 11, 2012 21:22
Example identity usage for web application.
<?php
/**
* @package Joomla.Platform
* @subpackage Identity
*
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
@LouisLandry
LouisLandry / multiple.patterns.php
Created June 8, 2012 16:36
Nested Task/Sub-task Example
<?php
/*
* Two patterns: one for with and one without vcard support.
*
* 'my/users/:user_id' => 'MyControllerUsers'
* 'my/users/:user_id/vcard' => 'MyControllerUsersVcard'
*/
class MyControllerUsersCreate extends JControllerBase
{
public function execute()
@LouisLandry
LouisLandry / reader.php
Created November 15, 2011 02:06
JFeedReader concept.
<?php
/**
* @package Joomla.Platform
* @subpackage Feed
*
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die();
@LouisLandry
LouisLandry / cache.php
Created November 1, 2011 03:43
JCache concept.
<?php
/**
* @package Joomla.Platform
* @subpackage Cache
*
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die();