Skip to content

Instantly share code, notes, and snippets.

View gu-stav's full-sized avatar
🍿

Gustav Hansen gu-stav

🍿
View GitHub Profile
@gu-stav
gu-stav / keep-focus.js
Created July 2, 2013 07:02 — forked from drublic/keep-focus.js
Keep the focus inside a lightbox/ element. Elegant solution.
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];
@gu-stav
gu-stav / test.js
Created September 4, 2013 06:15
nodejs - domains. Taken from http://nodetuts.com/08-domains.html
var EventEmitter = require('events').EventEmitter;
var domain = require('domain');
var fs = require('fs');
var a;
var server = require('http').createServer();
server.on('request', function(req, res) {
var d = domain.create();
@gu-stav
gu-stav / notes.md
Created May 12, 2014 09:32
codefront.io
@gu-stav
gu-stav / Readme.md
Last active January 7, 2020 21:57
An accessible HTML-Stepper Component.

#Accessible HTML-Stepper#

It will provide some label-magic through aria-label, so that the buttons actually have a meaning, even if you can't see them.

Styling is not part of it, so you can use whatever you want. The plugin itself doesn't know anything about responsiveness. It does not depend on any plugins.

TODOs/ Ideas

  • Option for limiting the total & minimal Amount
  • Provide Web-Component
  • Let users pass in a set of elements

Fontcache

Load a JSON-File, including an encoded Font, and cache it to the browsers localStorage. To encode the font, you can use grunt-webfontjson.

Usage

  new FontCache({
    storageIndex: 'my-storage-index-v1'
  }).load( 'URL/TO/JSON-FILE' )
@gu-stav
gu-stav / principles.md
Last active June 20, 2018 13:32
Wien.info - Frontend Code Guidelines

Goals

An easy extendable & understandable Codebase, which performs well on all kind of devices. It should provide basic Helpers and In-Code Documentation to develop new features fast and comprehensible way. To achieve this, the Frontend uses the following Technology Stack:

  • Grunt, (Website) for building a release of all resources and to optimize Files
  • LESS (Website), to write less, more structured CSS-Code, which provides re-usable components
  • require.js, (Website) to work with asynchronous JS-Modules, which are loaded, when they are needed
  • Node/ NPM, (Website Nodejs, Website NPM) to install grunt and its dependencies. Run npm install.
@gu-stav
gu-stav / install.md
Last active August 29, 2015 14:14
Note, how to install io.js and node alongside. It also covers, how to install global npm modules, without changing the ownership of /usr/local

Install node.js & io.js using nvm

brew install nvm
nvm install iojs

# .zshrc
export NVM_DIR=$(brew --prefix)/var/nvm
@gu-stav
gu-stav / cult_of_ignorance.md
Created December 14, 2015 15:08 — forked from conspect/cult_of_ignorance.md
A Cult Of Ignorance, Isaac Asimov

It's hard to quarrel with that ancient justification of the free press: "America's right to know." It seems almost cruel to ask, ingeniously, "America's right to know what, please? Science? Mathematics? Economics? Foreign languages?"

None of those things, of course. In fact, one might well suppose that the popular feeling is that Americans are a lot better off without any of that tripe.

There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way throughout political and cultural life, nurtured by the false notion that democracy means that "my ignorance is just as good as your knowledge."

Politicians have routinely striven to speak the language of Shakespeare and Milton as ungrammaticaly as possible in order to avoid offending their audiences by appearing to have gone to school. Thus, Adlai Stevenson, who incautiously allowed intelligence and learning and wit to peep out of his speeches, found the American people

@gu-stav
gu-stav / pseudo-elements.md
Created April 8, 2016 21:21 — forked from p3t3r67x0/pseudo_elements.md
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.