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
;; 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
(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
(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
{ | |
"Records": [ | |
{ | |
"eventSource": "aws:ses", | |
"eventVersion": "1.0", | |
"ses": { | |
"mail": { | |
"timestamp": "2019-03-27T21:58:29.360Z", | |
"source": "[email protected]", | |
"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
{"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
yarn add -D git+ssh://[email protected]:aarkerio/graphql-api-types.git |
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
curl localhost:3000/graphql \ | |
-F operations='{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) { filename } }" }' \ | |
-F map='{ "0": ["variables.file"] }' -F 0=@/home/mmontoya/Bilder/mydog12.jpg | |
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 RunLengthEncoding | |
def self.encode(input) | |
new_array = split_by_chars input | |
ordered = new_array.map do |el| | |
el.length > 1 ? "#{el.length}#{el.chr}" : el | |
end.join | |
end | |
def self.decode(input) |
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 question-item | |
[{:keys [question explanation hint key qtype id ordnen] :as q}] | |
(let [counter (reagent/atom 0) | |
editing (reagent/atom false)] ;; show and switch icons (Edit/Cancel) | |
(fn [] | |
[:div.div-separator {:key (str "div-question-separator-" id) :id (str "div-question-separator-" id)} | |
(if @editing | |
[:img.img-float-right {:title "Cancel question" | |
:alt "Cancel question" | |
:key (str "cancel-question-img-" id) |