Skip to content

Instantly share code, notes, and snippets.

View manchumahara's full-sized avatar
🎯
Focusing

Sabuj Kundu manchumahara

🎯
Focusing
View GitHub Profile
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@necenzurat
necenzurat / googleplus.php
Last active September 27, 2015 20:57
Get Google Plus Followers and Following, yea is messy but it does the job done :)
<?php
/*
* © WTFPL
* by necenzurat
* Updated: 19 May 2013
*/
$id = @$_GET["id"];
//$id = "108520002754793822340";
@netconstructor
netconstructor / custom-post-type-flush-rewrite-rules.php
Created January 23, 2012 10:46 — forked from jeremyboggs/custom-post-type-flush-rewrite-rules.php
Pseudo-elegant way to flush rewrite rules after creating a custom post type.
<?php
/**
* Example for writing a WP plugin that adds a custom post type and flushes
* rewrite rules only once on initialization.
*/
/**
* On activation, we'll set an option called 'my_plugin_name_flush' to true,
* so our plugin knows, on initialization, to flush the rewrite rules.
*/
@smeranda
smeranda / facebook_like-box_responsive.css
Created May 1, 2012 20:37
Flexible width layout for Facebook Like Box/Activity Stream to use in Responsive Designs
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@trepmal
trepmal / gist:2831344
Created May 29, 2012 23:07
Stand-alone WordPress.org plugin api access
<?php
// Stand-alone WordPress.org plugin api access
$url = 'http://api.wordpress.org/plugins/info/1.0/';
$fields = array(
'action' => 'query_plugins',
'request' => serialize( (object) array(
'author' => 'trepmal',
//'search' => 'howdy',
@jcemer
jcemer / gist:3130835
Created July 17, 2012 17:55
Less gradient mixins
#gradient {
.vertical(@startColor: #555, @endColor: #333, @colorStop: 100%) {
background-color: mix(@startColor, @endColor, 60%);
background-image: -moz-linear-gradient(top, @startColor, @endColor @colorStop); // FF 3.6+
background-image: -ms-linear-gradient(top, @startColor, @endColor @colorStop); // IE10
background-image: -webkit-gradient(linear, 0 0, 0 @colorStop, from(@startColor), to(@endColor)); // Android 2.3, Safari 4+, Chrome 2+
background-image: -webkit-linear-gradient(top, @startColor, @endColor @colorStop); // Safari 5.1+, Chrome 10+
background-image: -o-linear-gradient(top, @startColor, @endColor @colorStop); // Opera 11.10
background-image: linear-gradient(top, @startColor, @endColor @colorStop); // The standard
}
@zachbrowne
zachbrowne / auto-post.php
Created August 9, 2012 06:45
Auto post status updates to Google+
<?php
// REQUIRED PARAMETERS
$status = 'http://www.mylink.com';
$email = 'your@email.com';
$pass = 'yourpassw0rd';
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory