- Put your laptop on the stand
- Plug in Apple power cable
- Plug in white Thunderbolt display adapter
- Plug in black USB
- Wait 15 seconds
- 🤘 Do programming 🤘
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
| (def card-values {2 1 3 1 4 1 5 1 6 1 7 0 8 0 9 0 10 -1 :j -1 :q -1 :k -1 :a -1}) | |
| (defn count-cards [counter played-cards] | |
| (if (empty? played-cards) | |
| counter | |
| (count-cards (+ counter (card-values (first played-cards))) (rest played-cards)))) | |
| ;; counter: 0 | |
| ;; cards: [4 5 6 :j :q 9 2] | |
| ;; counter: 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
| ## N^2 | |
| stock_prices = [70,23,100,34,12,55,8,90,66,2,56,65] | |
| stock_prices.flat_map.with_index do |buy,i| | |
| stock_prices[(i+1)..-1].map do |sell| | |
| {:buy => buy, :sell => sell, :profit => sell - buy} | |
| end | |
| end.max_by { |h| h[:profit] } | |
| ## N | |
| def profit(spread) |
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 open-cl-playground.core | |
| (import [com.nativelibs4java.opencl.JavaCL] | |
| [com.nativelibs4java.opencl.CLMem.Usage.*] | |
| [com.nativelibs4java.opencl.CLMem.Usage] | |
| [com.nativelibs4java.opencl.CLDevice.QueueProperties] | |
| [org.bridj.Pointer.*] | |
| )) | |
| (defn create-context [] | |
| (com.nativelibs4java.opencl.JavaCL/createBestContext)) |
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
| diff --git a/resources/public/test.html b/resources/public/test.html | |
| index 48257a1..4dacb86 100644 | |
| --- a/resources/public/test.html | |
| +++ b/resources/public/test.html | |
| @@ -6,7 +6,8 @@ | |
| <link id="favicon" rel="shortcut icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIElEQVQ4T2NMS0v7z0ABYBw1gGE0DBhGwwCYh4ZBOgAAcQUjIUXh8RYAAAAASUVORK5CYII=" /> | |
| </head> | |
| <body> | |
| - <!-- Hidden #app div serves as target for loading the app. | |
| + <canvas id='target' width='500' height='500'></canvas> |
Refactor nrepl makes it possible to hotload a dependency into lein without rebooting the repl. This is awesome but it's not super well documented.
First, make sure you have the plugin installed by adding it to the :plugins key of your
lein profile. This can be done per project in project.clj, but is probably best to include in your
~/.lein/profiles.clj
Here's an example:
This file is written using a format called Markdown, which is a special text format used for generating HTML without having to actually write HTML.
Markdown is fairly readable as text, but you can get a better view of it by "rendering" it into HTML, which can fortunately
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 block-chain.core | |
| (:require [cheshire.core :as json]) | |
| (import [java.net DatagramSocket | |
| MulticastSocket | |
| DatagramPacket | |
| InetAddress | |
| InetSocketAddress])) | |
| ;; backchannel | |
| ;; MULTICAST_ADDR = "224.6.8.11" |
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
| class EnrollmentRepository | |
| def initialize(records = []) | |
| @records = [] | |
| end | |
| end | |
| class DistrictRepository | |
| def initialize(repos = {}) | |
| @enrollment_repository = repos[:enrollment_repository] || EnrollmentRepository.new | |
| create_districts! |
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
| worace @ sha-1 ➸ pry | |
| [1] pry(main)> require "digest" | |
| => true | |
| [2] pry(main)> key = "calzone" | |
| => "calzone" | |
| [3] pry(main)> Digest::SHA1.hexdigest(key) | |
| => "3aa0a0c50683e61c1f81584b1082e11c924535e0" | |
| [4] pry(main)> Digest::SHA1.hexdigest(key).to_i(16) | |
| => 334703588949583183218034173573122019749278332384 | |
| [5] pry(main)> Digest::SHA1.hexdigest(key).to_i(16).to_s(2) |