Mary Dickson Diaz

Code, Life, Learning

Tag: look i made a thing (page 2 of 2)

now we are two

My latest assignment for learning web development is to build a page with some css that can “house” the silly little JavaScript games we’ve been building. I used the opportunity to launch marythought.com, which I intend to build out as a non-Wordpress personal site while keeping this one a dedicated blog. The site name is a pun on the word “merrythought,” a British term for a wishbone, the etymology of which references “the pleasant thoughts imagined when the bone is ritually broken.”

Thoughts as acts of wish making, I’ll take it!

This week was a slow one to get started — I had a burst of inspiration this weekend to make an “achievement unlocked” twitter bot that has stalled out because I can’t figure out how to auto-upload an image. It’s fixable, but it requires seeking out additional expertise, and probably in person.  And we have a lot going on offline, finalizing a move (seems counter-intuitive but buying a house will save us half of what we’re currently paying in monthly rent) and planning a wedding that is slowly creeping up on me. On Sunday, we talked with our officiant who prescribed “a few pieces of undeniably beautiful music, a few readings that are meaningful to you, and make your list of people who must be involved to give their blessing.” That sounds… kinda fun, right? Well sure, if your idea of fun is curled up in a fetal position under the desk because god dammit why are all your favorite songs about loss and why is it so hard to pick readings, you have no fewer than 10,000 books to choose from… otherwise WRONG-O. Wait, let me code that…

var ceremony_planning = “pick your music, readings, and people who must be involved”

if (fun == “curled up in a fetal position under the desk”) {

  fun += ceremony_planning;

} else {

  console.log(“WRONG-O”);

}

Ok, THAT was fun. Maybe Valentine’s Day will inspire me. Anyway, happy weekends to you!

“Your bill is NaN”

Just checking in to share that I finished the garsh-darn JavaScript tutorial (kicking and screaming the last 3 miles) and attended my first Code Fellows class yesterday!

The instructor successfully articulated a point I was trying to make in my last post, the difference between paths and sandboxes (or, as I prefer to pluralize it, sandboxen). Learning paths include things like online tutorials: they are consumptive, they lead you down a specific path to completion. Sandboxes (eff it) sandboxen are more autonomous, exploratory learning experiences, driven by learner interest, that generally lead to greater understanding. The majority of our class time will be spent playing with sandboxen.

sandboxen
Oxen on the beach in Colva Beach | Goa, Colva (Trip Advisor photo by raumati1: Mar 2010)

Adorable!

I was trying to complete the first assignment, a simple guessing game, by converting one of my working python games to JavaScript. I wasn’t able to make that work (v. frustrating), but I was able to build on the instructor’s demo to make a game I’m proud of. The original game asked a player to guess a number between 1 and 10, with 2 options: 1. you win! and 2. you lose. I expanded the range, added a way to keep track of the high and low guesses, and built-in exclusions for guesses that are NaN (not a number) or out of range. Try it!

A warning: this game, built-in JavaScript and saved as an html file, operates entirely through pop-up windows. I promise you it does not reset your browser’s search engine to Yahoo! (when I find the program that is doing that there will be many strongly worded tweets), but otherwise the interface is a bit annoying and I hope it is not the only way that JavaScript knows how to talk to the world.

Click me, click meeeeeee!

finishing the bot

finishing the bot
how you have to finish the bot…
how you watch the rest of the world from a window–
while you finish the bot

mapping out a .py
what you feel for twitter’s API
what you feel when errors that come through heroku go

“tweet status update failed on third try…”

I have been watching Stephen Sondheim musicals basically non-stop and this song seems most appropriate for the past few days. “Oh there’s a new lecture out…. BOT.” “I should get started on that javascript pre-work…. BOTBOTBOT.” “It’s 2:30 in the morning…. BOOOOOOOTTTT”

twitterscreenshot

My bot is now deployed and fully-functioning out in The Cloud, thanks to Joel!

>>Ok I have a twitter bot and I want to run it but not from my personal computer, help

The above link tells the story of how I went from here (functioning bot, living on my laptop) to here (functioning bot, living on GitHub/running on heroku). First, you’ll need to install heroku and follow the directions to get started, here. After that, follow Joel’s directions and you’re golden.

I hope you didn’t have other things to do today.

UPDATE 6/25/15

This is part 2 of the tutorial.

Part 1: Build a Twitter Bot with Python

Part 3: Top Bot

build a twitter bot with python

This year I set out to learn how to make twitter bots, accounts that automatically interact with twitter in some way, whether through tweeting set content at regular intervals, watching for and responding to code words, or responding in a certain way when tweeted at. I learned the basics of Twitter API interaction at UW’s Community Data Science Workshop last November, and have since been inspired by other people doing cool stuff with bots.

Witness:

For more great examples, check out 52bot project.

A few nights ago, as I was reading about the reunion of the women of Bletchley Park, I clicked through to the Honour Roll and found a database that looked like it might translate well into a twitterbot. Using a subset of data and some internet tutorials, a test bot took maybe an hour or two tops to set up (and I was so thrilled when it worked!). The time-consuming part has been 1) finding a way to reliably keep it tweeting; and 2) pulling and cleaning up the full dataset to fit twitter’s 140 character limit (in my test run, I just told twitter “print the first 140 characters and ignore the rest” but for the full deployment, I wanted to edit the longer bios to make them fit).

Ok, so without further ado, here’s the bot:

And here’s how I made it!: Continue reading

Newer posts »

© 2020 Mary Dickson Diaz

Theme by Anders NorenUp ↑