Skip to content

Instantly share code, notes, and snippets.

View qd3v's full-sized avatar
🏠
Working from home

Ivan Kulagin qd3v

🏠
Working from home
View GitHub Profile
@2KAbhishek
2KAbhishek / Shell_Keybindings.md
Last active April 17, 2024 14:47
Keyboard shortcuts for bash/zsh

Shell Keybindings

Navigation 🚀

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

# 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
@marioaquino
marioaquino / format.clj
Created April 15, 2014 23:49
Clojure/edn formatter
(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))
@stevenharman
stevenharman / _angularjs_and_rails_asset_pipeline.md
Last active April 30, 2016 23:20
Load the Angular.js $templateCache while building assets for Rails Asset Pipeline. Be sure in require the `templates` module as a dependency of your Angular.js app.

AngularJS + Rails Asset Pipeline

This is my hand-rolled solution for getting Angular assets (Controllers, Models, Directives, Templates, etc.) integrated into the Rails Asset Pipeline.

Templates and the $templateCache

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.

@brenes
brenes / model_extension.rb
Last active February 14, 2024 11:39
Removing validation of a model declared on a gem
# 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