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 | |
$obj = new FileFinder($argv[1]); | |
$obj->setFileType(array_slice($argv, 2)); | |
$obj->setExcludingDirectories(array('test1')); | |
$pages = $obj->find(); | |
print_r($pages); | |
class FileFinder { |
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 | |
// Data CSV file | |
$fileName = 'data.csv'; | |
// Try to open the CSV file | |
$fh = fopen($fileName, 'r'); | |
if (!is_resource($fh)) { | |
die("Failed to open $fileName"); | |
} |
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 | |
// Nested array to sort | |
$data = array( | |
'Guy' => array( | |
array('id' => 1, 'title' => 'This'), | |
array('id' => 7, 'title' => 'Boo'), | |
array('id' => 9, 'title' => 'Boo'), | |
array('id' => 3, 'title' => 'Broken'), | |
), |
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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php | |
*/ | |
$args = array( |
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 | |
/** | |
* Quick proof of concept for feature management | |
*/ | |
class Feature { | |
/** | |
* This is where we keep the list of features | |
*/ | |
protected $features; |
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 | |
/* | |
* If we are being called as Ajax content provider, just print | |
* something out, based on passed parameters. Sleep for more | |
* obvious results. | |
*/ | |
if (!empty($_REQUEST['widget']) && !empty($_REQUEST['id'])) { | |
$config = $_REQUEST['widget'] . '-' . $_REQUEST['id']; | |
switch($config) { | |
case 'text-one': |
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 | |
// Keep bumping up in powers of two | |
define('LANG_LIST_VISIBLE', 1); | |
define('LANG_LIST_HIDDEN', 2); | |
define('LANG_LIST_BOTH', 4); | |
print "\nBoth\n"; | |
print_r(getSupportLanguages(LANG_LIST_BOTH)); |
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 | |
$data = array( | |
'Collections' => array( | |
'id' => 1, | |
'name' => 'Countries', | |
), | |
// sorted by group,name from the SQL | |
'CollectionItems' => array( | |
array( 'id' => 1, 'collection_id' => 1, 'name' => 'CountryName', 'value' => 'Cyprus', 'group' => 1,), |
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
#!/usr/bin/php | |
<?php | |
$in = empty($argv[1]) ? '' : $argv[1]; | |
$out = empty($argv[2]) ? '' : $argv[2]; | |
if (empty($out)) { | |
$out = basename($in, '.ini') . '.json'; | |
} |
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
#!/bin/bash | |
# Chart total number of web requests per hour using Google Charts | |
# Usage: chart_web_request.sh [DATE] [PATH] | |
# | |
# If DATE is not given, yesterday is used. Date should be in the format | |
# that your web server is using in access logs | |
# | |
# If PATH is not given /var/log/httpd/*-access_log is used. | |
# |