Megan Taylor

web developer, hack-n-slasher, freelancer, news & data junkie, bibliophile, Flyers fan, sci-fi geek and kitteh servant

post

Todoist tasks to Dashclock widget Tasker task

Wow that title is hella awkward. This is a writeup of how I got my tasks in Todoist to show up in a Dashclock widget using Tasker.

Pre-reqs:

  • Be using Todoist :)
  • Have an Android phone
  • Install and have some basic knowledge of Tasker
  • Install and have some basic knowledge of Dashclock

So, there is pretty good documentation for most of this around the Internets, I’m going to try to be as detailed as possible, but this is not going to be a fool-proof step-through. More of a guideline. Kinda like the painted lines on the floor in hospitals? Anyway…

ACTIONS 1, 2 and 3

After all my poking and prodding and rewriting, my task in Tasker starts by clearing some variables that will be created later in the task. So the first action should be Variable Clear, and set the name to %Tasks (or whatever, this is going to be an array that holds the final format of all the tasks you pull from Todoist). Then make another Variable Clear action and set the name to %Item (this is going to be an individual task that will end up in the array mentioned above). Then make a third Variable Clear and set the name to %Numtask (this is going to increment with the number of tasks).

ACTION 4

For your fourth action, create an Array Clear and set the name to %TLIST. OK, we’re done with clears.

ACTION 5

The fifth task is going to actually pull you tasks from the Todoist API. I used the /API/query request.

Please review the API documents and get your query URL figured out before continuing. Mine looks like this: https://api.todoist.com/API/query?queries=[“overdue”, “yesterday”, “today”, “tomorrow”]&token=tokentokentoken. It gives me all the tasks that have not been completed that are overdue, due yesterday (for some reason on my account, overdue does not include yesterday. i have been in contact with todoist support and they haven’t figured out why, but using the yesterday query takes care of that for this use case), due today, or due tomorrow.

NOTE: The Dashclock widget will only show the first 5 tasks from the combined list of tasks. If you want to show more, you can create a separate widget for each query.

So create a HTTP Get action and set it up like this:
Server:Port

https://api.todoist.com

Path
API/query
(or whichever request you choose to use)
Attributes
queries=[“overdue”, “yesterday”, “today”, “tomorrow”]&token=tokentokentoken

I didn’t change anything else for this action.

Have I lost you yet? Great! Onward!

ACTION 6

Now I’m going to give you some JavaScript. This was the hardest part for me to figure out, because Tasker doesn’t really support true arrays. So I’m giving you the JavaScript that will parse the query response (assuming you used the same one I did, if not, you will have to edit this). You need to get this into a file on your phone somewhere.

jsonData = JSON.parse(global("HTTPD"));

var y = 0;

if (jsonData[0].data[0] !== 'undefined') {
for (i = 0; i < jsonData[0].data.length; i++) {
setGlobal('TLIST'+y, jsonData[0].data[i].content);
y++;
}
}

if (jsonData[1].data[0] !== 'undefined') {
for (i = 0; i < jsonData[1].data.length; i++) {
setGlobal('TLIST'+y, jsonData[1].data[i].content);
y++;
}
}

if (jsonData[2].data[0] !== 'undefined') {
for (i = 0; i < jsonData[2].data.length; i++) {
setGlobal('TLIST'+y, jsonData[2].data[i].content);
y++;
}
}

if (jsonData[3].data[0] !== 'undefined') {
for (i = 0; i < jsonData[3].data.length; i++) {
setGlobal('TLIST'+y, jsonData[3].data[i].content);
y++;
}
}

Create a JavaScript action (this will be number 6) and set the path to wherever you have stored this file on your phone.

ACTION 7

