Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Markus Schober maxxscho

🏠
Working from home
Block or report user

Report or block maxxscho

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxxscho
maxxscho / main.m
Created May 8, 2015
Generate random float between two floats
View main.m
#define ARC4RANDOM_MAX 0x100000000
double val = ((double)arc4random() / ARC4RANDOM_MAX)
* (maxRange - minRange)
+ minRange;
@maxxscho
maxxscho / extras.php
Last active Aug 29, 2015
Wordpress get post by slug and post type
View extras.php
/**
* 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 Apr 16, 2015
Wordpress get page ID by slug
View extras.php
/**
* 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;
View gist:5847465ddf85f72d5ad0

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 Aug 29, 2015
Animated Burger Icon for usage with bourbon.
View _burger-icon.scss
.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 Feb 16, 2015
Replace "The Events Calendar"s loading gif
View functions.php
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 Feb 7, 2015
Wordpress Redirect Post Type archive
View extras.php
<?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 Aug 29, 2015
Animated underline on link hover mixin
View _animated_underline.scss
/**
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 Aug 29, 2015
jQuery Autoscroll on hashed links
View script.js
// Auto scroll
// -------------------------------------
$('a[href^=#]').on('click', function(e) {
e.preventDefault();
var $this = $(this),
target = $this.attr('href');
if(target && target !== "#") {
$('html, body').animate({
You can’t perform that action at this time.