- Read DataLoader Source
- Check out Keechma's Dataloader and Graphql Builder... (video)
- Check out this example with GraphQL + Express + Dataloader
| (defmacro def-curry-fn [name args & body] | |
| {:pre [(not-any? #{'&} args)]} | |
| (if (empty? args) | |
| `(defn ~name ~args ~@body) | |
| (let [rec-funcs (reduce (fn [l v] | |
| `(letfn [(helper# | |
| ([] helper#) | |
| ([x#] (let [~v x#] ~l)) | |
| ([x# & rest#] (let [~v x#] | |
| (apply (helper# x#) rest#))))] |
| /* next add the state to ask security questions */ | |
| render: function(){ | |
| // Now add the security challenge state | |
| var item = null; | |
| switch(this.state.bankState){ | |
| case "CONNECTED": | |
| break; | |
| case "SECURITY": | |
| // create a new element to show questions and get answers |
| // good example: https://github.com/loganpowell/Flickr-Wormhole | |
| // blog for that: https://serverless.com/blog/3rd-party-rest-api-to-graphql-serverless/ | |
| // NEXT: notes on using context: https://github.com/graphql/graphql-js/issues/953 | |
| // follow up: | |
| // access the request object in context arg: https://medium.com/stackfame/how-to-access-the-request-object-inside-a-graphql-resolver-function-apollo-server-express-8402c1bbb097 | |
| // notes on using context: https://github.com/graphql/graphql-js/issues/953 | |
| // https://stackfame.com/graphql-req-object | |
| // https://www.apollographql.com/docs/apollo-server/setup.html#options-function |
| const R = require('ramda') | |
| const fetch = require('node-fetch') | |
| const fetchJson = (f) => f.then(res => res.json()) | |
| const prepareGithubRequest = R.curry((accessToken, path) => fetchJson(fetch(`https://api.github.com/${path}?access_token=${accessToken}`))) | |
| const fetchFromGithub = prepareGithubRequest(ACCESS_TOKEN) | |
| const getReposFromOrg = org => fetchFromGithub(`orgs/${org}/repos`) | |
| const getPopularRepos = R.compose(R.reverse, R.sortBy(R.prop('stargazers_count')), R.project(['name', 'stargazers_count', 'language'])) |
| 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]] |
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).
| (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))) |
| 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] }) ) | |
| ); |
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.