Skip to content

Instantly share code, notes, and snippets.

View derak-kilgo's full-sized avatar

Derak Kilgo derak-kilgo

View GitHub Profile
@derak-kilgo
derak-kilgo / brightcove-smartplayer-api-sample.html
Last active December 19, 2015 14:29
Brightcove Smart Player API Example
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Sample2</title>
<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>
<p>Make sure you've got the dev console open or you won't see my messages.</p>
<button id="positionButton">Get position</button>
@derak-kilgo
derak-kilgo / cli-update-domain.php
Created October 23, 2013 14:12
cli tool to replace domain in wordpress content. Requires Zend Framework 1.x
<?php
/*
* Only allow script to run via command line interface.
*/
if(php_sapi_name() != 'cli'){
die('This script can only be run from the command line');
}
/*
* Tool makes use of Zend Framework 1.x
@derak-kilgo
derak-kilgo / customer-export.php
Last active April 17, 2021 01:11
CLI php script to export customers from magento to CSV using direct access to a magento collection.
<?php
if(php_sapi_name()!=="cli"){
echo "Must be run from the commend line.";
};
/**
* Setup a magento instance so we can run this export from the command line.
*/
require_once('app/Mage.php');
umask(0);
if (!Mage::isInstalled()) {
@derak-kilgo
derak-kilgo / social-test.php
Created October 31, 2013 21:42
PHP social button bar without javascript dependencies.
<?php
$url = urlencode($_SERVER['REQUEST_URI']);
$desc = urlencode('Title for your page');
//icons provied by iconfinder.com
$blueiconSize = 27;
$redIconSize = 24;
$template = <<<SOCIALTEMPLATE
<div class="social-bar">
<a href="http://www.facebook.com/sharer/sharer.php?u=$url"><img style="vertical-align: middle; margin-bottom: .25em;"width="$blueiconSize" height="$blueiconSize" src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/facebook_square-64.png" alt="Share on Facebook" /></a>
<a href="http://pinterest.com/pin/create/button/?url=$url&description=$desc"><img style="vertical-align: middle; margin-bottom: .25em;" width="$redIconSize" height="$redIconSize" src="https://cdn1.iconfinder.com/data/icons/Pinterest/61/big-p-button.png" alt="Share on Pintrest" /></a>
@derak-kilgo
derak-kilgo / wp-multisite-cron.php
Last active August 29, 2015 13:58
multisite cron for wordpress
<?php
/**
* Multisite Cron task. Hits the cron url for all enabled blogs so scheduled tasks function designed.
* @see http://www.lucasrolff.com/wordpress/why-wp-cron-sucks/
*
* Add this to your /etc/crontab file. Runs once per hour. Outputs log.
* 1 * * * * wget -q -O - "http://mydomain.com/wp-cron-multisite.php?doing_wp_cron >> /tmp/wp-cron.log
*/
require('./wp-load.php');
//increase memory for this process.
@derak-kilgo
derak-kilgo / gist:041662a29cd614e75f43
Last active August 29, 2015 14:06
Extract classnames from a php file.
<?php
Class LegacyAutoloader
{
/**
* Tokenize a php file and extract all classes defined inside.
* @param $filePath
* @return array
*/
public static function extractClasses($filePath){
$classNames = array();
@derak-kilgo
derak-kilgo / gist:54c4bd4cf74565b51c17
Created September 18, 2014 21:32
Retrieve the sizes of all tables in a schema
SELECT
TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) 'Size in MB'
FROM information_schema.TABLES
WHERE table_schema = 'YOUR_DB_NAME' and TABLE_TYPE='BASE TABLE'
ORDER BY data_length DESC
;
@derak-kilgo
derak-kilgo / composer.json
Created October 28, 2014 04:12
Load official pchart with composer
{
"name": "sample/sample-app",
"description": "How to add pchart to your application via composer",
"license": "GPLv3",
"repositories": [
{
"type": "package",
"package": {
"name": "pchart/pchart",
"version": "2.1.4",
@derak-kilgo
derak-kilgo / composer.json
Created October 28, 2014 04:42
Load ezComponents with composer
{
"name": "example/example-project",
"description": "How to load eZComponents with composer",
"license": "BSD",
"repositories": [
{
"type": "package",
"package": {
"name": "ezcomponents/ezcomponents",
"version": "2009.2.1",
@derak-kilgo
derak-kilgo / wp-multisite-cron.php
Created December 18, 2014 16:19
Wordpres Multisite Cron aware of system load
<?php
/**
* Multisite Cron task. Hits the cron url for all enabled blogs so scheduled tasks function designed.
* @see http://www.lucasrolff.com/wordpress/why-wp-cron-sucks/
*/
require('./wp-load.php');
//error_reporting(E_ALL);
//ini_set('display_errors',1);
ini_set('memory_limit','512M');
echo '<pre>';