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.
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.
A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()
):
<?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); |
<?php | |
$lines = explode( "\n", file_get_contents( 'input.csv' ) ); | |
$headers = str_getcsv( array_shift( $lines ) ); | |
$data = array(); | |
foreach ( $lines as $line ) { | |
$row = array(); | |
foreach ( str_getcsv( $line ) as $key => $field ) |
#!/bin/bash | |
# Convert a Github Flavored Markdown Syntax file to HTML | |
# | |
# The MIT License (MIT) | |
# Copyright © 2012 Evertton de Lima <[email protected]> | |
# http://evertton.mit-license.org/ | |
# Stylesheet feature by Dan Untenzu <[email protected]> | |
# | |
# Requirements: cURL (sudo apt-get install curl) |
#!/bin/sh | |
# Called by "git push" after it has checked the remote status, | |
# but before anything has been pushed. | |
# | |
# If this script exits with a non-zero status nothing will be pushed. | |
# | |
# Steps to install, from the root directory of your repo... | |
# 1. Copy the file into your repo at `.git/hooks/pre-push` | |
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push` |
# Install a Webserver | |
apt-get -y install apache2 | |
# Target docroot to /home/satis/web/ | |
# Install PHP5 CLI and needed programs. | |
apt-get -y install php5-cli php5-curl php5-json git wget | |
# Add a specifix user for our task | |
adduser satis |
#!/usr/bin/env bash | |
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz | |
mkdir vim && tar xzvf vim.tar.gz -C vim | |
export PATH=$PATH:/app/vim/bin |
/** | |
* Crawl the sitemap.xml for 301 redirections and 404 errors. | |
* Source: http://edmondscommerce.github.io/php/crawl-an-xml-sitemap-quality-check-301-and-404.html | |
* | |
* To use this script you need to allocate a huge amount of time to maximum_execution_time to | |
* avoid Fatal error: Maximum execution time...I suggest to run this script on terminal. | |
* Ex: $ php test-xml.php > ~/Desktop/sitemap-curl-result.txt | |
* | |
* For 3000 links the average time the script consumed is around 45 minutes to 1 hour. | |
*/ |
#!/bin/bash | |
# | |
############################################################################### | |
# Photo sorting program by Mike Beach | |
# For usage and instructions, and to leave feedback, see | |
# http://mikebeach.org/?p=4729 | |
# | |
# Last update: 20-January-2016 by tastensolo | |
############################################################################### | |
# |