Skip to content

Instantly share code, notes, and snippets.

View tkachenko1503's full-sized avatar

Sergey Tkachenko tkachenko1503

View GitHub Profile
@tkachenko1503
tkachenko1503 / why-do-we-need-types-in-javascript.md
Last active April 21, 2020 10:35
Do we need types in JavaScript? Or maybe not?

This is my lightning talk submission to ReactiveConf 2018 https://reactiveconf.com/

In this talk, I want to share my experience gained during the development of frontend applications in several programming languages.

I think it's not a secret for anybody that developing large JavaScript applications is not so easy as it seems at first glance. We all want something simpler and more reliable. Therefore, many developers and even entire companies switch to different, compiled in JavaScript, programming languages. The bulk of such transitions is accounted for TypeScript and flow, and often, developers faced with more problems than they were before.

I wasn't the exception. Moving to a new project, I started using TypeScript and was disappointed. Luckily in my next project I used ClojureScript and it was like everything is illuminated!

@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 1, 2024 09:43 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update

Code Splitting

NOTE: This gist uses the master branch of ClojureScript. Clone ClojureScript and from the checkout run ./script/bootstrap and ./script/uberjar. This will produce target/cljs.jar which you can use to follow this guide.

As client applications become larger it becomes desirable to load only the code actually required to run a particular logical screen. Previously ClojureScript :modules compiler option permitted such code splitting, but this feature only worked under :advanced compilation and users would still have to manage loading these splits. :modules also required manual

@ryanoglesby08
ryanoglesby08 / server.js
Last active April 4, 2024 13:25
A node.js SPA server that serves static files and an index.html file for all other routes.
/*
Incredibly simple Node.js and Express application server for serving static assets.
DON'T USE THIS IN PRODUCTION!
It is meant for learning purposes only. This server is not optimized for performance,
and is missing key features such as error pages, compression, and caching.
For production, I recommend using an application framework that supports server-side rendering,
such as Next.js. https://nextjs.org
(defmulti control (fn [action] action))
(defmethod control :init [_ [init-state] _]
init-state)
(defonce reconciler
(scrum/reconciler {:state (atom {}) ;; <= client-side state
:controllers {:user control}})) ;; <= action handlers
@bhb
bhb / test_helper.clj
Last active March 6, 2019 10:51
Test helpers when using clojure.spec
(ns foo.test-helper
(:require [clojure.spec :as s]
[clojure.spec.test :as st]
[clojure.string :as str]
[clojure.test :refer :all]
[clojure.test.check.generators :as gen]
[clojure.test.check.random :refer [IRandom]]
[clojure.test.check.rose-tree :as rose]))
(defn instrument-all
@pesterhazy
pesterhazy / reagent-ref-functions.clj
Last active January 19, 2023 11:31
Using ref functions with reagent
;; React supports "refs" as a way for a component to get a
;; handle to its children. Classically, refs were string-based.
;; Recent versions of React support callback attributes as a
;; more elegant variant of accessing DOM notes or components.
;;
;; This example uses a Form-3 component as per
;; https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components
;;
;; For callback refs, see React's documentation
;; https://facebook.github.io/react/docs/more-about-refs.html
@subfuzion
subfuzion / curl.md
Last active May 6, 2024 09:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@divmgl
divmgl / missinginteger.js
Created December 1, 2015 06:28
MissingInteger Javascript solution 100%/100%
function solution(A) {
var F = []; // Found list
var I = 0, V = 0; // Counter, container
while (I < A.length) { // Iterate through the array
V = A[I]; // Store the value
I++; // Increase counter
if (F[V]) continue; // If the value exists, continue
F[V] = true; // Store the value
}
@JacobNinja
JacobNinja / pipeline.clj
Last active April 6, 2022 09:14
Clojure core.async pipeline example
(require '[clojure.core.async :as async]
'[clj-http.client :as client]
'[clojure.data.json :as json])
(def concurrency 5)
(let [in (async/chan)
out (async/chan)
request-handler (fn [url out*]
(async/go