How to build a GitHub bot with PhantomJS, React, and Serverless framework

  • How to build a GitHub bot with PhantomJS, React, and Serverless frameworkThis tutorial is about building a simple Serverless bot that returns a chart with top GitHub repository contributors for a selected period.
  • To retrieve top repository contributors, we will use GitHub stats API, the amazing Nivo to display data, Storybook to check how our chart looks and feels, PhantomJS to turn HTML into an image, and Serverless framework to interact with AWS.
  • The only difference is an additional permission to invoke lambda: – iamRoleStatements: [ Effect: ‘Allow’, – Action: [‘lambda:InvokeFunction’], – Resource: [‘*’] – }]Setting up the Slack botThe last step will be to create a service that will handle message events for the bot.
  • npm install -g serverless – npm install -g servicelessCopy the GitHub and Slack bot tokens, and set them to GITHUB_TOKEN and SLACK_TOKEN environment variables accordingly.
  • At the end you should see a similar output: – Deployment completed successfuly[app/html-to-png] [completed]: – Service Information – service: html-to-png – stage: dev – region: us-east-1 – stack: html-to-png-dev – api keys: – None – endpoints: – None – functions: – renderToPng: Removing old service versions… – [app/slack] [completed]: -…

This tutorial is about building a simple Serverless bot that returns a chart with top GitHub repository contributors for a selected period. It is relevant to those who have some experience with…
Continue reading “How to build a GitHub bot with PhantomJS, React, and Serverless framework”


  • A simple set of tools to make using Redux easier – – The package is intended to help address three common complaints about Redux: – – We can’t solve every use case, but in the spirit of and , we can try to provide some tools that abstract over the…
  • Takes a single configuration object parameter, with the following options: – – A utility function to create reducers that handle specific action types, similar to the example function in the “Reducing Boilerplate” Redux docs page.
  • Takes an initial state value and an object that maps action types to case reducer functions.
  • Internally, it uses the library, so you can write code in your case reducers that mutates the existing value, and it will correctly generate immutably-updated state values instead.
  • It also accepts an object of customization options for more specific use cases.

A simple set of tools to make using Redux easier
Continue reading “@acemarke/redux-starter-kit”

Optional Chaining Operator in JavaScript – Bene Studio

  • var user = { name: ‘Joe’ } – var zip = // ⚡⚡⚡Uncaught TypeError: Cannot read property ‘zip’ of undefinedIn this example we expect to exist but for some reason the address is missing from the user object.
  • Workaround #1: Logic Expressionsvar user = { name: ‘Joe’ } – var zip = user – user.address – user.address.zipNoisy and verbose.
  • Workaround #2: Ternary Operatorsvar user = { name: ‘Joe’ } – var zip = – user === undefined – ?
  • Workaround #3: Try-Catchvar user = { name: ‘Joe’ } – var ziptry { – zip = – } catch (error) { – zip = null – }Breaks control and has own scopes.
  • bin/babel index.jsThe Transpiled CodeTranspiled version of the index.js above: – var _user$address;var user = { – name: ‘Joe’ – };var zip = – user == null – ?

All of us usually confronts the situation where an expected member of a property chain is undefined or null. In this example we expect to exist but for some reason the address is…
Continue reading “Optional Chaining Operator in JavaScript – Bene Studio”

How does CSS fit into Reactjs? – Hacker Noon

How does CSS fit into React? #css #reactjs

  • In React, using JSX, this looks like this: – p style={{color: “red”}}Hello World/p – Inline styles are probably the most limited approach in terms of styling full blown applications since they cannot make use of all of the CSS features such as pseudo selectors, animations and media queries.
  • CSS ModulesWith CSS modules you create a CSS file for every type of component that you want to style the same way that you might do with the “Standard CSS” option, however the difference here is that with CSS modules the styles are scoped locally which means that unlike “Standard…
  • How to use within React: – Use css-loader inside of your webpack.config with modules property set to true, or download a complete library such as css-modules, once setup use as follows: – create a CSS file for whatever components you want to stylewrite your CSSimport this CSS file inside of…
  • Behind the scenes CSS-in-JS is usually implemented in one of the following three ways (or a combination of): – via inline stylesvia a style elementvia a link element at build time by extracting styles into a CSS fileFor the sake of not making the article overly long, we will only…
  • If you like what you see, you might also want to checkout another, very similar, CSS-in-JS library called Emotion, it is very similar to styled-components but gives you the option of extracting all of your styles into a CSS file, at build time, which then get linked into the document…

