Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View neverything's full-sized avatar

Silvan Hagen neverything

View GitHub Profile
@neverything
neverything / functions.php
Created March 29, 2014 22:01
Overwrite or extend tiny mce styles dropdown in required-starter child theme.
<?php
/**
* Change options in the TinyMCE Styles dropdown
* @param array $args default styles array as seen in req-mce.php
* @return array our custom styles for the dropdown
*/
function req_starter_editor_stlye_args_filter( $args ) {
$custom_args = array(
@neverything
neverything / functions.php
Created March 29, 2014 22:09
Remove parent theme page templates in child theme from required-foundation theme
<?php
/**
* Remove parent theme Page Templates
*/
$_templates_to_remove = array();
function remove_template( $files_to_delete = array() ){
global $_templates_to_remove;
@neverything
neverything / functions.php
Created July 14, 2014 15:36
Remove the width and height attribute from all WordPress images
<?php
/**
* Remove width and height from all the WordPress images.
*
* @param $html
*
* @return mixed
*/
function remove_thumbnail_dimensions( $html ) {
@neverything
neverything / setEqualColumnHeight.js
Created September 4, 2014 14:43
Function to simply set elements next to each other to equal height.
// Equal Height for Frontpage Articles
if ($(window).width() > 1000) {
setEqualHeightColumns( $('.sidebar-front-top .box') );
};
function setEqualHeightColumns($elements) {
var tallestBox = 0;
$elements.each(function() {
var thisHeight = $(this).height();
if (thisHeight > tallestBox) {
@neverything
neverything / functions.php
Created June 17, 2015 12:16
Drop this function in your functions.php without the initial <?php if there already is an opening tag in your functions.php.
<?php
function ict_bz_render_pages( $args = array(), $template = 'content-page' ) {
// Default values for the query
$defaults = array(
'post_type' => 'page',
'post_status' => 'publish',
'order' => 'ASC',
'orderby' => 'menu_order',
@neverything
neverything / functions.php
Created June 17, 2015 12:36
This function adds a logo as a first menu item.
<?php
function ict_bz_add_logo_to_menu( $items, $args, $logo_path = 'https://placekitten.com/g/150/150', $menu_locations = array( 'primary' ) ) {
if ( in_array( $args->theme_location, $menu_locations ) ) {
$logo_item = sprintf(
'<li class="menu_item menu_item_custom menu_item_logo"><a href="%s"><img src="%s"></a></li>',
get_home_url(),
$logo_path
@neverything
neverything / idea-for-a-friendly-trojan.md
Last active August 29, 2015 14:26
tl;dr Ein freundlicher Trojaner für alle Geräte, damit wir den Geheimdiensten zu mehr Arbeit verhelfen, indem sogenannte False-Positives ausgelöst werden, die von einem Mitarbeiter manuell überprüft werden müssen.

Der freundliche Trojaner

Es war einmal an einem sonnigen Tag in der Zeit nach den Enthüllungen von Edward Snowden, ich fing an zu Faulenzen, aber mein Gehirn war dagegen. Ein Gedanke formte sich in meinem Kopf: "Wie wäre es wenn wir den Spiess umdrehen?". In meinem Kopf fing alles an zu drehen und das lag weder an der Sonne noch an Drogen, versprochen.

Menschen des Internets steht auf und verteidigt euch auf eine freundliche, aber bestimmte Art. Stell dir vor auf jedem deiner Geräte wäre ein "freundlicher Trojaner" installiert, der die Datenpakete die du versendest mit sogenannten Trigger-Wörtern anreichert und die Verschlüsselung ein paar Mal pro Minute wieder wechselt. Die Zusammensetzung der Trigger-Wörter liesse sich täglich automatisch im Hintergrund ändern und würde von der grossartigen Open Source Welt gepflegt und erweitert.

Jetzt stell dir vor ein Mitarbeiter bei einem der geheimen oder nicht geheimen Geheimdiensten kriegt nun dank den Trigger-Wörtern laufend Benachrichtigungen. Jede oder viele

@neverything
neverything / plugin.php
Last active October 11, 2015 18:48
Nasty fix to pass fixed cookie value in WP_Http_Cookie
<?php
//...
// Replace space with + from cookie value
// because WP_Http_Cookie does urldecode( value )
// which is fucking wrong.
$response['cookies'][0]->value = str_replace(' ', '+', $response['cookies'][0]->value);
// Set cookies for the second request
$this->cookies = $response['cookies'];
//...
<?php
if ( function_exists( 'required_side_nav' ) ) {
$args = array(
'before' => '<ul class="tabs vertical">',
'after' => '</ul>',
);
required_side_nav( $args );
}