Skip to content

Instantly share code, notes, and snippets.

View davidkryzaniak's full-sized avatar

David Kryzaniak davidkryzaniak

View GitHub Profile
.custom-background .site-header-banner {background-color:#F2F0ED !IMPORTANT;}
a.fancy-button:visited,
a.fancy-button{
color: #FFF;background-color: #5CB85C;text-decoration: none;
border-color: #4CAE4C;display: inline-block;padding: 6px 12px;margin-bottom: 0;
font-size: 14px;font-weight: normal;line-height: 1.428571429;text-align: center;
white-space: nowrap;vertical-align: middle;cursor: pointer;background-image: none;
border: 1px solid rgba(0, 0, 0, 0);border-radius: 4px;-webkit-user-select: none;
-moz-user-select: none;-ms-user-select: none;-o-user-select: none;user-select: none;
}
@davidkryzaniak
davidkryzaniak / web920_example.php
Created October 21, 2013 23:57
Web920 Shortcodes
<?php
/**
* Plugin Name: Web920 Shortcode Example
* Description: This is an example plugin
* Version: 1.0
* Author: David Kryzaniak
* Author URI: http://dave.kz
*/
@davidkryzaniak
davidkryzaniak / test.php
Last active December 26, 2015 03:39
WP Shortcode example
<?php
//add the shortcode
add_shortcode(
'testgetusers', //name of the shortcode [getusers]
'sample1' //the function associated with the shortcode ( get_site_users() )
);
function sample1($attributes,$content){
//make sure there is a value for each attribute
@davidkryzaniak
davidkryzaniak / gist:6983007
Last active December 25, 2015 13:19
FargoPHP getting started
<?PHP
//shutoff all relays
$myFargo->setAllTo(FALSE);
//change the state of relay #1
$myFargo->relayFlipState(1); //#1 is now ON
//change the state of relay #0 (Labeled "Relay1" on the board)
echo "Relay #0 is currently: ".($myFargo->relayFlipState(0) ? 'On' : 'Off'); //#0 is now ON
@davidkryzaniak
davidkryzaniak / gist:6982961
Created October 14, 2013 22:01
FargoPHP - Getting started
<?php
//Get the class
require_once('FargoPHP/FargoPHP.class.php');
//Create a new FargoPHP object.
//Takes in the IP address (or DNS/Domain name) of the Fargo. Do not include the "http://" or the ending /
//Username, Password
$myFargo = new FargoPHP('192.168.1.34','admin','admin');
@davidkryzaniak
davidkryzaniak / shortcode.class.php
Last active December 20, 2015 00:48
Generic WP ShortCode Boilerplate (OOP)
<?php
/**
* Plugin Name: ShortCode
*
* Usage: [MyShortcode]
*/
class myShortCode {
public function __construct(){
@davidkryzaniak
davidkryzaniak / RemoveAddMediaButtonsForNonAdmins.php
Created July 18, 2013 16:26
Remove "Add Media" Buttons For Non-Admins
function RemoveAddMediaButtonsForNonAdmins(){
if ( !current_user_can( 'level_10' ) ) {
remove_action( 'media_buttons', 'media_buttons' );
}
}
add_action('admin_head', 'RemoveAddMediaButtonsForNonAdmins');
@davidkryzaniak
davidkryzaniak / cookiemonster.php
Last active December 13, 2015 20:28
Test to see if Googlebot can set and get cookies
<?php
$expire=time()+1468800;//14days
$cookieName='CookieMonster';
$cookieData='Chocolate Chip';
if(isset($_COOKIE[$cookieName])){
echo "Yep, cookie found!";
}else{
echo "No cookie here! Let me bake one up for you...";
setcookie($cookieName,$cookieData,$expire);
@davidkryzaniak
davidkryzaniak / example-filter-val.php
Created December 5, 2012 19:33
Example of filter_var()
<?php
//Lists the available filters you can select from
print_r(filter_list());
//returns 100000000.10
echo filter_var("$100,000,000.10", FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
//returns -23423
echo filter_var("-2,3423.2343", FILTER_SANITIZE_NUMBER_FLOAT);