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
(require '[clojure.string :as str]) | |
(defn remove-pl [s] | |
(str/escape s (zipmap "ŻÓŁĆĘŚĄŹŃżółćęśąźń" "ZOLCESAZNzolcesazn"))) |
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
#!/usr/bin/env python | |
# | |
# Script downloads subtitles from napiprojekt | |
# python3 and Windows compatible | |
# | |
# based on older script | |
# by gim,krzynio,dosiu,hash 2oo8. | |
# last modified: 19-VI-2o19 | |
# 4pc0h f0rc3 | |
from hashlib import md5 |
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 edn-pprint.core | |
(:require | |
[clojure.pprint :refer [pprint]] | |
[clojure.edn :as edn])) | |
(pprint (edn/read-string (apply str (line-seq (java.io.BufferedReader. *in*))))) |
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 str->int | |
([s] (str->int s 10)) | |
([s base] | |
#?(:clj (java.lang.Integer/parseInt s base) | |
:cljs (js/parseInt s base)))) |
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://twitter.com/RobStuttaford/status/1095434901950734337 | |
(defn copy-to-clipboard [val] | |
(let [el (js/document.createElement "textarea")] | |
(set! (.-value el) val) | |
(.appendChild js/document.body el) | |
(.select el) | |
(js/document.execCommand "copy") | |
(.removeChild js/document.body el))) |
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
import json | |
from functools import wraps | |
from hashlib import sha1 | |
CACHE_DIR = '_cache/' | |
MAX_FILENAME_LENGTH = 40 | |
class CacheNotFound(Exception): | |
pass |
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 conn (atom nil)) | |
(defn ensure-conn [config] (swap! conn #(or % (connect config)))) |
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 gist.core | |
(:require [clojure.string :as str]) | |
(:import (java.io File) | |
(java.awt.image BufferedImage | |
WritableRaster) | |
(javax.imageio ImageIO)) | |
(:gen-class)) | |
(defn save-pixels-as-png |
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 lazy-file-lines [file] | |
(letfn [(helper [rdr] | |
(lazy-seq | |
(if-let [line (.readLine rdr)] | |
(cons line (helper rdr)) | |
(do (.close rdr) nil))))] | |
(helper (clojure.java.io/reader file)))) |
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 example.app | |
(:require [reagent.core :as reagent :refer [atom]])) | |
(defn app [] | |
[:div | |
[:h1 "Shadow cljs!"]]) | |
(defn mount-root [] | |
(reagent/render [app] (.getElementById js/document "app"))) |