git rm -r --cached .
git add .
git commit -m "Re-stage all files (e.g., after updating .gitignore)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = [1,2,3,3,5,4,8,9,5,2,3,1,2,2,1,1,3,6,4,8,9,1,2,5,3,4,6,9,7,8,9] as const; | |
const uniqueArray = Array.from(new Set(array)) satisfies typeof array; | |
const uniqueArray2 = array.reduceRight<number[]>((acc, cur) => acc.includes(cur) ? acc : [cur, ...acc], []); |
default_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
git checkout $default_branch
git pull
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const converter = (text) => text.replace(/[٠-٩۰-۹]/g,a=>a.charCodeAt(0)&15); | |
console.log(converter("۳٣۶٦۵any٥۵٤۶32٠۰")); | |
// Output: "33665any55453200" | |
//[Reference](https://stackoverflow.com/a/63133882/6390834) |
In new versions of Laravel, you can create your own paginate. Source: https://laravel.com/docs/9.x/pagination
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
/**
* @param Collection $collection
* @param int $perPage
Bash function for automatic DNS activation of shecan.ir site
shecan() {
local current_dns_state=$(scutil --dns | grep "178.22.122.100" | awk '{print $3}')
if [ "$current_dns_state" != "" ]; then
echo "YOUR_PASSWORD" | sudo -S networksetup -setdnsservers Wi-Fi Empty
echo "DNS has been disabled."
else
echo "YOUR_PASSWORD" | sudo -S networksetup -setdnsservers Wi-Fi 178.22.122.100 185.51.200.2
echo "DNS has been enabled."
Bash function for automatic DNS activation of 403.online site
403() {
local current_dns_state=$(scutil --dns | grep "10.202.10.102" | awk '{print $3}')
if [ "$current_dns_state" != "" ]; then
echo "YOUR_PASSWORD" | sudo -S networksetup -setdnsservers Wi-Fi Empty
echo "DNS has been disabled."
else
echo "YOUR_PASSWORD" | sudo -S networksetup -setdnsservers Wi-Fi 10.202.10.102 10.202.10.202
echo "DNS has been enabled."