Skip to content

Instantly share code, notes, and snippets.

<?php
public static function Segment($key = null, $default = false)
{
static $result = null;
if (is_null($result) === true)
{
if (count($result = explode('/', substr(self::Value($_SERVER, 'PHP_SELF'), strlen(self::Value($_SERVER, 'SCRIPT_NAME'))))) > 0)
{
/*
So you like the style of impress.js demo?
Or maybe you are just curious how it was done?
You couldn't find a better place to find out!
Welcome to the stylesheet impress.js demo presentation.
Please remember that it is not meant to be a part of impress.js and is
not required by impress.js.

Microframework

This is a PHP microframework based on anonymous functions.

Features

  • requested URLs matched using regular expressions
  • request methods (matches using regular expressions too)
  • differenced FIFO queues for each $priority
  • command line usage
  • backward compatibility
  • integrated Dependency Injection system
  • settings system
@alixaxel
alixaxel / Doo.php
Created May 11, 2013 03:27 — forked from eb1024/Doo.php
<?php
function DB($query)
{
static $db = null;
static $result = array();
if (is_file($query) === true)
{
$db = new PDO('sqlite:' . $query, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
@alixaxel
alixaxel / y.php
Last active October 13, 2016 12:41
Why...
<?php
namespace alixaxel;
class y
{
public static function Coalesce()
{
foreach (func_get_args() as $argument) {
if (isset($argument) === true) {
<?php
function gzip_static($path)
{
if ((extension_loaded('zlib') === true) && (is_file($path) === true))
{
$levels = array();
$content = file_get_contents($path);
foreach (range(1, 9) as $level)
<?php
/**
* The MIT License
* http://creativecommons.org/licenses/MIT/
*
* Tidy Wrapper for HTML 5 Indentation
* Copyright (c) 2013 Alix Axel <alix.axel@gmail.com>
**/
@alixaxel
alixaxel / daveBox.sh
Last active December 17, 2015 11:49
Post-install script for (X)Ubuntu 13.04 (Raring) Desktop Edition
#!/bin/bash
# CC0 License
# http://creativecommons.org/publicdomain/zero/1.0/
#
# daveBox 0.1.1 (gist.github.com/alixaxel/5605638)
# Copyleft (c) 2013 Alix Axel <alix.axel@gmail.com>
clear && echo -e "\e[1;31mdaveBox 0.1.1\e[0m\n"
@alixaxel
alixaxel / spl_autoload.php
Created May 23, 2013 20:30
Lightweight, PSR-0 compliant SPL Autoloader
<?php
$paths = array
(
__DIR__ . '/vendor/',
__DIR__ . '/vendor/phunction/phunction.php',
);
foreach ($paths as $path)
{
@alixaxel
alixaxel / sqlite.udf.like.icu.php
Last active September 22, 2021 19:03
SQLite UDFs for LIKE Operator Overloading
<?php
$db->sqliteCreateFunction('like',
function ($pattern, $data, $escape = null) use ($db)
{
static $modifiers = null;
if (isset($modifiers) !== true)
{
$modifiers = ((strncmp($db->query('PRAGMA case_sensitive_like;')->fetchColumn(), '1', 1) === 0) ? '' : 'i') . 'suS';