Skip to content

Instantly share code, notes, and snippets.

View pixline's full-sized avatar

Paolo T. pixline

View GitHub Profile
@pixline
pixline / blowfish_hex_test.php
Created October 23, 2011 04:00
Decodifica HEX -> Blowfish -> Plain Text
<?php
/**
* Decodifica HEX -> Blowfish -> Plain Text
* @license http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* pear install Crypt_Blowfish
* @link http://pear.php.net/package/Crypt_Blowfish/
*/
@pixline
pixline / Gruntfile.js
Created June 27, 2013 01:28
Grunt.js example file
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"email" : "contact@rarst.net",
"homepage": "http://www.Rarst.net/"
}
],
@pixline
pixline / imapsync.sh
Created June 28, 2013 04:24
IMAP to IMAP batch mailbox migration. Requires imapsync (http://imapsync.lamiral.info/)
#!/usr/bin/php
#
# Usage: ./imapsync.sh accounts.csv
#
# CSV account schema:
# old_username;old_password;new_username;new_password
#
<?php
define('HOST_FROM', 'imap.example.com');
#!/bin/bash
DOMAIN="easyforex"
POT="$DOMAIN.pot"
LANGS="en_US ru_RU"
SOURCES="*.php"
# Create template
echo "Creating POT"
rm -f $POT
@pixline
pixline / reset.sh
Created June 30, 2013 15:10
(sample) post-commit wp-cli local routine
#!/bin/bash
wp db reset --yes
wp core install --url=http://plugins.wp --title="plugin dev" --admin_name=plugins --admin_email=plugins@example.org --admin_password=plugins
wp plugin install <plugin_name> --activate
@pixline
pixline / wpcli-unit-tests-setup-draft.php
Last active December 19, 2015 04:18
(draft) wp-cli theme unit test setup automation
<?php
$download_url = 'https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml';
$silent = WP_CLI::get_config('quiet') ? '--silent ' : '';
$cmd = "curl -f $silent %s -o /tmp/theme-unit-test-data.xml";
WP_CLI::launch( Utils\esc_cmd( $cmd, $download_url ) );
# reset wp
WP_CLI::launch( 'wp db reset --yes' );
@pixline
pixline / stacktrace.txt
Last active December 19, 2015 06:09
wp-cli early command stack trace
PHP Fatal error: Call to a member function register_early_invoke() on a non-object in /src/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 23
PHP Stack trace:
PHP 1. {main}() /src/wp-cli/php/boot-fs.php:0
PHP 2. include() /src/wp-cli/php/boot-fs.php:17
PHP 3. WP_CLI\Utils\load_dependencies() /src/wp-cli/php/wp-cli.php:13
PHP 4. require() /src/wp-cli/php/utils.php:19
PHP 5. ComposerAutoloaderInitf85e7a78598cba3871ca35c635bc35df::getLoader() /src/wp-cli/vendor/autoload.php:7
PHP 6. require() /src/wp-cli/vendor/composer/autoload_real.php:46
PHP 7. WP_CLI::add_command() /src/wp-cli-test-command/wp-cli-test-command.php:72
@pixline
pixline / reset-wp.sh
Created July 5, 2013 22:54
Simple shell dev routine: - reset database - reinstall WP - install theme unit test dataset, plugins and options.
#!/bin/bash
wp db reset --yes
wp core install --url=http://wp35.dev --title="WP" --admin_name=test --admin_email=test@example.org --admin_password=test
wp theme-test install --menus
@pixline
pixline / test-raw.php
Last active December 19, 2015 20:49
Differences on exif_read_data() between raw PHP and WordPress 'wp_handle_upload_prefilter' filter. Raw PHP call will return $exif['Make'] and $exif['Model'] while WordPress filtered upload will set $exif['IFD0']['Make'] and $exif['IFD0']['Model']
<?php
print_r( exif_read_data( 'sucuri-test.jpg' ) );
/*
Array
(
[FileName] => sucuri-test.jpg
[FileDateTime] => 1374009774
[FileSize] => 38936
[FileType] => 2