This file contains hidden or 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 | |
add_filter( 'parse_query', 'hertzberg_filter_posts' ); | |
/** | |
* Hook into parse_query to only return display posts from category id #1 in search & blog/index | |
* | |
* @access public | |
* @return void | |
*/ | |
function hertzberg_filter_posts( $query ) { |
This file contains hidden or 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
[root@hertzberg ~]# pecl install apc | |
downloading APC-3.1.9.tgz ... | |
Starting to download APC-3.1.9.tgz (155,540 bytes) | |
.................................done: 155,540 bytes | |
54 source files, building | |
running: phpize | |
Configuring for: | |
PHP Api Version: 20090626 | |
Zend Module Api No: 20090626 | |
Zend Extension Api No: 220090626 |
This file contains hidden or 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 | |
/** | |
* Some words of wisdom: | |
* http://php.net/manual/en/class.directoryiterator.php | |
*/ | |
class HertzbergFilterDots extends FilterIterator { | |
public function __construct( $path ) { | |
parent::__construct( new DirectoryIterator( $path ) ); | |
} |
This file contains hidden or 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 | |
/** | |
* Filter get_post() array with only the relative information that we need | |
* | |
* @access public | |
* @param integer $post_id | |
* @return array | |
* @author moimikey | |
*/ | |
function hertzberg_filter_post_data( $post_id ) { |
This file contains hidden or 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 | |
class Time { | |
/** | |
* Seconds | |
*/ | |
const SECOND = 1; | |
/** | |
* Minutes |
This file contains hidden or 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
cat ~/Library/LaunchAgents/* > /tmp/.hi && cat /Library/LaunchAgents/* >> /tmp/.hi && cat /tmp/.hi | grep -E 'zeo|mkeeper' | wc -l && rm -rf /tmp/.hi |
This file contains hidden or 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 | |
/** | |
* Return a random post tag from the wp_terms table | |
* | |
* average 0.4ms on a 3K table | |
* | |
* @author Michael Scott Hertzberg | |
* @return mixed|string | |
*/ | |
function m_random_tag() { |
This file contains hidden or 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 | |
class XmlToJson { | |
public function Parse( $url ) { | |
$fileContents = file_get_contents( $url ); | |
$fileContents = str_replace( array( | |
"\n", | |
"\r", | |
"\t" | |
), '', $fileContents ); | |
$fileContents = trim( str_replace( '"', "'", $fileContents ) ); |
This file contains hidden or 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
([0...1000].filter (m) -> m % 3 is 0 or m % 5 is 0).reduce (s,h) -> s + h |
This file contains hidden or 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
# Convert bit rate from and to another rate | |
# | |
# amount: data being converted | |
# unitFrom: `from` unit. bps|kbps|mbps|gbps | |
# unitTo: `to` unit. bps|kbps|mbps|gbps | |
# | |
# uses double bitwise not `~~` as `Math.floor` | |
# uses `+` as type coercion to `int` | |
Util.bitCalculate = (amount, unitFrom, unitTo, maxDecimals=2) -> | |
base = 1000 |
OlderNewer