Skip to content

Instantly share code, notes, and snippets.

View dhimasanb's full-sized avatar
🎯
Focusing

Dhimas Akbar Noor Baihaque dhimasanb

🎯
Focusing
View GitHub Profile
/* global describe, it, expect, beforeEach :true */
import React from "react";
import { shallow, configure } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import Home from "../scenes/Home";
configure({ adapter: new Adapter() });
describe("Home Scene", () => {
const wrapper = shallow(<Home />);
@dhimasanb
dhimasanb / helpers.js
Created June 25, 2019 16:47
Util helpers
// Check if there are ',' & '.' in a input and after ',' is not 00
function checkSeparator(amount) {
if (amount.indexOf(",") > -1 || amount.indexOf(" ") > -1) {
if (amount.split(",")[1] !== "00") {
throw new Error("Invalid separator!");
}
}
}
// Check Rp is wrong position
@dhimasanb
dhimasanb / app.js
Created June 25, 2019 16:43
Scene App.js
import React from "react";
import { Layout, Icon } from "antd";
import Home from "./Home";
import "./App.css";
const App = () => {
return (
<Layout className="app">
<Layout.Content>
<div className="box">
@dhimasanb
dhimasanb / index.js
Created June 25, 2019 16:40
Home index.js
import React, { Component } from "react";
import { Input, Button, Typography, Row, Col, message } from "antd";
import TableResult from "./components/TableResult";
import { validationAmount } from "../../utils/helpers";
import { fractions } from "../../config/fractions";
class Home extends Component {
state = {
amount: "",
amountLeft: null,
@dhimasanb
dhimasanb / index.js
Created June 25, 2019 16:36
Table Result Index.js
import React from "react";
import PropTypes from "prop-types";
import { convertToRupiah } from "../../../../utils/helpers";
import DataTable from "./components/dataTable";
import AmountLeftTable from "./components/amountLeftTable";
import "./index.css";
const TableResult = ({ data, amountLeft }) => {
// Result data fractions
const dataSource = [];
import React from "react";
import { Table } from "antd";
import column from "./column";
const dataTable = ({ dataSource }) => {
return (
<Table
pagination={false}
dataSource={dataSource}
// Column table
export default function column(title, dataIndex, width, render) {
return {
title,
dataIndex,
key: dataIndex,
width,
render
};
}
import React from "react";
import { Table } from "antd";
import { convertToRupiah } from "../../../../../utils/helpers";
import column from "./column";
const amountLeftTable = ({ amountLeft }) => {
return (
<Table
showHeader={false}
@dhimasanb
dhimasanb / muach.php
Created February 14, 2018 16:23
Cari 3 Level yg sama
// Koneksi.php
<?php
class Koneksi {
private $SERVER = "localhost";
private $DATABASE = "contoh_test";
private $USERNAME = "root";
private $PASSWORD = "";
private $koneksi;
public function __construct() {
@dhimasanb
dhimasanb / Vagrantfile
Created July 15, 2017 06:09
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at