Skip to content

Instantly share code, notes, and snippets.

View maxxscho's full-sized avatar
🏠
Working from home

Markus Schober maxxscho

🏠
Working from home
View GitHub Profile
@maxxscho
maxxscho / style.css
Created April 19, 2012 07:34
Wordpress Default CSS Styles
/* !-------- WORDPRESS CLASSES ------------------- */
/*------------------------------------------------------------ *\
\*------------------------------------------------------------ */
/* !-- WP WYSIWYG Editor Styles -- */
.entry-content img {
margin: 0 0 1.5em 0;
}
.alignleft, img.alignleft {
margin-right: 1.5em;
@maxxscho
maxxscho / extras.php
Created February 7, 2015 09:30
Wordpress Redirect Post Type archive
<?php
if ( ! function_exists( 'redirect_post_type_archive' ) ) {
/**
* Redirect to 404 if we are querying an post_type archive, we won't
* @author Markus Schober
*/
function redirect_post_type_archive() {
global $wp_query, $post;
if (is_post_type_archive(array('post-type'))) {
@maxxscho
maxxscho / plugin-class-demo.php
Last active October 18, 2023 14:28 — forked from thefuxia/plugin-class-demo.php
Plugin Class Demo
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: GPL
* Text Domain: plugin_unique_name
@maxxscho
maxxscho / additional-methods.js
Created August 24, 2012 14:17
RegEx for decimal numbers with 'commas' or 'dots'
/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:(\.|,)\d+)?$/
@maxxscho
maxxscho / functions.php
Created March 17, 2012 12:48
Wordpress: Shortcode Empty Paragraph fix
function shortcode_empty_paragraph_fix($content)
{
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);

The Laracasts PHPStorm theme - modified.

This is a slightly modified version of the great Laracasts PHPStorm theme. I've added some styles for Verions Control (add, modified, deleted line...) and fixed some missing things like warnings.

Download

image

Mac: Add to ~/Library/Preferences/WebIde80/colors

# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
@maxxscho
maxxscho / homestead-base-setup.md
Last active February 19, 2020 10:36
Homestead Base Setup

Timezone

  1. Check your current timezone with date in the command line. You should get something like this. Fri Oct 3 10.32:13 UTC 2014 where UTC is your current timezone.
  2. To change your timezone just run sudo dpkg-reconfigure tzdata and follow the instructions. Easy!
  3. Check the timezone again with date. Now your timezone should be in this example CEST

Locale

Homestead provides an Ubuntu System and has by default only english locales installed. In PHP locales are important if you work for example with strftime. Check the currently installed locales with locale -a. To add a new locale, you have to generate it. For example for a german locale enter sudo locale-gen de_DE.UTF-8

@maxxscho
maxxscho / custom_post_type_slider_image.php
Created March 7, 2012 10:17
Wordpress: Custom Post Type Template
<?php
/* !-------- CUSTOM POST TYPE ------------------- */
/*------------------------------------------------------------ */
/**
* This is a Template for a Custom Post Type, in this case a Slider Image Post Type.
* I use this Post Type for Slideshows like Flexslider.
* Copy this file and/or customize it for you needs.
*/
@maxxscho
maxxscho / _strip-unit.scss
Created August 31, 2017 09:30
Strips the unit of a value in SCSS
/// Remove the unit of a length
/// @param {Number} $number - Number to remove unit from
/// @return {Number} - Unitless number
@function strip-unit($number) {
@if type-of($number) == 'number' and not unitless($number) {
@return $number / ($number * 0 + 1);
}
@return $number;
}