This file contains 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
public static function cleanPhoneNumber($number) | |
{ | |
return str_replace([' ', '(', ')', '-', '+', '.', '/', '_'], '', $number); | |
} | |
public static function getLast10Digits($number) | |
{ | |
return substr(self::cleanPhoneNumber($number), -10); | |
} |
This file contains 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
// function | |
function getYoutubeUrlId (url) { | |
const urlObject = new URL(url); | |
let urlOrigin = urlObject.origin; | |
let urlPath = urlObject.pathname; | |
// Örneğin url https://youtu.be/V-uynt7UXXI ise | |
if (urlOrigin.search('youtu.be') > -1) { | |
// substr yapma sebebimiz, youtube kısaltma linklerinde id path'de olur ve pathname başında "/" olur. | |
// Örneğin "/V-uynt7UXXI" ise "V-uynt7UXXI" return eder. |
This file contains 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
function updateQueryStringParam(key, value) { | |
let baseUrl = [location.protocol, '//', location.host, location.pathname].join(''), | |
urlQueryString = document.location.search, | |
newParam = key + '=' + value, | |
params = '?' + newParam; | |
// If the "search" string exists, then build params from it | |
if (urlQueryString) { | |
let updateRegex = new RegExp('([\?&])' + key + '[^&]*'); | |
let removeRegex = new RegExp('([\?&])' + key + '=[^&;]+[&;]?'); |
This file contains 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
# https://newbedev.com/exporting-data-from-mysql-docker-container | |
# delete first line from dump.sql file | |
docker-compose exec db mysqldump -u root -proot wordpress > dump.sql |
This file contains 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
php-switch () { | |
local phpVersion="$1" | |
sudo update-alternatives --set php /usr/bin/php"$1" > /dev/null | |
} |
This file contains 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
version: '3' | |
services: | |
mssql-server-linux: | |
image: microsoft/mssql-server-linux:latest | |
volumes: | |
- mssql-server-linux-data:/var/opt/mssql/data | |
environment: | |
- ACCEPT_EULA=Y | |
- SA_PASSWORD=${SQLSERVER_SA_PASSWORD:-yourStrong(!)Password} |
This file contains 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
/** | |
birinci parametrede array alıyoruz ve array içerisinde string, integer tipinde veriler var | |
ve bunun içindeki bazı veri kümsenin sırasını önceliklendirmek istiyoruz. | |
Hangi veri kümsenin önceliklendirileceğini de ikinci parametrede alıyoruz. | |
İkinci parametre de array olacak. birebir birinci parametreyle aynı özelliklere sahip olacak. | |
ikinci parametrede array içerisindeki veriler, birinci parametredekiler verilerde birebir match arayarak | |
ikinci parametrenin index sıralamasına göre birebir aynı şekilde önceliklendirerek | |
birinci parametrenin sıralamasını güncelleyecek ve return edecek. |
This file contains 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
import {message} from 'antd' | |
export const errorMessage = (error: any, printErrorMessage: boolean = true) => { | |
if (!error.response) { | |
return | |
} | |
let response = error.response | |
let data = response.data | |
let statusCode = response.status | |
const defaultMessage = 'Bir şeyler ters gitti. Lütfen daha sonra tekrar dene.' |
This file contains 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
// 3. satırı baştan sona kopyalamanız gerekmektedir. Çalışır örneğini 5. satırdaki linkten görebilirsiniz. | |
/(^[0\s]?[\s]?)([(]?)([5])([0-9]{2})([)]?)([\s]?)([0-9]{3})([\s]?)([0-9]{2})([\s]?)([0-9]{2})$/g | |
// https://regexr.com/5005l |
This file contains 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
// Trendyol'da yaptığınız toplam harcamayı hesaplar. | |
// https://www.trendyol.com/hesabim/siparislerim sayfasına gidin. | |
// Tüm siparişleri listeleyin. | |
// Console'da function'ı çağırın. => calculateTotalPrice(); | |
function calculateTotalPrice() { | |
let totalPrice = 0; | |
let prices = document.querySelectorAll('#orders-container .order .order-header .order-header-info:nth-child(4) b').forEach(function(item, index) { | |
totalPrice += parseFloat(item.innerText.replace(',', '.')); | |
}); |