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
@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 / _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;
@maxxscho
maxxscho / script.js
Last active August 29, 2015 14:14
jQuery Autoscroll on hashed links
// Auto scroll
// -------------------------------------
$('a[href^=#]').on('click', function(e) {
e.preventDefault();
var $this = $(this),
target = $this.attr('href');
if(target && target !== "#") {
$('html, body').animate({
@maxxscho
maxxscho / the_field_if.php
Created January 22, 2015 13:45
Echo a field of Advanced Custom Fields, if it is present. You may prepend and append it with custom strings (HTML ;) )
<?php
/**
* Echo an ACF Field if it is present
* @param bool|int $field Name of the field
* @param string $before prepend the field with this string. HTML for example
* @param string $after append the field with this string. HTML for example
* @param bool|int $post_id
*
* @return bool|void