Skip to content

Instantly share code, notes, and snippets.

View rikkrome's full-sized avatar

Ricky Romero rikkrome

  • EA
  • Los Angeles, CA
View GitHub Profile
@rikkrome
rikkrome / .eslintrc.js
Last active August 6, 2021 23:07
Configs
module.exports = {
env: {
es2020: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
@rikkrome
rikkrome / writeToFile.js
Created May 13, 2021 22:11
writeToFile nodejs
const fs = require("fs");
const writeToFile = (file, data) =>
new Promise((resolve, reject) => {
try {
if (file) {
fs.writeFile(file, data, err => {
if (err) {
console.log("writeFile error: ", err);
resolve({ error: true })
@rikkrome
rikkrome / execCommand.js
Created May 12, 2021 19:32
execCommand nodejs
const chalk = require('chalk');
const { exec } = require("child_process");
const util = require('util');
const execCommand = (command, displayError = true) => {
return new Promise(async (resolve, reject) => {
try {
const execPromise = util.promisify(exec);
const { stdout, error } = await execPromise(command, { cwd: process.cwd() })
if (stdout) {
return resolve({ stdout, error: false })

React Native Performance Tips

  • Lazy loading screens
    • bottom tabs & top tabs
  • Tracking renders
    • counting the amount of times a component renders.
    • added a custom useRef() hook into all components / child components.
import { useRef } from 'react';
# -------------------------------
# ENVIRONMENT CONFIGURATION
# -------------------------------
# Change Prompt
# ------------------------------------------------------------
# PS1 settings
# ---------------------------------------------------
# colors
export COLOR_NC='\e[0m' # No Color
@rikkrome
rikkrome / The Technical Interview Cheat Sheet.md
Created August 17, 2018 16:47 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@rikkrome
rikkrome / linkedlist.js
Created August 7, 2018 19:33
JS Linked list
{
function LinkedList() {
this.head = null;
this.tail = null;
}
function Node(value, next, prev) {
this.value = value;
this.next = next;
this.prev = prev;
@rikkrome
rikkrome / server.js
Created July 6, 2018 08:21
express and mongoDB starting point
// server.js file
const express = require('express');
const mongoose = require('mongoose');
const app = express();
//
// ─── DATABASE ───────────────────────────────────────────────────────────────────
//
// DB Config
@rikkrome
rikkrome / server.js
Created July 6, 2018 08:10
mongoose connect
// DB Config
const db = require('./config/keys').mongoURI;
// connect to mongoDB
mongoose
.connect(db)
.then(() => {
console.log('MongoDB Connected');
})
.catch(err => {
@rikkrome
rikkrome / key.js
Last active July 6, 2018 08:03
mLab key
// replace <dbuser>: with your admin's username
// replace <dbpassword> with your admin's password
module.exports = {
mongoURI: 'mongodb://<dbuser>:<dbpassword>@ds123456.mlab.com:1234556/project-name'
}