Skip to content

Instantly share code, notes, and snippets.

View ThinhPTran's full-sized avatar

Thinh P. Tran ThinhPTran

  • Ho chi minh city, Vietnam
View GitHub Profile
@ThinhPTran
ThinhPTran / deps.edn
Created July 8, 2022 14:22 — forked from mikeananev/deps.edn
Clojure compress / decompress data examples
{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
com.taoensso/nippy {:mvn/version "2.14.0"}
org.apache.commons/commons-compress {:mvn/version "1.18"}}}
@ThinhPTran
ThinhPTran / w2rgb.py
Created February 3, 2022 10:15 — forked from error454/w2rgb.py
Wavelength to RGB
#!/usr/bin/env python
# vim:set ft=python fileencoding=utf-8 sr et ts=4 sw=4 : See help 'modeline'
# From http://www.noah.org/wiki/Wavelength_to_RGB_in_Python
'''
== A few notes about color ==
Color Wavelength(nm) Frequency(THz)
Red 620-750 484-400
Orange 590-620 508-484
@ThinhPTran
ThinhPTran / inference.md
Created February 4, 2017 08:47 — forked from swannodette/inference.md
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

@ThinhPTran
ThinhPTran / lambda.md
Created December 14, 2016 10:01 — forked from KyleAMathews/lambda.md
Using Kafka and a Samza-like node.js architecture

Disclaimer

I'm still very new to Kafka, eventsourcing, stream processing, etc. I'm in the middle of building my first production system with this stuff and am writing this at the request of a few folks on Twitter. So if you do have experience, please do me and anyone else reading this a favor by pointing out things I get wrong :)

Inspirations

@ThinhPTran
ThinhPTran / charts-reframe.cljs
Created November 28, 2016 10:11 — forked from edwthomas/charts-reframe.cljs
Example of using Chart.js with Clojurescript
(:require [re-frame.core :as re-frame]
[reagent.core :as reagent]
[cljsjs.chartjs])
(defn show-revenue-chart
[]
(let [context (.getContext (.getElementById js/document "rev-chartjs") "2d")
chart-data {:type "bar"
:data {:labels ["2012" "2013" "2014" "2015" "2016"]
:datasets [{:data [5 10 15 20 25]