As I mentioned yesterday, I’m getting tired of manually uploading files to S3 to share. Today I wrote a short bash script to handle this task in one simple command: pp-upload <filename>.
While looking at a bash script isn’t pretty I’ll throw it up here.
if [ -f $FILE ]; then
aws s3 cp $FILE s3://$BUCKET/ --acl public-read
echo "File $FILE does not exist."
if [ $# -eq 1 ]
echo "script takes one argument - the file"
Bash has so many weird gotchas, it always takes me longer to write bash script than I expect. Today I ran into something weird where assigning the results of “basename $FILE_PATH” to a variable was unsetting $FILE_PATH. I had no idea why this was happening and given the 20 minute time restraint I didn’t have time to figure it out. If anyone reading this has a theory I’d love to hear it.
- Bash Scripting will take longer than I expect. In the future I’ll need to budget more time for tasks then I intuitively think I need.
- There’s a significant amount of boiler plate code for a basic script. I wonder if making a skeleton code generator script would be useful here.
I’m quite happy with this one. This is definitely my most useful project yet. I’ve symlinked this script onto my PATH and will be using this script frequently for future blog posts. For tomorrow’s post hopefully I’ll get to test it out in practice.
You can see the results here. I was able to apply some of what I learned in my first project. In fact I directly referenced it when applying the flicker effect to the box shadow.
- I spent a good chunk of my time wrapping my head around working with time in a more functional way. I view this as a positive as my goal for this mini project was to better grok elm time.
- I definitely don’t have muscle memory for spelling “millisecond”. I should set up auto complete for elm in my text editor so I don’t have to get distracted with something as simple as typing.
- I should use more “let/in” syntax in my elm functions. They really clean up the code and make it more reusable.
Overall I’m happy with the results of todays project. I’m getting a little tired of manually uploading html files to S3 for this though. I think for my next project I’ll write a script to automate that!
For Day 2 I decided to do a simple HTML page with some CSS styling. Specifically I wanted to use flexboxes. Flexboxes have become a valuable tool for website layout over the past few years. I put off trying them for far too long so for my 20 minute project today I decided to do a simple little web page that makes use of them.
You can see the result here. I actually finished setting up the flexbox layout before the 15 minute mark. I spent the rest of the time just fiddling with settings
- I finished this project with too much time to spare. In the future I’ll try harder projects
- My text editor (VIM) it not set up well for writing HTML. Spending some time to improve my setup for HTML may be a good investment if I plan to do more plain HTML in the future.
- A month ago, I made flash cards with Anki to help me memorize CSS attributes and syntax. I didn’t remember as much as I’d hoped. I wonder if setting up some sort of spaced repetition pseudo programming environment would be a better system to memorizing syntax.
That sums it up for day two. Stay tuned.
Hi all, welcome. I plan to use this space to document my new project. The plan is every day I will complete a 20 minute programming project. Usually, I pour hundreds of hours into projects before I share them. My goal here is to force myself to be as efficient as possible with my time and overcome the fear of sharing my creations (and failures).
- Pick a well scoped independent project to start (and finish) in a 20 minute time frame
- Code like crazy for those 20 minutes
- Write a post mortem blog post in no more than 20 minutes.
Rules and Restrictions
- Each project must be independent (eg adding authentication to a specific site is not a project in this context)
- Projects may be tools or libraries that I can employ in future projects. (eg creating an authentication module that I can import into any future project).
That about sums it up. I’m off to start my first project. Wish me luck!
I started small today. I used elm to make a simple animation on a div’s box shadow. The x coordinate of the mouse controls the vertical offset of the box shadow.
You can see the results here. I have to confess I had compiler error at the 20 minute mark and it took me another minute to fix. So although I did take 21 minutes I’m counting it as win.
- Twenty minutes is very short
- being smart with what you Google can save you a lot of time.
- the more of your tools you can commit to memory the faster you’ll be able to work
I think that last observation is the most important. To be a highly effective software developer you must know your tools extremely well.