Create async functions with this - most flexible - API contract/signature. This is good for coordinating numerous asynchronous operations (e.g., networking effects/propogation, streaming events, etc.).
| ;; ------------------------ | |
| (defn- log-time [{:keys [ns name line]} f & args] | |
| (let [start (System/nanoTime) | |
| res (apply f args) | |
| elapsed (quot (- (System/nanoTime) start) 1000)] | |
| (log/debug (format "%s/%s:%s %dus" ns name line elapsed)) | |
| res)) | |
| (defn enable-timing [var] |
I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.
For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.
Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.
| let standardJSON = | |
| <async fetch stats returns promise> | |
| .then(data => { | |
| let labels = data[0].map(datum => datum.toUpperCase()); | |
| let rows = data.slice(1); | |
| let objArray = rows.map(row => { | |
| return Object.assign( | |
| {}, | |
| ...labels.map( (key, idx) => ({ [key]: row[idx] }) ) | |
| ); |
| (defn deep-merge [v & vs] | |
| (letfn [(rec-merge [v1 v2] | |
| (if (and (map? v1) (map? v2)) | |
| (merge-with deep-merge v1 v2) | |
| v2))] | |
| (if (some identity vs) | |
| (reduce #(rec-merge %1 %2) v vs) | |
| v))) |
Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist.
Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
- Read DataLoader Source
- Check out Keechma's Dataloader and Graphql Builder... (video)
- Check out this example with GraphQL + Express + Dataloader
| var fetch = require("node-fetch"); | |
| var WKT = require("terraformer-wkt-parser"); | |
| var ramda = require("ramda"); | |
| require("dotenv").load(); | |
| var testWKT = WKT.convert({ | |
| type: "Polygon", | |
| coordinates: [ | |
| [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], | |
| [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] |