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
pragma solidity ^0.4.24; | |
contract HelloWorld { | |
} |
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
stack build && stack runghc test/Homework/Week01Spec.hs -v | |
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2 | |
2018-06-26 08:59:58.695588: [debug] Checking for project config at: /Users/ddyba/Code/haskell-cis-194-spring-2017/stack.yaml | |
@(src/Stack/Config.hs:850:9) | |
2018-06-26 08:59:58.696816: [debug] Loading project config file stack.yaml | |
@(src/Stack/Config.hs:876:13) | |
2018-06-26 08:59:58.699047: [debug] Decoding build plan from: /Users/ddyba/.stack/build-plan/lts-5.3.yaml | |
@(src/Stack/Snapshot.hs:164:5) | |
2018-06-26 08:59:58.699139: [debug] Trying to decode /Users/ddyba/.stack/build-plan-cache/lts-5.3.cache | |
@(src/Stack/Snapshot.hs:156:32) |
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
(set-env! | |
:source-paths #{"javasrc"} | |
:resource-paths #{"src/pnmacmodel" "src/movr2"} | |
:repositories [["releases" {:url "http://es-ubu-archiva-d-2.pnmac.com:8080/repository/internal" | |
:creds :gpg}] | |
["snapshots" {:url "http://es-ubu-archiva-d-2.pnmac.com:8080/repository/snapshots" | |
:creds :gpg}] | |
["clojars" {:url "https://clojars.org"}]] | |
:dependencies '[[org.clojure/clojure "1.7.0"] | |
[com.taoensso/nippy "2.5.2"] |
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
;; WIP... | |
(defn quote-units | |
[units] | |
(let [syms (filter symbol? units) | |
vals (filter number? units)] | |
(interleave (map (fn [u] `'~u) syms) vals))) | |
(defmacro defunits | |
[quantity base-unit & units] |
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
;; We can go further and use automatic gensyms provided | |
;; by Clojure when use a hashtag after the symbol we | |
;; want gensymed | |
(defmacro nif | |
[expr pos zero neg] | |
`(let [e# ~expr] | |
(cond | |
(pos? e#) ~pos | |
(zero? e#) ~zero |
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 days360.core | |
(:require [clj-time.core :as t] | |
[clj-time.format :as f] | |
[clj-time.predicates :as p] | |
[clj-time.periodic :as per])) | |
;; It works! Now to prettify it... | |
(defn days360 | |
"Calculates the number of days between a start-date and end-date according to | |
a 360-day year." |
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
# Movement | |
OPT + CMD + ] => Move a line up | |
OPT + CMD + [ => Move a line down | |
CMD + SHIFT + ] => Move one tab to the right | |
CMD + SHIFT + [ => Move one tab to the left | |
CMD + -> / CTRL + E => Move to the end of the line | |
CMD + <- / CTRL + A => Move to the start of the line | |
OPT + -> => Move forward one word | |
OPT + <- => Move backward one word | |
CTRL + -> => Move forward one word (can move by words inside of camelcased words) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>IDECodeSnippetCompletionPrefix</key> | |
<string>kspec</string> | |
<key>IDECodeSnippetCompletionScopes</key> | |
<array> | |
<string>All</string> | |
</array> |
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
(define (good-enough? guess next-guess) | |
(< (/ (abs (- guess next-guess)) guess) 0.001)) | |
(define (average x y) | |
(/ (+ x y) 2)) | |
(define (improve guess x) | |
(average guess (/ x guess))) | |
(define (sqrt-iter guess x) |
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
(defn update-my-atom [a name] | |
(let [new-state (assoc-in @a [:foo :bar] (merge {:name name}))] | |
(swap! a (fn [old] new-state)))) | |
;; refactored into: | |
(defn get-new-state [state name] | |
(assoc-in state [:foo :bar] (merge {:name name}))) |
NewerOlder