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 / 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 / _center-vertical.scss
Last active Jan 7, 2016
Centering the unknown
View _center-vertical.scss
// Center a block element width unknown
// height and width horizontally and vertically
// If it doesn't center vertically, play with the spacing.
// <div class="parent">
// <div class="child">....</div>
// </div>
//
// .parent {
// ... your styles here....
// text-align:center; // if you need horizontally spacing
@maxxscho
maxxscho / target_ie10
Created May 8, 2013
Target IE10 and add class .ie10 to the HTML Element. IE10 doesn't read conditional comments!!!
View target_ie10
if(Function('/*@cc_on return document.documentMode===10@*/')()){
document.documentElement.className+=' ie10';
}
View safari_legend_margin_fix.less
// Legend Safari fix
.legend-margin-fix(@selector, @margin) {
(~"@{selector}") {
margin-bottom: @margin;
}
(~"@{selector} + *") {
-webkit-margin-top-collapse: separate;
margin-top: @margin;
}
@maxxscho
maxxscho / index.html
Created Oct 31, 2012
Responsive embeded video
View index.html
<!DOCTYPE html>
<!-- Add classes for each IE to the HTML Tag -->
<!--[if lt IE 7 ]><html class="ie ie6 no-js"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7 no-js"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8 no-js"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html class="no-js"> <!--<![endif]-->
<head>
<title>Responsive Video</title>
@maxxscho
maxxscho / firstday_of_week.php
Created Oct 24, 2012
PHP - Get first day of a given week
View firstday_of_week.php
$week = 43;
$timestamp = mktime(0, 0 ,0, 1, 1, $this->year) + ($week * 7 * 24 * 60 * 60);
$timestamp_for_monday = $timestamp - 86400 * ( date( 'N', $timestamp) - 1 );
$first_day_of_week = date('d.m.Y', $timestamp_for_monday);
@maxxscho
maxxscho / widget_base.php
Created Oct 2, 2012
WORDPRESS: Widget base structure
View widget_base.php
<?php
class YourClassName extends WP_Widget {
public function YourClassName()
{
// Widget Options
$widget_ops = array(
'classname' => 'yourclassname',
'description' => 'Your description'
@maxxscho
maxxscho / Form_helper.php
Created Aug 21, 2012
Twitter Bootstrap Form Helper
View Form_helper.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Generates the HTML for a Twitter Bootstrap Input
*
* @var string
* @author Markus Schober
**/
if ( !function_exists('tb_horizontal_input')) {
You can’t perform that action at this time.