Skip to content

Instantly share code, notes, and snippets.

View sathishmanohar's full-sized avatar

Sathish Manohar sathishmanohar

View GitHub Profile
@andynu
andynu / examples.md
Created February 1, 2024 16:50
Assorted rake tasks for orienting and evaluating the use of a rails app.

Overview:

rails stats:controllers  # Show basic controller usage stats
rails stats:models       # Show basic model usage stats
rails stats:trends       # show frequency trends for a date column; MODEL=x COLUMN=y
rails stats:unroutable   # Find routes that will raise a routing error when requested
rails stats:users        # Show basic details of users
@idcrook
idcrook / neotree-project-dir.el
Created June 13, 2018 15:06
emacs neotree and projectile: sync with projectile
;; NeoTree can be opened (toggled) at projectile project root
(defun neotree-project-dir ()
"Open NeoTree using the git root."
(interactive)
(let ((project-dir (projectile-project-root))
(file-name (buffer-file-name)))
(neotree-toggle)
(if project-dir
(if (neo-global--window-exists-p)
(progn
@tanyuan
tanyuan / smart-caps-lock.md
Last active April 24, 2024 15:22
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@bluemont
bluemont / url_validator.rb
Created June 25, 2012 04:27
ActiveModel URL Validator
class UrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
valid = begin
URI.parse(value).kind_of?(URI::HTTP)
rescue URI::InvalidURIError
false
end
unless valid
record.errors[attribute] << (options[:message] || "is an invalid URL")