Monthly Archives: June 2014

ITP Camp: All You Can Eat APIs

Find the code on github: https://github.com/robynitp/itpcamp-canvas

Slideshow: ITPCamp_Canvas2014 [pdf]

Links and such:

HTML5 Canvas Tutorials

How to make a simple HTML5 Canvas Game

Comparison of Javascript drawing libraries
Find the code on github: https://github.com/robynitp/itpcamp-canvas

Slideshow: ITPCamp_Canvas2014 [pdf]

Links and such:

HTML5 Canvas Tutorials

How to make a simple HTML5 Canvas Game

Comparison of Javascript drawing libraries

UPDATE: Thanks, nurse buy
everyone, tooth for coming yesterday! I had fun — hope you did too. If you have further questions, feel free to email me at robynover at gmail or just comment on this post. See you around Camp!
The advantage of a front end language like javascript (in fact, audiologist javascript is really the only browser-based language we have) is that you can respond immediately to a user’s actions. Javascript calls these “events”. An event could be a mouse move, a scroll, a key press, and many others. Here’s a list of the major Javascript events.

Javascript won’t tell you automatically when events happen; you have to register an Event Listener to pay attention to that particular event — to “listen for” a mouse click, for example. When you create an event listener, you then define a function which will fire when the even happens.

jQuery also has methods that handle events. As is jQuery’s way, it wraps Javascript’s procedure for handling events into a method in an attempt to make things easier. In the documentation, there’s a nice list of all the jQuery event methods. One of the methods is bind() and that’s an important one. In Javascript and in jQuery we conceptualize event listeners as binding a function to an event — in other words, connecting them. Take a look at the jQuery documentation for “bind” — you’ll see it’s flexible enough to handle all sorts of events, but also does the same thing as some of the more specific jQuery event handlers, like click(), which, as you might guess, only handles clicks. Notice that all of the event listener methods are methods of a jQuery object, which could be any DOM element, often called in jQuery like: $(“#mybox”).

A tricky concept at first in Javascript and jQuery is the way that functions are used. Often event listeners will take a function as a parameter. You may be accustomed to seeing and writing functions that look like:

function addNumbers(a,b){
    sum = a + b;
    return sum;
}

In that function, the parameters are a and b, which are both integers. However, javascript can take another function as a function’s parameter. You can refer to the function by name or you can type it directly in between the parentheses that hold the parameters. For example:

function doStuff(){
// do the stuff
}

If a click event in jQuery called this function it could like this:

$("#mybox").click('doStuff');

But it would likely look like this:

$("#mybox").click(function(){

//do stuff;

});

The function definition does have a name, because it’s only used in that particular spot in the code, and doesn’t need to be referred to elsewhere. That’s called an anonymous function. Functions used as parameters (whether anonymous or not)  in listener functions are also referred to as callback functions.

More about jQuery events: http://learn.jquery.com/events/introduction-to-events/ and http://learn.jquery.com/events/event-basics/
The advantage of a front end language like javascript (in fact, page javascript is really the only browser-based language we have) is that you can respond immediately to a user’s actions. Javascript calls these “events”. An event could be a mouse move, look a scroll, overweight a key press, and many others. Here’s a list of the major Javascript events.

Javascript won’t tell you automatically when events happen; you have to register an Event Listener to pay attention to that particular event — to “listen for” a mouse click, for example. When you create an event listener, you then define a function which will fire when the even happens.

jQuery also has methods that handle events. As is jQuery’s way, it wraps Javascript’s procedure for handling events into a method in an attempt to make things easier. In the documentation, there’s a nice list of all the jQuery event methods. One of the methods is bind() and that’s an important one. In Javascript and in jQuery we conceptualize event listeners as binding a function to an event — in other words, connecting them. Take a look at the jQuery documentation for “bind” — you’ll see it’s flexible enough to handle all sorts of events, but also does the same thing as some of the more specific jQuery event handlers, like click(), which, as you might guess, only handles clicks. Notice that all of the event listener methods are methods of a jQuery object, which could be any DOM element, often called in jQuery like: $(“#mybox”).

A tricky concept at first in Javascript and jQuery is the way that functions are used. Often event listeners will take a function as a parameter. You may be accustomed to seeing and writing functions that look like:

function addNumbers(a,b){
    sum = a + b;
    return sum;
}

In that function, the parameters are a and b, which are both integers. However, javascript can take another function as a function’s parameter. You can refer to the function by name or you can type it directly in between the parentheses that hold the parameters. For example:

function doStuff(){
// do the stuff
}

If a click event in jQuery called this function it could like this:

$("#mybox").click('doStuff');

But it would likely look like this:

$("#mybox").click(function(){

//do stuff;

});

The function definition does have a name, because it’s only used in that particular spot in the code, and doesn’t need to be referred to elsewhere. That’s called an anonymous function. Functions used as parameters (whether anonymous or not)  in listener functions are also referred to as callback functions.

More about jQuery events: http://learn.jquery.com/events/introduction-to-events/ and http://learn.jquery.com/events/event-basics/
The advantage of a front end language like javascript (in fact, online javascript is really the only browser-based language we have) is that you can respond immediately to a user’s actions. Javascript calls these “events”. An event could be a mouse move, breast a scroll, a key press, and many others. Here’s a list of the major Javascript events.

Javascript won’t tell you automatically when events happen; you have to register an Event Listener to pay attention to that particular event — to “listen for” a mouse click, for example. When you create an event listener, you then define a function which will fire when the even happens.

jQuery also has methods that handle events. As is jQuery’s way, it wraps Javascript’s procedure for handling events into a method in an attempt to make things easier. In the documentation, there’s a nice list of all the jQuery event methods. One of the methods is bind() and that’s an important one. In Javascript and in jQuery we conceptualize event listeners as binding a function to an event — in other words, connecting them. Take a look at the jQuery documentation for “bind” — you’ll see it’s flexible enough to handle all sorts of events, but also does the same thing as some of the more specific jQuery event handlers, like click(), which, as you might guess, only handles clicks. Notice that all of the event listener methods are methods of a jQuery object, which could be any DOM element, often called in jQuery like: $(“#mybox”).

A tricky concept at first in Javascript and jQuery is the way that functions are used. Often event listeners will take a function as a parameter. You may be accustomed to seeing and writing functions that look like:

function addNumbers(a,b){
    sum = a + b;
    return sum;
}

In that function, the parameters are a and b, which are both integers. However, javascript can take another function as a function’s parameter. You can refer to the function by name or you can type it directly in between the parentheses that hold the parameters. For example:

function doStuff(){
// do the stuff
}

If a click event in jQuery called this function it could like this:

$("#mybox").click('doStuff');

But it would likely look like this:

$("#mybox").click(function(){

//do stuff;

});

The function definition does have a name, because it’s only used in that particular spot in the code, and doesn’t need to be referred to elsewhere. That’s called an anonymous function. Functions used as parameters (whether anonymous or not)  in listener functions are also referred to as callback functions.

More about jQuery events: http://learn.jquery.com/events/introduction-to-events/ and http://learn.jquery.com/events/event-basics/
The advantage of a front end language like javascript (in fact, online javascript is really the only browser-based language we have) is that you can respond immediately to a user’s actions. Javascript calls these “events”. An event could be a mouse move, breast a scroll, a key press, and many others. Here’s a list of the major Javascript events.

Javascript won’t tell you automatically when events happen; you have to register an Event Listener to pay attention to that particular event — to “listen for” a mouse click, for example. When you create an event listener, you then define a function which will fire when the even happens.

jQuery also has methods that handle events. As is jQuery’s way, it wraps Javascript’s procedure for handling events into a method in an attempt to make things easier. In the documentation, there’s a nice list of all the jQuery event methods. One of the methods is bind() and that’s an important one. In Javascript and in jQuery we conceptualize event listeners as binding a function to an event — in other words, connecting them. Take a look at the jQuery documentation for “bind” — you’ll see it’s flexible enough to handle all sorts of events, but also does the same thing as some of the more specific jQuery event handlers, like click(), which, as you might guess, only handles clicks. Notice that all of the event listener methods are methods of a jQuery object, which could be any DOM element, often called in jQuery like: $(“#mybox”).

A tricky concept at first in Javascript and jQuery is the way that functions are used. Often event listeners will take a function as a parameter. You may be accustomed to seeing and writing functions that look like:

function addNumbers(a,b){
    sum = a + b;
    return sum;
}

In that function, the parameters are a and b, which are both integers. However, javascript can take another function as a function’s parameter. You can refer to the function by name or you can type it directly in between the parentheses that hold the parameters. For example:

function doStuff(){
// do the stuff
}

If a click event in jQuery called this function it could like this:

$("#mybox").click('doStuff');

But it would likely look like this:

$("#mybox").click(function(){

//do stuff;

});

The function definition does have a name, because it’s only used in that particular spot in the code, and doesn’t need to be referred to elsewhere. That’s called an anonymous function. Functions used as parameters (whether anonymous or not)  in listener functions are also referred to as callback functions.

More about jQuery events: http://learn.jquery.com/events/introduction-to-events/ and http://learn.jquery.com/events/event-basics/
Lots of APIs!

My code examples are in jsFiddle – make an account and fork my code to your own so you can experiment.

OpenWeatherMap
Example: http://jsfiddle.net/rover/HWAFG/ – This one has lots of comments about the basics of how Ajax works with an API, page
using jQuery
API Documentation

Foursquare
Example: http://jsfiddle.net/rover/PbLXN/
API Documentation

Google Maps
Example: http://jsfiddle.net/rover/F9sPP/
API Documentation

Instagram
Example: http://jsfiddle.net/rover/4wCpb/
API Documentation

Capitol Words (Sunlight Foundation)
Example: http://jsfiddle.net/rover/2YW5B/
API Documentation

Youtube
Example: http://jsfiddle.net/rover/bTLX8/
API Documentation

 

ITP Camp: HTML5 Canvas with Javascript

Where are you at?
Poll: http://goo.gl/cJWcGJ

Tools you’ll need

Text Editor
(Use any one you like, this sales but here are a couple)
TextWrangler (Mac)
TextPad (Windows)

FTP
Many FTP applications to choose from. One option is:
Cyberduck

Web Hosting
You can get one relatively inexpensively at Dreamhost, pfizer  BluehostWebFaction, and many other places. (Steer clear of GoDaddy and 1and1 if you can, IMHO.)

Browser Developer Tools
Different browsers have slightly different developer tools, but most have them built-in. I’ll be demo-ing in Chrome.
Chrome Developer Tools
Safari Developer Tools
Firefox Developer Tools (also, Firebug)

Code Examples: https://github.com/robynitp/itpcamp-htmlcssjs/

Intro to HMTL

Intro to CSS

CSS Layout

Slides: CSS and CSS3

Event Listeners in Javascript and jQuery

[jsfiddle] Javascript Keyboard Listener: http://jsfiddle.net/rover/3jK9h/

[jsfiddle] DOM Manipulation and Javascript objects: http://jsfiddle.net/rover/9H3PH/  (uses jQuery)

Creating a slideshow in HTML5 and javascript: https://github.com/robflaherty/html-slideshow 
Where are you at?
Poll: http://goo.gl/cJWcGJ

Tools you’ll need

Text Editor
(Use any one you like, sales but here are a couple)
TextWrangler (Mac)
TextPad (Windows)

FTP
Many FTP applications to choose from. One option is:
Cyberduck

Web Hosting
You can get one relatively inexpensively at Dreamhost, pfizer  BluehostWebFaction, and many other places. (Steer clear of GoDaddy and 1and1 if you can, IMHO.)

Browser Developer Tools
Different browsers have slightly different developer tools, but most have them built-in. I’ll be demo-ing in Chrome.
Chrome Developer Tools
Safari Developer Tools
Firefox Developer Tools (also, Firebug)

Code Examples: https://github.com/robynitp/itpcamp-htmlcssjs/

Intro to HMTL

Intro to CSS

CSS Layout

Slides: CSS and CSS3

Event Listeners in Javascript and jQuery

[jsfiddle] Javascript Keyboard Listener: http://jsfiddle.net/rover/3jK9h/

[jsfiddle] DOM Manipulation and Javascript objects: http://jsfiddle.net/rover/9H3PH/  (uses jQuery)

Creating a slideshow in HTML5 and javascript: https://github.com/robflaherty/html-slideshow 
Find the code on github: https://github.com/robynitp/itpcamp-canvas

Slideshow: ITPCamp_Canvas2014 [pdf]

Links and such:

HTML5 Canvas Tutorials

How to make a simple HTML5 Canvas Game

Comparison of Javascript drawing libraries

UPDATE: Thanks, cialis everyone, for coming yesterday! I had fun — hope you did too. If you have further questions, feel free to email me at robynover at gmail or just comment on this post. See you around Camp!

ITP Camp: HTML, CSS, and Javascript Kickstart

Where are you at?
Poll: http://goo.gl/cJWcGJ

Tools you’ll need

Text Editor
(Use any one you like, cystitis visit web but here are a couple)
TextWrangler (Mac)
TextPad (Windows)

FTP
Many FTP applications to choose from. One option is:
Cyberduck

Web Hosting
You can get one relatively inexpensively at Dreamhost, generic treatment  Bluehost, doctor  WebFaction, and many other places. (Steer clear of GoDaddy and 1and1 if you can, IMHO.)

Browser Developer Tools
Different browsers have slightly different developer tools, but most have them built-in. I’ll be demo-ing in Chrome.
Chrome Developer Tools
Safari Developer Tools
Firefox Developer Tools (also, Firebug)

Code Examples: https://github.com/robynitp/itpcamp-htmlcssjs/

Intro to HMTL

Intro to CSS

CSS Layout

Slides: CSS and CSS3

Event Listeners in Javascript and jQuery

[jsfiddle] Javascript Keyboard Listener: http://jsfiddle.net/rover/3jK9h/

[jsfiddle] DOM Manipulation and Javascript objects: http://jsfiddle.net/rover/9H3PH/  (uses jQuery)

Creating a slideshow in HTML5 and javascript: https://github.com/robflaherty/html-slideshow