Skip to content

Instantly share code, notes, and snippets.

View erikkaplun's full-sized avatar

Erik Kaplun erikkaplun

  • UXO
  • Tallinn, Estonia
View GitHub Profile
Last login: Wed Dec 23 13:28:48 on ttys008
~$ brew untap mcuadros/hhvm
Error: No available tap mcuadros/hhvm.
~$ brew update; brew upgrade
Updated Homebrew from bce89851 to 2af05100.
Updated 2 taps (caskroom/cask, homebrew/science).
==> New Formulae
artifactory-cli-go digitemp gowsdl ploticus
clog elm homebrew/science/ess scour
==> Updated Formulae
# For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
resolver: ghc-7.10.3
# Local packages, usually specified by relative directory name
packages:
- '.'
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
@erikkaplun
erikkaplun / main.hs
Created October 10, 2018 09:04
PrizeMiniRouter created by eallik - https://repl.it/@eallik/PrizeMiniRouter
import Data.Time.Clock.POSIX (getPOSIXTime)
timeNanos, timeMicros, timeMillis :: IO Integer
t x = round . (x * ) <$> getPOSIXTime
timeNanos = t 1000000000
timeMicros = t 1000000
timeMillis = t 1000
main :: IO ()
package httpserverhelloworld;
import java.io.*;
import java.net.InetSocketAddress;
import com.google.gson.Gson;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
{
"coord": {"lon":-73.99, "lat":40.73},
"weather": [
{"id":501, "main":"Rain", "description":"moderate rain", "icon":"10n"}
],
"base":"stations",
"main": {"temp":288.02, "pressure":1022, "humidity":76, "temp_min":285.95, "temp_max":289.85},
"visibility":11265,
"wind": {"speed":3.85, "deg":47.0027},
"rain": {"1h":0.66},
ZoneId zoneId = null;
try { zoneId = ZoneId.of("Europe/Tallinn"); }
catch(Exception e) {
// what the handler should do when the
// provided URL path contains an invalid zone name
}
// take the current time in the current timezone
LocalDateTime localDateTime = LocalDateTime.now();
// "map" it to
ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, zoneId);
plugins {
id 'dev.clojurephant.clojure' version '0.5.0-alpha.5'
id 'application'
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'maven-publish'
}
group = 'myname'
version = '0.1.0-SNAPSHOT'
ERROR: Unhandled REPL handler exception processing message {:op classpath, :session 17b1873d-6e54-4a77-96a2-e9a30ee136e1, :id 6}
Syntax error macroexpanding at (namespace.clj:29:8).
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3707)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3701)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3701)
at clojure.lang.Compiler$DefExpr.eval(Compiler.java:457)
at clojure.lang.Compiler.eval(Compiler.java:7182)
at clojure.lang.Compiler.load(Compiler.java:7636)
at clojure.lang.RT.loadResourceScript(RT.java:381)
at clojure.lang.RT.loadResourceScript(RT.java:372)
user=> (defn foo [n]
(with-local-vars [x 0]
(dotimes [i n]
(var-set x (inc @x)))))
#'user/foo
user=> (time (foo 5000000))
"Elapsed time: 514.042912 msecs"
user=> (time (foo 5000000))
"Elapsed time: 438.661454 msecs"
(ns shadow.build.targets.chrome-extension
(:require
[clojure.java.io :as io]
[clojure.data.json :as json]
[clojure.string :as str]
[clojure.pprint :refer (pprint)]
[shadow.build :as b]
[shadow.build.targets.browser :as browser]
[shadow.build.targets.shared :as shared]
[shadow.cljs.repl :as repl]