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
;; keeps original new-lines, so that there may be shorter lines | |
;; caveat: if a single word is longer than the split length, it will overflow | |
(defn split-line [n line] | |
(reduce | |
(fn [lines word] | |
(if (or (empty? lines) | |
(>= (+ (count (last lines)) (count word)) n)) | |
(conj lines word) | |
(update lines (dec (count lines)) str " " word))) |
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
#!/usr/local/bin/planck | |
(ns pivotal.core | |
(:require [planck.http :as http] | |
[planck.core :refer [spit slurp]] | |
[planck.shell :as sh] | |
[clojure.walk :as walk] | |
[clojure.string :as str])) | |
;; Config section | |
(def pivotal-token "your token here") |
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 m | |
(:require [clojure.java.io :as io] | |
[clojure.pprint :refer [*print-suppress-namespaces* pprint]] | |
[clojure.repl :refer [doc source]])) | |
;; Utility ennen/jälkeen tulosteille | |
(defmacro m [form] | |
(binding [*print-suppress-namespaces* true] | |
(println "\n----ENNEN:" ) | |
(pprint form) |
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
#!/usr/local/bin/planck | |
(ns github.core | |
(:require [planck.http :as http] | |
[planck.core :refer [spit slurp]] | |
[planck.shell :as sh])) | |
(def gh-url "https://api.github.com/") | |
(defn load-gh-uri [uri] | |
(sh/sh "curl" "-o" "/tmp/harja-pulls.json" (str gh-url uri)) |
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
[{"url":"https://api.github.com/repos/finnishtransportagency/harja/pulls/99","id":80041335,"html_url":"https://github.com/finnishtransportagency/harja/pull/99","diff_url":"https://github.com/finnishtransportagency/harja/pull/99.diff","patch_url":"https://github.com/finnishtransportagency/harja/pull/99.patch","issue_url":"https://api.github.com/repos/finnishtransportagency/harja/issues/99","number":99,"state":"open","locked":false,"title":"Tee materiaalin käytöstä uniikki","user":{"login":"tatut","id":83725,"avatar_url":"https://avatars.githubusercontent.com/u/83725?v=3","gravatar_id":"","url":"https://api.github.com/users/tatut","html_url":"https://github.com/tatut","followers_url":"https://api.github.com/users/tatut/followers","following_url":"https://api.github.com/users/tatut/following{/other_user}","gists_url":"https://api.github.com/users/tatut/gists{/gist_id}","starred_url":"https://api.github.com/users/tatut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tatut/subscriptions", |
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 args) | |
(defn- parse-schema | |
"Parse comma separated schema. Returns map of character to type keyword." | |
[schema-spec] | |
(into {} | |
(map (fn [flag] | |
(let [chr (.charAt flag 0) | |
spec (subs flag 1)] | |
[chr (case spec |
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
#!/bin/sh | |
# To change the station, go to http://liikennetilanne.liikennevirasto.fi/ | |
# and open the network inspector when clicking a weather camera. | |
# Copy the URL below. | |
curl -s "https://services1.arcgis.com/rhs5fjYxdOG1Et61/ArcGIS/rest/services/RWS_station/FeatureServer/0/query?f=json&where=NUMERO%3D13008&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=windSpeed%2CwindDirection%2CTSA_NIMI%2CmeasurementTime%2CairTemperature%2CroadTemperature%2CroadSurfaceCondition" | /usr/local/bin/jq -r "\"Ilma: \\(.features[0].attributes.airTemperature), Tie: \\(.features[0].attributes.roadTemperature)\"" |
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 bug | |
(:require [reagent.core :refer [atom] :as reagent])) | |
;; This version does not work: changed values of all-selections or | |
;; selected atoms are not reflected in the markup. | |
;; The open swap! works as expected. | |
(defn pulldown [selected format-fn select-fn selections] | |
(let [open (atom false)] | |
(fn [] | |
[:div.pulldown-menu |
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 webjure.wiki | |
(:refer-clojure) | |
(:use webjure) | |
(:use webjure.html)) | |
(def *pages* (ref {})) | |
(defn update-page [page-name title body] | |
(dosync | |
(alter *pages* |
NewerOlder