title | subtitle | author | date | source |
---|---|---|---|---|
npm vs Yarn Command Translation Cheat Sheet |
CLI commands comparison |
yarn |
February 15, 2020 |
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
<?php | |
class Html | |
{ | |
const REL_STYLESHEET = 'stylesheet'; | |
const REL_PRELOAD = 'preload'; | |
/** | |
* style css link tagı return eder. | |
*/ |
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
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 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
#!/usr/bin/env bash | |
# 'Wi-Fi' or 'Ethernet' or 'Display Ethernet' | |
INTERFACE=Wi-Fi | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & |
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
if ($request_uri ~ "^(\/)index\.php$") { | |
return 302 $1; | |
} | |
if ($request_uri ~ "^(\/)index\.php\?(.*)") { | |
return 302 $1?$2; | |
} | |
if ($request_uri ~ "^(\/)index\.php\/(.*)") { | |
return 302 $1$2; |
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
// 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 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
function roundNumber(num, precision = 0) { | |
let decimalPlace = Math.pow(10, precision); | |
return Math.round((num + Number.EPSILON) * decimalPlace) / decimalPlace; | |
} |
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
function clearAllValues(data, byTypeOf = false) { | |
let clearValuesTypeOf = { | |
boolean: false, | |
number: 0, | |
string: '', | |
} | |
// clear array if data is array | |
if (Array.isArray(data)) { |
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
// 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(',', '.')); | |
}); |
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
// Export database in gzip form | |
mysqldump -u user -p database | gzip > database.sql.gz | |
// Import database from gzip form | |
gunzip < database.sql.gz | mysql -u user -p database |