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
# 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 / _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;
}
@maxxscho
maxxscho / _placeholder.scss
Created April 22, 2016 08:34
Mixin for styling the placeholder attribute on form fields
// 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 April 6, 2016 08:13
Smooth Scrolling for Jumplinks
$('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 March 31, 2016 15:11
Regular expression for matching a number with optional decimals, with "." or "," as comma-separator. The number can be signed or unsigned.
/^\-?[0-9]+([\.|\,]{1}[0-9]{1,2})?$/
@maxxscho
maxxscho / get-url-parameter.js
Created February 25, 2016 14:10
Get an url-parameter from the current URL
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 January 25, 2016 08:31
Simple Mobile Detection
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 September 20, 2015 18:30
Nginx configuration for Craft for speaking urls
## This is a possible configuration for nginx in Laravel Homestead for Craft
@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