Skip to content

Instantly share code, notes, and snippets.

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

@rf-
rf- / ResizingTextArea.css
Last active August 29, 2015 14:02
Resizing text area in JSX
.resizing-text-area__container {
position: relative;
}
.resizing-text-area__input {
height: 100%;
overflow: hidden;
position: absolute;
resize: none;
width: 100%;
@rf-
rf- / clickhole.user.js
Last active August 29, 2015 14:06
User script for revealing Clickhole quiz answers
// ==UserScript==
// @name Expose Clickhole Quizzes
// @namespace http://rynftz.gr
// @include *clickhole.com*
// @grant none
// ==/UserScript==
(function() {
$('#quiz .question .prompt').append(
$('<a href="#" class="expose-answers" style="font-size: 12px; display: block">Show Answers</a>')
~/bin/src/node $ coffee -pe "x: [0..10]"
(function() {
var _a, _b;
{
x: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
};
})();
~/bin/src/node $ coffee -pe "i in [0..10]"
(function() {
var _a, _b, _c, _d, _e;
!!(function(){ for (var _d=0, _e=(_a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).length; _d<_e; _d++) if (_a[_d] === i) return true; }).call(this);
})();
~ $ coffee -pe "a: 3"
(function() {
{
a: 3
};
})();
~ $ cat > test.coffee
a: 3
b: 4
c: a + b
~ $ coffee -p test.coffee
(function() {
{
a: 3,
~/bin/src/coffee-script $ coffee -pe "thing[stuff()] ?= 5"
(function() {
var _a, _b;
thing[(_a = stuff())] = (typeof (_b = thing[(_a = stuff())]) !== "undefined" && _b !== null) ? thing[_a] : 5;
})();
should be
~/bin/src/coffee-script $ coffee -pe "thing[stuff()] ?= 5"
(function() {
$.each carousels, ->
carousel = $(this)
carousels.each ->
carousel = $(this)
# or abstract it out
$.fn.each_j = (callback) ->
this.each (i) ->
callback.call this, i, $(this)
@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)