There are a lot of different ways in which you can style your React applications, and I would even go as far as to say that you actually have more options for styling React applications than…
Continue reading “How does CSS fit into Reactjs? – Hacker Noon”

nohoist in Workspaces

  • First, let’s take a quick tour on how hoist work in standalone projects: – – To reduce redundancy, most package managers employ some kind of hoisting scheme to extract and flatten all dependent modules, as much as possible, into a centralized location.
  • In such project, modules could be scattered in multiple locations: – – yarn workspaces can share modules across child projects/packages by hoisting them up to their parent project’s node_modules: .
  • Consequently, workspaces developers often witness “module not found” related errors when building from the child project: – – For this monorepo project to reliably find any module from anywhere, it needs to traverse each nodemodules tree: *“monorepo/nodemodules”* and .
  • There are indeed many ways library owners can address these issues, such as multi-root, custom module map, clever traversing scheme, among others… However, – – It is frustrating when a solution worked for a standalone project only fell short in the monorepo environment.
  • Module path is a virtual path of the dependency tree, not an actual file path, so no need to specify “node_modules” or “packages” in the nohoist pattern.

As wonderful as yarn workspaces are, the rest of the community hasn’t yet fully caught up with the monorepo hoisting scheme. The introducing of the nohoist i…
Continue reading “nohoist in Workspaces”

Why You Should Consider ReactJS for Your Web Application?

Here's Why You Should Consider #ReactJS for Your #Web Application.

  • Yes, we are talking about ReactJS – the JavaScript library which is the hot favorite of developers and is climbing the popularity charts every day.
  • Managing system updates is very easy with ReactJS because every change does not necessarily affect each component in the system.
  • Developers using ReactJS have free access to a variety of useful applications and tools from the community at large.
  • Apart from these, there are numerous other examples such as Uber, Salesforce, KISSmetrics, Tesla, Scribd, Reddit, Periscope and many more which have leveraged the power of ReactJS to build world-class interactive web applications.
  • If you are looking to develop SEO-friendly, interactive web applications with great UI and expect your application to handle heavy traffic, it’s time to migrate to ReactJS.

According to the 2016 StackOverflow developer survey, React.Js’s popularity had recently increased by over 300%.What is making ReactJS so popular? Let’s take a look why you should consider ReactJS for your web application?
Continue reading “Why You Should Consider ReactJS for Your Web Application?”

Why you should use React Native on your next cross-platform application.

Why you should use #reactnative on your next cross-platform application.  #redux

  • The cross platform development allows an app to have same features and functionality on multiple platforms and thus can be termed as the need of the hour.React Native is a JavaScript Framework, introduced by Facebook, for writing such cross platform applications.
  • Thus, apps written in React Native are needed to be built once and deployed on both iOS and Android.The State Store: ReduxRedux is one of the major benefits of React Native.
  • The development is fast, and the resulting applications are smooth in iOS and Android with 80% shared code.You can also update the already deployed applications in real time with tools like CodePush, which is not possible with native apps.Familiar territory for Web DevsFor Web developers, the transition from web to mobile…
  • As React Native is a JavaScript Framework, Web Developers can easily build mobile applications with it.
  • They will enjoy a steep learning curve with React Native thanks to their familiarity with JavaScript.Look and FeelReact Native gives a consistent and native look-and-feel to the apps i.e. the User Interface of a react native app is not any different for Android and iOS from the native platform apps.Use Native APISCoding…

With constant evolution and awe-inspiring innovations in technology, the world of mobile apps is not an exception either and is tremendously changing as well. The boom in the number of smartphone…
Continue reading “Why you should use React Native on your next cross-platform application.”