Skip to content

Instantly share code, notes, and snippets.

View binsarjr's full-sized avatar
👋
KNTL (Keep Never Tired Learning)

Binsar Dwi Jasuma binsarjr

👋
KNTL (Keep Never Tired Learning)
View GitHub Profile
<?php
if (@isset($_REQUEST['api'])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Credentials: true');
session_start();
error_reporting(0);
@set_time_limit(0);
@binsarjr
binsarjr / Cleanup.md
Last active January 21, 2025 15:08
This program is a Bash script designed to efficiently clean up specific directories in a project, such as node_modules and vendor folders, while providing real-time feedback through a loading animation.

Program Description

The script automates the process of cleaning up development-related directories, improving workspace organization and freeing up disk space. It supports the following features:

  1. Directory Scanning:

    • Scans a specified directory (or the current directory if no argument is provided) for node_modules and vendor folders.
  2. Selective Deletion:

    • node_modules: Removes all node_modules directories recursively within the specified path.
  • vendor: Removes vendor directories only if a composer.json file exists in the same level, ensuring it's part of a valid PHP project.
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Arisan {
address public owner;
address[] public members;
address public winner;
uint256 public balance;
mapping(address => bool) public isMember;
@binsarjr
binsarjr / .gitignore
Created May 31, 2024 09:37
common gitignore
# Nodejs
node_modules
# Laravel
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.phpunit.result.cache
const headlessDetected = () => {
alert("Automation detected")
}
// Test for user agent
function testUserAgent() {
const userAgent = ['phantomjs', 'Headless']
let agent = navigator.userAgent;

Auto target blank when difference host

document.addEventListener("click", function (e) {
  if (!e?.target?.href) return
  if (new URL(e.target.href).host != new URL(window.location.href).host && !e.target.hasAttribute("target")) {
    e.preventDefault();
    e.target.setAttribute("target", "_blank");
    window.open(e.target.href,'_blank')
  }
});

Dont use system("PAUSE") again

use this

system("read -p 'Press Enter to continue...' var");

.htaccess to hide directory laravel projects. Take care when you forget

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On
 RewriteRule !public [F,R=404]

I've required the same thing and i wrote a short library that works for CryptoJS 3.x and PHP with openssl support. Hope this helps, source plus example files here https://github.com/brainfoolong/cryptojs-aes-php

PHP Lib

/**
* Decrypt data from a CryptoJS json encoding string
*
* @param mixed $passphrase
* @param mixed $jsonString
* @return mixed