Skip to content

Instantly share code, notes, and snippets.

View faffyman's full-sized avatar
💭
I may be slow to respond.

Tim Swann faffyman

💭
I may be slow to respond.
View GitHub Profile
@dzuelke
dzuelke / bcrypt.php
Last active March 28, 2023 13:15
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?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
@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@faffyman
faffyman / gmapembed.js
Created March 28, 2012 20:00
Auto embed a google map from it's share link
// --------------------------------------------------------
// 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)' ;
@kroger
kroger / mobi.py
Created June 26, 2013 11:37
Mobi builder based on Sphinx's epub builder.
# -*- 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.
@justintadlock
justintadlock / register-post-type.php
Last active October 20, 2024 13:47
Help file when registering post types.
<?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
@v-jacob
v-jacob / Mailhog Bash Script (upstart)
Last active December 5, 2018 12:22
Mailhog Bash Script
#!/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
@kunicmarko20
kunicmarko20 / Readme.md
Last active May 4, 2022 06:33
Sonata Admin Custom Page

Sonata Admin Custom Page

This example will help you create custom Sonata Admin page and also explain how to make a statistics admin.

You can read more here

@martinbpeters
martinbpeters / counties.geojson
Created January 25, 2020 14:44
Ireland Counties GeoJson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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.

A.I. Generative Artificial Intelligence

Document Management

Libraries and software for working with PDF files.