Skip to content

Instantly share code, notes, and snippets.

View ocean90's full-sized avatar
🌊
Surfing the open source wave

Dominik Schilling ocean90

🌊
Surfing the open source wave
View GitHub Profile
@ocean90
ocean90 / .bash_profile
Created May 30, 2013 20:42
Password Generator for the console
################
# Password Gen #
################
# Source: http://blog.colovirt.com/2009/01/07/linux-generating-strong-passwords-using-randomurandom/
# Use: `pwgen` or pwgen 20 oder pwgen 20 10
pwgen() {
# Length of password
if [ -z "$1" ]
then
length=10
@ocean90
ocean90 / gist:5586293
Last active December 17, 2015 09:19
Revisions generator
<?php
// How many revisions should be created?
$num_of_revisions = 40;
// Demo content
$content = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in
@ocean90
ocean90 / admin-color-switch.php
Last active December 16, 2015 21:39
#WordPressPlugin: Switch admin color scheme via toolbar
<?php
/**
* Plugin Name: Admin Color Switcher
* Version: 0.1
* Description: Switch admin color scheme via toolbar
* Author: Dominik Schilling
* Author URI: http://wphelper.de/
* Plugin URI: http://wpgrafie.de/
*
*
@ocean90
ocean90 / php-chrome-logger.php
Created April 5, 2013 20:01
#WordPressPlugin: Place the plugin into mu-plugins and log your PHP debug infos into the Chrome console. See http://www.chromephp.com/ for more infos
<?php
/**
* Plugin Name: Chrome Logger
* Description: Logs PHP debug info into Chrome console
* Author: Dominik Schilling
*/
/**
* Server Side Chrome PHP debugger class
* Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0
@ocean90
ocean90 / svg.php
Created March 28, 2013 13:35
#WordPressPlugin: Allows you to upload SVG files through the media uploader.
<?php
/**
* Plugin Name: SVG
* Version: 1.0
* Description: Allows you to upload SVG files through the media uploader.
* Author: Dominik Schilling
* Author URI: http://wphelper.de/
* Plugin URI: https://gist.github.com/ocean90/5263152
*
* License: GPLv2 or later
@ocean90
ocean90 / class-custom-feed.php
Last active May 30, 2019 22:16
How to add a custom feed to WordPress
<?php
/**
* Add a custom feed to WordPress.
*
* The feed will be rendered through the wp-includes/feed-rss2.php template
* and avaiable under example.com/feed/{$feed_slug}.
*
* Note: Don't forget to flush the rewrite rules once.
*
* @author Dominik Schilling
@ocean90
ocean90 / plugin.php
Last active December 12, 2015 00:58
WordPress: Removes the hentry mircoformat from post_class() output.
<?php
/**
* Removes the hentry mircoformat from post_class() output.
*/
function ds_remove_hentry_microformat( $classes ) {
return array_diff( $classes, array( 'hentry' ) );
}
add_filter( 'post_class', 'ds_remove_hentry_microformat' );
@ocean90
ocean90 / gist:4517823
Last active December 11, 2015 00:39
SASS Mixin for converting px values to rem
// Based on https://github.com/bitmanic/rem/
// Examples of usage:
// text-shadow: rem( 1px 1px 0 #fff );
// font-size: rem( 16px );
// @include box-shadow( rem( -2px 2px 0 ) rgba(0,0,0,0.1) );
$baseline-px: 16px;
@function rem( $px-values ) {
$baseline-rem: $baseline-px / 1rem;
@if type-of($px-values) == "number" {
@ocean90
ocean90 / gist:4504872
Created January 10, 2013 19:12
Customize the title attributes of term links in the widget tag cloud
<?php
/**
* Adds additional args to the widget tag cloud:
* format => array
* topic_count_text_callback => my_remove_default_tag_title
*
*/
function my_add_type_arg( $args ) {
$args['format'] = 'array';
$args['topic_count_text_callback'] = 'my_remove_default_tag_title';