Skip to content

Instantly share code, notes, and snippets.

View rodneyrehm's full-sized avatar

Rodney Rehm rodneyrehm

View GitHub Profile
@rodneyrehm
rodneyrehm / demo.css
Last active October 23, 2015 17:51
JS Bin custom gist test
/* some css */
p { color: red; }
@rodneyrehm
rodneyrehm / function-arguments.js
Last active August 29, 2015 14:20
extract function arguments
var parameterCommentsPattern = /((\/\/.*$)|(\/\*[\s\S]*?\*\/)|\s+)/mg;
function getParameters(func) {
var text = Function.prototype.toString.call(func)
.replace(parameterCommentsPattern, '');
if (text === 'function(){[nativecode]}') {
throw new Error('Cannot extrapolate parameters from bound and native functions');
}
var params = text
@rodneyrehm
rodneyrehm / capabilities.json
Created April 29, 2015 23:36
Dalek: JsonWireProtocol and WD.js mappings
{
"browserName": {
"type": "string",
"description": "The name of the browser being used; should be one of {chrome|firefox|htmlunit|internet explorer|iphone}."
},
"version": {
"type": "string",
"description": "The browser version, or the empty string if unknown."
},
"platform": {
@rodneyrehm
rodneyrehm / focus.excerpt.dom3-events.md
Created April 20, 2015 20:56
Excerpt of the focus events chapter of my upcoming article-series/ebook on focus in general

The following is largely based on these test results


According to DOM Level 3 Focus Event Order there is a whole slew of events to be dispatched upon change of focus. focusin and focus are the two events dispatched the first time any element of the document receives focus. After that, when focus shifts to another element, we first get focusout on the element that has focus, then focusin on the element that will receive focus, then blur on the element that just lost focus, then focus on the element that got focus.

[…]

While focusout and focusin sound like the superior choice, they are not supported in Gecko at all. Blink 449857, WebKit 140596, [Trident 1

@rodneyrehm
rodneyrehm / Makefile
Last active August 29, 2015 14:19
emscripten and unicode
CC ?= gcc
CXX ?= g++
CFLAGS ?= -Wall -O2 -fPIC -stdlib=libc++
CXXFLAGS ?= -Wall -O2 -fPIC -stdlib=libc++
LDFLAGS ?= -Wall -O2 -fPIC -stdlib=libc++ -Wl,--no-undefined
SOURCES = \
test.cpp
@rodneyrehm
rodneyrehm / Makefile
Last active August 29, 2015 14:18
Emscripten async experiment
CC ?= gcc
CXX ?= g++
CFLAGS ?= -Wall -O2 -fPIC -stdlib=libc++
CXXFLAGS ?= -Wall -O2 -fPIC -stdlib=libc++
LDFLAGS ?= -Wall -O2 -fPIC -stdlib=libc++ -Wl,--no-undefined
SOURCES = \
test.cpp
@rodneyrehm
rodneyrehm / log-requests.php
Last active August 29, 2015 14:11
IE11 Bug: Favicon Request
<?php
$logfile = '/tmp/ie-11-favicon.log';
if (empty($_GET['type'])) {
$_GET['type'] = 'html';
}
$headers = array(
'Request ' . $_GET['type'] . ' at ' . date('Y-m-d H:i: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;
@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 / 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?!)