Megan Taylor

front-end dev, volunteacher, news & data junkie, bibliophile, Flyers fan, sci-fi geek and kitteh servant

The best way to beat Impostor Syndrome is to participate

I’ve noticed a common thread among people jumping into the deep end of speaking at our meetup. They’d often start their talks with “I’m not the most qualified person to speak on this topic,” or “I’m sure you guys are all smarter than me.”

In response, I decided to give a talk about Impostor Syndrome.

Check out this great presentation on Impostor Syndrome given by Zach Leatherman.

November 3, 2013 | Comments Off on The best way to beat Impostor Syndrome is to participate | Categories: Quotes | Permalink

Colonials Debate: Should Essayists Also Master The Mechanisms Of The Printing Press?

Colonials Debate: Should Essayists Also Master The Mechanisms Of The Printing Press? « Andy Carvin's Waste of Bandwidth

For those not in the know, this is satirizing the great “should journalists learn to code” debate of October 2013. (I note the date because it seems to recur every year or so.)

October 31, 2013 | Comments Off on Colonials Debate: Should Essayists Also Master The Mechanisms Of The Printing Press? | Categories: Links | Tags: , | Permalink

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?

October 31, 2013 | Comments Off on Getting Rid of Blue Links in Emails for iOS | Categories: Posts | Permalink

webclip

NYC Farmers Market Locator

githubThis app is a mashup of the Google Maps API and the State of New York Open Data API. It allows two ways to search for a nearby farmers market: geolocation via the browser or searching for a specific address or zip code. It shows farmers markets within a 1 mile radius of the given location on the map, while a column of cards gives information on each market, such as schedules, a link to open a native mapping application if on mobile device, and website (if any). It is completely responsive and mobile-friendly. Many future features are planned!

Skills: APIs, JavaScript, jQuery, CSS, HTML

post

Thinkful Unit 3 Comprehension Checks

Lesson 1

Assignment 1

Describe what event binding is and how it can be used to make your pages interactive.

Event binding attaches a handler to an event for the DOM elements.

Events can be:

  • A mouse click
  • A web page loading
  • Taking mouse over an element
  • Submitting an HTML form
  • A keystroke on your keyboard

So you can have elements appear, disappear, animate, etc., based on events.

What are the advantages of using the first block of code over the second?

