Skip to content

Instantly share code, notes, and snippets.

@lcmen
lcmen / yymmdd.rb
Last active June 26, 2017 17:46 — forked from sshaw/yymmdd.rb
[Ruby: DSL extension for date parsing] Small DSL for idiomatic date parsing and formatting in Ruby. tags: ruby
require "date"
# Usage:
#
# include YYMMDD
# date = Date.today
#
# puts yy/mm
# puts ymd(411207)
# puts yyyy.mm.dd(date)
@lcmen
lcmen / capybara cheat sheet.rb
Last active June 26, 2017 17:48 — forked from zhengjia/capybara cheat sheet
[Capybara: cheatsheet] All possible methods to interact with page using Capybara. #tags: ruby, rails
# Navigating
visit('/projects')
visit(post_comments_path(post))
# Clicking links and buttons
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@lcmen
lcmen / controller.js
Last active June 27, 2017 11:28
[Backbone: base Marionette controller] Base controller that I use in my marionette.js applications. #tags: backbone.js
Controller.Base = function() {
function Controller(options) {
options = options || {};
this.region = options.region;
Marionette.Controller.call(this, options);
}
Controller.extend = Marionette.Controller.extend;
_.extend(Controller.prototype, Marionette.Controller.prototype);