Skip to content

Instantly share code, notes, and snippets.

View afrijaldz's full-sized avatar
:octocat:
Focusing

Afrijal Dzuhri afrijaldz

:octocat:
Focusing
View GitHub Profile
@afrijaldz
afrijaldz / space_every_4_chars.js
Created August 1, 2020 14:33
give space at every 4 characters
const bankAccount = '111122223333444455556666'
const result = [...bankAccount].map((accountNumber, i) => (i) % 4 == 0 ? ' ' + accountNumber : accountNumber).join('').trim()
console.log(result)
@afrijaldz
afrijaldz / dateFormat.js
Created June 10, 2020 02:36
format date to yyyy-mm-dd
formatDate(date) {
let d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;
return [year, month, day].join('-');
@afrijaldz
afrijaldz / script.js
Created June 3, 2020 06:54
Detect if window browser scrolled to bottom
if (window.innerHeight + window.pageYOffset >= document.body.scrollHeight) {
// you're at the bottom of the page
console.log('wes nak ngesor')
}
@afrijaldz
afrijaldz / payment.js
Created May 11, 2020 06:42
handle snap pay midtrans in reactjs react hooks
import React, { useState, useEffect } from 'react';
function Payment(props) {
const [snap, setSnap] = useState(null);
useEffect(() => {
initSnap();
}, []);
@afrijaldz
afrijaldz / filter_array_by_array.js
Created May 9, 2020 13:12
filter array by array javascript
const cars = [
{
id: 1,
price: 5
},
{
id: 2,
price: 10
},
{
@afrijaldz
afrijaldz / style.css
Created April 21, 2020 05:43
hiding element with antd by @rcherem
.visible-xs,
.visible-sm,
.visible-md,
.visible-lg {
display: none !important;
}
@media (max-width: 48em) {
.visible-xs { display: block !important; }
.row.visible-xs { display: flex !important;
display: -webkit-flex !important;
@afrijaldz
afrijaldz / latihan.php
Last active June 21, 2019 08:16
materi kuliah pengembangan konten web latihan membuat form
<!DOCTYPE html>
<html lang="en" class="has-navbar-fixed-top">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PT. Makmur</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css" />
</head>
<body>
@afrijaldz
afrijaldz / .zshrc
Last active September 18, 2018 17:01
my zsh configuration
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/ijul/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@afrijaldz
afrijaldz / Rupiah.as
Created August 26, 2018 10:56 — forked from faisalman/Rupiah.as
Konversi Angka ke format Rupiah & vice versa (C#, PHP, JavaScript, ActionScript 3.0)
package
{
/**
* ActionScript 3.0 Code Snippet
* Convert Number to Rupiah & vice versa
* https://gist.github.com/845309
*
* Copyright 2011-2012, Faisalman
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
@afrijaldz
afrijaldz / modern_js.md
Created August 25, 2018 05:24 — forked from gaearon/modern_js.md
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav