Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
// secure hashing of passwords using bcrypt, needs PHP 5.3+ | |
// see http://codahale.com/how-to-safely-store-a-password/ | |
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt | |
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)), '+', '.'), 0, 22); | |
// 2y is the bcrypt algorithm selector, see http://php.net/crypt | |
// 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
// -------------------------------------------------------- | |
// auto embed google map if google map link found in body | |
// Allows site content editors to simply place a standard | |
// link in their text, and this will turn it into an | |
// embedded map | |
// -------------------------------------------------------- | |
// N.B. links with a class of dont-embed means... duh. dont embed. | |
var sMapSel = 'a[href^="http://maps.google.co.uk/maps"]:not(.dont-embed)' ; |
# -*- coding: utf-8 -*- | |
""" | |
sphinx.builders.mobi | |
~~~~~~~~~~~~~~~~~~~~ | |
Build mobi files. | |
Originally derived from epub.py. | |
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. | |
:license: BSD, see LICENSE for details. |
<?php | |
# Register custom post types on the 'init' hook. | |
add_action( 'init', 'my_register_post_types' ); | |
/** | |
* Registers post types needed by the plugin. | |
* | |
* @since 1.0.0 | |
* @access public |
#!/usr/bin/env bash | |
echo ">>> Installing Mailhog" | |
# Download binary from github | |
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64 | |
# Make it executable | |
chmod +x ~/mailhog |
This example will help you create custom Sonata Admin page and also explain how to make a statistics admin.
You can read more here
Below is a list of useful libraries and tools for PHP centric web dev, started out as a shortend list based on Awesome PHP but has since grown with other libs I've found to be useful over the years.
You can should always go check Awesome PHP as well see what's been update or to find anything that isn't here.
Libraries and software for working with PDF files.