Skip to content

Instantly share code, notes, and snippets.

View rodneyrehm's full-sized avatar

Rodney Rehm rodneyrehm

View GitHub Profile
@rodneyrehm
rodneyrehm / index.html
Last active August 29, 2015 13:56
rawgithub.com gist example - view HEAD at https://rawgithub.com/rodneyrehm/9020346/raw/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>rawgithub.com gist demo</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Hello world</h1>
@rodneyrehm
rodneyrehm / feedback.md
Last active August 29, 2015 14:01
WPDS Düsseldorf 2014 - JavaScript Group // http://wpd.mx/dusjs
@rodneyrehm
rodneyrehm / gist:cccc240e54bdf3304fc5
Last active August 29, 2015 14:02
Question: Promise resolved handling
// Do you prefer alwaysWrapped() or wrappedWhenNeeded() for
// a method that depends on some promise being resolved?
function FooBar() {
this.ready = $.getJSON('something.funky');
}
FooBar.prototype.alwaysWrapped = function() {
return this.ready.then(function(){
// do something that returns a promise
@rodneyrehm
rodneyrehm / gist:f8a613f137799fb0a18b
Created July 16, 2014 13:43
URI.js jQuery plugin: make $.ajax() accept URI instances
$.ajax = (function(ajax) {
return function(url) {
if (url instanceof URI) {
arguments[0] = arguments[0].toString();
}
return ajax.apply($, arguments);
};
})($.ajax);
@rodneyrehm
rodneyrehm / gist:760c81da6f0f713444a5
Created July 16, 2014 20:55
QUnit: why can't setup expose data to tests properly?
/*
Am I missing something here or is this really the way to go for a
module's setup function to expose something to the module's tests?
*/
(function() {
var filled_by_setup;
module('dummy module', {
setup: function() {
// prepare some data
filled_by_setup = Math.random();
@rodneyrehm
rodneyrehm / bc.function.js
Last active August 29, 2015 14:06
JavaScript: providing a backward compatibility layer for changed function names/signatures
/*
Figuring out how to provide a Backward Compatibility Layer
GOALS:
[aliasing] provide a function (nextGeneration) in another name (previousGeneration)
[parameters] the functions might differ in argument order (or length, …)
[warnings] log each access/mutation to the alias (previousGeneration) so old code bases can be cleaned up
*/
var myObject = {
@rodneyrehm
rodneyrehm / gist:6f61a1340a0e27d37859
Created October 14, 2014 00:10
Some Questions regarding WAI ARIA

Question Regarding WAI ARIA

The Enter key should serve as the default submit action.

  • JS-free only possible through <form> and <button type="submit">?

@rodneyrehm
rodneyrehm / a11y.focus.md
Last active August 29, 2015 14:07
A11Y: questions about focus

Focus!

let's focus on tabindex and :focus for a bit…

What is focus?

  • focus (and blur) event emitted on element
  • document.activeElement updated
  • :focus style applied
  • browser's default focus outline visible (not testable programatically, only visually?!)
@rodneyrehm
rodneyrehm / javascript.md
Last active August 29, 2015 14:09
Customizing Texmate Plugins

Javascript Bundle

Open The Bundle Editor, select the JavaScript bundle, select the JavaScript language entry, exchange the folding markers:

to fold [\n], {\n}, /*\n*/

foldingStartMarker = '(^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$|\[\s*$|\{\s*$|/\*+\s*$)';
foldingStopMarker = '(^\s*\}|^\s*\]|^\s*\*+/)';
@rodneyrehm
rodneyrehm / chainable.js
Last active August 29, 2015 14:09
How would you load optional parts of a chainable API?
// file: core/module.js
define(function defineModule(require) {
function Module() {};
// prevent "… not a function" errors and tell developr how to fix the issue
Module.prototype.optionalComponent = function() {
console.error('Module.optionalComponent has not been loaded yet!');
};
return Module;