A list of amazingly awesome PHP libraries, resources and shiny things.
- Composer/Packagist - A package and dependency manager.
- Composer Installers - A multi framework Composer library installer.
#!/bin/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
<?php | |
require_once('/path/to/wordpress/wp-load.php'); | |
require_once('class-wp_post_helper.php'); | |
// initialize | |
$post = new wp_post_helper(array( | |
'post_name' => 'slug' , // slug | |
'post_author' => 1 , // author's ID | |
'post_date' => '2012/11/15 20:00:00' , // post date and time | |
'post_type' => 'posts' , // post type (you can use custom post type) |
/* | |
* RC4 symmetric cipher encryption/decryption | |
* | |
* @license Public Domain | |
* @param string key - secret key for encryption/decryption | |
* @param string str - string to be encrypted/decrypted | |
* @return string | |
*/ | |
function rc4(key, str) { | |
var s = [], j = 0, x, res = ''; |
// if the gesture started from a link, open link in new tab | |
var linkURL = FireGestures.getLinkURL(FireGestures.sourceNode); | |
if (linkURL) { | |
gBrowser.loadOneTab(linkURL, {inBackground: true}); | |
return; | |
} | |
// else duplicate tab | |
gBrowser.loadOneTab(gBrowser.currentURI.spec, {inBackground: true}); |
// if the gesture started from a link, open link in new tab | |
var linkURL = FireGestures.getLinkURL(FireGestures.sourceNode); | |
if (linkURL) { | |
gTabDeque.moveTabToSecondPlaceInDeque(gBrowser.loadOneTab(linkURL, {inBackground: true})); | |
return; | |
} | |
// else duplicate tab | |
gTabDeque.moveTabToSecondPlaceInDeque(gBrowser.loadOneTab(gBrowser.currentURI.spec, {inBackground: true})); |
### | |
####### HISTIGNORE ####### | |
### | |
# examples from interwebs, noob dot file notes | |
#export HISTIGNORE='pwd:exit:fg:bg:top:clear' | |
# (if try to erasedups do not ignore things want 2 pune but on OSX it no workie) | |
# ignore things that start with a space, and ignore the exit command | |
#HISTIGNORE='[ \t]*:exit' | |
# some slashdot dudes says | |
#export HISTIGNORE="&:ls:[bf]g:exit:pwd:clear:mount:umount:[ \t]*" |
<?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. |
A list of amazingly awesome PHP libraries, resources and shiny things.
<?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); |
#!/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")" |