Skip to content

Instantly share code, notes, and snippets.

@merlinmann
merlinmann / wisdom.md
Last active April 28, 2025 20:57
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@SimeonGriggs
SimeonGriggs / desk-structure.js
Last active February 7, 2023 20:33
Sanity.io – Customize Desk Structure based on User Roles
import S from '@sanity/desk-tool/structure-builder'
import userStore from 'part:@sanity/base/user'
// Get the logged in user
const getCurrentUser = () => {
userStore.me.subscribe((user) => {
// Instead of a local variable, we use this window object to re-use it through the Studio
if (user) {
window._sanityUser = user ?? undefined
}
@steveruizok
steveruizok / getComponents.js
Last active July 16, 2023 22:37
Get components and styles (as full nodes) from a Figma file.
async function getComponents(fileKey, token) {
// Get file
const file = await fetch(`https://api.figma.com/v1/files/${fileKey}`, {
headers: { "X-Figma-Token": token }
}).then((r) => r.json())
if (file.err === undefined) {
// Get style ids
const styleIds = Object.keys(file.styles)
@kmelve
kmelve / create-community-newsletter.js
Created December 8, 2020 23:33
Create Mailchimp campaign document action proof of concept
const fetch = require('got');
const client = require('../client');
const HTML = require('../lib/newsletter-template');
const MAILCHIMP_URL = 'https://us3.api.mailchimp.com/3.0/campaigns';
const API_TOKEN = process.env.MAILCHIMP_TOKEN;
const QUERY = `//groq
*[
@steveruizok
steveruizok / render-state.js
Last active November 17, 2020 14:01
Render a State Designer state in the terminal.
import log from "ololog"
class Grid {
rows = []
width = 0
height = 0
chars = {
active: ["┌", "─", "┒", "┃", "┛", "━", "┕", "│"],
inactive: ["┌", "─", "┐", "│", "┘", "─", "└", "│"],
@joshuat
joshuat / Slack avatar-less sidebar.md
Last active January 19, 2021 08:25
Remove the avatars from your slack sidebar

Slack has listened to feedback and given us a way to toggle off the sidebar avatars.

(This only seems to be available in the Beta channel at the moment)

Display or hide profile photos

  1. From your desktop, click your profile picture in the top right.
  2. Select Preferences from the menu.
  3. Click Sidebar in the left-side column.
  4. Check or uncheck the boxes next to Show profile photos next to DMs.
@wesbos
wesbos / download-shows.ts
Created November 11, 2020 02:07
deno syntax episode downloader
// deno run --allow-net --allow-write download-shows.ts
import { download } from "https://deno.land/x/download/mod.ts";
const showList = 'https://syntax.fm/api/shows';
async function getShowList(): Promise<Show[]> {
const list = await (await fetch(showList)).json();
return list;
}
@poacher2k
poacher2k / Wishy.gift CloudFlare firewall rule
Last active October 30, 2020 11:23
Based on automated requests from attackers, this rule has stopped ~99% of all bad traffic. Add new rule -> "Edit expression" -> Paste -> "Use expression builder" -> Customize
(http.request.uri.path contains ".php") or (http.request.uri.path contains ".env") or (http.request.uri.path eq "/blog/") or (http.request.uri.path contains "wordpress") or (http.request.uri.path eq "/wp/") or (http.request.uri.path eq "/new/") or (http.request.uri.path eq "/old/") or (http.request.uri.path eq "/test/") or (http.request.uri.path eq "/main/") or (http.request.uri.path eq "/site/") or (http.request.uri.path eq "/backup/") or (http.request.uri.path eq "/home/") or (http.request.uri.path eq "/cms/") or (http.request.uri.path eq "/tmp/") or (http.request.uri.path eq "/dev/") or (http.request.uri.path eq "/old-wp/") or (http.request.uri.path eq "/web/") or (http.request.uri.path eq "/old-site/") or (http.request.uri.path eq "/temp/") or (http.request.uri.path eq "/2018/") or (http.request.uri.path eq "/2019/") or (http.request.uri.path eq "/bk/") or (http.request.uri.path eq "/wp1/") or (http.request.uri.path eq "/wp2/") or (http.request.uri.path eq "/v1/") or (http.request.uri.path eq "/v2/") or (
@gatsbyjs-employees
gatsbyjs-employees / Open letter to the Gatsby community.md
Last active February 23, 2021 00:24
Open letter to the Gatsby community

To the Gatsby Community,

We want to start by specifically thanking Nat Alison. We support her and commend her bravery in speaking out. It is not easy to stand alone. What she experienced at Gatsby was unacceptable and speaks to wider issues. We thank her for putting pressure on the company to fix them. We vow to double down on those efforts.

While we have worked hard to give feedback and help create a healthy work environment over the past few years, change has been far too slow and the consequences have been real. The previous weeks have intensified the need for rapid change by increasing employee communication and allowing us to collectively connect some dots. We are just as outraged. As a result, we have posed a series of hard questions to management as well as a list of concrete actions they need to take.

Kyle Mathews' public apologies to both Nat Alison and Kim Crayton are small actions swiftly taken that signal the possibility for change but don't speak to the systemic issues that must be addressed.

@steveruizok
steveruizok / getSegmentCubicBezierIntersections.ts
Last active May 13, 2022 06:32
Get the point(s) at which a line segment intersects a cubic bezier curve.
// Adapted from https://github.com/w8r/bezier-intersect
/**
* Get the point(s) at which a line segment intersects a cubic bezier curve.
* @param p0x The x-coordinate of the curve's starting point.
* @param p0y The y-coordinate of the curve's starting point.
* @param p1x The x-coordinate of the curve's first control point.
* @param p1y The y-coordinate of the curve's first control point.
* @param p2x The x-coordinate of the curve's second control point.
* @param p2y The y-coordinate of the curve's second control point.