Skip to content

Instantly share code, notes, and snippets.

Tobias Hochgürtel tobiashochguertel

Block or report user

Report or block tobiashochguertel

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
View gist:71568d3265c20b387f34
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title></title>
<link rel="stylesheet" href="css">
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" />
View gist:4542b8f66cc07dc23760
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
View gist:a8d6d7353a28543bb44d
(function($)) {
var o = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe'
}, function( key, api ) {
$[api] = function() {
o[key].apply( o, arguments );
@tobiashochguertel
tobiashochguertel / params.pp
Created Jun 21, 2015
Puppet: Switch for Operation Systems (params.pp)
View params.pp
class mysql::params {
case $::osfamily {
'RedHat': {
if $::operatingsystem == 'Fedora' and (is_integer($::operatingsystemrelease) and $::operatingsystemrelease >= 19 or $::operatingsystemrelease == "Rawhide") {
$client_package_name = 'mariadb'
$server_package_name = 'mariadb-server'
} else {
$client_package_name = 'mysql'
$server_package_name = 'mysql-server'
}
@tobiashochguertel
tobiashochguertel / server.pp
Created Jun 21, 2015
Puppet: Switch for Operation Systems (server.pp)
View server.pp
class mysql::server (
$config_file = $mysql::params::config_file,
$manage_config_file = $mysql::params::manage_config_file,
$old_root_password = $mysql::params::old_root_password,
$override_options = {},
$package_ensure = $mysql::params::server_package_ensure,
$package_name = $mysql::params::server_package_name,
$purge_conf_dir = $mysql::params::purge_conf_dir,
$remove_default_accounts = false,
$restart = $mysql::params::restart,
@tobiashochguertel
tobiashochguertel / server.pp
Created Jun 21, 2015
Puppet: Hiera defaults pattern (server.pp)
View server.pp
class mysql::server (
$config_file = hiera('mysql::params::config_file', 'default value'),
$manage_config_file = hiera('mysql::params::manage_config_file', 'default value'),
$old_root_password = hiera('mysql::params::old_root_password', 'default value'),
## Repeat the above pattern
) {
## Puppet goodness goes here
}
@tobiashochguertel
tobiashochguertel / server.pp
Created Jun 21, 2015
Puppet: Hybrid data model with Hiera (server.pp)
View server.pp
class mysql::server (
$config_file = hiera('mysql::params::config_file', $mysql::params::config_file),
$manage_config_file = hiera('mysql::params::manage_config_file', $mysql::params::manage_config_file),
$old_root_password = hiera('mysql::params::old_root_password', $mysql::params::old_root_password),
## Repeat the above pattern
) inherits mysql::params {
## Puppet goodness goes here
}
@tobiashochguertel
tobiashochguertel / vhost.pp
Created Jun 21, 2015
Puppet: Create an Defined Resource Type (vhost.pp)
View vhost.pp
# Define
define apache::vhost (
$port,
$docroot,
$servername = $title,
$vhost_name = '*'
) {
include apache # contains Package['httpd'] and Service['httpd']
include apache::params # contains common config settings
@tobiashochguertel
tobiashochguertel / websrv_service_nginx.pp
Created Jun 21, 2015
Puppet: Call an Defined Resource Type (websrv_service_nginx.pp)
View websrv_service_nginx.pp
# Call
apache::vhost { "example.com":
docroot => '/var/www/html',
priority => '25',
}
@tobiashochguertel
tobiashochguertel / uat_server.pp
Created Jun 21, 2015
Puppet: Roles (uat_server.pp)
View uat_server.pp
# Example role
class role::uat_server {
include profiles::base
include profiles::customapp
include profiles::test_tools
}
You can’t perform that action at this time.