Skip to content

Instantly share code, notes, and snippets.

View jmegs's full-sized avatar

John Meguerian jmegs

View GitHub Profile
import * as React from 'react'
import { SpringValue, easings, useSpring } from 'react-spring'
/**
* Hook that animates height when args.animationKey changes
*
* Ex:
* const animatedBlock = useAnimatedHeight({
* animationKey: key,
* })
@PixelJanitor
PixelJanitor / SafariRDMTailwindBreakpointPresets.txt
Last active May 18, 2023 06:00
Tailwind Safari responsive design presets
defaults write ~/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist ResponsiveDesignCustomPresetConfigurations '(
{
rotated = 0;
screenHeight = 1200;
screenWidth = 1280;
userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15";
},
{
rotated = 0;
screenHeight = 1540;
@cmod
cmod / hugofastsearch.md
Last active June 2, 2024 10:05 — forked from eddiewebb/readme.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

const puppeteer = require("puppeteer");
let waitTime = 5 * 1000;
async function testAjax() {
const url = "https://www.notion.so/Test-page-all-c969c9455d7c4dd79c7f860f3ace6429"
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setRequestInterception(true);
// those we don't want to log because they are not important
@sskylar
sskylar / netscape-bookmark-file.html
Created May 15, 2018 20:12
Dropmark-friendly import file in the Netscape Bookmark File format https://tools.dropmark.com/import
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Dropmark Import</TITLE>
<H1>Your Bookmarks</H1>
<!-- Minimum requirements (edit below) -->
<H3>Collection One</H1>
<DL>
<DT><A HREF="https://www.google.com">Google</A>
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@micahgodbolt
micahgodbolt / wsl_install_node.md
Last active December 22, 2022 09:37
WSL install Node

The apt-get version of node is incredibly old, and installing a new copy is a bit of a runaround.

So here's how you can use NVM to quickly get a fresh copy of Node on your new Bash on Windows install

$ touch ~/.bashrc
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
// restart bash
$ nvm install --lts
@jescalan
jescalan / post.sgr
Created December 1, 2016 15:54
Almost pure markdown, but infinitely more flexible
extend(src='layout.sgr')
block(name='content')
.post(md).
# A markdown post
Here you can write **pure markdown** without issue.
You can treat this entire block like it's a normal markdown file and it will be compiled as such. Pretty cool! Everything works -- headlines, links, etc.
.footnote What's nice is that if you need to inject some extra html, javascript, add another block to change the title, etc. this is very simple to do since you have the capability to write full html with a reshape file as opposed to markdown.
@bendc
bendc / easing.css
Created September 23, 2016 04:12
Easing CSS variables
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
@kentbrew
kentbrew / pinmarklet.md
Last active April 9, 2024 18:34
How to recreate your long-lost Pinterest bookmarklet.

How to recreate your long-lost Pinterest bookmarklet.

Right-click your bookmarks bar and choose Add Page (Chrome) or New Bookmarklet (Firefox).

In Name, put this:

Pin It

In URL, put this: