week of 04 march

04 Mar 2019

04 mar

Lots happening today. Knocked out the first half of new employee orientation, and I’m still debating if I’ll go back tomorrow for the benefits session since I’ve already enrolled in everything. Maybe there’s something else to glean there?

bash script, MD > RTF

When I got back to the office, I picked up where I left off with trying to set up a command line utility for converting markdown files to rich text format. I found some promising leads, but nothing was as helpful as this post on pandoc, textutility, and pbcopy from ostricher. Most of my time was spent trying to figure out how to add a find and replace action to take care of some weird encoding issue with apostrophes. To see the final script I ended up crafting, take a look at my dotfiles > ~/.bash_profile.

FOLIO dev curriculum, overview/setup

Now I’m working my way through the FOLIO dev curriculum. I installed a bunch of stuff to my new work machine:

I followed all the directions in the curriculum overview for setting up a new directory and starting up vagrant/setting ROOT.

FOLIO dev curriculum, part 1

Followed the instructions for building Okapi. I saw that the next step is to explore the API gateway, so I’m taking a little detour to google/youtube in an attempt to grasp the concept of API gateway as a microservice design pattern. This is all greek to me, so hopefully a few videos and articles will help shed some light on this topic.

Why should you use an API Gateway? was the best video I found. Much simpler than lots of the conference talks out there.

05 mar

Now that I have a rudimentary understanding of API gateways and why they’re a good thing for large applications, I can move my way through the first chapter. I forgot to ssh into vagrant when I opened a new terminal tab, so the curl http request wasn’t working correctly. Must remember to:

cd folio-curriculum
vagrant ssh
cd /vagrant
cd folio-tutorial-working-files
export FOLIO_ROOT=`pwd`

The rest of chapter 1 was pretty self-explanatory.

FOLIO dev curriculum, part 2

I have no idea what’s going on, but I’m following the instructions and getting the correct results, so let’s hope this will all amount to understanding at some point! :crossed_fingers:

06 mar

Started the day reading this tweet about bias in discovery system algorithm bias and following up with reading/youtubes:

adding renovation update box to website

I figured I’d spend the rest of the day working through the FOLIO developer curriculum, but we were assigned a new project! I ended up spending A LOT of time wandering blindly through the wordpress theme trying to figure out how the angular files interacted with each other. Simply finding the angular files was tricky… none of the directories/filenames seem to be following any kind of angular naming conventions.

There is quite a bit of documentation on how to get the wordpress theme up and running on a local machine, but there is just nothing on how all the angular stuff works. I’m baffled by this. It’s now my goal to write some documentation for this monster once I figure it all out. Hopefully my notes here as I go along will be enough to help me piece some stuff together. Since I don’t really understand the code base, I’m going to be writing unit tests to figure it all out. I may not have the time to test everything, but writing tests for the pieces I end up working with will be extremely helpful in the long run. Can you believe there are zero tests for this site? I can’t.

07 mar

I finished up yesterday after having finally figured out where/how to update the homepage template. For whatever reason, the Gruntfile does a bunch of weird stuff I can’t quite decipher yet, and it took me a minute to figure out where everything was compiling. Then when I found that my HTML was indeed being compiled into a JS file, I had to open the source code on my local wordpress build just to realize that caching was in full effect and my code wasn’t loading. After a hard refresh, everything was cool, but it took a long time for me to figure out what exactly the issue was. Hopefully this record will help remind me down the road in case it comes up again.

What needs to go down today:

Articles from today:

wordpress API

It seems like there used to be a plugin that had to be enabled, but the API stuff was merged into wordpress core in May 2018, so that isn’t necessary any longer. This left me sifting through the REST API handbook. The section on retrieving a post seems pretty straightforward, and this is basically what I did when I called the API and got the “not logged in” message.

There’s a whole page in the handbook on authentication. It seems we might need to take this route to use the API from our homepage. Our homepage is served on our wordpress site, but it isn’t wordpress (at least, I don’t think it is). I’ve tried a bunch of stuff to get around authenticating because it looks somewhat painful, but I think I need to set up the request header and API settings in the enqueues… yay. Fun for tomorrow!

I finally got to deploy the meeting minder/timetables app today! Woo! I think it needs some tinkering for usability purposes, but it already looks much better. :thumbsup:

08 mar

Friday before spring break! Woo! Today will be a wordpress learning/focus day. It’s been a loooonnng time since I’ve worked on custom wordpress themes, so it might take a while to get back up to speed. This API authentication business is already stretching my abilities, but it’s also jogging my memory on crucial wordpress files like functions.php and special functions/hooks like wp_enqueue_script and add_action. I’ve never done a JS front-end with wordpress before, so that’s also throwing a wrench in my brain at the moment, but I think once I figure out how all the pieces fit together, it won’t be too challenging to alter/edit.

Anyway. Started off the morning by trying to find some youtubes about the wp API that have come out in the last year. Most of the tutorials for the API I’ve found reference that old plugin, which really isn’t helpful anymore since that plugin was deprecated about 10 months ago and you can’t use it anymore. I found some videos by my fav treehouse guy Zac Gordon which are kind of helpful but maybe too much for what I’m trying to accomplish:

After watching those videos, I started flipping through the functions.php file and realized there’s a whole code block on authentication for the WP API. We’re the ones blocking GET requests! Ha. I agree that we don’t want randos making POST/DELETE calls, but how might I write some conditional logic to allow GET requests without authentication?

For now, I’ve removed those lines from the file, but it looks like there’s a way to filter requests based on the API endpoint/route. I will try to follow this stack overflow answer to require auth for POST method on the /posts endpoint: WP REST API require password for GET endpoint

Before I get to that, though, I’m going to work on pulling in the JSON data from the posts to populate the new renovation box on the homepage.

This is turning out to be trickier than I thought it would be! I ended up creating a local html page with the module/controller in it to make sure I understood the fundamentals of $http service and using controllers with data. Not too complicated, so that was cleared up pretty quickly. What I’m struggling with is where to load my new module. This dang Gruntfile is so complicated that I can’t tell where exactly I need to put my javascript in order for it to compile and load correctly. I guess I’ll just start inserting stuff in different files and see what breaks it! :grimacing::satisfied:

I started digging through the files again, and I haven’t even altered anything yet because I legit can’t figure out where any of this connects. After some extensive googling, I read the Angular 1.2.28 docs on Modules and read about the convention of naming reusable components using the dot naming convention, which at least explains why so many modules are named ualib.xyz. Unfortunately, I still haven’t figured out where those other modules are coming from. The main module that lists all the required modules is in /assets/js/_ualibs.js, but I cannot figure out where the other modules are. I found some of them (custom ualib apps) in the /assets/vendor directory, but what about ones like ualib.templates and ualib.databases? Can’t find those anywhere.