Thursday, June 7, 2018

floating with both sides aligned

For work, I was tasked with making a prototype that looked like the illustration. For the small thumbnails, I was pretty happy floating them:
  .smallpanel {
    width:50%;
    float: left;
  }

But they images were nestled up to each other, with no margin - but if I added a margin, then one side or the other might not line up with fullsize image above!

This seemed to work well:
  .smallpanel {
    width:49%;
    float: left;
  }

  .smallpanel:nth-of-type(even) {
    float: right;
  }

I guess the even tricker case of 3 images with the same kind of alignment might use the nth-child pseduoselector, something like nth-child(3n+1).

(Note that this is somewhat easier if you're using box-sizing: border-box;)

Followup: I should get more fluent with flexbox, "justify-content: space-between;" might about what I'm looking for and works for larger numbers of boxes (After checking in with Can I Use...) - see a working Codepen (inspired by this coworker's)

Tuesday, June 5, 2018

get rid of the random ransom note

Mac Users! Tired of seeing an ugly "ransom note" effect when you copy and paste some text, and the system "helpfully" tries to keep the old font and color info? Try this:

  • Open up System Preferences | Keyboard
  • Go to Shortcuts (tab) | App Shortcuts (left column) | All Applications (right column)
  • Hit the + button
  • Enter "Paste and Match Style" (exactly as it appears in the Edit menu dropdown) for "Menu Title" and then hit cmd-V in the "Keyboard Shortcut" box, then click "Add"
Voila. Any app that supports "Paste and Match Style" will now just paste the damn text as text, and you can stop pasting into an intermediate text app (or in my case, browser address box) to avoid your document from devolving into a crazy pastiche of colors and fonts. (Why this isn't more of a clipboard-level default, I'll never know. It's hardly ever helpful - just feels like OS developers trying to show off.)

2024 Update
  • go to System Settings
  • type "Keyboard" and open
  • scroll down to Keyboard Shortcuts...
  • Go to App Shortcuts (left column) | All Applications
  • Follow final two steps above

Monday, June 4, 2018

the long and lat of it

I have to think a bit about Latitude and Longitude to do Porchfest website maps - especially when I try to tweak their position in an X/Y axis kind of way. The other day I posted on FB
Honestly the only way I keep track of Latitude vs Longitude is the old beer commercial (Corona?) that says "change your latitude", i.e. think in a more southernly climes way...
Some of my friends responded with some interesting devices to remember which is which:
  • Liz: "Longitude is long. Latitude is Fat."
  • Dave A: "Latitude lines are horizontal like the rungs of a ladder. That's how I have always remembered it, even though that's a stretch of a mnemonic."
  • Tim: I remember learning it with the second-letter correspondence... L(A)ttitue runs e(A)st to west. L(O)ngitue runs n(O)rth to s(O)uth.
I tried visualizing all of these, but none of them seem helpful. I realize maybe it's because I'm a "interactional" thinker - each of these describe how the lines look when inscribed on a globe (latitude is fAT, or like lAdder rungs, or running EAst to West) but my visualization is more "what number changes as I travel north to south, say?" - kind of the exact opposite of Tim's method.

I think this may be an example of "nouns vs verbs" thinking. I feel it's a spectrum for many folks - probably "bathtub curve" shaped. It's pretty abstract, but I think many programmers think in nouns, and they're the ones who love Object Oriented programming, and Declarative program -- "lets start with what you are, and then fill in what you do, or how you do it" while I'm always more concerned with "what are we doing, how are we interacting".

Wednesday, May 30, 2018

fullpage screenshots

For doing print layout in a webpage, I used to use phantom.js for screenshots bigger than my monitor, but it was always pretty fiddly, and bad at showing you the problem if something went wrong.

Now it seems much better to just use a chrome plugin - FireShot seems like a decent one. It zips around the screen and gives you several options for saving the results, including a simple download as a PNG.

Sunday, May 27, 2018

better living through google docs

Local governments making life better with cheap and cheerful technology. I tend to build all this crap in PHP 'cause it's easy and I'm a little bit of a control freak, but it's nice to think about options for people who aren't quite as geeky.

Wednesday, May 23, 2018

tricks from class

Not a lot to say these days - I've learned a lot about React and Redux but nothing I feel sure enough about to be teaching on.

A few tricks I learned in class on it- in Chrome's Developer Tools, if you use the "Select an element on page to inspect it tool", you'll see a "==$0" next to it, which means "$0" is an object you can refer to by that name in the console.

Another handy thing was the sort-by js library - seems like a pretty friendly way of establishing the field order you want to use to sort objects.

Finally, DOMListener seems like a good chrome plugin.

It is a little weird how dependent life for developers is on Chrome, and tools in general. React can be great because you have a clear tree with a single root for your whole widget, and there are React and Redux plugins to view that - but also, you kind of need that, in the same you need to embrace webpack etc and get away from life of just using <script src=""> for all your .js needs...

Thursday, May 3, 2018

somewhat hip sliding underline tabs w/ animation

Coworker wanted me to implement this little sliding tab thing and I did, and it's ok, but not very robust code... (I mean, the example doesn't work unless you have those comments between each li? really?) I had to add a class to the entire ul thing to make the underline stick in place as well.