Skip to content

Instantly share code, notes, and snippets.

@rf-
rf- / 00-README.md
Last active March 8, 2019 06:39 — forked from datanoise/crystal-tags.cr
Crystal ctags generator

To compile with Homebrew-installed LLVM:

PATH=/usr/local/opt/llvm/bin:$PATH crystal build crystal-tags.cr

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

arr = [[{:name=>"one", :enabled=>true},
{:name=>"two", :enabled=>false}],
[{:name=>"one", :enabled=>true},
{:name=>"two", :enabled=>true}]
]
a = arr.flatten.inject(Hash.new(true)) do |result, element|
result[element[:name]] &&= element[:enabled]
result
@rf-
rf- / gist:954788
Created May 4, 2011 05:13 — forked from anonymous/gist:954770
coffeescript global offset
# note that this is gross
findPos = (obj) ->
values = while (obj = obj.offsetParent)
[obj.offsetLeft, obj.offsetTop]
_.reduce(values, (sums, pair) ->
left: sums.left + pair[0]
right: sums.right + pair[1]
left: 0, top: 0)