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 / RegExTime24h
Created April 18, 2014 10:47
Regular Expression for match a time string in the 24h format (hh:mm)
/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/
@maxxscho
maxxscho / Vagrantfile
Created March 20, 2014 10:25
Vagrant setup with forwarded port
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :shell, :path => "install.sh"
@maxxscho
maxxscho / Vagrantfile
Created March 6, 2014 22:31
Vagrant base setup (for a All-In-One machine on your host system)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
config.vm.network :private_network, ip: "192.168.33.21"
config.vm.provision :shell, :path => "install.sh"
@maxxscho
maxxscho / target_ie10
Created May 8, 2013 07:54
Target IE10 and add class .ie10 to the HTML Element. IE10 doesn't read conditional comments!!!
if(Function('/*@cc_on return document.documentMode===10@*/')()){
document.documentElement.className+=' ie10';
}
@maxxscho
maxxscho / safari_legend_margin_fix.less
Created November 7, 2012 13:35
LESS: Safari margin bugfix
// 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 October 31, 2012 14:02
Responsive embeded video
<!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 October 24, 2012 14:37
PHP - Get first day of a given week
$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 October 2, 2012 10:13
WORDPRESS: Widget base structure
<?php
class YourClassName extends WP_Widget {
public function YourClassName()
{
// Widget Options
$widget_ops = array(
'classname' => 'yourclassname',
'description' => 'Your description'
@maxxscho
maxxscho / additional-methods.js
Created August 24, 2012 14:17
RegEx for decimal numbers with 'commas' or 'dots'
/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:(\.|,)\d+)?$/
@maxxscho
maxxscho / Form_helper.php
Created August 21, 2012 08:27
Twitter Bootstrap Form Helper
<?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')) {