Skip to content

Instantly share code, notes, and snippets.

View ibayazit's full-sized avatar
🎯
Focusing

İbrahim Bayazit ibayazit

🎯
Focusing
View GitHub Profile
@ibayazit
ibayazit / light-dark.txt
Created September 4, 2021 15:28
Light/Dark Mode
CSS :
@media (prefers-dark-interface) {
color: white; background: black
}
JS :
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
// dark mode
}
@ibayazit
ibayazit / card-numbers.txt
Created September 4, 2021 15:34
Card number regexes
visa
4[0-9]{12}(?:[0-9]{3})?
mastercard
^5[1-5][0-9]{14}
american express
^3[47][0-9]{13}
diners club
^3(?:0[0-5]|[68][0-9])[0-9]{11}
discover
^6(?:011|5[0-9]{2})[0-9]{12}
@ibayazit
ibayazit / currency-format.js
Created September 4, 2021 15:43
JS Currency format
const number = 123456.789;
console.log(new Intl.NumberFormat('tr-TR', { style: 'currency', currency: 'TRY' }).format(number));
// expected output: "₺123.456,79"
// the Japanese yen doesn't use a minor unit
console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
// expected output: "¥123,457"
// limit to three significant digits
@ibayazit
ibayazit / php_version
Last active November 7, 2021 12:35
Switching php versions on macOs
- List php versions
brew list | grep php
- Installing wanted php version
brew install php@7.4
- Linking wanted php version
brew unlink php
brew link php@7.4 --force
@ibayazit
ibayazit / Laravel custom notification channel
Created July 27, 2022 10:03
Laravel custom notification channel. Example sms notification
#channel -------------------
<?php
namespace App\Channels;
use Illuminate\Notifications\Notification;
class SmsChannel
{
public function send($notifiable, Notification $notification)

Project structure

  • app.js
  • routes/route.js
  • layouts/Default.vue
  • components
    • Home.vue
    • About.vue

App.js

@ibayazit
ibayazit / Procfile
Created October 3, 2022 10:46
Bitbucker Deploy to Heroku
web: vendor/bin/heroku-php-apache2 public/
@ibayazit
ibayazit / migration-users.php
Created October 7, 2022 08:44
Laravel uuid migration.
<?php
...
use Illuminate\Database\Query\Expression;
...
return new class extends Migration
{
/**
* Run the migrations.
@ibayazit
ibayazit / migration-users.php
Created October 7, 2022 08:45
Laravel uuid migration. pros and cons : With this way you can create UUID easily but the created user model doesn't return UUID or i couldn't find a way
<?php
...
use Illuminate\Database\Query\Expression;
...
return new class extends Migration
{
/**
* Run the migrations.
@ibayazit
ibayazit / mongo-export-import.md
Created November 15, 2022 08:47
Mongodb exporting a database with all collections and importing

Export

mongodump -d DATABASENAME -o EXPORTDIR

Import

mongorestore --uri CONNECTIONSTRONG -d NEWDATABASENAME EXPORTEDDIR