Skip to content

Instantly share code, notes, and snippets.

View cngondo's full-sized avatar
🎯
Focusing

Cornellius Ngondo cngondo

🎯
Focusing
  • Galvanize
  • Mexico City, Mexico
View GitHub Profile
@cngondo
cngondo / Webpack.config.js
Last active March 16, 2022 20:50
SIMPLE WEBPACK 5 SETTINGS WITH CORRESPONDING package.json FOR REACT
const dev = process.env.NODE_ENV !== 'production' // Loads the environment that you're running on
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
module.exports = {
mode:'development',
devtool: dev ? 'inline-source-map': 'eval-source-map', // Maps the line numbers of jsx files to the ones in the bundle
entry: path.join( __dirname, 'client/src/index.jsx'),
module: { // All modules to be used in the app
@cngondo
cngondo / installing_cassandra.md
Created November 16, 2020 20:13 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@cngondo
cngondo / tray_filler_1
Created July 29, 2020 23:21
A farmer has asked you to develop a program for a robot that fills empty trays of eggs. How would you do that? A tray has 30 eggs.
Define a tray as a collection with length of 30
Define the eggs
Iterate over the tray
Check if there's any empty space
If spaces exist
Fill up the empty tray spaces with an egg
If full
Inform farmer that tray is full
Create another tray
@cngondo
cngondo / MySQL_5-7_macOS.md
Created June 3, 2020 21:49 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@cngondo
cngondo / docker-help.md
Created May 18, 2020 19:02 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@cngondo
cngondo / webpack.config.js
Last active November 12, 2020 21:43
Webpack react configuration 2020 (Works with the new @babel/core configurations)
// Webpack configuration for react to work with all browsers
const path = require("path"); // node's path module
const htmlWebpackPlugin = require("html-webpack-plugin"); // creates your html with all jsx bundled to es5
module.exports = {
entry: "./index.js",
output: { // path to the bundle
path: path.join(__dirname, "/bundle"),
filename: "bundle.js",
@cngondo
cngondo / current-dir-in-iterm-tab-title.sh
Created March 11, 2020 17:35 — forked from phette23/current-dir-in-iterm-tab-title.sh
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html
var addEventSystem = function(target){
// Stores all the events. Keys -> event names, Values -> array of
// all callbacks for the events
target.reactionsTo = {};
target.on = function(event, callback){
// the event will act as the keys to the system
this.reactionsTo[event] = this.reactionsTo[event] || []
this.reactionsTo[event].push(callback);
}
// Trigger all the callbacks based on the event being passed
@cngondo
cngondo / global.js
Last active November 25, 2019 21:35
Global Context
var gVariable = "foo";
gVariable == window.gVariable; //returns true
@cngondo
cngondo / HashTable.js
Created August 7, 2018 20:12 — forked from alexhawkins/HashTable.js
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);