Skip to content

Instantly share code, notes, and snippets.

View 5iDS's full-sized avatar
💭
@ease with the Source

Max 5iDS

💭
@ease with the Source
View GitHub Profile
@5iDS
5iDS / is_childPage
Created February 20, 2014 02:15
Check if a Page is a Child of Another Page in WordPress
#-----------------------------------------------------------------
# Check if a Page is a Child of Another Page in WordPress
# Returns true if a match was found.
#
# @param int $pageID
#
# @return bool
#
#-----------------------------------------------------------------
function is_childPage($pageID) {
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
csso = require('gulp-csso'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat');
gulp.task('css', function () {
gulp.src('./_includes/css/*.scss')
@5iDS
5iDS / android_winusb
Created December 16, 2013 14:51
HTC Wildfire ADB Drivers
;HTC Wildfire
%SingleAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C8B
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C8B&MI_01
%SingleBootLoaderInterface% = USB_Install, USB\VID_0BB4&PID_0C94
@5iDS
5iDS / WP-check_user_role
Created November 28, 2013 23:52
Checks if a particular user has a role.
#-----------------------------------------------------------------
# Checks if a particular user has a role.
# Returns true if a match was found.
#
# @param string $role Role name.
# @param int $user_id (Optional) The ID of a user. Defaults to the current user.
#
# @return bool
#
#-----------------------------------------------------------------
@5iDS
5iDS / WP-Redirect Register
Created November 28, 2013 23:51
Redirect from Default WordPress register page to custom register page.
/**
* RedirectWPRegister()
* Redirect from Default wordpress register page to custom register page.
*/
function RedirectWPRegister(){
$request = basename($_SERVER['REQUEST_URI']);
if ($request == 'wp-login.php?action=register'):
wp_redirect(site_url('/?page_id=776'));
exit();
endif;
@5iDS
5iDS / WP-Top-Most-Taxonomy
Created November 28, 2013 23:50
WP determine the topmost parent of a term
function get_term_top_most_parent($term_id, $taxonomy){
// start from the current term
$parent = get_term_by( 'id', $term_id, $taxonomy);
// climb up the hierarchy until we reach a term with parent = '0'
while ($parent->parent != '0'){
$term_id = $parent->parent;
$parent = get_term_by( 'id', $term_id, $taxonomy);
}
return $parent;
@5iDS
5iDS / IIS GZIP - web.config
Created September 18, 2013 03:13
enable GZIP compression through Web.config file
<system.webServer>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
<dynamicTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</dynamicTypes>
<staticTypes>
@5iDS
5iDS / IIS URL Rewrite
Created September 18, 2013 02:51
IIS REWRITE NON-WWW TO WWW
<rewrite>
<rules>
<rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="domain.com" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}" />
</rule>
</rules>
@5iDS
5iDS / clickatell_send_sms.php
Created July 30, 2013 00:26
Clickatell HTTP API Class
/*--------------------------------------------------*/
/* SMS CLICKATELL
*
* Http API
*
* @param string user
* @param string password
* @param int api_id
* @param int/"array" to (cellphone number) / "","",""
* @param string text (sms message)
@5iDS
5iDS / async_social_scripts.js
Created July 22, 2013 18:30
Loading Social Scripts Async.
(function social_async (d) {
var js,
ref = d.getElementsByTagName("head")[0];
js = d.createElement("script");
js.defer = true;
js.async = true;
js.type = "text/javascript";
var social_async_one = {