It's All Writing.

Writing makes you happy.

node

How to receive a Big Integer, process it and return it at node

Code gist.github.com This sample code is also a solution to the problem at the following URL of atcoder. * https://atcoder.jp/contests/abc178/tasks/abc178_b The code receive input parameters formatted as below from stdin. 1 2 1 1 3 5 -4 -2…

How to implement exlusive control at node

Premise Do you have such an experience that a bug was entered by neglecting exclusive control during asynchronous process with Promise at node? If you want to implement exclusive control, you have to use some library which you'll find out …

How to track pageview with Google Analytics in Node app

Environment Node ( TypeScript ) Google Analytics universal-analytics Premise Normally, in order to track pageview with Google Analytics, it is necessary to embed the tracking code in client-side JavaScript and execute it in the browser. Th…

How to share styles at React Native

Environment React Native mobx react-native-extended-stylesheet Code gist.github.com react-native-extended-stylesheet provides EStyleSheet.build which compile variables to reuse any style in EStyleSheet.create. (e.g. $dark087) And by using …

How to implement summation and product with recursion or reduce at node

Environment node Code Recursion gist.github.com Reduce gist.github.com Note Typically, reduce is faster than recursion, and more simple.

How to get return value from then function at node

Environment node Code gist.github.com The value returned by the then function can be received in a variable with await.

How to detect software keyboard visible state at React Native

Environment React Native react-native-keyboard-accessory NativeBase node Code gist.github.com If the software keyboard is visible ( when you'll input Textarea ), the Button is enabled. Otherwise, the Button is disabled. Typically, The timi…

How to provide utility functions for every components ( How to make HOC ( higher-order component ) ) at React Native

Environment React Native node Premise When there is a utility function you'd like to use in common during each components, you can do it easily via props by using HOC. Using common.js which provides common utility functions has the fault a…

How to navigate between different nested stacks in React Navigation

Environment React Native React Navigation ( react-navigation ) lodash Prerequisites If we have the following Navigator structure: ScreenA ScreenB ScreenC ScreenD TabScreenA StackScreenA StackScreenB TabScreenB StackScreenC StackScreenD Tab…

How to detect leads which has the same name at Salesforce by node

Environment Salesforce node jsforce lodash Premise We can't solve this problem with using report. So, I'll show you the solution which using node ( with jsforce and lodash ). Code gist.github.com Code's Summary The summary of the process i…

How to extends an @AuraEnabled method from super class at Apex

Environment Apex Prerequisites We can not access An Extended @AuraEnabled method from Aura ( node ) as below. gist.github.com AuraHelper.js can't access c:getAccounts. So, this code is not work. Code The solution is to change SubClass as b…

How to get arrays intersection include duplicate values at node

Prerequisites There are two arrays has multiple elements as below. array1 is [ { "mail": "shinchi@its-all-writing.com", "hobby": "Walking" }, { "mail": "shinchi@its-all-writing.com", "hobby": "Playing the Bamboo Flute" }, { "mail": "kazuyo…

How to implement multiple key's group by at node

Prerequisites There are arrays has multiple elements as below. [ { "name": "SHINCHI, Takahiro", "mail": "shinchi@its-all-writing.com", "hobby": "Walking" }, { "name": "SHINCHI, Takahiro", "mail": "shinchi.xx@gmail.com", "hobby": "Playing t…

How to get Salesforce sObject's fields information by node

It's simple. You can use jsforce for this purpose. The describe method returns sObject's meta data. The environment and code is below. Enviroment node jsforce lodash Code const jsforce = require('jsforce'); const lodash = require('lodash')…

How to detect that it can be merged between multiple elements in an array at node.

Prerequisites There are arrays has multiple elements as below. const mergeableArray = [ { 'age': 18, 'status': true }, { 'hobby': 'fishing' }, { 'status': null } ]; const unmergeableArray = [ { 'age': 18, 'status': true }, { 'hobby': 'fish…