Skip to content

Instantly share code, notes, and snippets.

View asis's full-sized avatar

Asís García asis

  • Trabe Soluciones
  • A Coruña, Spain
View GitHub Profile
import LibraryPen from "some-library";
const SecretNote = ({ pen }) => (
<span>🕵️‍♀️{React.cloneElement(pen, { text: "this is a secret" })}🕵️‍♀️</span>
);
const AdaptedPen = ({ text }) => <LibraryPen write={text} />;
const App = () => <SecretNote pen={<AdaptedPen />} />;
@asis
asis / ruler.js
Last active August 26, 2023 23:41
A simple js ruler
function ruler() {
const ruler = document.createElement("div");
ruler.style.cssText = `
position: absolute;
top: ${window.scrollY + window.innerHeight/2 - 20}px;
left: ${window.scrollX + window.innerWidth/2 - 20}px;
width: 40px;
height: 40px;
background: #ff00006e;