I have to say that one of the reasons I don’t like Facebook is that it sometimes reminds me how well others are doing professionally while I’m stuck in an unemployed funk. I just saw a post from McKinley Melton indicating that he got tenure with a promotion to associate professor. Damnation. I deserve a job too, and baby boy is doing so well. I hate that I am jealous, but I can’t deny it. Probably better to write about something else.

I’ve been working on my coding some more today. Let me try adding a big block of code to this post. That ought to help me feel better about my day.

// Include data for accessing Google APIs

const apiKey = 'AIzaSyANUcTGVdxDjikK-0lMoP3MIOfV_-dxVv0';
const url = 'https://www.googleapis.com/urlshortener/v1/url';
const projection = 'FULL';

// Some page elements

const $inputField = $('#input');
const $expandButton = $('#expand');
const $shortenButton = $('#shorten');
const $responseField = $('#responseField');

// AJAX functions

function expandUrl() {
	const urlToExpand = url + '?key=' + apiKey + '&shortUrl=' + $inputField.val();
  const xhr = new XMLHttpRequest;
  xhr.responseType = 'json';
  xhr.onreadystatechange = function() {
    if (xhr.readyState === XMLHttpRequest.DONE) {
      //console.log(xhr.response);
      $responseField.append('<p>Your expanded url is: </p><p>' + xhr.response.longUrl + '</p>');
    }
  }
  xhr.open('GET', urlToExpand);
  xhr.send();
}

function shortenUrl() {
	const urlWithKey = url + '?key=' + apiKey;
  const urlToShorten = $inputField.val();
  const data = JSON.stringify({longUrl: urlToShorten});
  const xhr = new XMLHttpRequest;
  xhr.responseType = 'json';
  xhr.onreadystatechange = function() {
    if (xhr.readyState === XMLHttpRequest.DONE) {
      //console.log(xhr.response);
      $responseField.append('<p>Your shortened url is: </p><p>' + xhr.response.id + '</p>');
    }
  }
  xhr.open('POST', urlWithKey);
  xhr.setRequestHeader('Content-Type', 'application/json');
  xhr.send(data);
}

function expand() {
  $responseField.empty();
  expandUrl();
  return false;
}

function shorten() {
  $responseField.empty();
  shortenUrl();
  return false;
}

// Call functions on submit

$expandButton.click(expand);
$shortenButton.click(shorten);

I hope this comes out the way I want when I post it to the internet. Sometimes I can’t predict the behavior of what my markdown posts are going to look like, even with the markdown preview function in Atom.

NOTE: It came out perfectly. Now I have figured out how to highlight code in markdown.

Fuck my 500 word minimum just now. I’m really not in the mood to push through. Jealousy has taken hold, and I can’t shake it.

I need to take a shower.

Now it’s some hours later and I am in a better mood. Let me go for my 500-words-per-post goal.

I guess I feel like coding is a future necessary skill for any sort of academic work. We do deal in information, and coding is really a basic necessity for doing anything creative online. But no, let me walk that back a bit. Coding is not necessary for creative work online, but it is a bit like learning how the stuff under the hood works. If I was fully involved in the digital humanities I wouldn’t want to be limited to technologies I couldn’t in some way control. Even if working with a pre-packaged software it would be nice to be able to hack it a bit.

But really what I want to do is to be able to create dynamic educational websites. In many ways, I’m already there. I just need to put the time in to create.