Skip to content

Instantly share code, notes, and snippets.

View anselmh's full-sized avatar

Anselm Hannemann anselmh

View GitHub Profile
@anselmh
anselmh / resimg-syntax-test.html
Last active December 25, 2015 20:49
It's a quick demo of the three candidates of #respimg syntax. I simply want to compare verbosity of all those.
<!--
A quick demo of the three current candidates of Responsive Images syntax on a real world example for one image.
This on purpose does not include any of the proposed viewport syntaxes because this IMO adds confucion and
is stylistic only (therefore should go in CSS IMO).
-->
<!-- This is the src-{N} way: http://tabatkins.github.io/specs/respimg/Overview.html -->

Syntax

This proposal introduces a new text-kerning property:

text-kerning: [ <upoint> <upoint> <length> ] #

The <upoint> pairs are the left and right code points of a kerning pair and <value> is the kern value. Kerning pairs and values can be repeated multiple times by separating them with a comma. Kerning is applied to all unicode code point pairs in an element that match the kerning pairs specified in the text-kerning property of that element.

@tobiastom
tobiastom / Readme.md
Last active December 23, 2015 21:19
Clone all repositories from a remote SSH server.

Backup repositories

The idea of this script is to backup all repositories from a remote SSH server.

It will search for ´.git´ directories inside the home directory of the "git" user. By default it is the current user, but can be configured by changing the $GIT_USER variable at the top of the script.

All repositories will be cloned into the current working directory.

If there is a previous clone of the repository at the given destination, it will obviously only make a new pull.

@erikroyall
erikroyall / evento.js
Last active September 23, 2016 17:03
A cross-browser event handling system
// Evento - v1.0.0
// by Erik Royall <[email protected]> (http://erikroyall.github.io)
// Dual licensed under MIT and GPL
// Array.prototype.indexOf shim
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
'use strict';
@millermedeiros
millermedeiros / osx_setup.md
Last active June 28, 2025 20:05
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

@drublic
drublic / sublime-plugins.md
Last active October 4, 2022 02:24
My Sublime Plugins

Sublime Text Plugins

  • All Autocomplete
  • Bower
  • Editor Config
  • Emmet
  • Grunt
  • Image2Base64
  • LESS
@anselmh
anselmh / target_blank--external.js
Created July 24, 2013 12:12
Open all external links (different hostname than current page) in new tab/window with plain vanilla JavaScript.
/**
* Open external links in new tab/window
*/
// All http:// links should open in new tab/window. Internal links are relative.
var anchors = document.querySelectorAll('a');
for (var i = 0; i < anchors.length; i++) {
if (anchors[i].host !== window.location.hostname) {
anchors[i].setAttribute('target', '_blank');
@drublic
drublic / keep-focus.js
Last active March 29, 2017 15:20
A function that lets you circularly tab through a part of a page.
var tabbableElements = 'a[href], area[href], input:not([disabled]),' +
'select:not([disabled]), textarea:not([disabled]),' +
'button:not([disabled]), iframe, object, embed, *[tabindex],' +
'*[contenteditable]';
var keepFocus = function (context) {
var allTabbableElements = context.querySelectorAll(tabbableElements);
var firstTabbableElement = allTabbableElements[0];
var lastTabbableElement = allTabbableElements[allTabbableElements.length - 1];
file_put_contents($filename,base64_decode(str_replace(array(
'data:image/jpeg;base64,',
'data:image/png;base64,',
'data:image/gif;base64,',
),'',$datauri)));