Adding SASS to the dotnet React template

Out of the box, ASP.NET’s JavaScriptServices app generator has gotten pretty good. It gives you a decent starting point (if you like TypeScript) and even has a react-redux template. It doesn’t, however, come with any css extensions like SASS. There’s a not very user-friendly description in the docs of how to add it, but here’s the quick and dirty of how to add SASS to your project.

Disclaimer: This will not include hot module reloading for the scss files. ūüė≠ This is very lame, but it’s discussed here that it’s better to build your css the same way in dev and prod (rather than using different loaders for the two environments), so until there’s a valid loader that can do both, this is the method they recommend.

  1. Install the required modules
    Using npm:

    npm install --save-dev node-sass sass-loader
  2. Update the webpack config(s)
    Find the rules block in your webpack config that are testing for /\.css$/ files. Modify that line to:

    { test: /\.s?css$/, use: ExtractTextPlugin.extract({ use: isDevBuild ? 'css-loader!sass-loader' : 'css-loader?minimize!sass-loader' }) }
  3. Rename your file(s)
    The default app has a file called “site.css” in the /css folder. Rename this to “site.scss”.
  4. Update your reference
    Wherever you are including your css into your app (by default, it’s in boot-client.tsx), change that reference to match your new file name:

    import './css/site.scss';

    Psst: DON’T change the file name in your webpack.config passed to the ExtractTextPlugin; that is specifying the name of the output file.

  5. Run your app, and load in a browser
    Run on the command line by using “dotnet run”, then open a browser to localhost:5000, or whichever port is specified. If your app is building in Production mode (it will say in the blurb when it boots up), then you can set the environment flag by running:

    SET ASPNETCORE_ENVIRONMENT=Development
  6. Add some SASS 
    At the top of your new .scss file, test it out by adding a variable, and then abuse that variable:

    $hideous-color: #f0f;
    
    body {
        background-color: $hideous-color;
    }
  7. Reload your app in the browser

You are now cookin’ with SASS. Terrible pun intended.

How To Delete iPhone Photos Except Favorites

Since I have a new baby, it’s no surprise that my iPhone is out of storage. I have backed everything up on my computer (and Google Photos as a back-up backup) so it’s time to delete them off of my phone. Except I don’t want to delete ALL of them; I have several albums I’d like to keep, and specifically, photos I’ve marked as “favorites” I’d like to keep after the purge.

How do you do this without deleting photos one by one? It’s a multi-step process.

  1. Hide the photos you want to keep
  2. Select all (unhidden photos) and delete
  3. Un-hide the photos you wanted to keep¬†and you’re done!

Here’s a breakdown.

Hide the photos you want to keep

There are a couple ways to do this on my current iOS (iOS 10.2). If you want to hide an entire album, open that album in the Photos app (on your phone), click “Select”, and click “Select All”. Then click the export icon, and at the bottom of the export screen there’s a “Hide” option. Do this for any albums you want to keep, including Favorites.

If you’d rather hide a single photo, tap on it to view as normal, and click the export icon. Then you can click the hide icon at the bottom.

Delete the ones you don’t

If you’re in “Albums,” including “Camera Roll,” you will still see your hidden photos. Go to “Photos” on the bottom to hide your hidden photos. Then click a category until you see the “Select” option appear at the top. Click “Select”, then¬†click “Select” next to each day¬†until you have selected everything you want to delete. You can hit the trash icon periodically to delete what you have selected so far. This is also a handy way to un-select anything you missed hiding but still want to save. Be sure to tap the trash can at the end to delete everything¬†you have selected. I wish there was a way to “Select All” that are remaining; if you figure out a way, post a comment!

To clear out the space on your phone immediately, go back to Albums, and Recently Deleted. Click “Select” then “Delete All” to remove them permanently. If you’re nervous, you can save this step until after you unhide the ones you’re saving.

Unhide your photos

You’re almost done! Click on the Hidden album, “Select”, “Select All”, export icon, and “Unhide”. Now they should all be visible again in your Collections.

Success! Storage space achieved.

DIY – Caulking Large Gaps

In both of our houses, we have had the need to caulk a large gap. One was a poorly installed countertop, the other a tub. In one case the wall was bowed, causing one or more spots to be larger than the rest.

