Skip to content

Instantly share code, notes, and snippets.

Ratandeep Ratti rdsr

Block or report user

Report or block rdsr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cross_product.clj
(->> colls
(reduce #(for [x %1 y %2] [x y]))
(map flatten)))
View full_screen.el
;;toggle full-screen
(defun toggle-fullscreen ()
(if (frame-parameter nil 'fullscreen)
View save_buffer.el
(defun my-save-buffer (&optional args)
"removing trailing whitespaces and tabs while saving buffer"
(interactive "p")
(untabify (point-min) (point-max))
(save-buffer args))
(global-set-key "\C-x\C-s" 'my-save-buffer)
View cleanup.clj
(defn clean-up [m]
(reduce f {} m))
(defn f
[m [key value]]
(vector? value) (apply conj m (map clean-up value))
(map? value) (conj m value)
:else (assoc m key value)))
View contextual_eval.clj
(defn contextual-eval [ctx expr] ;; from Joy of clojure
`(let ~(vec (mapcat #(list % `('~ctx '~%)) (keys ctx)))
(defn contextual-eval ;; alternative
[ctx expr]
`(let ~(vec (apply concat ctx))
View text data type not working
(defn create-project
[:id :int "PRIMARY KEY" "NOT NULL"]
[:name "varchar(30)" "NOT NULL"]
[:description :text "NOT NULL"]))
You can’t perform that action at this time.