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
Set-Alias new New-Object | |
Set-Alias aps New-ApplyContext | |
Set-Alias use New-DisposeOnLeaveContext | |
# iTextSharp アセンブリロード | |
[System.Reflection.Assembly]::LoadFile | aps { | |
ls S:\libs\itextsharp-all-5.4.4\*.dll | |
} > $null | |
function first ([ScriptBlock]$Body) { |
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
function Join-Namespace { | |
($args | %{$_})-join "." | |
} | |
function Invoke-Apply { | |
$func, $arg = $args | |
Invoke-Expression "$func $arg" | |
} | |
Set-Alias ns Join-Namespace |
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 'cl) | |
(macrolet ((hook (&body exprs) | |
`(add-hook 'groovy-mode-hook | |
'(lambda () ,@exprs)))) | |
(hook (require 'groovy-electric) | |
(groovy-electric-mode) | |
(linum-mode 1) | |
(paredit-mode 1) | |
(guru-mode 1))) |
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-seesaw-jfx.core | |
(:gen-class) | |
(:require [seesaw.core :as sw]) | |
(:import [javafx.scene Group Scene] | |
[javafx.scene.text Font Text] | |
[javafx.scene.shape Circle Rectangle] | |
javafx.scene.paint.Color | |
javafx.application.Platform | |
javafx.embed.swing.JFXPanel)) |
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
(use 'clojure.algo.monads) | |
(def maybes-t (partial reduce maybe-t)) | |
(with-monad (maybes-t maybe-m [0 :err1 :err2 :err3]) | |
(defn div [x y z] | |
(domonad [a x b y c z] (/ a b c)))) | |
(div 10 0 20) ;=> 0 | |
(div nil 0 20) ;=> nil |
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
;;変更箇所のみ | |
(extend-type clojure.lang.IPersistentCollection | |
Functor | |
(fmap [m f] (map f m)) | |
Monad | |
(bind [m f] (mapcat f m)) | |
MonadPlus | |
(mfilter [m p] (filter p m)) | |
;; 追加 |
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 chunked-string-seq | |
([^java.io.Reader rdr] | |
(chunked-string-seq rdr :chunk-size 16)) | |
([^java.io.Reader rdr &{chunk-size :chunk-size}] | |
{:pre [(some-> chunk-size pos?)]} | |
(let [buf (char-array chunk-size)] | |
(letfn [(f [] | |
(when (pos? (.read rdr buf)) | |
(cons (String. buf) (lazy-seq (f)))))] | |
(f))))) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 2 columns, instead of 1 in line 2.
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
aa,bb | |
cc,"dd,ee""F""" | |
"gg | |
hh" |
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.instaparse | |
(:require [instaparse.core :refer [parser transform]] | |
[hiccup.core :refer [html]])) | |
(def csv-bnf "https://gist.github.com/mnzk/5426024/raw/11de5851adc5b3dd704ec4079c22aa6ff8d131df/csv-bnf-rfc4180.txt") | |
(def csv-parser (parser csv-bnf)) | |
(def data-file "/path/to/data.csv") | |
(def tree (csv-parser (slurp data-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
file = [header CRLF] record (CRLF record)* [CRLF] | |
header = name (COMMA name)* | |
record = field (COMMA field)* | |
name = field | |
field = (escaped | non-escaped) | |
escaped = DQUOTE (TEXTDATA | COMMA | CR | LF | 2DQUOTE)* DQUOTE | |
2DQUOTE = DQUOTE DQUOTE | |
non-escaped = TEXTDATA* | |
COMMA = '\u002C' | |
CR = '\u000D' |