Skip to content

Instantly share code, notes, and snippets.

View tivnet's full-sized avatar

Gregory Karpinsky tivnet

View GitHub Profile
@tivnet
tivnet / save_post_action_example.php
Last active August 29, 2015 13:56
save_post action example
<?php
add_action( 'save_post', 'tivwp_save_post', 10, 3 );
/**
* Save the selected template info for the particular post
* @param int $post_id
* @param \WP_Post $post
* @param bool $update
* @wp-hook save_post
@tivnet
tivnet / php
Created January 4, 2014 14:55
To let PHP recognize Cygwin paths, put this file to /usr/local/bin/php and chmod +x Originally published by http://stackoverflow.com/users/264395/aefxx here: http://stackoverflow.com/questions/12276946/composer-cygwin
#!/bin/bash
# Path to the PHP executable
php="/cygdrive/c/PHP/php.exe"
for ((n=1; n <= $#; n++)); do
if [ -e "${!n}" ]; then
# Converts Unix style paths to Windows equivalents
path="$(cygpath --mixed ${!n} | xargs)"
@tivnet
tivnet / oop-procedural-benchmark.php
Created November 27, 2013 12:35
OOP vs. Procedural PHP Benchmark
<?php
/**
* OOP vs. Procedural PHP Benchmark
* @author tivnet
* @version 13.11.27
* Disclaimer: This is too simple, and does not prove anything. Just forget it. :-)
* My results on PHP 5.4 / Windows 8.1 / Apache 2.4 (all 64 bits, but who cares) :
* first 3 tests: same 3.1 to 3.4; the last test: 5.0 to 5.1
*/
header( 'Content-type: text/plain' );