Skip to content

Instantly share code, notes, and snippets.

View netconstructor's full-sized avatar
💭
pushing pixels

Christian Hochfilzer netconstructor

💭
pushing pixels
View GitHub Profile
@janfabry
janfabry / fixed-image-cropper.js
Created December 2, 2010 15:19
WordPress Fixed Image Cropper
// pxi: pixels in image scale
// pxc: pixels in crop scale
// Helper function to create an element with optional attributes
// Doesn't jQuery already have this?
Monkeyman_FixedImageCroppper_createElement = function(tagName, attr)
{
if (!attr) {
attr = {};
}
@jhaus
jhaus / wp-multi-install
Created December 4, 2010 05:59
install wordpress automatically via: http://codex.wordpress.org install wordpress automatic via: Installing_Multiple_Blogs#Multiple_Install_Automation
#!/bin/sh -x
# script by Stephanie Booth aka bunny http://stephanie-booth.com/ to install wordpress automatically (geeky, but useful for mass installs), with help from many people: drauh, io_error, zedrdave, roddie... and all those I've forgotten to mention.
# variables: $1 whatever, $2 wp_user, $3 wp_pass, $4 root password
# prerequisites: an existing mysql db, and a root password
# care! .htaccess is not generated, needs to be done manually, by clicking on "Update Permalinks" in Options once everything is installed
# todo: add themes, check plugin list, make wrapper script for multiple installs, prepare php patch template for options and common stuff, see if the script can edit the vhost conf files for mass installs, prepare alternate version for French, add bilingual plugin and maybe cache. Add an extra user to the WP install. Also an alternate version for upgrading the school blogs.
@mikeschinkel
mikeschinkel / admin-menu-challenge.php
Created January 15, 2011 05:03
The Great WordPress Admin Menu Challenge of Jan 2011
<?php
/*
Plugin Name: The Great WordPress Admin Menu Challenge of Jan 2011
Description: <em>"The Great WordPress Admin Menu Challenge of Jan 2011"</em> was inspired by the WordPress team's apparent lack of understanding of the problems addressed by trac tickets <a href="http://core.trac.wordpress.org/ticket/16048">#16048</a> and <a href="http://core.trac.wordpress.org/ticket/16050">#16050</a> <em>(See also: <a href="http://core.trac.wordpress.org/ticket/16204">#16204</a>)</em> and suggestion that the <a href="http://wordpress.org/extend/plugins/admin-menu-editor/>Admin Menu Editor</a> plugin handles the use-cases that the tickets address. Debate spilled over onto Twitter with participation from <a href="http://twitter.com/nacin">@nacin</a>, <a href="http://twitter.com/aaronjorbin">@aaronjorbin</a>, <a href="http://twitter.com/petemall">@petemall</a>, <a href="http://twitter.com/westi">@westi</a>, <a href="http://twitter.com/janeforshort">@janeforshort</a>, <a href="http://twitter.com/PatchesWelcome">@PatchesW
@chrisdickinson
chrisdickinson / smooth_sortable_animating.html
Created January 29, 2011 05:39
smoothly animate jquery sortable lists.
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
ul { float:left; margin-right:20px; }
body { color:white; font-family:Helvetica, sans-serif; text-shadow:1px 1px 1px rgba(0,0,0,0.2); }
ul { width:512px; overflow:hidden; border-radius:6px; }
@netconstructor
netconstructor / functions.php
Created February 5, 2011 04:30
Drag & Drop (functions.php code and referenced JS file below)
///////////////////////////////////////////////////////////////////////////////////////////
// CODE TO ADD POST PER PAGE FILTER
///////////////////////////////////////////////////////////////////////////////////////////
add_filter( 'edit_posts_per_page', 'reorder_edit_posts_per_page', 10, 2 );
function reorder_edit_posts_per_page( $per_page, $post_type ) {
// CHECK USER PERMISSIONS
if ( !current_user_can('edit_others_pages') )
return;
$post_type_object = get_post_type_object( $post_type );
@mattwiebe
mattwiebe / cleaner_menus.php
Created February 8, 2011 06:45
Clean up the cruft on WP-generated menus
<?php
/**
* De-cruft WordPress-generated menu HTML
* @author Matt Wiebe
* @link http://somadesign.ca/
* @contributor Roger Johansson {@link} http://www.456bereastreet.com/archive/201101/cleaner_html_from_the_wordpress_wp_list_pages_function/
* @license GPL v2 {@link} http://www.opensource.org/licenses/gpl-2.0.php
* @copyright 2011
*/
class SD_Cleaner_Menus {
@jeremyboggs
jeremyboggs / custom-post-type-flush-rewrite-rules.php
Created March 15, 2011 22:00
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.
*/
@DamonOehlman
DamonOehlman / marker-backflip.js
Created March 16, 2011 11:53
Marker Backflip Animation Recipe
marker.animate('rotate', [0], [-Math.PI * 2], {
easing: 'sine.inout'
});
marker.animate('translate', [0, 0], [0, -40], {
easing: 'sine.in',
duration: 500,
complete: function() {
marker.animate('translate', [0, -40], [0, 0], {
duration: 500
@forkandwait
forkandwait / fips.sh
Created March 24, 2011 20:23
Reworked script for loading tiger data
declare -A FIPS
declare -A STNAME
FIPS[AK]=02; STNAME[AK]=Alaska
FIPS[AL]=01; STNAME[AL]=Alabama
FIPS[AR]=05; STNAME[AR]=Arkansas
FIPS[AS]=60; STNAME[AS]=American Samoa
FIPS[AZ]=04; STNAME[AZ]=Arizona
FIPS[CA]=06; STNAME[CA]=California
FIPS[CO]=08; STNAME[CO]=Colorado
FIPS[CT]=09; STNAME[CT]=Connecticut
@infertux
infertux / mirror-github.sh
Last active August 12, 2022 09:07
A little Bash script to make a mirror of your Github repositories and keep them up-to-date.
#!/bin/bash
# A little Bash script to make a mirror of your Github repositories and keep
# them up-to-date.
# Why mirroring? Because I can!
# Also, it will be very useful if one day a meteorite crashes into Github
# servers (even if it will not happen).
# https://gist.github.com/950441