Skip to content

Instantly share code, notes, and snippets.

View tobireif's full-sized avatar

Tobi Reif tobireif

View GitHub Profile
@tobireif
tobireif / gist:3dbf08115c517cf7c8fd
Last active December 5, 2015 09:27
Some User Experience Maxims
@tobireif
tobireif / gist:ba62afcee6c19c4025c6
Created October 22, 2015 13:33
Appending CSS using Javascript
var head = document.documentElement.querySelector("head");
var styleEl = document.createElement("style");
var styleStr = document.createTextNode(
"#content {prop: val}"
);
styleEl.appendChild(styleStr);
head.appendChild(styleEl);
@tobireif
tobireif / gist:85abf3d0ca11d2d32c00
Created October 14, 2015 16:28
Appending a rule to the last CSS stylesheet (using JS)
var styleSheets = document.styleSheets;
var lastStyleSheet = styleSheets[styleSheets.length - 1];
lastStyleSheet.insertRule(
"selector {prop: val}", lastStyleSheet.cssRules.length
);
require 'rubygems'
require 'nokogiri'
def xpath_values doc, for_each_xpath, value_xpath
xslt_str =
%{<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Not well-formed: -->
<xsl:template match="/"/>