I keep seeing versions of this on different sites and only remember it while I'm working on another project. It is easily customized to your own ideas, but step-by-step this is how I made my own Sewing Machine Pin Cushion.
Two 2" x 4" scraps of fabric
One set of hook and eye latch
Needle and thread
Small amount of stuffing
Start with one of your 2" x 4" pieces of cloth.
With the pattern side facing down, fold each long side in to the middle and pin. The edges should only overlap a little tiny bit.
After that, you're going to pair the bottom edge up exactly the same, pin, and sew. You'll have a tube with one short, flat side, and one large, extra fabric side.
Stuff it with stuffing, leaving a half inch or so on each end without any stuffing in it.
Cut two pieces of elastic longer than you know you'll need to reach around the back of your sewing machine. You're going to attach one to each end of the pin cushion, and then fasten at the back of your machine with your hook and eye latch.
On each end of the cushion you're going to fold the raw edge inside. You can leave this a long end, or fold some inside as shown. In these photos I hadn't stuffed the cushion yet, but afterwards I realized I should have done that first. After you've folded the ends so there is no raw edge, pin them.
Holding the cushion in place in front of the machine where you want it, and pull elastics around back to measure how long you'll need them to be. Cut to length.
Fasten hook and eye to each end of elastic.