$(‘#my-div’).on(‘click’, function() { ...do stuff...; });
vs.
$(‘#my-div’).click( function() { ...do stuff...; });

the ability to bind to multiple events at once
use “namespaced” events

What does .preventDefault() do, and when would you use it?

prevents the default action of an event, like clicking on a link or a button

What does .stopPropagation() do, and when would you use it?

prevents ‘event bubbling’ – when an event is triggered for a nested element and then is triggered for every element up the DOM.

How and why would you use this in an event handler?

this allows you to target a specific element, while still binding to a high-level element. This is called event delegation.

Give an example of event delegation and explain its advantages.

Event delegation lets you bind fewer event handlers, which can be a big performance gain. It also lets you bind to parent elements and know that event handlers will fire as expected even if the contents of that parent element change.

Assignment 2

How can you set the fast and slow speeds for jQuery animations?

The predefined speeds are specified in the jQuery.fx.speeds object; you can modify this object to override the defaults, or extend it with new names:

// re-set an existing predefined speed
jQuery.fx.speeds.fast = 50;
// Since we've re-set the 'fast' speed, this will now animate over the
// course of 50 milliseconds
$( '.hidden' ).hide( 'fast' );

Why might you be further ahead using CSS animations instead of jQuery for mobile devices?

In modern browsers, and especially on mobile devices, it is often much more efficient to achieve animations using CSS rather than JavaScript.

What must you do to the spelling of properties like font-size that have hyphens if you want to reference them in a jQuery animation method?

If you want to animate a CSS property whose name includes a hyphen, you will need to use a “camel case” version of the property name if you do not quote the property name. For example, the font-size property must be referred to as fontSize.

How can you stop a jQuery effect?

.stop() will stop currently running animations on the selected elements.
.delay() will pause before the execution of the next animation method. Pass it the number of milliseconds you want to wait.

Lesson 2

Assignment 1

Memorize both syntactically correct ways you can call jQuery’s .ajax() method.

$.ajax({
 url: '/data/people.json',
 dataType: 'json',
 success: function( resp ) {
 $( '#target').html( resp.people[0].name );
 },
 error: function( req, status, err ) {
 console.log( 'something went wrong', status, err );
 }
});
$.ajax( '/data/people.json', {
  type: 'GET',
  dataType: 'json',
  success: function( resp ) {
    console.log( resp.people );
  },
  error: function( req, status, err ) {
    console.log( 'something went wrong', status, err );
  }
});

What are success and error callbacks, and how do they work with .ajax()?

Success Callback: A function to be called if the request succeeds.
Error Callback: A function to be called if the request fails.

Make sure you understand that how and why the return command of an ajax() call will return before the server to which the request was made has responded.

AJAX requests run asynchronously —  the $.ajax method returns before the request is finished, and this function’s return statement runs before the request is complete.

What is JSON and what can you use it to represent?

JSON is a string representation of data.

What are the .get() and .post() methods?

If we’re just making a simple request — and if we don’t care about error handling — jQuery provides several “convenience methods” that let us use an abbreviated syntax. Each of these methods takes a URL, an optional data object, and an optional callback for handling a successful request.

$.get( '/data/people.html', function( html ){
  $( '#target' ).html( html );
});
$.post( '/data/save', { name: 'Rebecca' }, function( resp ) {
  console.log( JSON.parse( resp ) );
});

We can send data with our request by passing an object as the second argument to one of the convenience methods.
For a GET request, this data will be appended to the URL as a query string; for a POST request, it will be sent as form data.

How can you use jQuery to serialize and submit form data?

The .serialize() method converts form input to a query string format.

.ajax() calls return a jqXHR object. What are the .then(), .done(), .fail(), and .always() methods on jqXHR objects for?

.then() – attach success and error callbacks
.done() – attach success callback
.fail()– attach error callback
.always() –  attach callback that runs on success or failure

What is JSONP and what does it allow you to do?

Allows you to use data even though it is hosted on another server.

What does an ajax call with JSONP look like in jQuery?

$.ajax({
 url: '/data/search.jsonp',
 data: { q: 'a' },
 dataType: 'jsonp',
 success: function( resp ) {
 $( '#target' ).html( 'Results: ' + resp.results.length );
 }
});

What is the .getJSON() method?

A convenience method to make a JSONP request; if the URL includes callback=? or similar, then jQuery will treat it as a JSONP request.

$.getJSON( '/data/search.jsonp?q=a&callback=?',
 function( resp ) {
 $( '#target' ).html( 'Results: ' + resp.results.length );
 }
);

How can you use $.Deferred() to return a promise?

The deferred.promise() method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request.

Lesson 3

Assignment 1

What is JSON?

JSON (or JavaScript Object Notation) is a lightweight, easy and popular way to exchange data.

What’s a callback and how does it work in the context of a jQuery .getJSON() request?

A callback is a function that is passed to another function to run.

What is JSONP and what does it allow you to do?

JSONP (or JSON with padding) allows a script to fetch data from another server on a different domain.

Assignment 2

What is encapsulation and why is it important?

Encapsulation in an important organization concept for code. It separates code into distinct pieces.
Broadly, encapsulation does one or both of these:

  • restricts access to some of the object’s components
  • facilitates the bundling of data with the methods (or other functions) operating on that data

How can you use object literals to namespace functions?

An object literal is perhaps the simplest way to encapsulate related code. It doesn’t offer any privacy for properties or methods, but it’s useful for eliminating anonymous functions from your code, centralizing configuration options, and easing the path to reuse and refactoring.


// An object literal
var myFeature = {

    myProperty: "hello",

    myMethod: function() {
        console.log( myFeature.myProperty );
    },

    init: function( settings ) {
        myFeature.settings = settings;
    },

    readSettings: function() {
        console.log( myFeature.settings );
    }

};

myFeature.myProperty === "hello"; // true

myFeature.myMethod(); // "hello"

myFeature.init({
    foo: "bar"
});

myFeature.readSettings(); // { foo: "bar" }

The object literal above is simply an object assigned to a variable. The object has one property and several methods. All of the properties and methods are public, so any part of your application can see the properties and call methods on the object. While there is an init method, there’s nothing requiring that it be called before the object is functional.

Explain the DRY concept.

Don’t repeat yourself; if you’re repeating yourself, you’re doing it wrong.

webclip

Quiz Web App

githubThis app allows the user to take a multiple choice quiz. User is given one questions at a time, submits an answer for each question, and is shown a score at the end. User will also see questions they missed along with the correct answer with their score.

Skills: JavaScript, jQuery, CSS, HTML

post

Food Walk

food-walk-08-13I have a wonderful friend who lives in NJ and is a passionate foodie. She comes into NYC once every other month or so and takes me on a journey of foot and mouth, walking up to 12 miles in a day to find interesting and delicious things to eat. This is a map of our August walk. Stops included Eataly, Joe’s Shanghai, and Taim, among many others.

August 31, 2013 | Comments Off on Food Walk | Categories: Posts | Permalink

webclip

Shopping List Web App

githubA web-based shopping list app with the ability to add, delete, and mark items as purchased.

Skills: JavaScript, jQuery, CSS, HTML

webclip

Hot or Cold? Guess the Number

githubThe program generates a random number, which the user then has to guess. The program provides hints, telling the users whether they are hotter or colder and in which direction they should continue to guess.

Skills: JavaScript, jQuery, CSS, HTML