Function | Shortcut |
---|---|
New Tab | ⌘ + T |
Close Tab or Window | ⌘ + W (same as many mac apps) |
Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
Go to Split Pane by Direction | ⌘ + Option + Arrow Key |
Cycle iTerm Windows | ⌘ + backtick (true of all mac apps and works with desktops/mission control) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class Things < ApplicationRecord | |
scope :filter_after_date, -> (date) { | |
where(created_at_as_date.gteq(date)) | |
} | |
scope :filter_before_date, -> (date) { | |
where(created_at_as_date.lteq(date)) | |
} | |
def self.created_at_as_date | |
Arel::Nodes::NamedFunction.new "DATE", [ arel_table[:created_at] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
# with their associated values. For example, "{ status: 'delayed' }" would call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Example do | |
def main(args) do | |
args |> parse_args |> process | |
end | |
def parse_args(args) do | |
options = OptionParser.parse(args, switches: [help: :boolean], | |
aliases: [h: :help]) | |
case options do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SpecHelper | |
def local_io(in_str) | |
old_stdin, old_stdout = $stdin, $stdout | |
$stdin = StringIO.new(in_str) | |
$stdout = StringIO.new | |
yield | |
$stdout.string | |
ensure | |
$stdin, $stdout = old_stdin, old_stdout | |
end |
- Your class can be no longer than a hundred lines of code.
- Your methods can be no longer than five lines of code
- You can pass no more than four parameters and you can't just make it one big hash.
- In your controller, you can only instantiate one object, to do whatever it is that needs to be done.
- Your view can only know about one instance variable.
- Your Rails view should only send messages to that object i.e., no Demeter violations.[ "thunder dome principal". Translated: one model in, one model out! ]
- Rules are meant to be broken if by breaking them you produce better code. [ ...where "better code" is validated by explaining why you want to break the rule to someone else. ]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Rails Upgrade check | |
# | |
# Check your github repos for out of date rails apps | |
# | |
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ruby railscheck.rb | |
# or | |
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ORG=yourorgname ruby railscheck.rb | |
# | |
# n.b requires the octokit gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Form | |
include ActiveModel::Validations | |
extend ActiveModel::Naming | |
def self.wraps(model) | |
@wraps = model | |
end | |
def self.model_name | |
ActiveModel::Name.new(@wraps.to_s.classify.constantize) |
- Open the iTunes subscription (itpc://rubytapas.dpdcart.com/feed)
- Authenticate with your Ruby Tapas username and password
- Plug in your device and select it from the Devices menu
- Open the Podcasts tab
- Enable "Sync Podcasts"
- Ensure that RubyTapas is included in the sync list
- Press Apply
- Enable Wi-Fi syncing to get the episodes without plugging into your computer (optional)
Note: iTunes Syncing only works with the Podcasts app (https://itunes.apple.com/us/app/podcasts/id525463029?mt=8)
NewerOlder