Skip to content

Instantly share code, notes, and snippets.

;; A space invaders game in Racket
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
;; Software is furnished to do so, subject to the following conditions:
@matthewdowney
matthewdowney / sorting-transducer.clj
Created September 6, 2018 19:55
Clojure Sorting Transducer
(defn xf-sort
"A sorting transducer. Mostly a syntactic improvement to allow composition of
sorting with the standard transducers, but also provides a slight performance
increase over transducing, sorting, and then continuing to transduce."
([]
(xf-sort compare))
([cmp]
(fn [rf]
(let [temp-list (java.util.ArrayList.)]
(fn
@subfuzion
subfuzion / curl.md
Last active March 27, 2024 16:11
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ZucchiniZe
ZucchiniZe / list-files-in-dir.clj
Created February 15, 2016 10:00
simple clojure function to recursively list files in directories.
(let [directory (clojure.java.io/file "/path/to/list")
dir? #(.isDirectory %)]
(map #(.getPath %)
(filter (comp not dir?)
(tree-seq dir? #(.listFiles %) directory))))
@ducky427
ducky427 / core.cljs
Created June 11, 2015 11:31
Facebook's fixed data for reagent. Adapted from https://github.com/ul/fixed-data-table-demo
(ns datatable.core
(:require [reagent.core :as reagent]
[cljsjs.fixed-data-table]))
(def Table (reagent/adapt-react-class js/FixedDataTable.Table))
(def Column (reagent/adapt-react-class js/FixedDataTable.Column))
(defn gen-table
"Generate `size` rows vector of 4 columns vectors to mock up the table."
[size]
anonymous
anonymous / gist:d87a27cc544cb4dd2bb1
Created October 17, 2014 23:33
(global-set-key (kbd "M-?") 'flash-active-buffer)
(make-face 'flash-active-buffer-face)
(set-face-attribute 'flash-active-buffer-face nil
:background "red"
:foreground "black")
(defun flash-active-buffer ()
(interactive)
(run-at-time "100 millisec" nil
(lambda (remap-cookie)
@attentive
attentive / conduit.clj
Last active August 29, 2015 14:03
Shows one way to create a "dynamic deftemplate" for Enlive
(ns gist.conduit
(:use [net.cgrand enlive-html tagsoup]))
; The implementations of conduit and defconduit are modified versions of
; the macros template and deftemplate from the guts of Enlive.
; They're named 'conduit' because the selectors and transformations serve as a
; channel between the scaffold of HTML and some data provided as an argument.
; Tagsoup is used to parse a list of HTML nodes from a specified input file at runtime.