Create a seventh action, Variable Set. Name should be %Numtask and To should be %TLIST(#<)+1. I don't know why, but it works for me.

ACTION 8

Number eight! Create a For action. Set Variable to %Item and Items to %TLIST(0:).

ACTION 9

Your ninth action is part of a for loop that was initiated by number eight. Create a Variable Set action. Name is set to %Item. Leave To blank.

ACTION 10

For the tenth step create another Variable Set action. Name should be set to %Tasks and To should be set to %Item.

End the for loop with your next action. (Seriously, this is action number eleven, create an End For action).

ACTION 11

FINALLY. Create the Dashclock action.Set the title to %Numtask Tasks in order to display a title above your list in the widget that will say "N Tasks". Or leave it blank. Whatever. Set the body to %Tasks.

Now you have to add this task to a profile. I hope it works for you. Feel free to ask questions, suggest better flow/code or whatever.

post

This month, CSS turned 17 and JavaScript turned 18

Much has happened, both to CSS and the Web, since those days. But on its 17th birthday, I’d like to acknowledge the creators, custodians and champions of CSS in those early days. These were the days before blogging (in any mainstream sense), twitter, and other social media. Indeed, these were the days of newsgroups, the water cooler of the web for its first decade at least. And many of the most important figures in the development, and success, of CSS (and as a consequence the modern web) are little known, though they are the giants whose shoulders we all stand on.

by John Allsopp via Web Directions.

The JavaScript community is moving ahead, often with its usual dramatic “two steps forward one step back” dance, with detractors now being more vocal. JavaScript is no longer the underdog, but the establishment. Keeping that upstart “everything is possible” mentality going for as long as possible will be the challenge of the next 18 years of the language, as it heads into adulthood with a new-found confidence.

via Resin.io.

post

Stupid, Lazy Programmers?

“It may sound amazing, but you could be a better programmer if you were both lazier and more stupid.

First, you must be stupid, because if you are smart, or if you believe you are smart, you will stop doing two of the most important activities that make a programmer a good one: Learning and being critical of your own work…Second, a good programmer must also be lazy because only a lazy programmer would want to write the kinds of tools that might ultimately replace much of what the programmer does…Perhaps paradoxically, the road toward effective stupidity and laziness can be difficult and laborious, but it deserves to be traveled in order to become a better programmer.”

By Mario Fusco via Be Stupid and Lazy – Programmer 97-things.

Related:

Why Good Programmers Are Lazy and Dumb by Philipp Lenssen.

How to be Lazy, Dumb, and Successful by Jeff Atwood.

post

Link Roundup!

Because I’ve been lazy and just posting links on Facebook and Twitter…Pardon the emphasis on ScriptEd and computer science education, this week is CSEdWeek.

“Nationwide there are 3.3 million seniors in high school but in 2012 only 26,000 took the AP Computer Science Test. Wouldn’t it be great if students could try programming while in high school? Why aren’t more high schools teaching computer science?” Why Teach Computer Science in High Schools? | Brian Heese.

“There is also the expert noob, who still haven’t mastered the subject but is already able to get through the most common problems without external help. The expert noob might even be able to teach others.” Being a noob | Blog | Miller Medeiros.

Want to teach kids code? Apply to volunteer with ScriptEd! In particular, we’re looking for Brooklyn folks!

“If we behave like facts don’t matter, then one day they won’t.” Why facts matter — Inside MATTER — Medium.

This is a great list of tips for educators looking to incorporate computational thinking into their curriculum. Also, not just for girls. Beautiful Pixels: Preserving Girls’ interest in Computer Science.

“Even if we taught every disadvantaged young person to code, they would still not have access to the opportunities that today’s successful programmers and technology experts enjoy.” Learn to Code Switch Before You Learn to Code – Anil Dash.

This blog post by one of my ScriptEd students. “I think the one thing I like best about learning to code is the different possibilities for study it provides. Aside from just “coding,” or creating websites, there’s Artificial Intelligence, Computer Engineering, Robotics, and Web Design, among many other topics. It shows that computer science is not just about numbers, but can include Art, writing, problem solving, and multiple ways of thinking.” Not Just About Numbers: A Young Woman’s Perspective on Computer Science Education | Kendra Farrell.

Infographic: “The Job/Student Gap in Computer Science.

“The core of the idea is this: teach others as a way to teach yourself.” My free degree  — Medium.

This video in which ScriptEd students, volunteers and internship providers speak about their internships with ScriptEd.▶ ScriptEd Summer Internship Program – YouTube.

“The Processing Hour of Code was designed to inspire new programmers to try their hand at programming, and what better way than to write some real code that will help other people and improve the tutorial?” An Hour of Code spawns hours of coding.

Two 24ways articles on accessibility: Why Bother with Accessibility? and Coding Towards Accessibility.

post

Support my fundraising team for ScriptEd!

hackathon4-52852ce1f13ecScriptEd is the nonprofit I work with to teach HTML, CSS and JavaScript (the basic languages of the web) to high school kids in low-income schools.

From now until January 9th, we’re competing with other nonprofits to raise money. Nonprofits that raise the most money will be awarded additional funding from Crowdrise!

Make your holiday donation to ScriptEd.

Our students are currently getting ready for ScriptEd’s end-of-semester hackathon, where they will build web apps using the skills they’ve learned and compete for prizes.

These kids are really amazing. ScriptEd is an after-school program, so this is in addition to their normal courses and they work really hard!

Make your holiday donation to ScriptEd.

post

Questions About APIs and Dirty Data and Best Practices

So I’m working on this Farmers Market Locator project, and I’ve got a pretty basic version up and running. Everything is client-side. And I’m using the New York State Open Data API to get the information on the farmers markets. Right now, all that happens when you use the site is a query to Google to find out where you are, and then a query to the NYSOD API to get the nearest markets’ info, and then some Google Maps API stuff. But some of the data is a little dirty: missing spaces in addresses, that kind of thing.

More complications: There’s a bunch of features I want to add, some of which involves incorporating data from the USDA Farmers Market API. Now the USDA API has a little more info about the markets, like what kind of products are sold at each market. This data might also be pretty dirty. And as far as I can tell, the only way to match up markets between the two APIs is to do string matching. (Meaning that, having determined that the Union Square Farmers Market is the closest to your location, I then have to search the USDA API for “Union Square Farmers Market”)

Is there a better way to approach matching up the markets between the two different APIs? Do I need to switch to a back-end solution? What’s the best way to clean up the dirty data? Should I be pulling this info into something else, like a Google Spreadsheet, clean it up there, and make queries to the spreadsheet instead of NYSOD?

I don’t even know how to approach this.

Edit: Adding links to raw JSON.

http://data.ny.gov/resource/qq4h-8p86.json

http://search.ams.usda.gov/farmersmarkets/v1/data.svc/zipSearch?zip=10008

Edit: Some suggestions have been made…but as usual they only spawn new questions.

  • Best way to match markets:
    • search name (problem: not standard)
    • search address (problem: not standard)
    • use URLs as keys (problem: what URLs??!!)
  • Cleaning up dirty data:
    • You can use a back-end solution with some data store OR you could do it all in JS. If you were to do it all in JS you would just have to call a few API’s, compare the data returned, fill in missing data from one API with data from another. You would also need to decided which would have priority if there was a conflict. (problem: wouldn’t doing all that matching, comparison, and cleaning on the client-side make it slower?)
    • I think you are wise to consider grabbing the data, cleaning it up and storing it under your own backend. This allows you to keep your app up and running even if they change their format. (sure your data might get stale, but probably not by much, and it would buy you time address any new formatting from your sources) You could pull down the source data, create your combined json set, and just use that. (depending on how huge all the data was) While a backend solution might sound really complicated, it doesn’t have to be. A google spreadsheet could work, or Google Fusion tables, or Parse.com, FireBase.com, or Tableau.

So far the best suggestion is pretty close to my initial idea, but I’m hoping to get some more feedback on this before I commit myself. Chime in!

post

Getting Rid of Blue Links in Emails for iOS

I recently put together an email for JNF regarding a fancy event in NYC. The email was pretty great-looking, medium blue background color, white copy, black NYC skyline image at the bottom, really different from what we normally send out. Unfortunately, after hitting “Send,” I was almost immediately bombarded with complaints that on iOS devices, certain parts of the text were turning blue – a shade of blue that really didn’t show up well against the medium blue background color. Whoops.

JNF-GoE-blueJNF-GoE-white
Apparently, iOS devices highlight pieces of text that might be useful in your calendar or mapping application: dates, times, locations, etc. So all that copy was now practically illegible. I did some digging around the internets, and this article turned up repeatedly as the definitive solution: Update: Banning Blue Links on iOS Devices. Great! The email was scheduled to be resent in a couple of weeks anyway, so I would implement the fix for the resend.

Whomp Whomp. None of the suggestions in the article worked for me. After hours of testing, I finally gave up, got rid of my lovely blue background, and applied the same color (nearly indistinguishable from the color iOS uses) for the text. If anybody out there has an alternate solution for the blue link problem, I’d love to hear about it.

After this experience, I have several questions: How do other people conquer the blue link demon? Why does email (easily the most used form of communication for the past decade) still rely on technology and standards from the early 90s?