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.
| function DecodePolylines(encoded) { | |
| var poly = []; | |
| var index = 0, len = encoded.length, | |
| lat = 0, lng = 0; | |
| while (index < len) { | |
| var b, shift = 0, result = 0; | |
| do { | |
| b = encoded.charCodeAt(index++) - 63; | |
| result |= (b & 0x1f) << shift; |
| /* | |
| * Android API Guide | |
| * http://developer.android.com/guide/topics/ui/actionbar.html | |
| * Android Design Guide | |
| * http://developer.android.com/design/patterns/actionbar.html | |
| * Titanium Mobile will support someday | |
| * https://jira.appcelerator.org/browse/TIMOB-2371 | |
| */ | |
| var osName = Ti.Platform.osname, | |
| isAndroid = osName==='android', |
| // | |
| // in this demo, we simply show how you could dynamically scroll | |
| // with a continuous amount of data in the tableview by detecting | |
| // when the user's scroll position gets near the end of the table | |
| // and start a background fetch of new data and seamlessly append | |
| // the new data to the table automatically | |
| // | |
| var win = Ti.UI.createWindow(); |
| module Todo | |
| class API < Grape::API | |
| use Rack::Session::Cookie | |
| version 'v1', :format => :json | |
| resource do | |
| http_basic do |username, password| | |
| User.authenticate(username, password) | |
| end | |
| RSpec.configure do |config| | |
| # ... | |
| config.after(:all) do | |
| if Rails.env.test? | |
| FileUtils.rm_rf(Dir["#{Rails.root}/spec/support/uploads"]) | |
| end | |
| end | |
| end | |
| # put logic in this file or initalizer/carrierwave.rb |
| # RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
| # defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
| module Player | |
| describe MovieList, "with optional description" do | |
| it "is pending example, so that you can write ones quickly" | |
| it "is already working example that we want to suspend from failing temporarily" do | |
| pending("working on another feature that temporarily breaks this one") |
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.
| ... | |
| # ==> Configuration for any authentication mechanism | |
| # Configure which keys are used when authenticating a user. The default is | |
| # just :email. You can configure it to use [:username, :subdomain], so for | |
| # authenticating a user, both parameters are required. Remember that those | |
| # parameters are used only when authenticating and not when retrieving from | |
| # session. If you need permissions, you should implement that in a before filter. | |
| # You can also supply a hash where the value is a boolean determining whether | |
| # or not authentication should be aborted when the value is not present. | |
| config.authentication_keys = [ :login ] |
| # In config/initializers/local_override.rb: | |
| require 'devise/strategies/authenticatable' | |
| module Devise | |
| module Strategies | |
| class LocalOverride < Authenticatable | |
| def valid? | |
| true | |
| end |
| counts = Hash.new(0) | |
| ObjectSpace.each_object do |o| | |
| next unless (o.class == String) | |
| counts[o[0,60]] += 1 | |
| end | |
| counts = counts.to_a.sort_by(&:last); | |
| puts counts[-10..-1] | |
| puts Process.pid |