Skip to content

Instantly share code, notes, and snippets.

View iswanj's full-sized avatar
:octocat:
I may be slow to respond.

Tuan Iswan (TIJ) iswanj

:octocat:
I may be slow to respond.
View GitHub Profile
@iswanj
iswanj / UserList.js
Last active January 14, 2016 08:19
Handling Permissions
import React from 'react';
import { isPremited } from './premission'; // custom module
class UserList extends React.Component {
renderEdit() {
let { roles } = this.props;
if(!isPremited(roles, 'EDIT_USER')) return null;
return (
@iswanj
iswanj / CreateGroup.js
Created January 25, 2016 06:19
Create Group submit function
class CreateGroup extends React.Component {
render() {
....
<Field meta={meta} name={'username'} ref={'username'} value={this.state['username']} onChange={onFieldChange}/>
<Field meta={meta} name={'password'} ref={'password'} value={this.state['password']} type="password" onChange={onFieldChange}/>
<Field meta={meta} type="text" name={'fullname'} ref={'fullname'} value={this.state['fullname']} onChange={onFieldChange}/>
<Field type="select" meta={meta} name={'role'} ref={'role'} value={this.state['role']} onChange={onFieldChange}/>
}
createGroup() {
@iswanj
iswanj / Button.js
Last active March 24, 2016 06:29
Reactjs import/export component (ES6)
import React from 'react';
class Button extends React.Component {
render() {
const { label, onClick } = this.props;
return(
<div>
<button onClick={onClick}>{label}</button>
</div>
);
@iswanj
iswanj / attendance.js
Last active April 13, 2018 02:37
Database structure for sherminator 3.0
{
"attendance": {
"id": "454354sgs554s5z558z6z13",
"type": "in",
"date": "2018/03/15",
"time": "07:00",
"status": "approved", // ["pending", "approved", "rejected"]
"employee": "890s0fd900g9f7gga0ag0a80b"
}
}
@iswanj
iswanj / compose.js
Created May 29, 2018 17:22
Composing Functions
function increment(x) { return x + 1; }
function decrement(x) { return x - 1; }
function double(x) { return x * 2; }
function half(x) { return x / 2; }
function compose(...fns) {
return pipe(...fns.reverse());
}
function pipe(...fns) {
return function(input) {
@iswanj
iswanj / core.js
Last active June 11, 2018 06:42
Remove language specification from data
/**
const data = {
firstName_en: "Iswan",
lastName_en: "Jumat",
age: 30
}
*
const exprectedData = {
firstName: "Iswan",
lastName: "Jumat",
@iswanj
iswanj / SketchSystems.spec
Created June 17, 2018 10:32
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
@iswanj
iswanj / Access.js
Created August 29, 2018 05:17
Permission handle
import React from "react";
const isPremited = (roles, type) => {
// premission check logic
return ...;
}
export default () => {
let { roles, permissionId, children } = this.props;
@iswanj
iswanj / bug.md
Created May 18, 2019 21:12
[Sample Bug] The price mentioned on the pricing page is not correct

Issue description

The price mentioned on the pricing page is not correct

Steps to reproduce the issue

  1. Log in to the system
  2. Go to the pricing page
  3. Click more details button

What's the expected result?

  • The Price for the basic plan should be $43
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.main {
position: relative;
width: 440px;