Skip to content

Instantly share code, notes, and snippets.

Avatar

Wayne Roddy dubrod

  • MODX
  • Huntsville, AL
View GitHub Profile
View Run a PHP or jQuery Function after jQuery UI Dialog Confirmation
<script>
$(function() {
//run function after jquery dialong confirm
//step 1 - the action
$(".deleteBtn").click(function(e) {
e.preventDefault();
pid = $(this).attr("title"); // the id of the photo i want to delete
//console.log($(this).attr("title")); // check you get it first
@dubrod
dubrod / jQuery Over 21 Dialog Checker
Last active Jan 25, 2016
Completely jQuery Over 21 Dialog Check
View jQuery Over 21 Dialog Checker
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Over 21 script</title>
<style type="text/css">
#ageCheckWrapper{
@dubrod
dubrod / Commonly Used Content Tags in MODX
Created Feb 3, 2016
Commonly Used Content Tags in MODX used in my Public Snapshots
View Commonly Used Content Tags in MODX
[[$header]]
<h1>[[*longtitle]]</h1>
[[*content]]
[[$footer]]
@dubrod
dubrod / Commonly Used Context Variable Examples
Created Feb 3, 2016
Commonly Used Context Variable Examples for use in my Public Snapshots
View Commonly Used Context Variable Examples
<footer>
<h3>[[++site_name]]</h3>
<p>[[++site_desc]]</p>
<h3 class="mt1">Phone</h3>
<p>[[++site_phone]]</p>
<small class="m1">[[++site_copyright]]</small>
</footer>
@dubrod
dubrod / TWEET2COUPON
Created Aug 30, 2011
Translate # of Twitter Followers to Discount Coupon % on osCommerce
View TWEET2COUPON
<?php
$tweet_data = json_decode(file_get_contents("http://api.twitter.com/1/users/show.json?screen_name=YOURTWITTERNAME"), true);
// display tweet data array ( just to show you i know what i'm doing =] )
//print "<pre>";
//print_r($tweet_data);
//print "</pre>";
@dubrod
dubrod / FQL2COUPONCODE
Created Feb 14, 2011
Using the new FQL (Facebook) we pull # of Likes of a company page, make it a %, and insert it into osCommerce for a Coupon Code.
View FQL2COUPONCODE
<?php
// must have http://addons.oscommerce.com/info/4269 installed in your osCommerce
$fb_data = json_decode(file_get_contents("https://graph.facebook.com/ACCESS-TOKEN-HERE"), true);
// ACCESS TOKEN FOR YOUR PAGE OR PROFILE
// See http://developers.facebook.com/docs/reference/api - Once a user has granted your application the "manage_pages" permission, the "accounts" connection will yield an additional access_token property for every page administrated by the current user.
// used for debugging/install
// print "<pre>";
@dubrod
dubrod / Mobile Device Detect
Last active May 12, 2016
A simple mobile device detector in PHP . If $mobile_browser == true ....
View Mobile Device Detect
<?
$mobile_browser = false; // set mobile browser as false till we can prove otherwise
$user_agent = $_SERVER['HTTP_USER_AGENT']; // get the user agent value - this should be cleaned to ensure no nefarious input gets executed
$accept = $_SERVER['HTTP_ACCEPT']; // get the content accept value - this should be cleaned to ensure no nefarious input gets executed
switch(true){ // using a switch against the following statements which could return true is more efficient than the previous method of using if statements
case (preg_match('/ipad/i',$user_agent)); // we find the word ipad in the user agent
$mobile_browser = false; // mobile browser is either true or false depending on the setting of ipad when calling the function
$status = 'Apple iPad';
@dubrod
dubrod / MODX - Register Quickstart
Last active Jun 1, 2016
MODX - Register Quickstart
View MODX - Register Quickstart
[[!Register?
&submittedResourceId=`1`
&validate=`
fullname:required,
email:email:required,
username:required:minLength=^6^,
password:required:minLength=^6^
`
]]
@dubrod
dubrod / Not a full script - pieces of example
Created Jun 1, 2016
MODX - Register - DOB done on Frontend
View Not a full script - pieces of example
<section>
<label>Birth Date </label>
<select id="birthMonth">
<option value="0">January</option>
<option value="1">February</option>
<option value="2">March</option>
<option value="3">April</option>
<option value="4">May</option>
<option value="5">June</option>
<option value="6">July</option>
@dubrod
dubrod / modx-active-users-plus-extended-fields-snippet
Created Jul 6, 2016
Get MODX Active Users and Create a Table based on Extended Fields
View modx-active-users-plus-extended-fields-snippet
//SNIPPET
$year = date("Y");
$jerseyYS = 0;
$jerseyYM = 0;
$jerseyYL = 0;
$jerseyYXL = 0;
$jerseyAS = 0;
$jerseyAM = 0;
$jerseyAL = 0;
You can’t perform that action at this time.