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 / Vagrantfile
Created Mar 6, 2014
Vagrant base setup (for a All-In-One machine on your host system)
View Vagrantfile
# -*- 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 / Vagrantfile
Created Mar 20, 2014
Vagrant setup with forwarded port
View Vagrantfile
# -*- 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 / RegExTime24h
Created Apr 18, 2014
Regular Expression for match a time string in the 24h format (hh:mm)
View RegExTime24h
/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/
@maxxscho
maxxscho / _validateDateDACH.js
Last active Aug 29, 2015
jQuery Validate additional validation for dates in the format dd.mm.yyyy
View _validateDateDACH.js
/* Additional method for jquery validate
Valiate dates in the format dd.mm.yyyy
------------------------------------- */
jQuery.validator.addMethod(
"dateDECH",
function(value, element) {
var check = false;
var re = /^\d{1,2}\.\d{1,2}\.\d{4}$/;
if( re.test(value)){
var adata = value.split('.');
@maxxscho
maxxscho / _center-block.scss
Created Dec 5, 2014
Centers a block element
View _center-block.scss
// Center a block element
@mixin center-block {
display: block;
margin-right: auto;
margin-left: auto;
}
@maxxscho
maxxscho / _font-size.scss
Created Dec 5, 2014
Font size mixin for rem values with pixel fallback for old browsers
View _font-size.scss
// REM output based on the $em-base variable with pixel fallback
@mixin font-size($pxVal) {
@if not unitless($pxVal) {
$pxVal: strip-unit($pxVal);
}
font-size: $pxVal * 1px;
font-size: rem($pxVal);
}
@maxxscho
maxxscho / change-browser-name.js
Created Dec 11, 2014
Change browser tab name on blur
View change-browser-name.js
window.onblur = function () { document.title = 'you went?'; }
window.onfocus = function () { document.title = 'you came back'; }
@maxxscho
maxxscho / SubmenFirstWalker.php
Created Jan 5, 2015
Menu Walker for wordpress, that changes the order of items, which have a submenu. The submenu is first (standard is anchor first)
View SubmenFirstWalker.php
<?php
/**
* Class SubmenuFirstWalker
* This walker changes the order of elements, if they have a submenu
* Standard is anchor than the submenu. Wth this walker, the submenu gets rendered first.
* There is one new filter 'walker_nav_menu_end_el'
* @author Markus Schober
*/
class SubmenuFirstWalker extends Walker_Nav_Menu {
@maxxscho
maxxscho / passwordGenerator.php
Last active Aug 29, 2015
Password generator method
View passwordGenerator.php
<?php
/**
* Generate Password with a given length and strength
*
* @param int $length
* @param int $strength
* @return string
*/
function generatePassword($length = 9, $strength = 4)
@maxxscho
maxxscho / the_field_if.php
Created Jan 22, 2015
Echo a field of Advanced Custom Fields, if it is present. You may prepend and append it with custom strings (HTML ;) )
View the_field_if.php
<?php
/**
* Echo an ACF Field if it is present
* @param bool|int $field Name of the field
* @param string $before prepend the field with this string. HTML for example
* @param string $after append the field with this string. HTML for example
* @param bool|int $post_id
*
* @return bool|void
You can’t perform that action at this time.