Skip to content

Instantly share code, notes, and snippets.

View ashishpuliyel's full-sized avatar

Ashish Puliyel ashishpuliyel

View GitHub Profile
/* 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) {
/*
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
@ashishpuliyel
ashishpuliyel / GestureCallback Helper Class - Mobile Webkit
Created November 12, 2011 21:04
Class to handle touch gestures for scale and rotate (pinch to zoom) on Mobile webkit
/*
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 ) {