12

Making an Index Using Javascript

Working with a faculty member we had a rather long page that was originally written in Google Docs. It had many sections that were (mostly) designated by H tags of various denominations. The goal was to and put it on a website quickly build an index of anchor links. I did not wish to do the index portion by hand. With javascript things like this are relatively pleasant. You can see the whole thing in this codepen but I’ll break it down a bit below. First we can get all the H tags with querySelectorAll. I can console.log(headers) and I’ll see a NodeList of all the headers it found. I tend to work console.log all my variables as I go just to make sure it’s really happening the way I think it is. My next move is to add an id to each of these headers so that we can navigate to them via anchor links. with this forEach loop each header will get an id of header-whatever number we’re on in the loop. Now that I have headers that I can link to as anchor links, I need to build the index and put it somewhere. In this case it was easy for me to add a div to the source manually so I did. That will be where […]

Google Sheets Data Flow

This is a pretty specific thing but the concepts ought to be broadly applicable and interesting for the 3 to 5 people who will end up reading this. It’s a fairly amusing blend of less standard Google Functions and a bit of Google Script to do something fairly decent that had been quite a bit of hassle to do previously. We have Social Work students who are assigned to various supervisor/liaison people. There are a lot of students. We wanted students to be able to submit a form to Google Drive and we’d keep track of all this and show only the relevant data to the various supervisors. Files from Form Setting up a form that requires you to be logged in and accepts files is now very easy in Google Forms. It also remains easy to log that information to a spreadsheet associated with the form. Merging the Data The student email address became the unique ID that would allow us to tie the form submission to the list of students and their programs, liaisons etc. Now we needed a formula to link these two sheets via email. I started with =VLOOKUP but that would have required the student email to be the leftmost column in the data and that would be awkward for other things. After some banging […]

Footprints leading to the horizon in the snow.

Starting to Think Through a Mapping Theme with ACF

We’re working with Dr. Nicole Turner on a mapping site that will accompany her upcoming book. There’s a lot of specifics there which we’re considering while trying to walk the fine line where what we make is also something we’ll be able to use with other people down the road. We want to generalize but not too much. I’m sketching out some early thinking here as a way to document it personally and to share it with Jeff (who’s thinking through the javascript side of things).1 Thinking About the Data It seems that any mapping project would have three basic data types– People, Locations, and Events. People because humans are usually important in these scenarios. Locations being important in mapping and events for things that have limited duration. Matt described it well as the Who, When, and Where. Those types could be associated with each other in multiple ways. A person might be associated with various locations and various events. Events might involve various people in various places. If I think too hard I’ll make this more complex. The Custom Post Types & ACF Structure I feel relatively good about those three main types so breaking down the details of what those big boxes should contain was the next consideration. People First Name Middle Name Last Name Title Description/Bio Birth […]

Three rows of orange-ish colors with the text 'fake hues' over the top of them in white.

Social Media Jujutsu

Jujutsu1 is a martial art focused on using your opponent’s momentum against them– clever redirection of force rather than trying to meet it directly. This seems like it might be an option for some of today’s social media woes where people are trying to continue to take advantage of the good aspects of these tools/communities while opposing some of their attempts at manipulation. There are major alternatives like Brontosaurus Mastodon but many people aren’t going to make that jump.2 So consider this post more of a way you might mitigate harm while continuing using tools meant to bend your mind and warp your perceptions. Twitter Numbers One way these interfaces play games with your mind is by showing all kinds of numbers. You’ve got a score card for likes, retweets, followers etc. It becomes a shortcut. Is this tweet funny? 453 people fav’d it. Should I fav it too or is this just a bandwagon thing now? How good was my tweet? Did enough people retweet it? That extends even to following people. How many followers do they have? Are they worth following? It can make you skip really looking at the content. One path out of Twitter’s attempt to manipulate you via numbers is Benjamin Grosser’s Twitter Demetricator. It’s a browser plugin3 that removes all those numbers replacing them […]

06

Weather API + Google Sheets

I have many little robot scripts busy saving data to Google Sheets. Here’s one I made based on a little comment from one of my kid’s teachers. It goes to a very kind URL that returns the data structure at the bottom of the page. http://api.wunderground.com/api/YOUR_API_KEY/conditions/q/VA/Richmond.json It’s a pretty nice starter script for anyone wanting to play with an API and Google Scripts. The full Google Script is below and I’ve tried to comment it up pretty thoroughly. I’ll also break it down below for those of you who want to play at home. Get the Data The first variable ‘url’ is the API endpoint we’re getting the data from. Where it says YOUR_API_KEY, you should put your API Key. I recall early on trying to do this stuff I’d get confused when people did different things to indicate that an API Key should go somewhere. People would put it in quotes or surrounded by asterisk or something else. I’d end up confused about what should go there because I had no baseline to judge this against. It’s fairly obvious now but I haven’t forgotten that feeling of basic confusion. Sometimes it helps to be very basic. Google has a nice UrlFetchApp class that you use in Google Script instead of fetch like you’d use in vanilla javascript land. Since […]

01

Google Form to Google Sheets to Vue Website

