Skip to content

Instantly share code, notes, and snippets.

View jaju's full-sized avatar
🏠
Working from home

Ravindra R. Jaju jaju

🏠
Working from home
View GitHub Profile
@jaju
jaju / pi.rb
Created March 25, 2012 16:30
Akka.io - Pi calculating actors example ported to JRuby
require 'java'
require 'mvn:org.scala-lang:scala-library'
require 'case'
module Akka
include_package 'akka.actor'
include_package 'akka.util.duration'
java_import 'akka.routing.RoundRobinRouter'
java_import 'akka.util.Duration'
end
@jaju
jaju / Foo.scala
Created August 13, 2012 13:19
Something that fails when "sbt run"
// do "sbt run" to see exceptions while running main (although main is discovered fine.)
trait Foo[+A]
// Change trait to class, and it works.
object Foo {
def main(args: Array[String]) : Unit = println("Hello, Foo!")
}
;;; Some NS which has the gen-class directive
(defn -main-that-wont-work []
(let [coll (some-collection-returning-function)]
(for [c coll]
(transform c)
)
)
)
(ns s-and-l.main)
#?(:cljs (set! *print-fn* #(.log js/console %)))
#?(:cljs (def log print))
#?(:clj (def log println))
(def max-board-value 100)
(defn roll-dice []
(-> #?(:cljs (.random js/Math) :clj (java.lang.Math/random))
(* 100)
;; So that we don't repeat figwheel config options in two places.
(use 'figwheel-sidecar.repl-api)
;; See - http://stackoverflow.com/questions/16270805/how-to-get-the-version-of-the-current-clojure-project-in-the-repl
;; This script should be invoked from the base project directory.
(def project (->> "project.clj"
slurp
read-string
(drop 2)
(cons :version)
@jaju
jaju / IntermediateInstructions.md
Created January 7, 2019 17:35
IN/Clojure 2019 - Intermediate workshop setup

Clojure intermediate workshop

Setup Instructions

Just do the following one by one, and you should be fine.

Java 8

You will need Java to work with this Clojure workshop content.

(ns etaoin-play.core
(:require [etaoin.api :refer :all]
[etaoin.keys :as k]))
(defonce drivers (atom {}))
(defmacro a [action _ & body]
`(for [[_# driver#] @drivers]
(future (~action driver# ~@body))))
;; You can try evaluating individual expressions in steps instead of calling the function `steps` by itself.
@jaju
jaju / copy-statics.js
Created July 14, 2021 04:35
Gulp snippets
// Copy static resources from your node modules - CSS files, font files etc.
let publicDir = "resources/public";
const copyStatics = async () => {
var katex = {
"css/fonts": {"pattern": "katex/dist/fonts/**/*"},
"css": {"pattern": "katex/dist/**/*.min.css"}
}
var normalize = {