Gunnar's Blog - TIL

Disable Atom.js Startup Welcome Guide

There is a discreet checkbox at the bottom of the left hand block of text that disable the Atom.js startup Welcome Guide

I've been test driving Atom.js and I like it pretty well. Something I don't like about it, is that the startup welcome guide keeps coming back. After several days of using it, I finally noticed how to turn it off.

In the left hand pane, at the bottom of the text there is a checkbox that disables the Welcome Guide. I think it's pretty hard to see, at least with the dark theme, but just uncheck it and you are good to go.

Tags: til ide development how-to guide tutorial programming

Get great articles about development every month here ⬇️

TIL CSS has a 'Calculate' Function


I don't like to specify layouts in pixels, because display sizes are all over the place. I dislike sniffing the display size and adjusting parameters through javascript, because I feel like the document should take care of all of that for me.

Something that has been bothering me is I find myself specifying heights, widths, margin, etc in em, while I typically specify border in px. Maybe this is bad practice, but it's what I've been doing.

The trouble is when trying to figure out how big something is, I can add up the em, and I can add up the pixels, but I didn't know how to combine them.

Today I learned that you can combine them with the calc() function. calc( 10em + 5px ); will spit out the number.

It's only supported in bleeding edge browsers, but it's a nice feature.

The big gotcha is that you must have a space surrounding the mathematical operator, or it won't get parsed.

Happy Calculating!

Tags: til css html web development web dev web

Get great articles about development every month here ⬇️

TIL SQL Unique Constraints can Apply to Multiple Columns


This is a little embarrassing, considering how long I've been working with SQL, but it's important to never stop learning.

Apparently, you can have a unique constraint that encompasses multiple columns. This is super useful!

I had a problem at work where I have two tables, a parent table

PARENT
--------------
ID

And a child table

CHILD
-------------
ID
PARENT_ID
NAME

I wanted to have each parent have children with unique names. Children don't need to have unique names - you might have a classroom full of Aidens, but every family only has one Aiden. I totally blanked on how to do this. I thought I probably had to craft a check constraint with a query that looked up the parent, but Stack Overflow to the rescue

You can just make a unique constraint that covers PARENT_ID and NAME at the same time

ALTER TABLE child ADD CONSTRAINT multi_unique UNIQUE (parent_id, name)

This probably saved future me from a real pain in the ass - I was worried I'd have to enforce this solely with business rules in the middle tier.

Tags: til sql oracle embarrassing

Get great articles about development every month here ⬇️

TIL Python has Built-in HTML Escaping


TIL that Python has a built in to escape text for html!

xkcd comic about how python makes everything better.  You gotta go to the real site if you want the real alt text

This might be old news, but it makes my life easier! I need to make a quick edit to the template for this blog.

Clearly I've been stuck in the 2.7 world too long!

Tags: til python html development programming wow today-i-learned

Get great articles about development every month here ⬇️

Page 1 / 1