Skip to content

Instantly share code, notes, and snippets.

View lildata's full-sized avatar

Programming is fun lildata

View GitHub Profile
@lildata
lildata / clipboard.clj
Created September 22, 2017 19:45 — forked from exupero/clipboard.clj
Clojure code to interact with the system clipboard
(refer-clojure :exclude '[slurp spit])
(import '[java.awt.datatransfer DataFlavor StringSelection Transferable])
(defn clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp []
(try
(.getTransferData (.getContents (clipboard) nil) (DataFlavor/stringFlavor))
(catch java.lang.NullPointerException e nil)))
@lildata
lildata / README.md
Created June 2, 2017 10:20 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


@lildata
lildata / webview-for-martin.clj
Created December 29, 2016 22:24 — forked from jackrusher/webview-for-martin.clj
An example boot-ified Swing app that contains a JavaFX WebView (Webkit instance).
#!/usr/bin/env boot
;; -*- mode: Clojure;-*-
(set-env! :dependencies '[[seesaw "1.4.5"]])
(use 'seesaw.core)
(import '(javafx.scene.web WebView)
'(javafx.scene SceneBuilder)
'(javafx.scene.layout VBoxBuilder))
@lildata
lildata / gist:fd8ebfbd8d51932d5684
Created February 16, 2016 21:42 — forked from gorsuch/gist:1418850
clojure uuid
(defn uuid [] (str (java.util.UUID/randomUUID)))
@lildata
lildata / gist:c318a44b18d7d6de24a9
Created January 31, 2016 16:10 — forked from bayan/gist:3382884
Clojure DSL to generate static HTML
;; Generating static HTML using Clojure macros
;; It is possible to write a DSL in Clojure that generates HTML markup without the need to write a separate parser and compiler (e.g. HAML).
;; Our aim here would be to write code that converts the following Clojure code into the HTML below it
;; (html
;; (head)
;; (body
;; (h1 "An example")
@lildata
lildata / gist:ae9dbe13b95dd228b580
Created November 11, 2015 18:17 — forked from daveray/gist:1055523
Async Workflows in Seesaw
(ns seesaw.async
(:use [seesaw core]))
; see http://dotnetslackers.com/articles/net/Programming-user-interfaces-using-f-sharp-workflows.aspx#1478
(defmacro async
"Macro that executes an async call (the first form), ignores its result, and the
executes the body normally."
[async-call & body]
`(~@(apply list (first async-call) `(fn [& args#] ~@body) (rest async-call))))
@lildata
lildata / table-test.clj
Created October 26, 2015 21:48 — forked from daveray/table-test.clj
Highlighting table rows with Seesaw
(ns table-test.core
(:use [seesaw core table swingx]))
; A predicate that decides whether a row should be highlighted
; adapter is an instance of JXTable.TableAdapter
; http://projects.joshy.org/projects/painterreview/swingx/org/jdesktop/swingx/JXTable.TableAdapter.html
(defn hl-predicate [renderer adapter]
; Highligh all rows where :age is over thirty
(> (.getValueAt adapter (.row adapter) 0) 30))
@lildata
lildata / busy-cursor.clj
Created October 26, 2015 21:48 — forked from daveray/busy-cursor.clj
Clojure/Seesaw busy cursor example
(ns busy-cursor.core
(:use seesaw.core))
(defn long-running-task
[]
(Thread/sleep 5000)
"The result")
(defn run-task-with-busy-cursor
[c]
@lildata
lildata / mapdb.clj
Created October 8, 2015 09:17 — forked from hideshi/mapdb.clj
This is hash map database written in Clojure. See also: http://d.hatena.ne.jp/hideshi_o/20121123/1353698397
;mapdb.clj
(ns db.mapdb
(:use
[clojure.contrib.duck-streams :only (reader)]
[clojure.java.io :only (writer)]
[clojure.string :only (split)]
[clojure.contrib.server-socket :only (create-server close-server)]))
(def database-file "/Users/hideshi/Dev/Clojure/db/dbfile")
(ns async-tut1.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [goog.dom :as dom]
[goog.events :as events]
[cljs.core.async :refer [<! put! chan]])
(:import [goog.net Jsonp]
[goog Uri]))
(def wiki-search-url
"http://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=")