This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Disable plugins when doing local dev | |
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ivan@ivan:~/missions/wptest/src/wp-content/themes/calibrefx$ sudo phpcs --standard=WordPress $(find . -name '*.php') | |
ivan@ivan:~/missions/wptest/src/wp-content/themes/calibrefx$ phpcbf --standard=WordPress comments.php | |
Setup PHP code sniffer with WordPress standard | |
http://subharanjan.com/setup-php-codesniffer-along-wordpress-coding-standards-windows-xampp/ | |
ivan@ivan:/usr/share/php/PHP/CodeSniffer/Standards/WordPress$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xclip -sel clip < ~/.ssh/id_rsa.pub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Author: minimus | |
* Date: 24.10.13 | |
* Time: 12:14 | |
*/ | |
define('DOING_AJAX', true); | |
if (!isset( $_POST['action'])) die('-1'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_time_limit(0); | |
file_put_contents( 'progress.txt', '' ); | |
$targetFile = fopen( 'filename.zip', 'w' ); | |
$ch = curl_init( 'URL to File' ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt( $ch, CURLOPT_NOPROGRESS, false ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fetch_imap( $host, $username, $password, $port ){ | |
$hostname = '{'.$host.':'.$port.'/imap/ssl/novalidate-cert}INBOX'; | |
/* try to connect */ | |
$inbox = imap_open( $hostname, $username, $password ) | |
or die("Can't connect to '$hostname': " . var_dump(imap_errors()) ); | |
// or die('Cannot connect to Gmail: ' . imap_last_error()); | |
/* grab emails */ | |
$emails = imap_search( $inbox, 'UNSEEN' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_to_csv_download($array, $filename = "export.csv", $delimiter=";") { | |
// open raw memory as file so no temp files needed, you might run out of memory though | |
$f = fopen('php://memory', 'w'); | |
// loop over the input array | |
foreach ($array as $line) { | |
// generate csv lines from the inner arrays | |
fputcsv($f, $line, $delimiter); | |
} | |
// reset the file pointer to the start of the file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ip_is_private ($ip) { | |
$pri_addrs = array ( | |
'10.0.0.0|10.255.255.255', // single class A network | |
'172.16.0.0|172.31.255.255', // 16 contiguous class B network | |
'192.168.0.0|192.168.255.255', // 256 contiguous class C network | |
'169.254.0.0|169.254.255.255', // Link-local address also refered to as Automatic Private IP Addressing | |
'127.0.0.0|127.255.255.255' // localhost | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm |