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
const partitionBy = (f, collection) => { | |
const r = collection.reduce(({result, currentPartition, partitions}, item) => { | |
const newResult = f(item) | |
if (result != undefined && result != newResult) { | |
return {result: newResult, currentPartition: [item], partitions: R.append(currentPartition, partitions)} | |
} | |
return {result: newResult, currentPartition: R.append(item, currentPartition), partitions} | |
}, {result: undefined, currentPartition:[], partitions: []}) | |
return R.append(r.currentPartition, r.partitions) | |
} |
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
(def defaults {:a ["default-a"] | |
:b ["default-b"] | |
:c ["default-c"] | |
:d ["default-d"]}) | |
(def ex1 [:a 1 2 :b 4 5 :c :d]) | |
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
(defmacro first-do | |
"Executes first expression of do-block and returns it's result after the rest of the body" | |
[fexpr & body] | |
`(let [a# ~fexpr] | |
(do ~@body a#))) | |
; EXAMPLE: |
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
class Spuce < Formula | |
desc "A C++ library for DSP filters" | |
homepage "http://pyspuc.com" | |
head "https://github.com/audiofilter/spuce.git" | |
url "https://github.com/audiofilter/spuce/archive/0.4.3.tar.gz" | |
version "0.4.3" | |
sha256 "5688e107b57640ba0485790d64eb16bff855f54f6fa5b2fdab568ee91f6dc687" | |
depends_on "cmake" => :build | |
depends_on :python |
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 auth-middleware [req] | |
(let [auth-headers (get-in req [:headers :auth])] | |
(assoc req :user | |
(if (= auth-headers "secret") | |
{:name "Secret User"} | |
nil)))) |
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
function checkletter (s) { | |
lcount = 26; // 26 letters | |
var i = 0; | |
var csum = s.split('').reduce(function(sm, c, idx) { | |
var n = c.charCodeAt(0)-65; | |
if (idx % 2 == 0) { | |
return sm + n; | |
} else { | |
return sm + n*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
#cloud-config | |
write_files: | |
- path: /run/cloud-config.yml | |
permissions: '0644' | |
content: | | |
#cloud-config | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB.... |
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
<h1 id="protokollakuvaus">Protokollakuvaus</h1> | |
<script src="http://cdn.rawgit.com/knsv/mermaid/master/dist/mermaid.full.min.js"></script> | |
<h2 id="yleisesti">Yleisesti</h2> | |
<p>Kaikki Nodet pitävät listaa muista nodeista</p> | |
<p>esim klusteri G = {A, B, C, D} | |
<div class="mermaid"> | |
graph TD; | |
A---B; | |
B---C; | |
C---A; |
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
[ | |
"Automotive", | |
"Budgeting", | |
"HVAC", | |
"Heaters", | |
"Hydraulics", | |
"Logistics Management", | |
"Management", | |
"Negotiation", | |
"Project Planning", |