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)"| 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 |
| 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 |
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).
This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"| // 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", |
| # 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 |
| var gVariable = "foo"; | |
| gVariable == window.gVariable; //returns true |
| 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); |