Skip to content

Instantly share code, notes, and snippets.

@jebeck
jebeck / README.md
Last active May 30, 2023 05:03
SVG foreignObject tooltips in D3

SVG foreignObject tooltips in D3

Just a little proof-of-concept here - using an SVG <foreignObject> element as a container for a tooltip that can involve handy HTML features like text-wrapping and (semi-)dynamic sizing.

Gotchas so far:

  • Like an <svg> element, a <foreignObject> element needs a width and a height in order to be rendered.

  • However, specifying width and/or height can be delayed. Here I specify a width (foWidth) of 300px, then find the height of the contained <div> using getBoundingClientRect() and use that to specify the height of the containing <foreignObject>.

@visnup
visnup / talk.md
Last active December 19, 2015 09:59
Was chatting with @dshaw about teaching design to engineers. He asked me if I wanted to give that talk or workshop. I said no, but then of course was thinking about it after...

Design 101 for Engineers

  • design (and everything) is teachable

    • if you hear an engineer say, "I'm really bad at design," it's the same as hearing someone say, "I'm really bad at math"
  • focus on simplicity

    • should make your life implementing simpler too
  • people's brains are bad at doing many things; don't overly burden them

  • eg, interface with so many calls to action that no one knows which to use

@visnup
visnup / .gemrc
Last active December 16, 2015 07:18
dotfiles .profile .gitconfig
install: --no-rdoc
@visnup
visnup / id_dsa.pub
Created August 10, 2011 03:56
my public ssh key. yay.
ssh-dss AAAAB3NzaC1kc3MAAACBANuU42yktRzN/NMEA6mABmTO5ktVoMHcEV34k0aAntOGg3axhDV29gA+VXH5X5wPIMvm/Ua/bt3YURpxoy+auWd8h8dXjj1C8+f0Zbhwr+uZqKRYdxqKRkwlnc7tzu6VHEdS8qwwwMKr5vZ6djSJl4bKEiGX4Ms7TflUOuYMGIL9AAAAFQCu2MwxtR6VnWLkCActtYAVKEegbwAAAIAO5wRvfJG1pzkcNQoVaMjxB6/fKS2U8mAYD0AsnKYOHFBYA4BMeUrOi9qG3OhmGEuISA8vduJZq8J9uK52mXFkx9+JmpnGdUYMdAaPA/BcaFnja2x+PSlxYcSk+GHFUqk1L5m5EdSbG08+QnNHFHFHt0f8qtg2hF0B2Kp0M6a2iAAAAIB5A6D8dGJzIkXm46IeRPaLpbO7QplJQEJ0mydpHNFph/koWeWTmVvKYIzDvuWnCKGPfB/ZkB6z6Id44JSobh0Qhlgfi/eLaJmHodiIF8CBJZEEA4UpuFAcHtBVNShBVwolSkn8YvMmI3TkQl9KBtwge+V6QZVs+BoqRYfIL+rbAg== visnup@visnu
@visnup
visnup / README.js
Created November 15, 2010 21:36 — forked from igrigorik/webapp.rb
node.js version inspired by igrigorik's any ruby object, as a webapp! 'cause we can too.
#!/usr/bin/env node
var http = require('http')
, webapp = require('webapp');
http.createServer(webapp.bind([])).listen(8000);
// ^^^^^^^^^^^^^^^
// | (x)
// ROFLSCALE DEQUE ---/
@visnup
visnup / fish_prompt.fish
Last active March 6, 2016 00:40
bash prompt
function fish_prompt --description 'Write out the prompt'
set git_sha (git rev-parse --short HEAD 2>/dev/null)
set git_branch (git rev-parse --abbrev-ref HEAD 2>/dev/null)
set git " $git_sha $git_branch "
if [ $git = ' ' ]
set git ''
end
set length (echo [ 00:00 AM -$git(prompt_pwd) ] | wc -c | tr -d ' ')
set fill (printf '%*s\n' (math (tput cols)-$length) '' | tr ' ' –)