Skip to content

Instantly share code, notes, and snippets.

@ejabu
ejabu / OtpModal.jsx
Last active April 26, 2021 03:24
Apollo Otp Timer
const OtpModal = ({ modal, toggle, phoneNumber = '', successCb }) => {
const [otp, setOtp] = useState('');
const [timer, setTimer] = useState(10);
const [hasResendOtp, setHasResendOtp] = useState(false);
const [errorMessage, setErrorMessage] = useState('');
useEffect(() => {
const interval = setInterval(() => {
setTimer((timer) => {
if (timer === 1 || timer === 0) {

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@ejabu
ejabu / good-theme-vscode.md
Created February 22, 2021 11:44
Github Light Theme Setup
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
@ejabu
ejabu / .htaccess
Last active July 25, 2020 18:01
HT Access Apache
GNU nano 4.8 /var/www/html/dist/.htaccess
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]
@ejabu
ejabu / cadastro_controller.dart
Created July 22, 2020 04:21
lib/app/modules/cadastro/cadastro_controller.dart
telefoneValidateOld(value) =>
value.length < 11 ? 'Insíra um número válido' : null;
telefoneValidate(String value) {
if (value.isNotEmpty) {
return value.length < 11 ? 'Insíra um número válido' : null;
}
return null;
}
@ejabu
ejabu / Halaman Ecommerce render XML template
Last active July 1, 2020 04:26
Override Controller Odoo
from odoo import http
from odoo.addons.http_routing.models.ir_http import unslug
from odoo.http import request
from odoo.addons.web import Home
class EcommercePage(Home):
@http.route(['/'], type='http', auth="public", website=True)
def halaman_page(self, **post):
barang_ids = request.env['barang.dagang'].sudo().search([])
@ejabu
ejabu / command
Created June 21, 2020 05:20
Setup Firewall Centos
# Type this on your Terminal CLI
# Refer to this link to understand below rules: https://wiki.centos.org/HowTos/Network/IPTables
# Set default input policy to ACCEPT
iptables -P INPUT ACCEPT
# Flush all current rules!
iptables -F
function sideBar() {
return (
<div>
<ul>
<li><a href="https://github.com/">Dashboard</a></li>
<li><a href="https://github.com/">Produk</a></li>
<li><a href="#">Penjualan</a></li>
<li><a href="#">Kontak</a></li>
<li><a href="https://github.com/">Integrasi</a></li>
</ul>
@ejabu
ejabu / regex.js
Created May 25, 2020 12:47
REGEX BUAT FRONTMATTER
^(---(?:\r?\n(?!--|\s*$).*)*)\s*((?:\r?\n(?!---).*)*\r?\n---)