Skip to content

Instantly share code, notes, and snippets.

@kafene
kafene / cmd.md
Created September 11, 2013 18:00 — forked from KenMacD/cmd.md

Microframework

This is a PHP (5.3+) 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 and settings system
  • named patterns
@kafene
kafene / cd.sh
Last active December 21, 2015 04:08 — forked from mbadran/gist:130469
silent pushd (aliased to cd)
function cd {
if (("$#" > 0)); then
if [ "$1" == "-" ]; then
builtin popd >/dev/null
elif [ "$1" == "--" ]; then
dirs -v
return $?
elif [ "$1" == "." ]; then
# break out of symlinked dir (cd into realpath)
builtin pushd "`pwd -P`" >/dev/null
#!/bin/bash
#
# Steam installer for Debian wheezy (32- and 64-bit)
#
# Place into empty directory and run.
#
download() {
local url="$1"
local filename="$(basename "$url")"
<?php
/* From: http://www.php.net/manual/en/function.str-getcsv.php#88773 and http://www.php.net/manual/en/function.str-getcsv.php#91170 */
if(!function_exists('str_putcsv'))
{
function str_putcsv($input, $delimiter = ',', $enclosure = '"')
{
// Open a memory "file" for read/write...
$fp = fopen('php://temp', 'r+');
// ... write the $input array to the "file" using fputcsv()...
fputcsv($fp, $input, $delimiter, $enclosure);

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Composer

<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.