Skip to content

Instantly share code, notes, and snippets.

View Janiczek's full-sized avatar

Martin Janiczek Janiczek

View GitHub Profile
(ns print-let)
;; https://www.youtube.com/watch?v=3eqW7rghDew
(defn print-form [[id form]]
`(~id ~form _# (println ~(str id ":") ~id)))
(defmacro print-let [bindings & body]
(let [binding-pairs (partition 2 bindings)
bindings-with-prints (apply concat (map print-form binding-pairs))]
`(let [~@bindings-with-prints]
;;; global state
;; pros/cons:
;; + the code looks nice
;; - can't control the state
(defn milk-the-cow []
(if (have? :bucket)
(do
(item-remove! :bucket)
Presenter 1: formuláře A, B, C
Presenter 2: formuláře A, D
Presenter 3: formuláře C, E
@Janiczek
Janiczek / a.clj
Last active August 29, 2015 14:05
(ns untitled.core
(:require [schema.core :as s]
[schema.macros :as sm]))
(def Length s/Int)
(def Count s/Int)
(sm/defn add-lengths :- Length
[a :- Length
b :- Length]
@Janiczek
Janiczek / example.cljs
Last active August 29, 2015 14:06
Keeping state between Figwheel reloads
;;;;;;;; actually, (defonce state (new-state)) solves all of this.
;;;;;;;; thanks @bhauman for pointing this out!
;;;;;;;; https://twitter.com/bhauman/status/508328343201005568
;;;;;;;; ---------------------------------------------------------
;; How to keep state atom between Figwheel reloads?
(ns example
(:require [cljs.reader :refer [read-string]]))
@Janiczek
Janiczek / coretyped.clj
Created September 22, 2014 21:44
core.typed aliases
(ns untitled.core
(:require [clojure.core.typed :as t]))
(t/defalias Length t/Num)
(t/defalias Count t/Num)
(t/defn add-lengths
[a :- Length
b :- Length]
#!/usr/bin/env bash
# Will generate CSV file with your commits. Columns:
# repository | branch | date | hash | message
# The file will be sorted by the date, and rows made unique.
# Expects to be run in a directory in form:
# .
# |- repo 1
# |- repo 2
{
"Expert" : [
{
"id" : "CS2_188o",
"text" : "This minion has +2 Attack this turn.",
"name" : "'Inspired'",
"type" : "Enchantment",
"mechanics" : [
"OneTurnEffect"
]
<?php
$scrolls = array(
"'Inspired'" => "'Inspired'",
"-1 Durability" => "-1 Durability",
"1000 Stats" => "1000 Stats",
"AFK" => "AFK",
"AI Buddy - All Charge!" => "AI Buddy - All Charge!",
"AI Buddy - Damage Own Hero 5" => "AI Buddy - Damage Own Hero 5",
"AI Buddy - Destroy Minions" => "AI Buddy - Destroy Minions",
@Janiczek
Janiczek / definicni_obory.md
Last active August 29, 2015 14:12
Definiční obory

Rekapitulace ze dneška :)

  1. jaké vyplývají ze zadání podmínky?
  • jmenovatel ≠ 0
  • odmocnina: vnitřek ≥ 0
  • logaritmus: vnitřek > 0
  • tg: vnitřek ≠ π(k+1/2), k ∈ Z
  • cotg: vnitřek ≠ kπ, k ∈ Z
  • arcsin: -1 ≤ vnitřek ≤ 1
  • arccos: -1 ≤ vnitřek ≤ 1