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.
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
# | |
WP_OWNER=www-data # <-- wordpress owner | |
WP_GROUP=www-data # <-- wordpress group | |
WP_ROOT=$1 # <-- wordpress root directory |
<?php | |
namespace igorw\lusp; | |
// all functions return a pair of [val, env] | |
function evaluate($expr, $env = []) { | |
if (is_string($expr)) { | |
if (is_numeric($expr)) { | |
$val = (float) $expr; |
<?php | |
use Rarst\Profiler\Handler; | |
global $wp; | |
if ( Handler::$profiling && empty( $wp ) ) { | |
Handler::close(); | |
} |
<?php | |
/** | |
* Plugin Name: MLP Autosync Terms | |
* Description: Automatically sync all linked terms when a post is saved | |
* Author: Biont | |
* Author URI: https://github.com/Biont | |
* License: GPLv3 | |
*/ | |
/** |
<?php | |
class ForLoop implements IteratorAggregate | |
{ | |
public $from = 0, $to, $step = 1; | |
function getIterator() { | |
for($i = $this->from; $i <= $this->to; $i += $this->step) { | |
yield $i; |
<# | |
Note: Eliminate `-WhatIf` parameter to get action be actually done | |
Note: PS with version prior to 4.0 can't delete non-empty folders | |
#> | |
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force -WhatIf |