Skip to content

Instantly share code, notes, and snippets.

@johnpbloch
johnpbloch / query-thief.php
Created November 18, 2011 17:11
Hijacking the main WordPress query and loop for fun and profit
<?php
/*
* Plugin Name: Query Thief
* Description: Hijacking the main WordPress query and loop for fun and profit
* Version: 0.1
*/
// I namespace everything now that PHP 5.2.4 is the minimum requirement. :D
namespace JPB;
@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@farico
farico / gist:3938084
Created October 23, 2012 10:31
Linksniavimas LT vardu
<?php
/**
* Lietuviškų vardų linksniai.
*
* @author Maug Lee <mauglee@gmail.com>
* @copyright Copyleft (ↄ) 2011, Maug Lee
* @version 0.3
* @package Vardai
*/
@malarkey
malarkey / Contract Killer 3.md
Last active July 5, 2024 08:43
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@grisha87
grisha87 / purge.php
Last active July 27, 2022 12:16
PHP.Kryptik.AB removal script
<?php
/**
* PHP.Kryptik.AB Cleanup script
*
* Usage: place the script in same directory that contains files / directories
* to be scanned. Then run `php [script_name].php` and wait a bit
*
* @link http://blog.twelvecode.com
* @author Grzegorz Godlewski <grisha87@gmail.com>
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@BenSibley
BenSibley / Envato
Last active December 24, 2015 14:29
Support templates from the post, "How to Make Your Customers Better at Customer Support." Please follow the guide here for instructions on how to best implement the templates: http://www.supportdash.com/customers-better-customer-support
<h3>How to Get Better, Faster Support</h3>
<p>Please follow these eight steps when you ask a question.  It helps us provide you with better support.</p>
<p>The Steps:</p>
<ol>
<li><a href="#sd-search">Search First</a></li>
<li><a href="#sd-ask">Ask the Right Person</a></li>
<li><a href="#sd-tell">Tell Us What is Wrong</a></li>
<li><a href="#sd-state">State Your Original Goal</a></li>
<li><a href="#sd-list">List the Symptoms</a></li>
@paulund
paulund / example-wp-list-table.php
Last active May 20, 2024 05:29
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@augustohp
augustohp / custom-respect-validation-rules.md
Last active March 24, 2022 17:24
How to create custom Respect\Validation rules.

Custom rules on Respect/Validation

You may not know that [the most awesome validation engine for PHP][1] out there is [Respect/Validation][2]. If you do, this is tailored for you!

All rules on [Respect/Validation][2] are meant to be used together, composing a more complex validation rule that is closer to the domain of your application than the existing ones, let's try an example:

INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)