Skip to content

Instantly share code, notes, and snippets.

View inovramadani's full-sized avatar
🇮🇩
Write program that can work well with other programs

inovramadani

🇮🇩
Write program that can work well with other programs
  • Indonesia
View GitHub Profile
@inovramadani
inovramadani / mathCalculation.js
Created January 31, 2019 17:20
Javascript recursive function to do math calculation on string formula input
// recursive function to do math calculation on string formula input
// use case: mathCalculation("1 * 2 + 4 / 2 - 6")
function mathCalculation (formula) {
const plusOperator = '+'
const minusOperator = '-'
const multiplyOperator = '*'
const divideOperator = '/'
if (formula.indexOf(plusOperator) > 0) {
@inovramadani
inovramadani / branch-squash-commits.md
Last active March 19, 2019 01:12
How to squash commits on git branch

How to squash commits on git branch

When submitting a pull request, it's important that you squash your commits to keep our repository concise and clean.

You will need to use VIM to do this.

Make sure your branch is up to date with the master branch.

  • Run git rebase -i master.
  • VIM will be opened
@inovramadani
inovramadani / codility_solution.txt
Last active January 3, 2021 02:48
Solution to programming problems in Codility (Javascript)
Lesson 1 - Iterations
BinaryGap: https://app.codility.com/demo/results/trainingMNDHQN-2SY/
Lesson 2 - Array
CyclicRotation: https://app.codility.com/demo/results/training672XDD-B8R/
OddOccurrencesInArray: https://app.codility.com/demo/results/trainingKHZYEY-RR6/
Lesson 3 - Time Complexity
FrogJmp: https://app.codility.com/demo/results/training6JSR59-MEM/
PermMissingElem: https://app.codility.com/demo/results/trainingBFETZ2-2GY/
@inovramadani
inovramadani / react-clean-code.md
Created October 29, 2019 15:59
React clean code, coding style guide, and best practice

General

Git

  • Use ~/.gitignore to ignore files related to your environment / editor.
  • Use present tense in commits "upgrade dependencies" or "introduce custom error object"
  • Use [Conventional Commits][conventional-commits-url]:
feat: add hat wobble #227
^--^ ^------------^ ^--^
@inovramadani
inovramadani / calculator.js
Last active March 10, 2024 08:14
calculator.js
/* input is string (with spaces) as below expressions.
operator precedes numbers
"+ 4 5" --> result: 9,
"+ + 3 4 7" --> 14,
"- 3 * 4 5" --> -17,
"* 3 + 4 5" --> 27,
"* + 3 4 5" --> 35,
"+ - 3 4 7" --> 6,
"+ - * 3 2 4 5" --> 7,
"+ 24 * - 2 1 1" --> 25