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
{"type":"charge.succeeded", | |
"event_date":"2019-03-06T12:54:01-06:00", | |
"transaction":{"id":"trnvybx9sdu6yfd3o4pn", | |
"authorization":"305180", | |
"operation_type":"in", | |
"method":"store", | |
"transaction_type":"charge", | |
"status":"completed", | |
"conciliated":false, | |
"creation_date":"2019-03-06T12:54:01-06:00", |
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
{ | |
"Records": [ | |
{ | |
"eventSource": "aws:ses", | |
"eventVersion": "1.0", | |
"ses": { | |
"mail": { | |
"timestamp": "2019-03-27T21:58:29.360Z", | |
"source": "mmontoya@gmail.com", | |
"messageId": "ujuocr76opqg7nbrjanfj78792kvpcig4i8g6f81", |
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
(defn flat? | |
"true if there is no sequences" | |
[seq] | |
(not-any? (fn [x] (isa? (type x) java.util.List)) seq)) | |
(defn my-flatten | |
"Returns flat sequence" | |
[seq] | |
(if (isa? (type seq) java.util.List) | |
(if (flat? seq) |
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
(defn index-by-id | |
"Get index from a vector of maps using id field" | |
[v id] | |
(first (filter #(= (:id (v %)) id) (range (count v))))) |
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
;; Clojure hiccup file | |
[:button {:class "btn btn-success" :onClick (str "zentaur.core.deletetest("id")")} "Borrar resgistro"] | |
;; file: src/cljs/zentaur/core.cljs | |
(defn ^:export deletetest [test-id] | |
(when (js/confirm (str "Delete test?")) | |
(set! js/window.location.href (str "/admin/tests/deletetest/" test-id)))) |
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
;; Clojure hiccup file | |
[:button {:class "btn btn-success" :onClick (str "zentaur.core.deletetest("id")")} "Löschen"] | |
;; file: src/cljs/zentaur/core.cljs | |
(ns zentaur.core | |
(:require [ajax.core :refer [GET POST DELETE]])) | |
(defn delete-test [test-id] |
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
class Anagram | |
def initialize | |
@unique_anagrams = nil | |
end | |
def my_array | |
@unique_anagrams ||= ["perro", "algo", "qwer","uuu", "lujo", "peorr","lago","edfr", "sadasd", "uljo", "erpro", "perro", "jolu"] | |
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
(:require [java-time :as jt])) | |
(defn format-date | |
"Format a Java instant" | |
[date] | |
(let [formatter (jt/format "dd-MM-yyyy HH:mm")] | |
(jt/format formatter (.atZone date (jt/zone-id))))) | |
;; clj-time is now deprecated |
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 clj-odf.core | |
(:import java.net.URI | |
org.odftoolkit.simple.TextDocument | |
org.odftoolkit.simple.table.Cell | |
org.odftoolkit.simple.table.Table | |
org.odftoolkit.simple.text.list.List)) | |
(defn generate-odf [filename] | |
(let [outputOdt (TextDocument/newTextDocument) | |
uri (URI. "/home/manuel/Documents/lisplogo_fancy_256.png") |
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
(defn str-to-int | |
"Convert some string keys in a map to integer" | |
[coll & int-keys] | |
(let [listed (set int-keys)] | |
(reduce-kv #(assoc %1 %2 (if (contains? listed %2 ) (Integer/parseInt %3) %3)) {} coll))) | |
(str-to-int {:qt "56" :kl "Some String" :wer "22" :jj "This is ok" :aa "456" :ll "Address"} :aa :qt :wer) | |
;; => {:qt 56, :kl "Some String", :wer 22, :jj "This is ok", :aa 456, :ll "Address"} |