Skip to content

Instantly share code, notes, and snippets.

View mcseptian's full-sized avatar
🏠
Working from home

Septian Adi mcseptian

🏠
Working from home
View GitHub Profile
@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts
function buildCSSProperties() {
var used = {}; // hash table lookup instead of scanning the list
var properties = []; // build the properties ourselves
var style = document.documentElement.style; // cache the style, prevent numerous property lookups
var list = document.defaultView.getComputedStyle(document.documentElement, "");
var length = list.length;
for (var i = 0; i < length; ++i) // fill the hash table early with known values
used[properties[i] = list[i]] = true; // combine statements (1) mark as used (2) add to list
for (var i = 0, end = length; i < length; ++i) { // keep end pointer to prevent push() calls
@cms
cms / getStyle.js
Created April 17, 2010 00:48
Get computed styles
function getStyle(el, styleProp) {
var value, defaultView = el.ownerDocument.defaultView;
// W3C standard way:
if (defaultView && defaultView.getComputedStyle) {
// sanitize property name to css notation (hypen separated words eg. font-Size)
styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase();
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
} else if (el.currentStyle) { // IE
// sanitize property name to camelCase
styleProp = styleProp.replace(/\-(\w)/g, function(str, letter) {