A while back I was messing with getting Instagram data without bothering with their API because I think their most recent API changes are really annoying. I’m also a bit fascinated with the scale of numbers in social media right now. I opted to look at Snoop Dogg’s Instagram followers and plot their change very 10 minutes. Click here or on the image to see the live chart. Get the Instagram Data w/o the API & Put it in the Database It turns out that each Instagram page has an embedded JSON file with the data I wanted. You can see it if you view the source of any page. This Stackoverflow post was kind enough to point it out and you see regex rearing it’s head again. I started out with my standard process of using Google Sheets as the database but decided I’d try MySQL because I wanted to try getting the JSON ought more cleanly. The chunk below grabs the data and puts it in the database. So that gets us the stuff we want in a nice little box on the Internet. I did try to do some fancy mysql stuff to avoid entering the change in followers as an additional field but I failed in enough ways that I just opted to proceed with the […]
I had an interesting conversation with a pair of elementary school teachers. It led to me saying I’d put our two older kids on Good Reads in lieu of some less pleasant ways of documenting their reading. It’s not a place I’d necessarily drop a group of 3rd graders. As we spoke, I figured I could build a little version of one very quickly with Angular and a Google Form. It’s worth noting that once you set up one Angular page tied to a Google Sheet, you can just copy that over and make websites very, very quickly. It’s just a matter of re-aligning the json data. I hadn’t done anything with Angular in a while and while doing this I found out a few other neat little tricks that’ll be of use at some point. One was this slick star rating CSS option. It will show the star rating based on a div percentage. I really liked it but my rating scale was 1 to 5 and Google didn’t really support doing something with percentages. However, I didn’t realize you could do math right in Angular. It turns out you can and I did it like so. The entry.gsx$_cyevm.$t part is just the name of the data chunk that holds the 1 to 5 rating scale. I can divide […]
I was just messing around a bit more with mashing up the YouTube API post from earlier with the Twitter post from earlier today. This Google Script will get the view count of a particular video (Gangnam Style) and send out the total views and the time elapsed watching the video (assuming I did the math right). It has no real purpose (other than the scale of the number amuses me) but it’s one of those things with concepts that I’ll be able to apply more usefully in the future. That’s a gut feeling but I’m pretty confident. Don’t forget to add the Twitter library as directed here.1 1 in the Apps Script project, include the library MKvHYYdYA4G5JJHj7hxIcoh8V4oX7X1M_ with the identifier set to Twitter
flickr photo shared by Thomas Hawk under a Creative Commons ( BY-NC ) license Reclaim Hosting has a great status page that alerts you when stuff is not working correctly. We had a brief outage this morning and I just thought it’d be nice to see if we could proactively send out a message based on that status page but only for things relevant to our server. I asked Tim (as you can see in the tweets below) and ended up with an API that happily spit out a JSON feed. @ReclaimHosting ha ha – LOVE IT https://t.co/UrlIvwa91S — Tom Woodward (@twoodwar) February 24, 2016 Based on my recent experiments with JSON and Google Scripts I didn’t think it’d be too hard to write something to send out Tweets based on that feed. I found this snippet that dealt with the authorization portion for Twitter.1 Once I had the JSON parsed and assigned to variables, all I had to do was set it to check every 5 minutes. Now we can hook it up to the ALTLab account if we’d like, have it notify various people, etc. etc. Fun stuff . . . all done during lunch. The following script will check a JSON feed and send a Tweet out from my account letting @vcualtlab know we should check on […]
Radioactive is the book that VCU’s first-year students are reading. It’s an interesting book with interesting art and collage playing a major role in the design. I hadn’t really looked at it until this morning but I ended up in a conversation and an idea came to mind. “What if we could deconstruct elements of the text (words and images) and give them to students to recombine in interesting ways?” It seemed like a fun thing to do and within reach based on work I’d done earlier with Google Spreadsheet Fridge Poetry but I wanted a few more capabilities to help people create better visual products. I took my phone and took a bunch of quick pictures of pages from the book that seemed interesting and easy to cut out. That took about 10 minutes to photograph and drop the backgrounds.1 Another 10 minutes and I had a working prototype using the old Google Fridge Poetry. Not bad but I wanted to be able to rotate/resize images and be able to save the results as an image file (something I tried but failed at doing last time around). Resizing It turned out resizing was built into jQuery with the resizeable. $( “.resize” ).resizable(); Nice but it resizes the element holding the image rather than the image itself . . . […]
Like the music post a while back, I’m not going to attempt to tie this to education in any way. I’ll start this off with a caveat similar to my posts on programming . . . I’m just a guy trying to do stuff. Almost all of it is on the very edge of, perhaps a bit beyond, my competency levels. It is not unlikely that I will either say something that’s a bad idea or document something poorly. You have been warned. To set the stage, I have four kids. We have three bedrooms so the youngest two share a room. It’s not a huge room so bunk beds have been a topic of conversation for a while. I decided I’d talked enough over Winter Break and decided to make them. I have little woodworking experience. To the point that I’m not even sure if people call this woodworking. Carpentry maybe? I’m probably doing something like calling heating up pre-made cookie dough baking . . . Full disclosure, I have a table saw1 and a circular saw. I put in hardwood floors in our first house. I used floor glue instead of nails.2 I built a gate for that house as well. It weighed roughly 600 lbs and could withstand the charge of a bull elephant. It was a […]
Because I’ve been messing with The Events Calendar for the RVArts project, along came another conversation where that plugin seemed like a good answer. It answered all their needs except for one – the wanted to have the month view of events be the homepage for the site. I knew that didn’t happen natively but I figured I could do it. The first step is to create a custom page template. There are a number of tutorials on how to do that. I usually just duplicate the page template for the theme I’m using as a parent and go from there. The one I’m using is below. The Events Calendar has this nice function (tribe_show_month) which’ll pull the month’s data by default. That’ll get you something that looks like below (depending on your theme). It’s the right content but it’s not applying the same CSS/JS that’s on the regular month view. You could go in and rewrite CSS and JS etc. but that would suck for this particular project. It turns out you have to enqueue the right stuff and this post was so very helpful in telling what to enqueue. I updated it to the newer functions and presto everything worked just like the normal month events view. It goes into my child theme’s functions.php. This particular version only […]
I often get requests from instructors that ask me to get WordPress to behave in a way that’s just different enough that WordPress fights them. Now that I can mostly program, I could make quick child themes to deal with this but that causes me the hassle of keeping all that stuff straight so I still do some quick and dirty stuff with plugins. This example is based on an instructor who wanted one particular category (lesson plans) to list from oldest to newest rather than the default WP blog layout of newest to oldest. That’s a pretty easy thing to do if you use the List Category Post plugin. Once you’ve got the plugin on and you’ve found the category id (mouse over the category when you’re in Dashboard>Categories and look for id= in the URL at the bottom of the page) all you need to do is put in [catlist id=9 numberposts=-1 order=asc] In this case, it says get the posts in the category with id 9, -1 means get all of them, and order them from lowest to highest/ or oldest/newest. That’s it. I’ve now got a page that shows all 41 lesson plans from oldest to newest and no child theme to keep track of.
We have an awesome general education course starting this semester called Cultural Passport (aka RVArts). The goal is to get students involved with the community’s cultural events – participating, promoting, reviewing them. The web side of this ends up being pretty interesting. See their video below for more details on the course. When we started this conversation last year, I thought I was going to go the Gravity Form submission route1 and use a js library to make it possible to add the events to various calendars. Like most projects, particulars shifted and we started changing things pretty radically right before winter break. We ended up shooting for full WordPress editor access for students to create events and the desire to write three different types of responses (interviews, reviews, and features) that would be associated with a specific event. Also, like most projects, this was all a bit beyond what I’d ever done before. I started off thinking I’d create a custom post type for events. I was trying to make up my mind between using Advanced Custom Fields and CMB to help do that when I realized I hadn’t really thought about repeat events. The complexities involved there really made me rethink my decision to do this from scratch. After that I started trying various plugins and eventually decided […]
Imagine you have a large folder of images in Google Drive. I don’t have to imagine this as I do thanks to an IFTTT recipe.1 Google tends to be kind of stingy with the kinds of filtering/interactions you can have with files in their folders and we know that if you get stuff in Google Sheets then a world of other possibilities opens up. I’ve been thinking about what options there are with Google file storage because VCU is a GAFE school and we have unlimited Drive storage. That might open some media storage options with heavy load projects like our Field Botany site or our more recent work with the East End Cemetery. So . . . I wrote a quick script to take a large G Drive folder full of images and write the content to a spreadsheet while embedding an image preview. The script is below. I ended up revamping both enough that I felt it was worth reposting. For the record, the script ran through about 4,500 images but it may have timed out so keep that in mind if you’re dealing with lots of images. 1 I figure if I have enough backups to my online backups then I can pretend I’m safe.