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 Person { | |
constructor(name) { | |
this.name = name; | |
} | |
count() { | |
return Person.prototype.counter++; | |
} | |
} | |
Person.prototype.counter = 0; |
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 Humanoid { | |
constructor(name) { | |
this.name = name; | |
} | |
say() { | |
console.log(this.name); | |
} | |
} | |
class Human extends Humanoid { |
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
function Device(power) { | |
this.power = power; | |
this.turnPower = function() { this.power = !this.power }; | |
} | |
Device.prototype.sayHello = function() { this.power ? console.log('hello, the power is on') : ''} | |
function Computer(proccessor, memory) { | |
this.proccessor = proccessor; | |
this.memory = memory; |
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 asyncReducerFactory = (name) => { | |
return (state = { data: null, isLoading: false, error: null }, action) => { | |
switch (action.type) { | |
case `FETCH_${name}_STARTED`: | |
return { data: null, isLoading: true, error: null }; | |
case `FETCH_${name}_SUCCESS`: | |
return { data: action.payload, isLoading: false, error: null }; | |
case `FETCH_${name}_ERROR`: | |
return { data: null, isLoading: false, error: action.payload }; | |
default: |
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
// jasmine | |
const customMatchers = { | |
toBeArray: function () { | |
return { | |
compare: function (item) { | |
const result = { | |
pass: item instanceof Array, | |
message: '' | |
}; |
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
function Constans(arg, value) { | |
return Object.defineProperty(this, arg, { | |
value: value, | |
writable: false | |
}); | |
} | |
Constans('test', 2); | |
test; //2 |
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
function makeIterator(arr) { | |
var index = 0; | |
return { | |
next : function() { | |
return index < arr.length ? { | |
value: arr[index++], | |
done: false | |
} : { | |
value: arr[index], | |
done: 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
<!DOCTYPE html> | |
<html lang="5"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Pierwszy komponent w React.js</title> | |
<script src="https://unpkg.com/react/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/babel-standalone/babel.js"></script> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.css"> | |
</head> |
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
<!DOCTYPE html> | |
<html lang="5"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Pierwszy komponent w React.js</title> | |
<script src="https://unpkg.com/react/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/babel-standalone/babel.js"></script> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.css"> | |
</head> |
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
Array.prototype.map2 = function(fn) { | |
this.forEach(function(e) { | |
fn.call(this,e); | |
}); | |
} |
NewerOlder