Pew Pew Laser Blog

Code. Glass art. Games. Baking. Cats. From Seattle, Washington and various sundry satellite locations.

OSX Screenshots.

9.30.2017

In Windows, I use either the PrintScreen key or the Snip program for screenshots. But I can never remember the keyboard commands for screenshots in OSX, so here is a quick reference:

Both of the above methods will save the screenshot on your Desktop.

If I'm working in Firefox, I just use the built-in screenshot tools in Firefox too. (The files are saved in Downloads.)

Spinning Up a New GitHub Pages Site.

9.11.2017

Pages might just be one of my favorite things about GitHub. Though I often use them for lists of links to go along with my presentations, they are capable of much more complex static sites.

Here is a quick reminder of how to set up a new GitHub Pages site:

  1. Create a new repo on GitHub.
  2. Don't create any new files yet, even licenses or readmes. If you have already created files, then stash them.
  3. Clone that repo locally and check out a new gh-pages branch (git checkout -b gh-pages).
  4. Pop any files you've stashed. Add any other files you want in your repo.
  5. Commit the changes, and then push the gh-pages branch up to Github.

You're done! You can now view your new page at https://[your-user-name].github.io/[your-repo-name]/.

If you have somehow ended up with a master branch with commits, you can remove it thusly:

Free Images.

8.22.2017

Here are some sources for free images that you can use for your website, presentation, art project or whatever.

There are also companies which will give you free photos or credits on your first sign-up or periodically: iStock, Adobe Stock (fotolia), Shutterstock and Creative Market. And both Google and Flickr will let you search for CC licensed photos.

tinylab Flashlight.

8.2.2017

Photograph of a tinylab - an all-in-one arduino-compatible prototyping board. I've been fiddling around with my tinylab - an all-in-one prototyping board with an embedded Leonardo and a fair selection of components. I'd already got it working with Node and Johnny-Five. Next I wanted to do something which demonstrated interaction between the software and some real-world conditions.

Note that my tinylab (perhaps because it's an early crowd-funded version) doesn't have the breadboard shown in the current production versions of the tinylab. No worries - a mini breadboard (without the connector tabs) fits in there perfectly.

I made a "flashlight" - where an LED gets brighter when the hardware detects less ambient light. Since all the components on the tinylab are already built in, I didn't have to do any wiring. It's pretty easy to test by covering the photoresistor with your finger. Here is the code:

var five = require("johnny-five"), board, photoresistor;
var board = new five.Board();

board.on("ready", function(){

  var led1 = new five.Led(10);

  photoresistor = new five.Sensor({
    pin: "A2",
    freq: 500 // Data is polled every half second
  });

  maxLight = 750 // Set this to the "high" value of light in your room.
  minLight = 250 // Set this to the "low" value of light in your room.
  lightRange = (maxLight - minLight) // Will change for different rooms.

  photoresistor.on("data", function() {

    currentLight = this.value;
    ledValue = (((currentLight - minLight) * 255) / lightRange); 
    ledValue = Math.max(ledValue, 0);  
    ledValue = Math.min(ledValue, 255);

    console.log("Photosensor: " + this.value + "     ledValue: " + ledValue); 
    led1.fade(ledValue, 500); // Smooth transition of LED brightness

  });

});

You'll need to set the maxLight and minLight values for your environment.

With this experiment, you now have a way to read a value from your environment, report it to a computer, and act on it.

Subscriptions.

7.13.2017

I recently bought digital subscriptions to some "newspapers" (Seattle Times, NYT, WaPo) because I believe that creators should be paid for their work, that the news media is important in these political times, and because I wanted to move the motivation equation away from "ads and eyeballs". But I'm kinda disappointed at the less-than-premium treatment of paid subscribers by these organizations. Here are some examples of what I do not want:

Common Resume Feedback.

6.23.2017

A resume is a marketing document. Its job is to get you a phone screen or interview. During that interview, the resume can guide the conversation. Each bullet point should be able to start a story which demonstrates the specific ways in which you are awesome.

When I was unemployed a number of years ago, I learned a lot about resume writing from books, articles, and especially the career counselor that I saw. Because of this, I've offered to review friends' resumes. After a few rounds of this, I've put together the common pieces of feedback that I've shared:

Orphans and Widows in Wider CSS Contexts.

6.6.2017

Currently, orphans and widows aren't supported unless you're working inside paged media or columns. Phooey on that - I've got a few use cases where it would be nice to use it in other contexts.

Multiline Headline.

Here is a multiline headline inside an element whose width leaves just one word on the bottom line: Screenshot of a multiline headline in a width that leaves one word on the bottom line. See a demo. It would be nice if a declaration of orphans: 4; on the headline caused the browser to reflow the text so that 4 was the minimum number of words remaining in the bottom line of the paragraph.

Flexbox.

Here is a group of images arranged with flexbox, and just one lonely element stretched at the bottom of the group: Screenshot of images arranged with flexbox, with one element stretched at the bottom of the group. See a demo. It would be nice if a declaration of orphans: 2; on the flexboxed element caused the browser to try its best to arrange the child elements so that 2 was the fewest number of children at the bottom row.