Skip to content

Instantly share code, notes, and snippets.

View victorbruce's full-sized avatar
👨‍💻
focused

Victor Bruce victorbruce

👨‍💻
focused
View GitHub Profile

Deploying React App to App Engine

  • Run the command gcloud init
  • Reinitialize settings by choosing an account, a project, and a location
  • Create an app.yaml file
  • gcloud app deploy
@victorbruce
victorbruce / Firebase.md
Last active March 12, 2024 12:07
My journey with Firebase so far. Cheatsheet to serve as a quick reference when developing firebase applications

Firebase

Set up firebase and Deploy

  • Head over to firebase. Sign in and create a project.

  • Copy your project settings under Firebase SDK snippet into your local project (ie your project's api key, auth domain, databaseURL, etc)

  • Create a file (firebase.js or config.js Any name that suits you is fine)

@victorbruce
victorbruce / pagination.md
Last active January 3, 2022 03:22
Paginating, Filtering, and Sorting in React

Pagination

To paginate a page, a general algorithm needs to be followed. Also, you should have the following variables in place:

  • Total items availabe or Items count (It can be a list of patients, books, etc coming from the database)
  • Number of items to display per page or Page size
  • Page count or number of pagination buttons to be rendered (**NB:**This needs to be calculated)

Calculation:

// this is just the happy paths
/* PRODUCT COMPONENT */
class Product extends Component {
state = {
products: PRODUCTS,
editProduct: {} // I added a property to the component state
}
// this method gets called when edit button is clicked
/* Animate Smooth Scroll Snippet */
$('#view-work').on('click', function() {
const images = $('#images').position().top;
$('html, body').animate(
{
scrollTop: images
},
900

What is Nodejs

NodeJs is an open source runtime environment. Runtime simply means something that is executable in it's own environment. Nodejs was built on google's chrome v8 javascript engine.

Node is not a convention based platform where everything is thought through such as the database, sessions, authentication, etc. For example PHP, Ruby on Rails etc. NodeJs has no idea or does not know which database you are going to hook on to.

Node is not recommmended for high CPU intensive operations like reading the file system asynchronously, or machine learning or large arithemetic. Node is good when it comes to concurrency.

# --------- Bump Android Version ---------------
desc "Android: Increase versionCode"
package = load_json(json_path: "./package.json")
private_lane :increase_android_version do
increment_version_code(gradle_file_path: './android/app/build.gradle')
increment_version_name(gradle_file_path: './android/app/build.gradle', version_name: package['version'])
end
# --------- Bump iOS Version ---------------
desc "iOS: Increment versionCode and set versionName to package.json version"
tag-version-release:
needs: build-production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@master
- name: Install Dependencies
run: |
@victorbruce
victorbruce / deploy-to-firebase-app-distribution.yml
Created October 19, 2021 04:19
Github action to deploy a react native application to firebase app distribution
name: Deploy To Firebase App Distribution And Bump Tag Version
on:
push:
branches: [master]
jobs:
build-production:
runs-on: macos-latest
@victorbruce
victorbruce / decrypt-encrypted-files.sh
Created October 19, 2021 04:23
A script to decrypt encrypted files
#!/bin/sh
# Decrypt the file
# --batch to prevent interactive command
# --yes to assume "yes" for questions
gpg --quiet --batch --yes --decrypt --passphrase="$KEYS_KEYSTORE_PASSPHRASE" \
--output android/app/release-key.keystore android/app/release-key.keystore.gpg
gpg --quiet --batch --yes --decrypt --passphrase="$KEYS_KEYSTORE_PASSPHRASE" \