Skip to content

Instantly share code, notes, and snippets.

View franz-josef-kaiser's full-sized avatar

Franz Josef Kaiser franz-josef-kaiser

View GitHub Profile
@scribu
scribu / category-custom-fields.php
Created October 8, 2010 13:24
Category Custom Fields
<?php
/*
Plugin Name: Category Custom Fields
Author: scribu
*/
class Category_Custom_Fields {
function init() {
@scribu
scribu / gist:642361
Created October 23, 2010 16:04
get_ascii_array()
<?php
/**
* Returns an array containing the ASCII codes of a string (useful for decomposition)
* Example: print_r(get_ascii_array('ș'))
*
* @param string $str
* @return array
*/
function get_ascii_array($str) {
@mikeschinkel
mikeschinkel / wp-post-counts-for-user-by-post-type.php
Created October 24, 2010 07:06
Adds Post Counts by Post Type per User in the User List withing WordPress' Admin console (URL path => /wp-admin/users.php)
<?php
/*
Adds Post Counts by Post Type per User in the User List withing WordPress' Admin console (URL path => /wp-admin/users.php)
Written for: http://wordpress.stackexchange.com/questions/3233/showing-users-post-counts-by-custom-post-type-in-the-admins-user-list
By: Mike Schinkel (http://mikeschinkel.com)
Date: 24 October 2010
*/
@kevinkace
kevinkace / screen.css
Created December 21, 2010 20:39
Add varying amounts of padding or margin to elements.
/* --------------------------------------------------------------
screen.css
* Add varying amounts of padding or margin to elements.
* Naming convention:
- First letter denotes padding (p) or margin (m).
- Second letter denotes where spacing is applied:
a - all sides
t - top
r - right
@Rarst
Rarst / nice-labels.php
Last active May 3, 2017 06:43
"Nice numbers" implementation for pretty range of numerical labels on graph
<?php
// @link http://books.google.com/books?id=fvA7zLEFWZgC&pg=PA61&lpg=PA61#v=onepage&q&f=false
function nice_labels( $min, $max, $ticks = 5 ) {
$range = nice_number( $max, false );
$d = nice_number( $range / ( $ticks - 1 ) );
$graphmin = floor( $min / $d ) * $d;
$graphmax = ceil( $max / $d ) * $d;
$nfrac = max( array( - floor( log( $d, 10 ) ), 0 ) );
@gerardpaapu
gerardpaapu / tests.js
Created December 9, 2011 11:45
UTF-8 encoding in javascript
var assert = require('assert'),
toBytes = require('./utf8.js').toBytes,
toUTF8Bytes = require('./utf8.js').toUTF8Bytes,
fromUTF8Bytes = require('./utf8.js').fromUTF8Bytes;
assert.deepEqual(toBytes(0x0), [0]);
assert.deepEqual(toBytes(0xff), [0xff]);
assert.deepEqual(toBytes(0x01ff), [0x01, 0xff]);
assert.deepEqual(toBytes(0xffff), [0xff, 0xff]);
@scribu
scribu / test-list-tables.php
Created January 24, 2012 12:43
WP Admin List Tables hooks
<?php
//////////////////
// Screens
//////////////////
// Posts
foreach ( array(
'posts', 'pages', 'recipe_posts',
'edit-post', 'edit-page', 'edit-recipe',
@chrisguitarguy
chrisguitarguy / iframe-widget.php
Created February 7, 2012 02:52
Embed your recent posts anywhere as an iframe!
<?php
/*
Plugin Name: iFrame Your WP
Description: Allow people to embed your latest posts in an iFrame
Author: Christopher Davis
Author URI: http://www.christopherguitar.me
License: GPL2
*/
register_activation_hook( __FILE__ , 'wpse32725_activation' );
@Rarst
Rarst / readme.md
Last active January 28, 2020 02:51
Walker class for WordPress custom menu integration in Twitter Bootstrap navbar
@Rarst
Rarst / class-opera-bookmarks-parser.php
Last active September 30, 2017 07:54
Parser for Opera's native bookmarks.adr format.
<?php
/**
* Parse Opera's bookmarks.adr file.
*/
class Opera_Bookmarks_Parser {
/** @var string path to bookmarks.adr */
public $adr;