Skip to content

Instantly share code, notes, and snippets.

View peterkinmond's full-sized avatar

Peter Kinmond peterkinmond

View GitHub Profile
@peterkinmond
peterkinmond / zepto-jquery-conflict.html
Created August 7, 2013 21:53
With jQuery in noConflict mode, Zepto is no longer assigned to $. We ran into this issue while running our own js which included a noConflict version of jQuery on a publishers page which already included zepto.js
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script>
<script>
$.noConflict(true)
</script>
<script src="http://zeptojs.com/zepto.js" type="text/javascript"></script>
</head>
<body>
With jQuery in noConlict mode, Zepto is no longer assigned to $.
</body>
@peterkinmond
peterkinmond / gist:4192239
Created December 3, 2012 02:39
Adku hiring puzzle
def find_unique_paths(x, y, visited_points)
if is_at_end_point?(x, y)
@total_paths += 1 # successful path
elsif !visited_points.include?([x, y])
visited_points << [x, y] # unvisited point, add to path
find_unique_paths(x + 1, y, visited_points.clone) if x + 1 <= @MAX_X # right
find_unique_paths(x - 1, y, visited_points.clone) if x > 0 # left
find_unique_paths(x, y + 1, visited_points.clone) if y + 1 <= @MAX_Y # down
find_unique_paths(x, y - 1, visited_points.clone) if y > 0 # up