This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* makesPairWith returns a boolean indicating if the | |
* given array (inArr) contains a pair of numbers that | |
* add up to the target | |
* | |
* inArr - The array to be flattened | |
* target - The number the pairs may add up to | |
*/ | |
function makesPairWith(inArr,target) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In ruby I could just do: | |
our_arr = in_arr.flatten | |
But that says more about ruby than it does about me. | |
*/ | |
/* flatten returns a new array that is a flattened |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is from | |
http://uihacker.blogspot.com/2011/04/javascript-handle-touch-gestures-for.html | |
I wrote a little class to handle pinch & rotate gestures on a web page in iOS. There's a bunch of event listener adding/removing, which can get a little messy, so this should help keep your code clean if you need to handle gestures. | |
Here's the class: | |
*/ | |
function GestureCallback( element, endCallback, changeCallback ) { |