Skip to content

Instantly share code, notes, and snippets.

View seeingidog's full-sized avatar

Ian Morgan seeingidog

View GitHub Profile
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active February 21, 2024 01:58
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@Marchino
Marchino / rsend.rb
Created June 20, 2011 08:20
Recursive send method for Ruby Objects
# Lets you call object.rsend('method1.method2.method3') instead of object.send('method1').send('method2).send('method3)
class Object
def rsend(method, *params)
method.to_s.split('.').inject(self) { |obj, mth| obj.send(mth.to_sym, *params) }
end
end