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
<html><head> | |
<style> | |
img { | |
filter: drop-shadow(0.1em 0.2em 0.3em) | |
} | |
</style> | |
</head> | |
<body><img src="https://www.w3schools.com/html/pic_trulli.jpg"> | |
<img src="https://www.w3schools.com/html/img_girl.jpg"> | |
<img src="https://www.w3schools.com/html/img_chania.jpg"> |
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
// forked from | |
// https://github.com/jonnysmith1981/getIndexedDbSize | |
function showIndexedDbSize(dbname) { | |
"use strict"; | |
var db; | |
var totalSize = 0 | |
function openDatabase(dbname) { | |
return new Promise(function(resolve, reject) { |
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
(defn inspect [] | |
(let [state (r/atom nil)] | |
(fn [[c & args]] | |
(let [{:keys [hover]} @state] | |
[:div {:on-mouse-over #(do | |
(swap! state assoc :hover (.getModifierState % "Control"))) | |
:on-mouse-out #(swap! state assoc :hover false) | |
:style {:display :inline-block | |
:width "100%" | |
:height "100%" |
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
#!/bin/bash | |
shopt -s nullglob | |
for g in /sys/kernel/iommu_groups/*; do | |
echo "IOMMU Group ${g##*/}:" | |
for d in $g/devices/*; do | |
echo -e "\t$(lspci -nns ${d##*/})" | |
done; | |
done; |
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
;; to use in cursive: | |
;; 1. create a project.clj, deps.edn or pom.xml with tubular dependency and open in Cursive | |
;; 2. create new run-config | |
;; 3. select clojure.main as repl type | |
;; 4. specify socket_repl.clj (this file) in `Parameters` | |
;; 5. run lumo with socket repl: | |
;; lumo --socket-repl 5555 --classpath src-dir1:src-dir2 --dependencies some/dep:0.1.0-SNAPSHOT,other-dep:1.0.1 | |
;; 6. run run-config from cursive |
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
//Parameter is the type of parameter passed in the selector | |
public class ClosureSelector<Parameter> { | |
public let selector : Selector | |
private let closure : ( Parameter ) -> () | |
init(withClosure closure : @escaping ( Parameter ) -> ()){ | |
self.selector = #selector(ClosureSelector.target) | |
self.closure = closure | |
} |
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
(defn sleep [s] | |
(js/Promise. (fn [res rej] | |
(js/setTimeout res (* 1000 s))))) | |
(defn start [] | |
(println "while start") | |
(-> (sleep 2) | |
(.then start))) | |
(start) |
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
function sleep(s){ | |
return new Promise(function(resolve,reject) { | |
setTimeout(_ => { | |
resolve(); | |
}, 1000 * s); | |
}); | |
} | |
async function start(){ | |
while(true){ |
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
;; Retrieve order of keys in an edn-map | |
(defn ordered-keys-from-edn-map [edn] | |
(assert (map? (read-string edn))) | |
(let [list-of-symbols (-> edn | |
(clojure.string/replace-first "{" "[") | |
(clojure.string/replace #"}(\s+)$" "]") | |
read-string)] | |
(->> list-of-symbols | |
(partition 2) |
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 xhr-client | |
(:refer-clojure :exclude [get]) | |
(:require [httpurr.protocols] | |
[clojure.string :as str] | |
[httpurr.protocols :as p] | |
[httpurr.client :as c])) | |
(defn normalize-headers | |
[headers] | |
(reduce-kv (fn [acc k v] |