Skip to content

Instantly share code, notes, and snippets.

View not-much-io's full-sized avatar

Kristo Koert not-much-io

View GitHub Profile
@not-much-io
not-much-io / gist:9532709
Last active August 29, 2015 13:57
Problem suggestion
public class IcalParser {
public static void main(String [] args) throws IOException {
String [] subjectCode = new String [30];
String [] aineNimi = new String [30];
String [] attendingGroups = new String [30];
String [] classTypes = new String [30];
String [] startTimestamp = new String [30];
String [] endTimestamp = new String [30];
String [] classRooms = new String [30];
@not-much-io
not-much-io / Example
Created October 17, 2014 19:59
AutoCad
;;Draws some cube with point in positions :a :b :c and :c in 3d space.
(draw-cube {:a [10 10] :b [-10 -10] :c [10 -10] :d [-10 10]})
(defn draw-tower [nr-of-blocks]
"Draws nr-of-blocks of cubes in some correlation with eachother in 3d space."
(repeat nr-of-block (draw-cube {{:a [(+ 10 10)] :b [(+ -10 -10)] :c [(+ 10 -10)] :d [(+ -10 10) (+ 10 10)}}))
@not-much-io
not-much-io / Clojure server
Created November 8, 2014 22:03
Client-Server-Attempt
(ns chat-server.echo-server
(:import (java.net Socket ServerSocket)
(java.io DataInputStream PrintStream)))
(defn run-echo-server []
(let [echo-server (ServerSocket. 8887)
client-socket (.accept echo-server)
in (DataInputStream. (.getInputStream client-socket))
out (PrintStream. (.getOutputStream client-socket))]
(while true
@not-much-io
not-much-io / designer.html
Last active August 29, 2015 14:10
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@not-much-io
not-much-io / gist:e09652bdda8acab8b214
Created December 9, 2014 09:27
Clojure binary clock
(ns binary-clock)
(defn split-into-digits [time]
[(quot time 10)
(mod time 10)])
(defn get-time []
(let [dt (new java.util.Date)
digits (apply concat (map split-into-digits
[(.getHours dt) (.getMinutes dt) (.getSeconds dt)]))]
@not-much-io
not-much-io / gist:6cc9e54d21be2a41f12d
Created March 28, 2015 08:34
Splitting recursion
(def roads '((12 41) (12 57) (41 22) (41 4) (53 41) (49 22) (57 75) (22 96) (4 66) (96 31) (96 76) (94 96)
(61 66) (28 94) (61 60) (50 60) (60 7) (28 91) (28 51) (60 79) (7 30) (30 24) (27 79) (30 65)
(30 97) (27 84) (97 2) (56 2) (14 56) (14 86) (86 23) (14 44) (70 44) (23 43) (43 90) (70 32)
(43 54) (82 54) (90 81) (83 82) (82 67) (83 46) (72 82) (100 67) (100 71) (26 72) (72 36) (36 64)
(71 89) (36 25) (26 20) (80 89) (64 48) (63 25) (11 48) (87 20) (80 1) (1 19) (1 21) (37 87) (37 69)
(19 5) (37 33) (69 10) (45 33) (35 33) (40 10) (13 45) (6 13) (15 40) (85 6) (6 47) (13 8) (47 98) (99 85)
(16 47) (88 98) (88 9) (55 99) (99 92) (9 93) (77 93) (59 55) (62 93) (18 77) (18 39) (18 73) (38 62) (58 73)
(95 73) (73 42) (34 95) (52 34) (34 74) (3 52) (3 68) (17 52) (74 29) (78 29) (29 1)))
(defn in? [seq el]
@not-much-io
not-much-io / gist:e67608eac32d88ce528b
Created June 16, 2015 07:23
Disabling input in Reagent
(defn break-time-slider []
(let [init-value @settings/break-time]
[:p {:class "range-field"}
[:label {:for "break-time"}
(string/replace "Break time (% min)" #"%" @settings/break-time)]
[:input {:type "range"
:id "break-time"
:min "1"
:max "60"
;; How do I disable this input?
@not-much-io
not-much-io / example.clj
Created September 1, 2015 18:51
Problem with POST
;;cljs-ajax POST
(defn handler [[ok response]]
(.log js/console "Client handling response!")
(if ok
(.log js/console (str "Response: " response))
(.error js/console (str "Errora: " response))))
(defn send-msg [data]
(.log js/console "Client sending request!")
@not-much-io
not-much-io / pipeline.py
Last active September 3, 2015 09:21
python pipeline
def inc(x):
return x + 1
def pipe(val, *args):
for func in args:
val = func(val)
return val
pipe(1, inc, inc, inc)
//Basic math
import java.lang.Math;
//Collections
import java.util.*;
public class Main {
public static void main(String[] args) {