Skip to content

Instantly share code, notes, and snippets.

View nrrb's full-sized avatar
:shipit:
Learning

Nicholas Bennett nrrb

:shipit:
Learning
View GitHub Profile
@nrrb
nrrb / doc.markdown
Created March 5, 2026 20:20
Web App to Figma

Web Page → Figma Snapshot Import

Screenshot background + editable rectangles (fills/borders/shadows) + editable text

Goal

Capture a web page “as-is” (at the time of capture) and import it into Figma with minimal manual work while retaining meaningful editability:

  • Pixel-perfect visual baseline via a PNG screenshot (locked background)
  • Editable rectangles for DOM elements with:
# singleton.py
class Logger:
"""Simple singleton logger."""
_instance = None
def __new__(cls):
if cls._instance is None:
cls._instance = super().__new__(cls)
cls._instance.logs = []
return cls._instance
@nrrb
nrrb / Cognitive biases in car buying.md
Created July 15, 2024 03:44
Cognitive biases in car buying

The Nicholas Bennett Guide to Empowered Buying

Cognitive Biases in Car Buying

  1. Sunk-Cost Fallacy: Feeling like you need to buy the car because you’ve already spent so much time at the dealership.

  2. Anchoring Bias: Getting stuck on the first price you hear and letting it shape all your other decisions.

  3. Confirmation Bias: Only paying attention to information that supports your desire to buy the car you want.

  4. Availability Heuristic: Basing your decision on a recent story or experience, like a friend’s good or bad deal, rather than the full picture.

@nrrb
nrrb / Cognitive biases in car buying.md
Created July 15, 2024 03:43
Cognitive biases in car buying
<title>Cognitive biases in car buying</title>
@nrrb
nrrb / scrolling_spectrogram.java
Created November 7, 2023 17:55
Scrolling Spectrogram in Processing using Sound library
import processing.sound.*;
FFT fft;
AudioIn in;
int bands = 512;
float[] spectrum = new float[bands];
void setup() {
size(512, 600);
background(255);
@nrrb
nrrb / circles.tex
Last active November 30, 2019 06:49
Using LaTeX to make circles on an equilateral triangle grid. Seed of Life Coloring Book.
\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage[left=0cm,top=2cm,right=0cm,bottom=0cm,nohead,nofoot]{geometry}
\usepackage{xcolor}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\r}{3}
% Given that A4 paper is 21cm x 29.7 cm, we can calculate the maximum number of circles that will fit on the page based on the radius
@nrrb
nrrb / nrrb.py
Created November 1, 2019 16:51
Making silly phrases out of initials
from random import choice
from functools import reduce
with open('mobypos.txt', 'r', encoding='latin1') as f:
moby_words = [line.strip() for line in f.readlines()]
words = [dict(zip(['word', 'pos'], moby_word.split('\\'))) for moby_word in moby_words]
pos_key = {
'Noun': 'N',
@nrrb
nrrb / r-rstudio-tinytex-faq.markdown
Last active January 8, 2019 19:15
FAQs related to installing R, RStudio, TinyTeX at Kellogg

FAQs for Installing R, RStudio, and TinyTeX

@ Kellogg School of Management

1. /usr/local/bin not writable

I see this error when I install TinyTeX:

add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/hagen/Library/TinyTeX/bin/x86_64-darwin. add of symlinks had 1 error(s), see messages above. add of symlinks had 1 error(s), see messages above. tlmgr: An error has occurred. See above messages. Exiting.

This is an issue on some Macs, where that folder /usr/local/bin is not writable by your user account for some reason. Here's how to fix it:

@nrrb
nrrb / beer_menu.thor
Created January 27, 2018 04:59 — forked from cadwallion/beer_menu.thor
Ruck beer list scraper
#!/usr/bin/env ruby
# A Thor-based commandline tool for all BeerMenu.
# Based on @jsteiner's Ruby equivalent of @jlet's Python Ruck
# beer list scraper
# @jsteiner's Original: https://gist.github.com/2703889
# @jlet's Original: ttps://gist.github.com/2659721
require 'open-uri'
require 'nokogiri'
@nrrb
nrrb / ruck-beer.py
Created January 27, 2018 04:58 — forked from jletourneau/ruck-beer.py
Ruck beer list scraper
#!/usr/bin/python
from pyquery import PyQuery as pq
import re
import datetime
print datetime.datetime.now().strftime('%c')
print
doc = pq(url='http://www.beermenus.com/places/4733-the-ruck')