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 / _parent.scss
Created June 19, 2015 09:46
Adds a parent selector to your selector
@mixin parent($selector: null) {
@if $selector {
#{$selector} & {
@content;
}
}
}
@mixin and_parent($selector: null) {
@maxxscho
maxxscho / main.m
Created May 8, 2015 11:38
Generate random float between two floats
#define ARC4RANDOM_MAX 0x100000000
double val = ((double)arc4random() / ARC4RANDOM_MAX)
* (maxRange - minRange)
+ minRange;
@maxxscho
maxxscho / extras.php
Last active August 29, 2015 14:19
Wordpress get post by slug and post type
/**
* Retrieve by its slug
* @param string $slug Slug of the post
* @param string $post_type Post Type
* @param string $output Type of output
* @return mixed
* @author Markus Schober
*/
function bb_get_post_by_slug($slug, $post_type = 'post', $output = 'OBJECT') {
global $wpdb;
@maxxscho
maxxscho / extras.php
Created April 16, 2015 08:35
Wordpress get page ID by slug
/**
* Get a page ID by slug
* @param $page_slug
*
* @return int|null
*/
function bb_get_page_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
@maxxscho
maxxscho / Fluid-and-fixed-columns.markdown
Created March 10, 2015 07:47
Fluid and fixed columns

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

@maxxscho
maxxscho / _burger-icon.scss
Last active August 29, 2015 14:16
Animated Burger Icon for usage with bourbon.
.mobile-nav-toggler {
@include prefixer(transform, rotate(0deg), webkit moz ms o spec);
@include transition(all 0.5s ease-in-out);
cursor: pointer;
height: 21px;
position: absolute;
right: 0;
top: 22px;
width: 30px;
@maxxscho
maxxscho / functions.php
Created February 16, 2015 20:28
Replace "The Events Calendar"s loading gif
if ( ! function_exists('bb_tribe_events_before_html_filter')) {
/**
* Replace the events calender loading gif
* @param $before
*
* @return mixed
* @author Markus Schober
*/
function bb_tribe_events_before_html_filter($before) {
@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 / _animated_underline.scss
Last active August 29, 2015 14:14
Animated underline on link hover mixin
/**
Adds an animated underline hover effect
a {
@include animated-underline(#000000);
// your styles here
}
*/
@mixin animated-underline($color: $color__link, $bottom: 3px, $height: 1px) {
position: relative;
display: inline-block;