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 categories = [ | |
{id: 'animals', 'parent': null}, | |
{id: 'mammals', 'parent': 'animals'}, | |
{id: 'dogs', 'parent': 'animals'}, | |
{id: 'chihuahua', 'parent': 'dogs'}, | |
{id: 'labrador', 'parent': 'dogs'}, | |
{id: 'persian', 'parent': 'cats'}, | |
] | |
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 a = 'abcd efg hig' | |
console.log(a) | |
console.log(a.split()) | |
console.log(a.split('')) | |
/* | |
abcd efg hig | |
[ 'abcd efg hig' ] | |
[ 'a', 'b', 'c', 'd', ' ', 'e', 'f', 'g', ' ', 'h', 'i', 'g' ] | |
*/ |
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 getDrink(type) { | |
const drinks = new Map([ | |
['coke', () => 'Coke'], | |
['pepsi', () => 'Pepsi'], | |
['lemonade', () => 'Lemonade'], | |
['default', () => 'Default item'], | |
]); | |
const drink = drinks.has(type) ? drinks.get(type)() : drinks.get('default')(); | |
return `The drink I chose was ${drink}`; | |
} |
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
" Lucario - The best colorful flat theme ever | |
" Author: Raphael Amorim | |
" | |
" GitHub project: https://github.com/raphamorim/lucario | |
set background=dark | |
highlight clear | |
set t_Co=256 |
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {Header} from './Header' //with state | |
import Header2 from './Header2' //without state | |
export class App extends React.Component { | |
render(){ | |
return ( |
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
import React from 'react'; | |
const Header2 = ({age}) => | |
<h2 className="Header text-center"> | |
{age} | |
</h2> | |
; | |
Header2.propTypes = { | |
message: React.PropTypes.string |
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
import React from 'react'; | |
export class Header extends React.Component { | |
render() { | |
// user = { | |
// name: 'Anna', | |
// hobbies: 'Gold' | |
// } |
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
import React from 'react'; | |
// state with render() | |
class Header extends React.Component { | |
name = 'name in the class' | |
render() { |
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 clone --bare {repo} .git | |
$ git config --bool core.bare false | |
$ git reset --hard | |
$ git branch |
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 dog = () => { | |
const sound = 'woof' | |
return { | |
talk: () => console.log(sound); | |
} | |
} | |
const bark = dog() | |
bark.talk() |