Skip to content

Instantly share code, notes, and snippets.

Volker Otto l4ci

View GitHub Profile
View JS Boilerplate.js
/**
* Example Boilerplate Module
*
* Add boilerplateModule.init() to main.js to initiate it.
*/
var boilerplateModule = (function(){
var config = {
'default': true,
View seo: robots.txt
# robotstxt.org/
User-agent: *
Disallow:
View php: go live after date.php
<?php
$date = strtotime("15.11.2017 05:00");
$now = time();
if ($date > $now) {
die("Silence is golden!");
}
View php: dd() function.php
<?php
function dd(){
array_map(function($x) { var_dump($x); }, func_get_args()); die;
}
View Browser Caching + gzip Compression.txt
## Browser Caching + Deflate Compression
<IfModule mod_deflate.c>
<FilesMatch "\.(js|jpg|jpeg|gif|png|ico|svg|css)$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# Deflate Compression
View jQuery: CountUp.js
// <div class="counter" data-count="150">0</div>
$('.counter').each(function() {
var $this = $(this),
countTo = $this.attr('data-count');
$({ countNum: $this.text()}).animate({
countNum: countTo
},
{
View js: Select onchange go to url.html
<select onchange="if (this.value) window.location.href=this.value">
<option value="">Pick one:</option>
<option value="/foo">Foo</option>
<option value="/bar">Bar</option>
</select>
View html: jQuery with Fallback.html
<script src="https://cdn.jsdelivr.net/jquery/3.2.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/libs/jquery.min.js">\x3C/script>')</script>
View html: Asynchrones Google Analytics with OptOut.html
<!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
<script>
var gaProperty = 'UA-XXXXX-Y';
window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
ga('create', gaProperty,'auto');
ga('set','anonymizeIp',true);
ga('send','pageview');
var disableStr = 'ga-disable-' + gaProperty;
View html: Browsehappy.html
<!--[if lt IE 8]>
<div class="info-box" id="browsehappy">
<div class="info-box__headline">Unsicherer Browser!</div>
Sie benutzen einen <strong>veralteten und unsicheren</strong> Webbrowser. Wir empfehlen, den <a href="http://browsehappy.com/">Browser zu aktualisieren</a> oder einen anderen, aktuellen Browser zu verwenden.
</div>
<![endif]-->
You can’t perform that action at this time.