Keybinding | Action |
---|---|
Alt + f/b | Move cursor to previous/next word |
Ctrl + a/e | Move cursor to beginning/end of command |
Ctrl + xx | Toggle between the start of line and current cursor position |
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
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything | |
require 'rouge' | |
require 'method_source' | |
require 'pp' | |
class Dbg | |
def initialize(object, to:) | |
@object, @stream = object, to | |
end |
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
(ns segmentation.util.format | |
(:require [clojure.pprint :refer [pprint with-pprint-dispatch code-dispatch]] | |
[rewrite-clj.parser :as p] | |
[rewrite-clj.printer :as prn])) | |
(defn is-token-sandwich [triplet] | |
(let [first-token (-> triplet first first) | |
second-token (-> triplet second first) | |
result (and (not= first-token :newline) (= second-token :whitespace))] | |
result)) |
This is my hand-rolled solution for getting Angular assets (Controllers, Models, Directives, Templates, etc.) integrated into the Rails Asset Pipeline.
Of particular note: this hack will also load the AngularJS $templateCache
with your templates,
while allowing you to use Slim, ERB, etc. to write your templates.
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
# We have to remove validations on email, as it's no longer needed. | |
# Based on a solution found at http://stackoverflow.com/questions/7545938/how-to-remove-validation-using-instance-eval-clause-in-rails | |
Model.class_eval do | |
_validators.reject!{ |key, _| key == :field } | |
_validate_callbacks.each do |callback| | |
callback.raw_filter.attributes.delete :field | |
end |