Skip to content

Instantly share code, notes, and snippets.

View raidenz's full-sized avatar

raidenz raidenz

View GitHub Profile
@raidenz
raidenz / gist:37caeaba8c778df2aedf
Created February 4, 2015 16:49
shortcode.class.php
<?php
#PLUGIN SHORTCODE MANAGEMENT
class hslider_shortcodes{
#CLASS VARS
private $shortcode; //plugin shortcode is the same as the plugin name
private $plugin_dir;
private $plugin_url;
private $display;
@raidenz
raidenz / gist:ba30c7366d1209ad8e80
Created February 4, 2015 16:50
plugin_setup.class.php
<?php
#PLUGIN CONFIG
class hslider_setup{
#CLASS VARS
private $capability = 'publish_posts';
private $plugin_name;
private $plugin_friendly_name;
private $plugin_version;
@raidenz
raidenz / gist:5810cd7760995d464f61
Created February 4, 2015 16:51
frontend.class.php
<?php
#PLUGIN FRONT-END MANAGEMENT
class hslider_frontend{
#CONSTRUCT
public function __constuct(){
}
#IMPLEMENT SHORTCODE LISTENER
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
@raidenz
raidenz / gist:f119778b557714b3e85c
Last active August 29, 2015 14:23
earning jade
doctype html
html(lang='en')
head
meta(charset='UTF-8')
title earning
style.
body {
font-family: sans-serif;
color: #333333;
}
@raidenz
raidenz / boilerplate-widget.php
Created September 25, 2015 07:20 — forked from eddiemoya/boilerplate-widget.php
WordPress Boilerplate Widget
<?php /*
Plugin Name: Boilerplate Widget
Description: Starting point for building widgets quickly and easier
Version: 1.0
Author: Eddie Moya
/**
* IMPORTANT: Change the class name for each widget
*/
class Boilerplate_Widget extends WP_Widget {
@raidenz
raidenz / gist:d8cefbe2cb472c9b30b2
Created November 26, 2015 02:24 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@raidenz
raidenz / php
Last active January 22, 2016 04:00
cygwin fix php
#!/bin/bash
# fix wp-cli di cygwin
# save as php
# jika muncul error '\r' gunakan dos2unix php
# masukkan wp dan php ke /usr/local/bin
# chmod +x php
# chmod +x wp
# e.g. php="/cygdrive/c/Program Files (x86)/php/php.exe"
php="/cygdrive/c/xampp/php/php.exe"
@raidenz
raidenz / isMobile.js
Created March 9, 2016 01:46
detect mobile device
// https://www.mattcromwell.com/detecting-mobile-devices-javascript/
var isMobile = {
Android: function() { return navigator.userAgent.match(/Android/i); },
BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); },
iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); },
Opera: function() { return navigator.userAgent.match(/Opera Mini/i); },
Windows: function() { return navigator.userAgent.match(/IEMobile/i); },
any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } };
@raidenz
raidenz / mediaquery.css
Last active March 9, 2016 09:37
bootstrap full mediaquery
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
}
/* Small Devices, Tablets */