Skip to content

Instantly share code, notes, and snippets.

View dubrod's full-sized avatar

Wayne Roddy dubrod

View GitHub Profile
@dubrod
dubrod / zap-banner-engine
Last active August 29, 2015 13:58
Zap Banner Engine
<?php
//BOOSTRAP FILE CODE
//ZAP Banner Engine
include_once('zap.banner.engine.php');
$ZAP_banner_engine = new ZAP_banner_engine;
$banner_html = $ZAP_banner_engine->get_unseen();
?>
<?php
@dubrod
dubrod / Foursquare Mayor
Created April 13, 2011 13:21
A small script to show who is the Mayor of a Foursquare Venue on your site.
<?php
//main function
function foursquare_spotter() {
//set SpotID and Oauth Token - https://foursquare.com/oauth/
$spot_id = 311661; // just change this # to your venue # in the foursquare URL
$oauth_token = 123456789; // just change this # to your Oauth Token
if ($spot_id != "") {
@dubrod
dubrod / Gowalla Recent Activity Script
Created April 13, 2011 13:27
Show the 5 Recent Checkins with Name and Photo from your Gowalla Spot
<?php
function nicetime($date)
{
if(empty($date)) {
return "No date provided";
}
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
$lengths = array("60","60","24","7","4.35","12","10");
@dubrod
dubrod / Facebook Feed Trim
Created June 17, 2011 15:50
Facebook Feed Trim
<?php
function facebook_feed() {
$token = "XXXXXX";
$fb_id = "XXXXXX"; // the number in your Facebook URL
$json = json_decode(file_get_contents("https://graph.facebook.com/$fb_id/feed?access_token=$token"), true);
// only grab 1st
@dubrod
dubrod / SADO API
Created January 8, 2013 15:02
Setting Up and API in PHP for those of us awesome developers using SADO. http://www.shayanderson.com/projects/sado-php-orm.htm
<?
//bootstrap
require_once 'lib/Sado/sado.bootstrap.php';
//pre-qualify
if(function_exists($_GET['method'])){
$_GET['method']();
}
//methods
@dubrod
dubrod / MODX Nav Switch
Last active December 13, 2015 19:29
Switch MODX Nav from <ul> to <select> when mobile device detected.
Change Nav UL to Select when Mobile.
System Settings: Turn off resource and snippet caching. cacheable default is none. no pages can be cached.
1. add mobile_device_detect.php to the root folder
2. make sure jquery is called at the top of every page
@dubrod
dubrod / gist:3e6276350bd5ee27f232
Created December 14, 2015 19:15
Firebase DB to Static File for React JS
// first you have included your FireBase client JS
var leaguesNode = new Firebase("https://XXXX.firebaseio.com/Leagues");
jsonLeagues = '{"leagues": []}';
leaguesNode.once("value", function(snapshot) {
snapshot.forEach(function(childSnapshot) {
var key = childSnapshot.key();
var val = childSnapshot.val();
@dubrod
dubrod / gist:5488995
Created April 30, 2013 14:12
Prototype slider js file. Used in Magento 1.7 - Based on http://www.tomdoyletalk.com/simple-gallery/ - BUT I changed line 20 duration to 0 so you don't have that stack issue
// set the starting image.
var i = 0;
// The array of div names which will hold the images.
var image_slide = new Array('image-1', 'image-2', 'image-3');
// The number of images in the array.
var NumOfImages = image_slide.length;
@dubrod
dubrod / Magento Advanced Import Dataflow SQL Database
Last active December 17, 2015 08:29
Here I have exported my Magento Advanced Import Dataflow Empty SQL Database. I wrote a PHP application to take values from various sources to create this master sheet. I then exported as csv and imported with no problems using the System->Import->Advanced Dataflows inside Magento
CREATE TABLE `master` (
`mst_id` int(100) NOT NULL AUTO_INCREMENT,
`store` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`websites` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`attribute_set` varchar(75) COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(75) COLLATE utf8_unicode_ci NOT NULL,
`category_ids` int(50) NOT NULL,
`sku` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`has_options` int(50) NOT NULL,
`name` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
@dubrod
dubrod / Magento Custom XML Sitemap Creator
Created May 15, 2013 18:02
Get Collections for products, categories, and pages. Filter them, use any custom PHP you like and create an XML file. Couldn't find it so I built it. Very useful for carts that only have configurable "main" products and don't want all the bits and pieces "simple products" showing in the sitemap. 1. create a my_sitemap.xml to be overwritten. 2. K…
<?php
/* Compilation includes configuration file */
define('MAGENTO_ROOT', getcwd());
$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
include $compilerConfig;
}
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';