When @cogdog & @twoodwar Were Building Websites From Google Spreadsheets Years Ago https://t.co/Im7oCecvpg — Keegan?Long-Wheeler (@KeeganSLW) February 28, 2018 This post from Keegan kicked of this demo.1 The goal is to create a pretty flexible template for using Google Forms to Google Sheets to simple website. I opted to do this one in Vue but may get around to doing it in plain JS or jquery if time allows. The first thing you need to do is make the form and put in some entries. You’ll be happier if your form prompts aren’t super long. Make them readable just keep them concise.2 Once you’ve made a few entries so you have some data to work with, publish your spreadsheet as HTML. File>Publish to the Web. Click OK and what not. Don’t bother going to that link as Google has made that a fake promise. You just need the ID of the document in your current view. It’ll be something painful like 12WsyLvtfIPJkCXgEXsRkrI6dS0_K6brJikZqzkQa8TU and is visible in the URL after the /d/ but before the /edit. You can see the spreadsheet here. It doesn’t really matter but !full transparency! With that ID in hand, you want to go to a URL like so. You could manipulate the number in the URL to hit different pages in the spreadsheet. https://spreadsheets.google.com/feeds/list/12WsyLvtfIPJkCXgEXsRkrI6dS0_K6brJikZqzkQa8TU/1/public/values?alt=json You should […]

23

WordPress Timeline JS Plugin

Background I like Timeline JS. It’s a nice way to create multimedia timelines. I’d previously done some work that would take WordPress JSON API data and insert it into the Timeline JS view.1 It was nice for creating alternate and standardized views of blogs that might be useful for different reasons. It didn’t serve some other needs and while doing it through a generic URL was handy for many reasons it was odd in other scenarios. As a result I decided to make a new version as a plugin. If you don’t like reading stuff there’s a quick video of how it works below. Plugin Goals First, I wanted this to be a plugin rather than a theme. That adds a bit of complexity because you don’t have control of the whole scenario but it makes it much more portable and more likely to be used as it doesn’t require people to change themes or spin up an additional site. I wanted people to be able to use WordPress rather than a spreadsheet to create the content for Timeline JS. Doing that has a few advantages- the WYSIWYG editor, the ability to upload images directly in WordPress, the ability to use posts you’ve already written, etc. etc. I also wanted people to be able to choose what posts ended up […]

A drawing of a small terrier dog jumping through a hoop held by a monkey.

Code as Poetry, Time as a Variable – Options in the Ether

Backstory Driving into work I was listening to NPR and they were interviewing Nikki Giovani a poet from Virginia Tech. In high school I was one of those people who really suffered reading the The Red Wheelbarrow and other non-rhyming poems. They irritated me in the same way people seem to be annoyed by White Paintings or 4’33”. In any case, in college I took lots of English classes. One of those classes was on poetry with Donna Hickey. The class selection was driven more by fitting my schedule and a vague notion that I might minor in English rather than any real interest in poetry. The first day of class she had everyone list their favorite poets. I don’t recall what people chose but I remember feeling like my choices of Shel Silverstein and Dr. Suess was not of the same category. In any case, I had a great deal of fun with the course and using poems as games and puzzles to think around and through. I later took a graduate course with Dr. Hickey1 in poetry and made my first digital liberal arts website around 2001 or 2002. It focused on breaking down various Richard Hugo poems and creating attempts at multimedia experiences.2 That stuff is all long gone from the UR website. I might have backup […]

06

Considering Making Digital Sociology Tools

First off, I believe that websites that help you think are tools. Websites that help you author media are also tools. So when I say “tools” that’s what I mean. I will also likely call them sites. That’s also what I mean. I like to start off posts like these establishing the fact that I’m not going to try very hard to make sense to you but at least I’m explicit about it. I’ve had a couple of conversations recently that have me close to building these with or without a faculty/course attached. #metoo Movies This started when I was watching one of the original Star Wars movies with my kids. I’d never really watched them closely as an adult. It really seemed like Han Solo was a textbook example of a person acting out some pretty specific examples of sexual harassment. Repeatedly Leia tells him to stop touching her and he ignores her etc. I ended up talking to some friends at a school function about it and the conversation expanded into the idea of a database of clips like this that both act as a lens on that time/space/movie and as examples of particular patterns that might be of interest more broadly. For example here’s Han being creepy . . . In order to write this post, I’ve […]

29

Census Reporter API Exploration

We’re trying out a new site idea for the online digital sociology program. Once again, Matt came up with an idea that really got me excited and I started wandering around trying to figure out how to make it work. At some point I found CensusReporter.org. This is a pretty amazing site that is a Knight1 News Challenge-funded project. What we want to do is figure out roughly where the viewer/visitor is geographically and give them a glimpse of that area through some data. Nothing too deep, just a taste of the interesting ways technology, data, and visualization can blend together to do interesting things. We don’t want the exact address for a few reasons. One, we don’t want to be too creepy. Two, getting a rough location through the IP address doesn’t trigger the browser approval request that more exact location data requires. My goal is not to subvert the approving/denying of location data but I worry too many people will miss that approval prompt and we’re not keeping this data. Get Location To get local data I have to figure out where the person is. To do that, I’m just grabbing the IP address and getting a location bounced back. There are a few ways to do this. I went with freegeoip.net and the following function would give […]