Skip to content

Instantly share code, notes, and snippets.

View kovkor's full-sized avatar

Kornel Kovacs kovkor

View GitHub Profile
@kovkor
kovkor / envbackup.sh
Created October 3, 2024 16:52
Backup .env files recursively and keep for 30 days
#!/bin/bash
# crontab for daily backup
# 0 3 * * * /home/user/envbackup.sh >> /home/user/backup/backup.log 2>&1
# Backup destination
BACKUP_DIR="/home/user/backup"
# Work directory
@kovkor
kovkor / TelepulesekSeeder.php
Created June 21, 2024 14:01
Magyarországi települések Laravel seeder fájlban
<?php
use Illuminate\Database\Seeder;
class TelepulesekSeeder extends Seeder
{
public function run()
{
DB::table('telepulesek')->insert([
['telepules' => 'Abádszalók', 'megye' => 'Jász-Nagykun-Szolnok'],
@kovkor
kovkor / removeEmoji.php
Created April 7, 2019 19:02
Remove emojis from string but allow all other characters
<?php
function removeEmoji($string) {
return mb_ereg_replace('[^\p{L}\p{N}\p{P}\p{Z}\r\n\<\>]','',$string);
}
?>

Keybase proof

I hereby claim:

  • I am kovkor on github.
  • I am kovkor (https://keybase.io/kovkor) on keybase.
  • I have a public key ASBnMngIyaveo-cqCDIs1uv-ZjFo0tpgVeOBJYB7O08LvQo

To claim this, I am signing this object:

@kovkor
kovkor / mysql-country-list.sql
Created June 19, 2018 14:39
Country list in MySQL dump file
CREATE TABLE `countries` (
`id` int(11) NOT NULL auto_increment,
`country_code` varchar(2) NOT NULL default '',
`country_name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `countries` VALUES (null, 'AF', 'Afghanistan');
INSERT INTO `countries` VALUES (null, 'AL', 'Albania');
INSERT INTO `countries` VALUES (null, 'DZ', 'Algeria');
INSERT INTO `countries` VALUES (null, 'DS', 'American Samoa');
@kovkor
kovkor / url-parser-for-search.js
Created December 3, 2017 17:28
URL feldolgozása pl. kereséshez. A / jellel elválasztott url-ben megkeresi a kulcsszavakat, majd a mögöttök található keresőszavakat tömbbe rendezi.
var keresoszavak = ['kategoria','helyiseg'];
function prepareSearch() {
let searchwords = [];
let uri = window.location.pathname;
let uritemp = uri.split('/');
let db = uritemp.length;
for (i=1;i<db;i++) {
if (uritemp[i]) {
if ($.inArray(uritemp[i],keresoszavak)>-1) {
@kovkor
kovkor / AppServiceProvider.php
Created October 31, 2017 14:02
Hack for Laravel 5.4 on MySQL 5.6.x (app/Providers/AppServiceProvider.php)
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**

Keybase proof

I hereby claim:

  • I am kovkor on github.
  • I am kovkor (https://keybase.io/kovkor) on keybase.
  • I have a public key ASAckSElKv2UaQDBVeQ9nTtr0BKDvntjdsDCwsjnfE1PIAo

To claim this, I am signing this object: