Git can be challenging, but here are a few git commands that might be helpful on a daily basis.(Shortcuts work using Oh-My-Zsh)

Rebase

git rebase -i master or grbi masterwill attempt to add all the changes in master to your current branch. This is typically done right before pushing upstream and opening up a pull request. While rebasing, there may be some merge conflicts you need to handle. If so, run git rebase --continue or grbc to continue the rebasing. This also gives you the chance to ammend any previous git commit messages or merge commits together. …


First off, let me be the first to say congrats and welcome to Invisible! This is meant to be a brief guide to getting started here.

Accounts

First, let’s get you set up with your accounts.

Email — This is where most meetings will be scheduled, so be sure your Invisible email is set up properly.

HiBob — This is where you can set up your internal company profile and view other employees profiles as well.

Notion — This is a board where various different documents are linked such as our Policies and Guides.

Jira — Jira is where you’ll find…


Given an array, find the greatest sum of a contiguous subset. For example, the input can be [3, 5, -9, 1, 3, -2, 3, 4, 7, 2, -9, 6, 3, 1, -5, 4] and the output should be 19 because the contiguous subset with the greatest sum is [1, 3, -2, 3, 4, 7, 2, -9, 6, 3, 1]

So conceptually, what’s the best approach to solving this problem? We need to create a function that iterates through each individual element and holds both the current running total as well as the overall maximum running total. Let’s call the current…


When working on React projects it’s standard convention to use camelCase and in Rails use snake_case. So, when using Rails as a backend for a React frontend project — do you use snake_case or camelCase?

Image courtesy of https://rodic.fr/

I have experimented with all sorts of ways of handling this frontend-backend communication. One option is to ignore the convention in the backend and create our model columns using camelCase. That way, there’s no need for conversion upon receiving or sending information. However, this is against the standard convention and can be a little confusing when the rest of your variables and methods are snake_case.


Courtesy of www.nan-labs.com

When using Redux, we reconfigure our components to allow for a global state that can be passed in as props and updated accordingly. This can drastically simplify our logic, as we no longer have to worry about potentially passing props down a long on child components. We use action creators to dispatch an action and adjust our Redux store accordingly.

In the long run, this can simplify an app if you understand the basic Redux data flow. Now that our store is global we may want to make fetch requests to our API and, in turn, dispatch actions. Note that…


createStore() and connect()

Redux allows us to access ‘props’ throughout our project and have one global state. In this post, we’ll go in depth on createStore() and connect() when implementing Redux.

First, we need to define some things. We need a reducer when using Redux, like the example below.

The reducer is where we update our current state. When called and passed a state and object (‘action’), it returns an updated state. In the example above, we have a switch statement that can add an animal to the state.

Dispatch persists our state changes.

Now when calling dispatch(action…


https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/

In React, every component has several methods that trigger at different points in a components “life”. These methods are called Lifecycle Methods. Below, I go into detail on when these events are triggered and what they are commonly used for. Refer to the diagram above for a visual aid in understanding what order these events are triggered.

constructor(props)

The constructor method is triggered before mounting even begins. It is the first method called upon the initialization of a component. This method is particularly useful for creating an inital state for a component.

static getDerivedStateFromProps(props, state)

This method gets triggered just…


Problem

Given an array of candies, determine the maximum amount of different candies one can eat if the maximum amount of candies to be consumed is n / 2, where n is the amount of candies.

Example:

Input: candyType = [1,1,2,2,3,3]
Output: 3
Explanation: Alice can only eat 6 / 2 = 3 candies. Since there are only 3 types, she can eat one of each type.

Solutions

Brute Force

A theoretical valid first attempt, but it’s runtime is too long. We try to create an array of unique candies and either push that length or that of maxCandies. …


Ever wanted to know where your sites are being viewed, how many people are even seeing them, and what’s being done on those pages?

Google Analytics is your answer, and it’s super simple to set up.

  1. Navigate to google.com/analytics and set up an account/sign in
  2. Create a property
  3. Click settings > setup assistant > tag installation > add stream > web
  4. Create a new stream
  5. Click Global Site Tag and copy the script.

It should look something like this:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=ID_HERE"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);} …

Jack Tawil

Magician, Mathematician, and Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store