Skip to content

Instantly share code, notes, and snippets.

View martinwolf's full-sized avatar
🐺

Martin Wolf martinwolf

🐺
View GitHub Profile
@dzenzes
dzenzes / HTML5-boilerplate
Created March 9, 2012 20:17
my HTML5 boilerplate
<!DOCTYPE html>
<meta charset=utf-8 />
<title>hi</title>
<style>
</style>
<div></div>
@andrewrocco
andrewrocco / ga-ratio.js
Created July 17, 2012 15:48
Pixel Aspect Ratio Google Analytics Custom Variable
// Create the test
var pixelRatio = (window.devicePixelRatio >= 1.5) ? "high" : "normal";
..
// Pass it along through GA
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
// --- IMPORTANT LINE!
// params: event method, custom variable slot, variable name, variable value, scope level
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
@murtaugh
murtaugh / 1. single-line.html
Last active April 21, 2021 16:23
Blockquote patterns for ALA
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>
// http://jasonwyatt.tumblr.com/post/10481498815/how-to-correctly-debounce-a-javascript-function
function debounce(fn, debounceDuration)
{
debounceDuration = debounceDuration || 100;
return function(){
if(!fn.debouncing){
var args = Array.prototype.slice.apply(arguments);
fn.lastReturnVal = fn.apply(window, args);
fn.debouncing = true;
@aahan
aahan / WordPress Custom Global Variables.md
Last active March 28, 2024 19:26
Creating and using custom global variables in wordpress.

First create global variables (in functions.php or as a mu-plugin):

<?php

/*
 * CUSTOM GLOBAL VARIABLES
 */
function wtnerd_global_vars() {
@sergejmueller
sergejmueller / _scripts.js
Last active May 19, 2018 13:05
Lazyload-Technik fürs Nachladen der Bilder. Besonderheit: Bilder werden 3 Screens (3 x Browserfentserhöhe) vor der eigentlichen Position geladen, um beim Erreichen des Viewports bereits sichtbar zu sein. Ohne noscript-Fallback.
addEventListener(
'scroll',
function() {
var i,
img,
rect,
images = document.querySelectorAll('[lazyload-src]');
if ( ! images.length ) {
return;
@Wilto
Wilto / thanks.md
Last active August 29, 2015 14:02

Let’s leave aside, for now, the fact that you’ve changed web standards. You’ve been a participant in the first time—in the history of the web, far as I know—that the web development community has taken a feature from an initial proposal to the funding of an honest-to-God native implementation.

Instead, I want you to focus on this: say only ten developers use a native responsive images solution to reduce the weight of just one page apeice by only 500kb, and each of those pages has a barely-significant 5,000 hits per month: those users have been saved almost 24GB of data. A thousand pages saving 500kb apeice, and we’ve saved users an entire terabyte in a month. Now expand that to the entire industry: every web developer; every hit on every page that would otherwise carry with it a huge, wasteful image request, saving megabytes at a time. To those users, the only change is that the web is faster, less expensive, more accessible. For those users, the web is just better.

In helping make the picture element

@bradfrost
bradfrost / gist:59096a855281c433adc1
Last active September 4, 2023 15:01
Why I'm Not A JavaScript Developer

Answering the Front-end developer JavaScript interview questions to the best of my ability.

  • Explain event delegation

Sometimes you need to delegate events to things.

  • Explain how this works in JavaScript

This references the object or "thing" defined elsewhere. It's like "hey, thing I defined elsewhere, I'm talkin' to you."

  • Explain how prototypal inheritance works.
@sergejmueller
sergejmueller / goodbye-wordpress.md
Last active July 13, 2016 11:19
Goodbye, WordPress!

Goodbye, WordPress!

Fast 9 Jahre und nahezu 3 Millionen Downloads später ist Schluss.
Schluss mit WordPress.

Für mich geht ein Lebensabschnitt zu Ende. Ein Lebensabschnitt, der unendlich viel Erfahrung, Learnings und Spaß mit sich brachte. Ein Lebensabschnitt, der aber unendlich viel Zeit, Nerven und Motivation mit sich nahm. Doch der Wille zählt und ich hoffe stark, dass meine Software und mein Engagement die WordPress-Community ein Stückchen besser, qualitativer gemacht haben.

// Bitteschön