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 data = [ | |
{ | |
id: 1, | |
name: 'test', | |
category: 'Kitchen' | |
}, | |
{ | |
id: 2, | |
name: 'Bacon', | |
category: 'Fork' |
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 'babel-polyfill' | |
//dont forget to import babel-polyfill for this Set | |
[... new Set(this.props.data.map(e => e.gender))] |
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
_onClickHandler: function _onClickHandler() { | |
console.log('State before (_onClickHandler): ' + JSON.stringify(this.state)); | |
this.setState({ | |
dollars: this.state.dollars + 10 | |
}, () => { | |
console.log('Here state will always be updated to latest version!'); | |
console.log('State after (_onClickHandler): ' + JSON.stringify(this.state)); | |
}); | |
} |
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 path = require('path'); | |
module.exports = { | |
entry: './assets/js/dev/index.js', | |
output: { | |
filename: 'bundle.js', | |
// __dirname is a function that npm itself have in the library | |
path: path.resolve(__dirname, './assets/js/dist') | |
}, | |
module: { |
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 path = require('path'); | |
const webpack = require('webpack') | |
const HtmlWebpackPlugin = require('html-webpack-plugin') | |
const pug = { | |
test: /\.pug$/, | |
use: [ | |
'html-loader?attrs=false', | |
'pug-html-loader' | |
] |
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
//npm install --save-dev simple-autoreload-server | |
var launcher = require('simple-autoreload-server'); | |
var server = launcher({ | |
port: 8008, | |
path: './dist/html/', | |
}); | |
module.exports = server; |
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 pOC = [ | |
{ | |
fullName: '', | |
type: { | |
name: '' | |
}, | |
email: '', | |
mobileNo: '', | |
officeNo: '', | |
}, |
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 makeChange = function(amount) { | |
var change = [], | |
total = 0; | |
[25, 10, 5, 1].forEach(function(coin) { | |
while (total + coin <= amount) { | |
change.push(coin); | |
total += coin; | |
} | |
}); | |
return change; |
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
<?php | |
function kembalian($jumlah){ | |
$kembali = []; | |
$total = 0; | |
$obj = array( | |
[ | |
'name' => 'G2', | |
'val' => 200, | |
], | |
[ |
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 nFormatter(num, digits) { | |
var si = [ | |
{ value: 1, symbol: "" }, | |
{ value: 1E3, symbol: "K" }, | |
{ value: 1E6, symbol: "M" }, | |
{ value: 1E9, symbol: "G" }, | |
{ value: 1E12, symbol: "T" }, | |
{ value: 1E15, symbol: "P" }, | |
{ value: 1E18, symbol: "E" } | |
]; |
OlderNewer