This file contains 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 shades.lenses) | |
; We only need three fns that know the structure of a lens. | |
(defn lens [focus fmap] {:focus focus :fmap fmap}) | |
(defn view [x {:keys [focus]}] (focus x)) | |
(defn update [x {:keys [fmap]} f] (fmap f x)) | |
; The identity lens. | |
(defn fapply [f x] (f x)) | |
(def id (lens identity fapply)) |
This file contains 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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>group</groupId> | |
<artifactId>dummy</artifactId> | |
<name>Dummy Project</name> | |
<version>1.0.12</version> | |
<packaging>pom</packaging> | |
<scm> | |
<connection>scm:git:https://......</connection> | |
<tag>HEAD</tag> |
This file contains 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
;; This is at: https://gist.github.com/8655399 | |
;; So we want a rhyming dictionary in Clojure. Jack Rusher put up | |
;; this code here: | |
;; | |
;; https://gist.github.com/jackrusher/8640437 | |
;; | |
;; I'm going to study this code and learn as I go. | |
;; | |
;; First I put it in a namespace. |
This file contains 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/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
This file contains 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
;; Some helper functions that adds support for currying-like syntax to function definitions but | |
;; still enable you to use variadic arguments in each function call. | |
(defn collect-vec | |
([l] (collect-vec l [])) | |
([[h & t :as p] acc] | |
(cond | |
(not (vector? h)) [acc p] | |
(nil? t) [acc [h]] | |
:else |
This file contains 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 Data.List | |
lineBreak :: String -> String | |
lineBreak = joinBrokenLines . joinWordsInBrokenLines . brokenLines . words | |
brokenLines :: [String] -> [[String]] | |
brokenLines [] = [] | |
brokenLines wordList = brokenLine : brokenLines remainingWords | |
where (brokenLine, remainingWords) = splitAt (brokenLineWordCount wordList) wordList |