Skip to content

Instantly share code, notes, and snippets.

@swdunlop
Created July 4, 2011 00:17
Show Gist options
  • Select an option

  • Save swdunlop/1062745 to your computer and use it in GitHub Desktop.

Select an option

Save swdunlop/1062745 to your computer and use it in GitHub Desktop.
Sample of some CoffeeScript from AndBug's Navi utility
layout_local = (k, v) ->
$('<div class="local">k = v</div>').text("#{k} = #{v}")
layout_frame = (f) ->
div = $('<div class="frame"></div>')
div.append($('<h3></h3>').text("Frame: " + f[0]))
div.addClass('native') if f[2]
div.append(layout_local l[0], l[1]) for l in f[2..]
div.hide()
return div
layout_thread = (t) ->
div = $('<div class="thread"></div>')
div.append($('<h3></h3>').text("Thread: " + t[0]))
div.append(layout_frame f) for f in t[1..]
return div
$ ->
threads = eval($('#forest').text())
$('#content').append(layout_thread t) for t in threads
$('#content').children().first().find('.frame').show()
$('.thread > h3').click (evt) ->
$('.frame').hide()
console.log(this.parent)
$(this).parent().find('.frame').show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment