Skip to content

Instantly share code, notes, and snippets.

View xavierchia's full-sized avatar

Xavier Chia xavierchia

View GitHub Profile
<script src="simpletest.js"></script>
<script>
/*
The runWithDebugger function should run a callback with a debugger
Syntax:
Formula: runWithDebugger(callback, [callbackArguments])
Arguments:
<script src="simpletest.js"></script>
<script>
/*
The librarySystem should be able to store libraries with dependencies and return the library if called
Syntax:
Formula: librarySystem(libraryName, dependencyArray, callbackLibrary)
Arguments:
<script src="simpletest.js"></script>
<script>
/*
The librarySystem should be able to store libraries with dependencies and return the library if called
Syntax:
Formula: librarySystem(libraryName, dependencyArray, callbackLibrary)
Arguments:
<script src="simpletest.js"></script>
<script>
/*
The function isPrototypeOf should work just like Object.prototype.isPrototypeOf
Syntax:
Formula: isPrototypeOf(parentObject, childObject)
Arguments:
// This is a variant on the toFixed method on accountingJS using string manipulation instead of exponential form
var toFixed = lib.toFixed = function (value, precision) {
precision = checkPrecision(precision, lib.settings.number.precision);
// Using exponentialForm
// var exponentialForm = Number(lib.unformat(value) + 'e' + precision);
// var rounded = Math.round(exponentialForm);
// var finalResult = Number(rounded + 'e-' + precision).toFixed(precision);
// return finalResult;

Fixup and autosquash

  • git add .
  • git commit --fixup 3050fc0de // Created a fixup commit for 3050fc0de
  • GIT_SEQUENCE_EDITOR=: git rebase -i main --autosquash // Now the fixup commit has been squashed

Cherry picking a range of commits

  • git cherry pick firstCommit^..lastCommit # First and last are inclusive

Working with forked repos

  • git fetch upstream # This will fetch all upstream branches & show on terminal

How to read source code

Why it’s important

  1. Most of your time will be spent reading, not writing.
  2. Simulates working at a company or open source project.
  3. It's the fastest way to learn and improve.
  4. Learn how to ignore large parts of a codebase and get a piece-by-piece understanding.

Before you start

  1. Read the docs (if they exist).

Choosing an Open Source Project

  1. Software that you've used
  2. Software that you want to use in the future
  3. Software that solves a specific problem
  4. Software that will teach you something that you want to know
  5. Software written by companies that you're interested in
  6. Software written by people that you know

1 April 2022: Crossed $100 in 30 days for MyTummy

1648297060792

10 August 2021: Start first iOS job

Screenshot 2022-04-14 at 7 27 32 AM

1 July 2021: Crossed $100 in paid users

Screenshot 2021-07-01 at 3 42 38 PM

24 April 2021: First paid user for third iOS app (launched)

Switch on emulator keyboard: Command + k
Refresh preview: option + command + p