Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@metacritical
metacritical / gits.go
Created July 19, 2018 13:41
Git Prompt PS1 in go lang.
package main
import (
"os"
"fmt"
"regexp"
"os/exec"
//"strings"
)
(ns dbooked-clj.core
(:import (java.time LocalDateTime format.DateTimeFormatter)))
(defn parse-datetime [date-str]
"Parse datetime."
(LocalDateTime/parse date-str (DateTimeFormatter/ISO_DATE_TIME)))
(defn is-before? [this that]
"Is this time before that?"
(.isBefore this that))
@metacritical
metacritical / fsm.clj
Created April 27, 2018 08:23 — forked from mnicky/fsm.clj
Finite State Machine in Clojure core.logic
(ns fsm
(:refer-clojure :exclude [==])
(:use [clojure.core.logic]))
;; Encoding a Finite State Machine and recognizing strings in its language in Clojure core.logic
;; We will encode the following FSM:
;;
;; (ok) --+---b---> (fail)
;; ^ |
@metacritical
metacritical / 90-min-scc.scm
Created April 15, 2018 20:20 — forked from nyuichi/90-min-scc.scm
The 90 Minute Scheme to C Compiler
#!/usr/local/Gambit-C/bin/gsi
; Copyright (C) 2004 by Marc Feeley, All Rights Reserved.
; This is the "90 minute Scheme to C compiler" presented at the
; Montreal Scheme/Lisp User Group on October 20, 2004.
; Usage with Gambit-C 4.0:
;
; % ./90-min-scc.scm test.scm
@metacritical
metacritical / README.md
Created March 14, 2018 13:54 — forked from mfikes/README.md
Bocko in browser using cljs.main and synthetic index.html

First start up the REPL by issuing this command:

clj -Sdeps '{:deps {github-mfikes/e00202b2de7cc2352fedcf92b1fe60dc {:git/url "https://gist.github.com/mfikes/e00202b2de7cc2352fedcf92b1fe60dc" :sha "c18479fa4fdf4bb2af3d971cb1aaeb2cbd8c909c"}}}' -m cljs.main -i @index.cljs -r

Once the REPL is waiting for the browser to connect, if it doesn't automatically, open http://localhost:9000 in your browser.

You will now be running Bocko. The following forms evaluated in the REPL will draw an American flag.

@metacritical
metacritical / README.md
Created February 6, 2018 15:19
Deep recursive Array Flattener in Ruby

#Array Flattener

The main program file is flatarray.rb, in order to run it you can simply, require_relative 'flatarray' in irband then call the program as follows :

m = FlatArray.new([[1,2,[3]],4, [5,6,[7,8],[9]]]) And then execute m.squash

Run Tests

@metacritical
metacritical / introrx.md
Created February 2, 2018 03:01 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@metacritical
metacritical / racket-clojure-rant.md
Last active September 2, 2022 00:43
Racket-Lisp-Scheme-Clojure Rant and Answers.

Two gentlemen and their rant on languages.

Rant

  • Racket & scheme are orders of magnitude faster than clojure.
  • I like lisp but I hate this clojure movement. Especially when 60% of it is written in Java.
  • Are there major java libraries for which there is no scheme implementations?
  • Why did people pick up clojure rather than racket. Hype?
@metacritical
metacritical / rickhickey.md
Last active January 29, 2018 19:07
Rich Hickey on becoming a better developer
@metacritical
metacritical / slurp.clj
Created October 30, 2017 01:37 — forked from noprompt/slurp.clj
How to use slurp from ClojureScript
(ns foo.core
(:refer-clojure :exclude [slurp]))
(defmacro slurp [file]
(clojure.core/slurp file))
;; In CLJS
(ns bar.core
(:require [foo.core :include-macros true :refer [slurp]]))