Skip to content

Instantly share code, notes, and snippets.

;;THE MOST: 42% of words with J in them start with J
;;THE LEAST: 1.6% of words with Y in them start with Y
;; Word list used: https://github.com/dwyl/english-words
;; Calculation in clojure as follows:
(def words (st/split (slurp "words.txt") #"\n"))
(println (sort-by :percentage-starts
(for [c (map char (map (partial + (int \a)) (range 26)))]
(defn foo [coll]
(map concat (reductions conj () (cycle (reverse coll))) (repeat (cycle coll))))
;; > (map (partial take 10) (take 10 (foo [:a :b :c :d])))
;; ((:a :b :c :d :a :b :c :d :a :b)
;; (:d :a :b :c :d :a :b :c :d :a)
;; (:c :d :a :b :c :d :a :b :c :d)
;; (:b :c :d :a :b :c :d :a :b :c)
;; (:a :b :c :d :a :b :c :d :a :b)
;; (:d :a :b :c :d :a :b :c :d :a)
0xd3f66506b9227344Dc30a56E228f342b646eB61F
(defun split-window-multiple-ways (x y)
"Split the current frame into a grid of X columns and Y rows."
(interactive "nColumns: \nnRows: ")
;; one window
(delete-other-windows)
(dotimes (i (1- x))
(split-window-horizontally)
(dotimes (j (1- y))
(split-window-vertically))
(other-window y))
Two economists are walking down the street and one of them notices what appears to be a $20 bill (or a $100 bill—the monetary amounts vary) on the sidewalk. “It’s not a real $20 bill,” the other economist declares. “If it were a real $20 bill, someone would have picked it up off the sidewalk already.”
(ns groupon.core
(require [clojure.string :refer [lower-case]]))
;;functional code
(defn delete-item [items n]
(vec (concat (take n items) (drop (inc n) items))))
(def commands [{:name "(A)dd"
:key :a
(ns groupon.core
(require [clojure.string :refer [lower-case]]))
;;functional
(defn add-item [items item]
(conj items item))
(defn edit-item [items index item]
(assoc items index item))
(ns webfui-examples.add-two-numbers-low-level.core
(:use [webfui.dom :only [defdom add-dom-watch]]
[webfui.state-patches :only [patch]]))
(def my-dom (atom nil))
(defdom my-dom)
(def a 0)
(def b 0)
@drcode
drcode / foo
Created June 1, 2015 23:19
enode interface
'enode://400b11f152fd4a2348c059ada1f67ea8f732cf8e2fde8136a0ec174c443d63a7ccb27a50598bd65979565b1d4913f193af8f7ee2d69aae1a9aeba3fe58dbb26a@[::]:30303'
@drcode
drcode / contract.html
Created February 4, 2015 04:09
Contract.html for use with go-ethereum CLI JSON-RPC interface
<html>
<head>
<script type="text/javascript" src="bignumber.min.js"></script>
<script type="text/javascript" src="ethereum.js"></script>
<script type="text/javascript">
var web3 = require('web3');
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));