Skip to content

Instantly share code, notes, and snippets.

View bennybennet's full-sized avatar

Benny Bennet Jürgens bennybennet

View GitHub Profile
@bennybennet
bennybennet / gist:c47a1a86dc1bd448413e
Created November 10, 2014 12:39
Delete All Revisions Of Post Of Which Are Published
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b
ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c
ON (a.ID = c.post_id)
INNER JOIN (SELECT * FROM wp_posts WHERE post_status = 'publish') d
ON a.post_parent = d.ID
WHERE a.post_type = 'revision'
@bennybennet
bennybennet / class.js
Last active December 11, 2015 11:19
Trying to implement a usefull and easy-to-read way for declaring classes in JavaScript.
/* Simple JavaScript Inheritance
* First draft!
* @author Benny Bennet Jürgens (http://ben.nyben.net)
* CC-by-sa 3.0 - please provide my name and url
*/
;(function() {
"use strict";
this.BBClass = function(ctor, proto) {
ctor.prototype = proto || {};
ctor.prototype.constructor = ctor;
@bennybennet
bennybennet / Example.java
Last active December 11, 2015 12:48
Example Java class
package de.bennybennet.examples;
public class Example extends Parent {
String exampleVarPP = "I'm only visible for every class in this package.";
private String exampleVarPriv = "I'm only visible for this class";
public Example() {
System.out.println("...entered the constructor");
}
@bennybennet
bennybennet / customEventData.js
Created January 30, 2013 16:09
For every Browser except lower than IE9, which you shouldn't support anyway (imho).
var evt = document.createEvent('Event');
evt.initEvent('bbEvent', true, true);
var customEventData = {
dataString: "Hello",
dataArray: ['W', 'o', 'r', 'l', 'd']
}
evt.data = customEventData;
element.dispatchEvent(evt);
/* Don't use... */
body {
margin: 0px;
}
h1 {
padding: 0px;
}
/* ...instead use it without measurement units */
body {
@bennybennet
bennybennet / outline_border.css
Last active December 12, 2015 05:18
Two borders on one element. Code below results in: http://jsfiddle.net/qFGeN/1/
#myDoubleborder {
border: 2px solid green;
outline: 2px solid red;
}
@bennybennet
bennybennet / shadow_border.css
Last active December 12, 2015 05:19
Two borders on one element. Code below leads to: http://jsfiddle.net/hZGa7/3/
#myDoubleShadowBorder {
border: 2px solid green;
box-shadow: inset 0px 0px 0px 2px red;
}
#myEmbossedElement {
background-color: #eee;
border: 2px solid #eee;
border-radius: 5px;
box-shadow: inset 1px 1px 5px 1px #ddd;
}
#myDualColorBorder {
border-top: 5px solid #eaeaea;
position: relative;
}
#myDualColorBorder:before {
position: absolute;
top: -5px;
display: block;
content: '';
border-top: 5px solid #ffd300;
div {
width: 200px;
height: 100px;
margin: 30px auto;
}
#doubleBorder {
border-style: double;
}
#insetBorder {
border-style: inset;