Skip to content

Instantly share code, notes, and snippets.

View danrichman's full-sized avatar

Dan Richman danrichman

View GitHub Profile
@danrichman
danrichman / copy-html-css-bookmarklet.js
Last active February 4, 2025 16:11
Copy Selected HTML/CSS Bookmarklet
javascript:(function()%7Bconst highlight=document.createElement('div');highlight.style.cssText=%60%0A position: absolute;%0A background: rgba(78, 146, 249, 0.3);%0A border: 2px solid %234e92f9;%0A pointer-events: none;%0A z-index: 999999;%0A transition: all 50ms;%0A box-sizing: border-box;%0A %60;let selectedElement=null;function processCSSRule(rule,elements)%7Btry%7Bif(rule instanceof CSSStyleRule)%7Breturn processStyleRule(rule,elements)%7Dif(rule instanceof CSSMediaRule%7C%7Crule instanceof CSSSupportsRule)%7Breturn processConditionalRule(rule,elements)%7Dif(rule instanceof CSSFontFaceRule)%7Breturn processFontRule(rule)%7Dreturn ''%7Dcatch(error)%7Breturn ''%7D%7Dfunction processStyleRule(rule,elements)%7Bconst selector=rule.selectorText?.replace(/%5Cs*%5C%7B.*/,%27%27)%7C%7C%27%27;if(!selector%7C%7C!elements.some(el=>el.matches(selector)%7C%7Cel.closest(selector)))%7Breturn %27%27%7Dconst styles=Array.from(rule.style).filter(prop=>%7Bconst value=rule.style.getPropertyValue(prop).trim();return value&&!
@danrichman
danrichman / keybase.md
Created September 16, 2019 01:51
keybase.md

Keybase proof

I hereby claim:

  • I am danrichman on github.
  • I am dric (https://keybase.io/dric) on keybase.
  • I have a public key ASCXPG5LGM83zYHNdmnQgka3_SnIc6yGfUxP-hkHP3V7aAo

To claim this, I am signing this object:

@danrichman
danrichman / homepage.marko
Last active February 8, 2016 02:05 — forked from adammcarth/homepage.marko
Navigation bar component in Marko JS
<!-- /src/pages/homepage/homepage.marko -->
<layout-use template="../../layouts/layout.marko" navbar-current="home">
<layout-put into="body">
...
</layout-put>
</layout-use>
@danrichman
danrichman / palinquotes.php
Last active January 25, 2016 13:30
Sarah Palin Fictional Quote Generator v1.0
<?php
/*
* Sarah Palin Fictional Quote Generator v1.0
* Demo: http://palinquotes.herokuapp.com
*
* MIT License:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal