This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
} | |
this.searchDB = this.searchDB.bind(this); | |
this.handleClick = this.handleClick.bind(this); // This was the missing critical line | |
} | |
handleClick (type, param) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//package.json | |
... | |
"scripts": { | |
... | |
"bundle:dev": "webpack --watch --debug --mode='development'", | |
"bundle:prod": "webpack --watch --mode='production'", | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//webpack.config.js | |
const path = require('path'); | |
const SRC_DIR = path.resolve(__dirname, 'client') | |
const DIST_DIR = path.resolve(__dirname, 'public') | |
var config = { | |
entry: `${SRC_DIR}/index.jsx`, | |
output: { | |
filename: 'bundle.js', | |
path: DIST_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git remote -v | |
origin https://github.com/myUser/example.git (fetch) | |
origin https://github.com/myUser/example.git (push) | |
upstream https://github.com/someoneElse/example.git (fetch) | |
upstream https://github.com/someoneElse/example.git (push) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//NB: assumes encoding is 'utf8'; adjust as necessary | |
const readFromDiskAsync = (file) => { | |
fs.readFile(file, { encoding:'utf8'}, function read(err, data) { | |
if (err) {throw err;} | |
console.log('The data is --> ', data) | |
}) | |
} | |
const readFromDiskStream = (file) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0001 // x | |
0100 // y | |
---- | |
0101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0001 // x | |
0101 // y | |
---- | |
0100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0100 // x | |
0101 // y | |
---- | |
0001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bitwiseSwap = (x,y) => { | |
if (x === y) { | |
return; | |
} else { | |
x = x ^ y; | |
y = x ^ y; | |
x = x ^ y; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let swap = (i, j) => { | |
let temp = i; | |
i = j; | |
j = temp | |
} |