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 / _strip-unit.scss
Created Aug 31, 2017
Strips the unit of a value in SCSS
View _strip-unit.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;
}
View jquery-jumplink-scroll-animation.js
@maxxscho
maxxscho / _placeholder.scss
Created Apr 22, 2016
Mixin for styling the placeholder attribute on form fields
View _placeholder.scss
// Usage
// @include placeholder {
// font-style:italic;
// color: white;
// font-weight:100;
// }
@mixin placeholder {
::-webkit-input-placeholder {@content}
:-moz-placeholder {@content}
@maxxscho
maxxscho / smooth-scroll.js
Last active Apr 6, 2016
Smooth Scrolling for Jumplinks
View smooth-scroll.js
$('a.jumplink[href^="#"]').on('click', function(event) {
event.preventDefault();
var $this = $(this),
target = $this.attr('href');
if (target && target !== "#") {
$('html, body').animate({
scrollTop: $(target).offset().top
}, 600);
@maxxscho
maxxscho / RegExNumericDecimal
Last active Mar 31, 2016
Regular expression for matching a number with optional decimals, with "." or "," as comma-separator. The number can be signed or unsigned.
View RegExNumericDecimal
/^\-?[0-9]+([\.|\,]{1}[0-9]{1,2})?$/
@maxxscho
maxxscho / get-url-parameter.js
Created Feb 25, 2016
Get an url-parameter from the current URL
View get-url-parameter.js
var getUrlParameter = function(param) {
var pageUrl = window.location.search.substring(1);
var urlVariables = pageUrl.split('&');
for (var i = 0; i < urlVariables.length; i++) {
var parameterName = urlVariables[i].split('=');
if (parameterName[0] == param) {
return parameterName[1];
}
@maxxscho
maxxscho / isMobile.js
Created Jan 25, 2016
Simple Mobile Detection
View isMobile.js
isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
@maxxscho
maxxscho / Nginx configuration in Laravel Homestead for Craft
Last active Sep 20, 2015
Nginx configuration for Craft for speaking urls
View Nginx configuration in Laravel Homestead for Craft
## This is a possible configuration for nginx in Laravel Homestead for Craft
View plugin-class-demo.php
<?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 / _parent.scss
Created Jun 19, 2015
Adds a parent selector to your selector
View _parent.scss
@mixin parent($selector: null) {
@if $selector {
#{$selector} & {
@content;
}
}
}
@mixin and_parent($selector: null) {
You can’t perform that action at this time.