1623378921
https://www.youtube.com/watch?v=i1wN86rnMEI&t=7s
1632537859
Not babashka. Node.js babashka!?
Ad-hoc CLJS scripting on Node.js.
Experimental. Please report issues here.
Nbb's main goal is to make it easy to get started with ad hoc CLJS scripting on Node.js.
Additional goals and features are:
Nbb requires Node.js v12 or newer.
CLJS code is evaluated through SCI, the same interpreter that powers babashka. Because SCI works with advanced compilation, the bundle size, especially when combined with other dependencies, is smaller than what you get with self-hosted CLJS. That makes startup faster. The trade-off is that execution is less performant and that only a subset of CLJS is available (e.g. no deftype, yet).
Install nbb
from NPM:
$ npm install nbb -g
Omit -g
for a local install.
Try out an expression:
$ nbb -e '(+ 1 2 3)'
6
And then install some other NPM libraries to use in the script. E.g.:
$ npm install csv-parse shelljs zx
Create a script which uses the NPM libraries:
(ns script
(:require ["csv-parse/lib/sync$default" :as csv-parse]
["fs" :as fs]
["path" :as path]
["shelljs$default" :as sh]
["term-size$default" :as term-size]
["zx$default" :as zx]
["zx$fs" :as zxfs]
[nbb.core :refer [*file*]]))
(prn (path/resolve "."))
(prn (term-size))
(println (count (str (fs/readFileSync *file*))))
(prn (sh/ls "."))
(prn (csv-parse "foo,bar"))
(prn (zxfs/existsSync *file*))
(zx/$ #js ["ls"])
Call the script:
$ nbb script.cljs
"/private/tmp/test-script"
#js {:columns 216, :rows 47}
510
#js ["node_modules" "package-lock.json" "package.json" "script.cljs"]
#js [#js ["foo" "bar"]]
true
$ ls
node_modules
package-lock.json
package.json
script.cljs
Nbb has first class support for macros: you can define them right inside your .cljs
file, like you are used to from JVM Clojure. Consider the plet
macro to make working with promises more palatable:
(defmacro plet
[bindings & body]
(let [binding-pairs (reverse (partition 2 bindings))
body (cons 'do body)]
(reduce (fn [body [sym expr]]
(let [expr (list '.resolve 'js/Promise expr)]
(list '.then expr (list 'clojure.core/fn (vector sym)
body))))
body
binding-pairs)))
Using this macro we can look async code more like sync code. Consider this puppeteer example:
(-> (.launch puppeteer)
(.then (fn [browser]
(-> (.newPage browser)
(.then (fn [page]
(-> (.goto page "https://clojure.org")
(.then #(.screenshot page #js{:path "screenshot.png"}))
(.catch #(js/console.log %))
(.then #(.close browser)))))))))
Using plet
this becomes:
(plet [browser (.launch puppeteer)
page (.newPage browser)
_ (.goto page "https://clojure.org")
_ (-> (.screenshot page #js{:path "screenshot.png"})
(.catch #(js/console.log %)))]
(.close browser))
See the puppeteer example for the full code.
Since v0.0.36, nbb includes promesa which is a library to deal with promises. The above plet
macro is similar to promesa.core/let
.
$ time nbb -e '(+ 1 2 3)'
6
nbb -e '(+ 1 2 3)' 0.17s user 0.02s system 109% cpu 0.168 total
The baseline startup time for a script is about 170ms seconds on my laptop. When invoked via npx
this adds another 300ms or so, so for faster startup, either use a globally installed nbb
or use $(npm bin)/nbb script.cljs
to bypass npx
.
Nbb does not depend on any NPM dependencies. All NPM libraries loaded by a script are resolved relative to that script. When using the Reagent module, React is resolved in the same way as any other NPM library.
To load .cljs
files from local paths or dependencies, you can use the --classpath
argument. The current dir is added to the classpath automatically. So if there is a file foo/bar.cljs
relative to your current dir, then you can load it via (:require [foo.bar :as fb])
. Note that nbb
uses the same naming conventions for namespaces and directories as other Clojure tools: foo-bar
in the namespace name becomes foo_bar
in the directory name.
To load dependencies from the Clojure ecosystem, you can use the Clojure CLI or babashka to download them and produce a classpath:
$ classpath="$(clojure -A:nbb -Spath -Sdeps '{:aliases {:nbb {:replace-deps {com.github.seancorfield/honeysql {:git/tag "v2.0.0-rc5" :git/sha "01c3a55"}}}}}')"
and then feed it to the --classpath
argument:
$ nbb --classpath "$classpath" -e "(require '[honey.sql :as sql]) (sql/format {:select :foo :from :bar :where [:= :baz 2]})"
["SELECT foo FROM bar WHERE baz = ?" 2]
Currently nbb
only reads from directories, not jar files, so you are encouraged to use git libs. Support for .jar
files will be added later.
The name of the file that is currently being executed is available via nbb.core/*file*
or on the metadata of vars:
(ns foo
(:require [nbb.core :refer [*file*]]))
(prn *file*) ;; "/private/tmp/foo.cljs"
(defn f [])
(prn (:file (meta #'f))) ;; "/private/tmp/foo.cljs"
Nbb includes reagent.core
which will be lazily loaded when required. You can use this together with ink to create a TUI application:
$ npm install ink
ink-demo.cljs
:
(ns ink-demo
(:require ["ink" :refer [render Text]]
[reagent.core :as r]))
(defonce state (r/atom 0))
(doseq [n (range 1 11)]
(js/setTimeout #(swap! state inc) (* n 500)))
(defn hello []
[:> Text {:color "green"} "Hello, world! " @state])
(render (r/as-element [hello]))
Working with callbacks and promises can become tedious. Since nbb v0.0.36 the promesa.core
namespace is included with the let
and do!
macros. An example:
(ns prom
(:require [promesa.core :as p]))
(defn sleep [ms]
(js/Promise.
(fn [resolve _]
(js/setTimeout resolve ms))))
(defn do-stuff
[]
(p/do!
(println "Doing stuff which takes a while")
(sleep 1000)
1))
(p/let [a (do-stuff)
b (inc a)
c (do-stuff)
d (+ b c)]
(prn d))
$ nbb prom.cljs
Doing stuff which takes a while
Doing stuff which takes a while
3
Also see API docs.
Since nbb v0.0.75 applied-science/js-interop is available:
(ns example
(:require [applied-science.js-interop :as j]))
(def o (j/lit {:a 1 :b 2 :c {:d 1}}))
(prn (j/select-keys o [:a :b])) ;; #js {:a 1, :b 2}
(prn (j/get-in o [:c :d])) ;; 1
Most of this library is supported in nbb, except the following:
:syms
.-x
notation. In nbb, you must use keywords.See the example of what is currently supported.
See the examples directory for small examples.
Also check out these projects built with nbb:
See API documentation.
See this gist on how to convert an nbb script or project to shadow-cljs.
Prequisites:
To build:
bb release
Run bb tasks
for more project-related tasks.
Download Details:
Author: borkdude
Download Link: Download The Source Code
Official Website: https://github.com/borkdude/nbb
License: EPL-1.0
#node #javascript
1604922206
Advanced Excel Certification offers numerous job opportunities that have come up. Lately, companies search for a talented personality who holds great knowledge in excel. However, simply basic knowledge isn’t sufficient. If you would like to be a part of a well-renowned company then you want to have the excel certification matching industrial standards.
Whether you’re seeking higher growth within an equivalent company or expecting an honest hike from the new company, complicated excel training courses with certification can surely increase your chances to be on the brink of the success ladder. Join an advanced online excel training class and improve your skills.
Know More About Advanced Excel?
The word itself explains the meaning of this course. this is often one quite skill that sets a learning benchmark for MS Excel. It offers a transparent insight to all or any of the simplest and therefore the most advanced features that are now available within the current version of Microsoft Excel.
In this competitive era where your colleagues would equally be striving to urge a far better post than you, if you excel yourself in some good certification courses then surely there’s no looking back for you.
This type of certification is all about brushing up your administration, management, and analytical skills which in today’s market is sort of important. To match up with the flexible needs of the clients, it’s important for you to be advanced and for this such training can certainly be helpful.
Some Mind-Blowing Benefits You Get:
There are ample Excel Training Courses that you simply may encounter, but choosing a certification course in Advanced excel possesses its perks for you also as for the corporate. Listed are a few that you simply got to know.
1.There is a superior recognition that you simply get
2.As compared to non-certified professionals, you occupy the highest at the competition
3.Employers will have you ever within the priority for giant important projects
4.If you’re a freelancer, then such advanced training is often an excellent learning experience
5.For those that wish to urge within the management, the world can have a boosting knowledge
6.Administration skills also get brushed up and a replacement range of job opportunities opens
7.There is an honest hike in PayScale soon after you show your skills and certification to your HR
Quick Tip which will Help:
If you’re getting to join a web course to urge such certification then see thereto that the trainer who is going to be taking care of you during this course is very experienced and may provide you with the simplest possible assistance.
Now you’ll boost your knowledge during a spreadsheet, play with new financial
#advanced excel online training #advanced excel online course #advanced excel training #advanced excel course #advanced excel training in noida #advanced excel training in delhi
1625778000
In this video, we are going to look at how to do validations of the request coming to the controller. Validating the request object is very important, and I will show you in this video how you can create a DTO and then define rules inside that DTO so that you can run validations.
Github code: https://my-lnk.com/r/2233233755
#nest js #node js #node #nest #javascript #dto
1608615386
The principal concept at the back of ReactJS improvement become to discover a framework that allows in constructing a dynamic library with excessive performance. An appropriate instance of this becomes to offer newsfeeds on equal time whilst human beings are chatting. Optimization of the improvement technique and bringing on JavaScript become all that become required at that time. ReactJS is greater like an open-supply JavaScript library in place of a framework. Used for constructing superb consumer interfaces, it is ideal for rendering performance.
Reasons to pick out React.js/React/ReactJS
Out of the several reasons React.JS can be future of hybrid mobile app, some of the interesting ones are:
Cons of ReactJS Making use of JSX which permits blending HTML with JavaScript is taken into consideration a critical drawback through ReactJS builders as it’s far complicated and has a steep mastering curve. Join ReactJS Online Training and learn the regular launch of the latest tools, documentation nonetheless stays incomplete, which makes it tough for brand spanking new ReactJS builders to apprehend and code. With the excessive tempo of improvement, ReactJS builders have to quickly research new methods of improvement. With rapid evolution, now no longer each developer is capable of preserve tempo. What’s our tackle it?
AngularJS is a featured framework at the same time as ReactJS is a library. You will need to write much less code with ReactJS and it even plays higher because of the implementation of digital DOM. As React has simply commenced its network is developing. Node.js is a JavaScript runtime that is rapid and lightweight. It may be used to create rapid and scalable networking packages. With Client-Side statistics rendering and a top configuration, ReactJS is an outright desire of JavaScript framework Developers.
#react js online training #react js online course #online react js course #online react js training #react js training in noida #react js training in delhi
1624291630
Learn and master the most common data structures in this full course from Google engineer William Fiset. This course teaches data structures to beginners using high quality animations to represent the data structures visually.
You will learn how to code various data structures together with simple to follow step-by-step instructions. Every data structure presented will be accompanied by some working source code (in Java) to solidify your understanding.
⭐️ Course Contents ⭐️
⌨️ (0:00:00) Abstract data types
⌨️ (0:04:28) Introduction to Big-O
⌨️ (0:17:00) Dynamic and Static Arrays
⌨️ (0:27:40) Dynamic Array Code
⌨️ (0:35:03) Linked Lists Introduction
⌨️ (0:49:16) Doubly Linked List Code
⌨️ (0:58:26) Stack Introduction
⌨️ (1:09:40) Stack Implementation
⌨️ (1:12:49) Stack Code
⌨️ (1:15:58) Queue Introduction
⌨️ (1:22:03) Queue Implementation
⌨️ (1:27:26) Queue Code
⌨️ (1:31:32) Priority Queue Introduction
⌨️ (1:44:16) Priority Queue Min Heaps and Max Heaps
⌨️ (1:49:55) Priority Queue Inserting Elements
⌨️ (1:59:27) Priority Queue Removing Elements
⌨️ (2:13:00) Priority Queue Code
⌨️ (2:28:26) Union Find Introduction
⌨️ (2:33:57) Union Find Kruskal’s Algorithm
⌨️ (2:40:04) Union Find - Union and Find Operations
⌨️ (2:50:30) Union Find Path Compression
⌨️ (2:56:37) Union Find Code
⌨️ (3:03:54) Binary Search Tree Introduction
⌨️ (3:15:57) Binary Search Tree Insertion
⌨️ (3:21:20) Binary Search Tree Removal
⌨️ (3:34:47) Binary Search Tree Traversals
⌨️ (3:46:17) Binary Search Tree Code
⌨️ (3:59:26) Hash table hash function
⌨️ (4:16:25) Hash table separate chaining
⌨️ (4:24:10) Hash table separate chaining source code
⌨️ (4:35:44) Hash table open addressing
⌨️ (4:46:36) Hash table linear probing
⌨️ (5:00:21) Hash table quadratic probing
⌨️ (5:09:32) Hash table double hashing
⌨️ (5:23:56) Hash table open addressing removing
⌨️ (5:31:02) Hash table open addressing code
⌨️ (5:45:36) Fenwick Tree range queries
⌨️ (5:58:46) Fenwick Tree point updates
⌨️ (6:03:09) Fenwick Tree construction
⌨️ (6:09:21) Fenwick tree source code
⌨️ (6:14:47) Suffix Array introduction
⌨️ (6:17:54) Longest Common Prefix (LCP) array
⌨️ (6:21:07) Suffix array finding unique substrings
⌨️ (6:25:36) Longest common substring problem suffix array
⌨️ (6:37:04) Longest common substring problem suffix array part 2
⌨️ (6:43:41) Longest Repeated Substring suffix array
⌨️ (6:48:13) Balanced binary search tree rotations
⌨️ (6:56:43) AVL tree insertion
⌨️ (7:05:42) AVL tree removals
⌨️ (7:14:12) AVL tree source code
⌨️ (7:30:49) Indexed Priority Queue | Data Structure
⌨️ (7:55:10) Indexed Priority Queue | Data Structure | Source Code
📺 The video in this post was made by freeCodeCamp.org
The origin of the article: https://www.youtube.com/watch?v=RBSGKlAvoiM&list=PLWKjhJtqVAblfum5WiQblKPwIbqYXkDoC&index=3
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!
#data structures #data structures easy to advanced course #google engineer #william fiset #data structures easy to advanced course - full tutorial from a google engineer #advanced course