Skip to content

Instantly share code, notes, and snippets.

View webowodev's full-sized avatar
🏠
Working from home

Dimas Wibowo webowodev

🏠
Working from home
View GitHub Profile
@webowodev
webowodev / backButton.tsx
Last active May 8, 2025 01:09
NextJS Route History Provider to prevent user go outside our app when navigate back
// your back button component
// components/backButton.tsx
'use client';
import { ArrowLeft } from "@phosphor-icons/react";
import { Button } from "./ui/button";
import useRouteHistory from "@/hooks/use-route-history";
import { useRouter } from "next/navigation";
@webowodev
webowodev / laravel_encryption.py
Created March 30, 2023 18:13
Python laravel encryption
from Crypto import Random
from Crypto.Cipher import AES
import base64
import json
from phpserialize import unserialize, dumps
import hmac
import hashlib
class LaravelEncryption:
require('dotenv').config()
const express = require('express')
const fetch = require('node-fetch')
const app = express()
app.use('/', async (req, res) => {
// Attachment URL
const attachmentURL = "https://trello.com/1/cards/5e65954f0f343116e999658f/attachments/5e67a146876719748d64057b/previews/5e67a147876719748d6405ae/download"
@webowodev
webowodev / generate-env.sh
Last active July 4, 2022 15:50
Bash generate .env file from vault
if [ -z "$TOKEN" ]; then
echo "Token not provided!"
else
if [ -z "$API_URL" ]; then
echo "Missing the API url, I don't know where the env is :/"
else
echo "Getting environment variable from $API_URL"
if [ -z "$OUTPUT" ]; then
# set default output name
-- grant permissions to the role
GRANT SELECT,INSERT,UPDATE,DELETE ON my_db_name.* TO qateam;
-- getting a list of roles
SELECT * FROM information_schema.APPLICABLE_ROLES;
-- Creating a new role
CREATE OR REPLACE ROLE qateam;
@webowodev
webowodev / assignRoleToUser.sql
Last active June 12, 2022 09:24
MariaDB ACL
-- first, we need to grant user to access qateam role
GRANT qateam TO tester@'%';
-- then we assign it
SET ROLE qateam;
-- check if role access already granted to related user
SHOW GRANTS for tester@'%';
@webowodev
webowodev / Invoice.php
Last active October 1, 2019 04:19
Group Count Invoices
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Invoice extends Model
{
public function bulan ()
{
@webowodev
webowodev / app - build.gradle
Last active May 22, 2019 10:59
My React Native Initial Setup for Every Projects
// android/app/build.gradle
android {
...
defaultConfig {
...
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
}
// setup keystore for release