Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Tobias Hochgürtel tobiashochguertel

🎯
Focusing
View GitHub Profile
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);
@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
}
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 / gitlab.pp
Created Jun 21, 2015
Puppet: Profile (gitlab.pp)
View gitlab.pp
# Example profile:
class profiles::gitlab {
## Hiera lookups
# - not yet
# see: http://garylarizza.com/blog/2014/02/17/puppet-workflow-part-2/
# $site_name = hiera('profiles::gitlab::site_name')
## Create user
@tobiashochguertel
tobiashochguertel / gist:0a6955c0fcca99b7e818
Created Jun 21, 2015
Cygwin: Windows Path to Unix Path
View gist:0a6955c0fcca99b7e818
`cygpath.exe -ua "Q:\Schnellspeicherort\2015-04-08 11_39_18-Greenshot.png"`
@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 / post-receive.erb
Created Jun 21, 2015
Puppet: Template (post-receive.erb)
View post-receive.erb
# This file is managed by Puppet. DO NOT EDIT.
# Getting a List of All Variables
<% scope.to_hash.keys.each do |k| -%>
<%= k %>
<% end -%>
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" />