| Command | What it do |
-------------------------------------+
| C-h r | Emacs Help |
| C-/ | Undo |
| C-h k | Show definition of command |
| C-x C-o | Delete all blank lines |
| M-5 C-n | Perform the action 5 times |
| M-% | Search and replace (Query) |
| [alias] | |
| com = commit | |
| co = checkout | |
| br = branch | |
| # Log display from screencast, with train tracks. | |
| l = log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset' | |
| # Alternate log display from Scott Chacon | |
| lol = log --pretty=oneline --abbrev-commit --graph --decorate | |
| # Other useful aliases: |
| new_button :home_button do |b| | |
| b.title = "Home Button" | |
| b.titleColor = .... | |
| b.target = .... | |
| end |
| # Wouldn't first_name equal the array? | |
| def test_parallel_assignment_with_one_variable | |
| first_name = ["John", "Smith"] | |
| assert_equal "John", first_name | |
| end | |
| # Pry | |
| [1] pry(main)> first_name = ["Brady", "Love"] | |
| => ["Brady", "Love"] |
| # Use: it { should accept_nested_attributes_for(:association_name).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })} | |
| RSpec::Matchers.define :accept_nested_attributes_for do |association| | |
| match do |model| | |
| @model = model | |
| @nested_att_present = model.respond_to?("#{association}_attributes=".to_sym) | |
| if @nested_att_present && @reject | |
| model.send("#{association}_attributes=".to_sym,[@reject]) | |
| @reject_success = model.send("#{association}").empty? | |
| end | |
| model.send("#{association}").clear |
| # lib/custom_logger.rb | |
| class CustomLogger < Logger | |
| def format_message(severity, timestamp, progname, msg) | |
| "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" | |
| end | |
| end | |
| logfile = File.open("#{Rails.root}/log/custom.log", 'a') # create log file | |
| logfile.sync = true # automatically flushes data to file | |
| CUSTOM_LOGGER = CustomLogger.new(logfile) # constant accessible anywhere |
| { name: "Basic Crepes", | |
| prep_time: 10, | |
| cook_time: 10, | |
| servings: 4, | |
| short_description: %q(These crepes are awesome!), | |
| ingredients_attributes: [{ amount: "1/3", | |
| measurement: "Cup", | |
| ingredient: "Flour" }, | |
| { amount: "2", | |
| measurement: "", |
| development: | |
| adapter: postgresql | |
| encoding: unicode | |
| database: RecipEasy_development | |
| pool: 5 | |
| username: brady | |
| password: | |
| # Connect on a TCP socket. Omitted by default since the client uses a | |
| # domain socket that doesn't need configuration. Windows does not have |
| $(filelist).delegate(".send", "click", function() { | |
| var li = $(this).closest("li"); | |
| var fileID = parseInt(li.attr("data-fileid"), 10); | |
| var groupID = parseInt(li.attr("data-groupid"), 10); | |
| var file = FileReaderJS.output[groupID].files[fileID]; | |
| if (file.size < o.maxSize) { | |
| sendFile(file, li); | |
| } |
| (custom-set-variables | |
| ;; custom-set-variables was added by Custom. | |
| ;; If you edit it by hand, you could mess it up, so be careful. | |
| ;; Your init file should contain only one such instance. | |
| ;; If there is more than one, they won't work right. | |
| '(ansi-color-faces-vector [default bold shadow italic underline bold bold-italic bold]) | |
| '(ansi-color-names-vector (vector "#eaeaea" "#d54e53" "#b9ca4a" "#e7c547" "#7aa6da" "#c397d8" "#70c0b1" "#000000")) | |
| '(blink-cursor-mode nil) | |
| '(column-number-mode t) | |
| '(custom-enabled-themes (quote (sanityinc-tomorrow-night))) |