Skip to content

Instantly share code, notes, and snippets.

@thefuxia
thefuxia / simple-type-casting.php
Created August 30, 2013 13:09
Simple Type Casting in PHP
<?php # -*- coding: utf-8 -*-
header( 'Content-Type: text/plain;charset=utf-8' );
interface Simple_Type
{
public function __construct( $var );
public function __get( $var );
}
@imankulov
imankulov / db_test.py
Created June 24, 2013 12:44
Performance test for MySQL UPDATE
# -*- coding: utf-8 -*-
"""
Performance test for different types of update
Results sample
-----------------------------------------------
In [1]: import db_test
@jdevalk
jdevalk / .htaccess
Last active November 28, 2023 20:28
These three files together form an affiliate link redirect script.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule (.*) ./index.php?id=$1 [L]
</IfModule>
@thefuxia
thefuxia / t5-spam-block.php
Last active December 15, 2015 12:09
T5 Spam Block Stop comments based on a block list before they can enter the database.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Spam Block
* Description: Block spam before it reaches the database.
* Plugin URI: https://github.com/toscho/T5-Spam-Block
* Version: 2013.03.31
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
<?php
/*
Plugin Name: Easy Digital Downloads - Variable Pricing License Activation Limits
Plugin URL: http://easydigitaldownloads.com/extension/
Description: Limit the number of license activations permitted based on variable prices
Version: 1.0
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@franz-josef-kaiser
franz-josef-kaiser / wpse.md
Created October 18, 2012 17:16
Comments for WPSE
@Rarst
Rarst / .maintenance
Created April 21, 2012 12:36
WordPress maintenance mode
<?php
function is_user_logged_in() {
$loggedin = false;
foreach ( (array) $_COOKIE as $cookie => $value ) {
if ( stristr($cookie, 'wordpress_logged_in_') )
$loggedin = true;
}
return $loggedin;
}
if ( ! stristr($_SERVER['REQUEST_URI'], '/wp-admin') && ! stristr($_SERVER['REQUEST_URI'], '/wp-login.php') && ! is_user_logged_in() )