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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const cors = require('cors'); | |
const app = express(); | |
const port = 3000; | |
app.use(cors()); | |
const jsonParser = bodyParser.json(); |
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
const express = require('express') | |
const bodyParser = require('body-parser') | |
const uuidv1 = require('uuid/v1'); | |
const cors = require('cors') | |
const app = express() | |
const port = 3000 | |
app.use(cors()) |
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
// Zadanie 1 | |
const data1 = [1, 2, 3, 4, 4, 2, 1, 3]; | |
console.log([...new Set(data1)]); | |
// Zadanie 2 | |
const data2 = [{a: 1, b: 2},{a: 5, b: 8},{a: "aaaa", c: "aaaaa"}]; | |
console.log(data2.map(i => i.a)); |
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
<html> | |
<head></head> | |
<body> | |
<div></div> | |
<span id="drag-test"></span> | |
</body> | |
<script> | |
document.addEventListener( | |
'mousemove', | |
function(ev) { |
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
// Example of updating record on shallow copied array in Javascript | |
const arr1 = [{a: 10, b: 15}]; | |
console.log("arr1 before update = ", arr1); | |
const arr2 = arr1.slice(); | |
console.log("arr2 before update = ", arr2); | |
arr2[0].b = 15; |
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
mv .zsh_history .zsh_history_bad | |
strings .zsh_history_bad > .zsh_history | |
fc -R .zsh_history |
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
const Buttons = branch( | |
props => props.loading, | |
withProps({ label: 'LOADING...', isDisabled: true }), | |
withProps({ id: 'signIn', label: 'SIGN IN', type: 'submit' }) | |
)(SignInButton); | |
const Buttons = ({ loading }) => | |
loading ? ( | |
<SignInButton label="LOADING..." isDisabled={true} /> | |
) : ( |
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
export default function applyScopeToSelectors(selectors, stateKey) { | |
return Object.keys(selectors).reduce((res, val) => { | |
if (typeof selectors[val] === 'object') { | |
return { ...res, [val]: applyScopeToSelectors(selectors[val], stateKey) }; | |
} | |
return { ...res, [val]: state => selectors[val](state[stateKey]) }; | |
}, {}); | |
} |
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
export default class Counter extends React.Component { | |
state = { | |
counter: this.props.counter | |
}; | |
increment = () => { | |
this.setState(state => ({ | |
counter: state.counter + 1 | |
})); | |
}; |
NewerOlder