Skip to content

Instantly share code, notes, and snippets.

@tobireif
tobireif / gist:ba62afcee6c19c4025c6
Created Oct 22, 2015
Appending CSS using Javascript
View gist:ba62afcee6c19c4025c6
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 Oct 14, 2015
Appending a rule to the last CSS stylesheet (using JS)
View gist:85abf3d0ca11d2d32c00
var styleSheets = document.styleSheets;
var lastStyleSheet = styleSheets[styleSheets.length - 1];
lastStyleSheet.insertRule(
"selector {prop: val}", lastStyleSheet.cssRules.length
);
View gist:106373
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="/"/>
You can’t perform that action at this time.