Skip to content

Instantly share code, notes, and snippets.

View bueltge's full-sized avatar
Always interested

Frank Bültge bueltge

Always interested
View GitHub Profile
@bueltge
bueltge / gist:1292097
Created October 17, 2011 07:08
Update User Data in WordPress, depending from domain
-- generic email addresses and new passwords for users
UPDATE wp_users
SET user_email = CONCAT(user_login, '@example.com'),
user_pass = MD5(CONCAT(RAND(), CAST(ID AS CHAR), user_login));
-- generic email addresses for commentors
UPDATE wp_comments
SET comment_author_email = CONCAT(CAST(comment_ID AS CHAR), '@example.com');
@bueltge
bueltge / script_deamon.php
Created November 13, 2011 17:07 — forked from franz-josef-kaiser/script_deamon.php
WordPress Plugin to check your DataBase for injected links
<?php
/**
Plugin Name: AntiScript deamon
Plugin URI: https://github.com/franz-josef-kaiser
Description: Removes script-links to spam sites from your post content after your site got hacked. Please go to <a href="tools.php?page=script_deamon.php">Tools &rarr; Remove Hack</a>. Thank you. Proudly brought to you by <a href="http://example.com">Franz Josef Kaiser</a>.
Version: 0.1
Author: Franz Josef Kaiser
Author URI: https://github.com/franz-josef-kaiser
License: GPL2
WP-Version: Tested in 2.7.1, 2.9.2, 3.0
@bueltge
bueltge / gist:1362660
Created November 13, 2011 20:44
Extract word from a string given a position in php
function extractWord($text, $position){
$words = explode(' ', $text);
$characters = -1;
foreach($words as $word){
$characters += strlen($word);
if($characters >= $position){
return $word;
}
}
return '';
@bueltge
bueltge / gist:1503172
Last active September 28, 2015 22:08
Remove Admin Bar in WordPress 3.3
<?php
/**
* Plugin Name: Remove Admin Bar in WordPress 3.3
* Plugin URI: http://wordpress.stackexchange.com/questions/40983/removing-admin-bar-from-wordpress-dashboard
* Description: Remove Admin Bar
* Version: 1.0.0
* Author: Frank Bültge
* Author URI: http://bueltge.de
* License: GPLv3
*/
@bueltge
bueltge / gist:1559312
Created January 4, 2012 09:35
Inputfelder optional zwischen type=text|password umschaltbar
<form method="post" action="">
<input type="password" id="my_password" name="password" value="" autocomplete="off" />
<input type="submit" value="Los" id="my_submit" disabled="disabled" onclick="document.getElementById('my_password').type = 'password'" />
<br />
<input type="checkbox" onchange="document.getElementById('my_password').type = this.checked ? 'text' : 'password';"> Passwort beim Tippen anzeigen
</form>
@bueltge
bueltge / gist:1572371
Created January 6, 2012 20:57
Aptana Bug?
on this source; Aptana dont view functions, vars etc. in outline window
if ( ! class_exists( 'Foo' ) ) {
class Foo {
static public $foo;
public function foo() {
@bueltge
bueltge / gist:1575381
Created January 7, 2012 17:29
Remove pixel in img for responsive design
// remove height, width for responsive design
(function ($) {
$(document).ready(function($) {
$( 'img' ).removeAttr( 'height' ).removeAttr( 'width' );
});
})(jQuery);
/**
* @package Normalize Style with goal CSS3 and html5-elements
* @author Hans Mustermann <info@inpsyde.com>
* @since 0.0.1
* @version 0.0.2
*
* Description: Normalize all browsers
*
* Normalize, inspired by http://bueltge.de/b/33 and http://bueltge.de/b/34
*/
@bueltge
bueltge / dabblet.css
Created January 11, 2012 09:25
Nice button with CSS3 - to view or play: http://dabblet.com/gist/1593891
body {
margin: 3em;
}
.button {
padding: 10px 15px;
background: #4479BA;
text-decoration: none;
color: #FFF;
border-radius: 4px;
border: solid 1px #20538D;
@bueltge
bueltge / Singleton.php
Created January 13, 2012 11:34
Vererbung Singleton; Gewährleistung, dass Kind-Klassen Singletons sind, spätere Kind-Klassen aber nicht irgendetwas anderes werden können
class Singleton {
private static $_instances = array();
final public static function getInstance() {
return ! isset( self::$_instances[ get_called_class() ] )
? self::$_instances[ get_called_class() ] = new static
: self::$_instances[ get_called_class() ];
}