Skip to content

Instantly share code, notes, and snippets.

View syamilmj's full-sized avatar

Syamil MJ syamilmj

View GitHub Profile
@samdark
samdark / github-post-receive.php
Last active October 11, 2019 10:05
Simple GitHub post-receive PHP hook
<?php
function cidr_match($ip, $ranges)
{
$ranges = (array)$ranges;
foreach($ranges as $range) {
list($subnet, $mask) = explode('/', $range);
if((ip2long($ip) & ~((1 << (32 - $mask)) - 1)) == ip2long($subnet)) {
return true;
}
}
@syamilmj
syamilmj / gist:2952342
Created June 19, 2012 04:51
Fix pagination error on homepage WP3.4
//Fix for home page navigation error on WP 3.4
function aq_query_for_homepage( $query ) {
global $paged;
if(get_option('lp_include_reviews') == "true") { $include_reviews = "reviews"; }
if(get_option('lp_include_videos') == "true") { $include_videos = "videos"; }
if(get_option('lp_include_screenshots') == "true") { $include_screenshots = "screenshots"; }
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'post_type', array( 'post', $include_reviews, $include_videos, $include_screenshots ) );
@nimbupani
nimbupani / index.html
Created December 2, 2011 05:00
Showing latest post on home page with Jekyll
---
layout: default
---
<div class="blog-index">
{% assign post = site.posts.first %}
{% assign content = post.content %}
{% include post_detail.html %}
</div>
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo