This file contains hidden or 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
(defun weather-ametlla () | |
"Obre un buffer amb la predicció horaria de temps a l'Ametlla segons meteocat.cat." | |
(interactive) | |
(let ((buffer (get-buffer-create "*weather ametlla*"))) | |
(switch-to-buffer buffer) | |
(setq buffer-read-only nil) | |
(erase-buffer) | |
(shell-command "w3m -dump https://m.meteo.cat/prediccio-per-hores?codi=080057" buffer) | |
(local-set-key "q" 'kill-this-buffer) | |
)) |
This file contains hidden or 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://gist.github.com/trikitrok/a97d330bacb1f56fe5ee027c12ff273a | |
(require '[clojure.test :as test]) | |
(def format-functions | |
{:snake-case (fn [words] | |
(clojure.string/join "_" words)) | |
:kebab-case (fn [words] | |
(clojure.string/join "-" words)) | |
:camel-case (fn [words] | |
(apply str (first words) |
This file contains hidden or 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
(def format-functions | |
{:snake-case (fn [words] | |
(clojure.string/join "_" words)) | |
:kebab-case (fn [words] | |
(clojure.string/join "-" words)) | |
:camel-case (fn [words] | |
(apply str (first words) | |
(map clojure.string/capitalize (rest words)))) | |
:pascal-case (fn [words] | |
(apply str |
This file contains hidden or 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
1) create project with re-natal | |
re-natal init MyApp reagent6 | |
2) reorganize source code | |
cd my-app | |
mkdir alt | |
mv src/cljsjs alt | |
mv src/reagent alt |
This file contains hidden or 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
def makeMultiInput(inputs, idx=0): | |
'inputs a collection of strings, to be returned one at a time' | |
# closure on inputs and index | |
def next_input(message=""): | |
# nonlocal only in python3 similar to global but | |
# for non local non global variables | |
nonlocal idx | |
if idx < len(inputs): | |
idx = idx + 1 |
This file contains hidden or 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
;; it formats buffer and attempts to return to original position. | |
(defun cider-format-buffer-back () (interactive) | |
(let (p) | |
(setq p (point)) | |
(cider-format-buffer) | |
(goto-char p)) | |
) | |
(defun add-clj-format-before-save () (interactive) | |
(add-hook 'before-save-hook |
This file contains hidden or 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 ic.user) | |
;; funciones | |
;; (function param-1 param-2 ... param-n) | |
(inc 3) | |
(str "hola" "mundo") | |
;;(1 2 3) |
This file contains hidden or 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 alphabet-cipher.coder) | |
(defn encode-int [range key msg] | |
(mod (+ key msg) range)) | |
(defn decode-int [range key encoded-msg] | |
(mod (- encoded-msg key) range)) | |
(defn decipher-int [range encoded-msg msg] | |
(mod (- encoded-msg msg) range)) |
This file contains hidden or 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 recur.ns-hof) | |
(defn f-nth-iterate | |
[f init] | |
(fn fun-nth | |
([val left] | |
(if (zero? left) val | |
(recur (f val) (dec left)) | |
)) | |
([e] (fun-nth init e)))) |
NewerOlder