If you try to just fill these gaps with silicone caulk, there’s nothing for it to grab on to, and as it dries it caves in. So what do you do about it?

Turns out there’s a magic solution called a backer rod. It’s a soft foam tube in various sizes that you cut and stuff into the gaps (1/4 inch down)¬†so you can caulk on top of it.

br1

Tub gap with old caulk removed, and with backer rod inserted

br2Now you can cover gaps to you heart’s content! (awaiting cleanup)

br3

Granny Square Pixel Blanket

One of my projects for my baby-to-be is a large crochet granny square blanket, with a pixel portrait of baby Yoshi on it.

I’m about 15% done so far; may or may not finish by May. Either way, it’s a fun project you can work on a little bit at a time, and I have created a YouTube playlist featuring the project start-to finish.
granny1

Since I know not everyone (including me) likes to watch videos unless I have to, I’ve written up a summarized transcript of them here. The videos do go into more detail, so if you have the time or need some further info (or visual help), please do watch them.

If you undertake your own pixel blanket, I’d love to see the progress!

Intro – Granny Square Pixel Blanket

In this first video, I explain how I created my Yoshi pattern, and how to calculate how big your blanket will turn out.

If you already know what character you want to use, the first step is to find a sprite (small, clear, pixel image) of the character. A great place to look is The Spriters Resource, where you can look up sprites by system, and game.

Once you have your sprite chosen, you can throw it in some pattern software, or create a pixel pattern by zooming in on the image, or by drawing it on graph paper. If you want more detail on how to create patterns using pattern software, check out this video.

To determine the finished size of your pattern, count the number of pixels wide and tall it is, and multiply those dimensions by how big one of your finished squares will be. To be really accurate, you will need to stitch a square with the type of yarn and hook you plan to use for the blanket, and measure it. My gauge square came out to 3.5″ x 3.5″.

Since my pixel image was 16 x 16, this would make a square blanket of 56″ x 56″ with no additional border. Since I wanted it to be rectangular, and be about the size of a twin sized blanket, I added two rows of border to the sides, and 4 rows to the top and bottom. This makes my finished pattern 20 x 24, and the blanket size 70″ x 84″. I used this chart to reference what size standard blankets are.

Making a Granny Square – Part 1

granny2
(Abbreviations: Ch – chain, Sl St – slip stitch, Dc, double crochet)

Round 1:

Start by tying slipknot on your hook with a long tail (~6 inches).
Ch 4.
Sl St into first chain to create a loop
Ch 3, then Dc 2 into the center of your loop
Ch 2 to make the first corner
*Dc 3, Ch 2* 3 times, all into the center of your loop
Sl St to join to the 3rd chain of your original Ch 3.

Making a Granny Square – Part 2

granny3
Round 2:

Ch 3, turn your work
Dc 2, Ch 2, Dc 3 in the corner gap
Ch 1
*Dc 3, Ch 2, Dc 3 in the next corner, Ch 1* three times
Sl St to join to the 3rd chain of your original Ch 3.

Making a Granny Square – Part 3

granny4
Round 3:

Ch 3, turn your work
Dc 2 in the center gap
*Ch 1, Dc 3, Ch 2, Dc 3 in the corner, Ch 1, Dc 3 in the center* three times,
Ch 1, Dc 3, Ch 2, Dc 3 in the corner, Ch 1, Sl St to join to the 3rd chain of your original Ch 3.

Making a Granny Square – Part 4

granny5
Your square is complete! Time to tie off the ends. Pull the center tail to close up the hole in the center of your square. Then use a sharp yarn or upholstery needle to weave it in completely around the center circle 1-2 times. For your last stitch, go back in the opposite direction to really lock it in.

For the upper tail, to weave it in seamlessly, sew the tail from back to front under both loops of the center stitch (in the middle of the center shell). Then, take the needle down through the center of the chain stitch to the right of the shell. Then, weave in the end down toward the middle of the square and back up toward the edge. Trim your tails up against the square.

Hidden, Flat, Reversible Granny Square Join

This one was a method I created myself, after trying several other join methods and not being happy with the look. I do recommend watching this one so you can see what I’m describing, but I’ll take a stab at putting it into words in its own blog post with some pictures.

Update: Finished blanket! 4/19/16
granny6