Skip to content

Instantly share code, notes, and snippets.

View aliemre's full-sized avatar
🎯
Focusing

Ali Emre Çakmakoğlu aliemre

🎯
Focusing
  • Webridge
  • İzmir / Türkiye
View GitHub Profile
@aliemre
aliemre / full-background.css
Last active June 20, 2022 08:26
CSS Full Background
/**
https://twitter.com/challengescss/status/1534494160589307904?s=21&t=0YATrbqVwq4M-9hhSZO2nQ
<div class="container">
<section class="about">
<h2>About us</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nesciunt, quo, rerum. Itaque iure cumque corrupti deleniti blanditiis similique, accusamus veniam placeat rerum! Est debitis quae voluptatem itaque reiciendis consequuntur earum.</p>
</section>
<section class="products">
@aliemre
aliemre / composer-self-update.sh
Created January 7, 2022 16:08
Downgrade and Rollback for Composer
# Downgrade to Composer v1.x
composer self-update --1
# Rollback to Composer v2.x
composer self-update --rollback
@aliemre
aliemre / postgresql-sync-sequence.sql
Last active September 13, 2023 13:19
PostgreSQL Sync Sequence for Duplicate Key Error
# For Single Table
SELECT setval('public."upload_file_morph_id_seq"',
(SELECT MAX(id) FROM public.upload_file_morph)
);
# For All Tables
DO $$
@aliemre
aliemre / sylius-nginx.conf
Last active August 12, 2021 14:05
Sylius Nginx Configuration with SSL
server {
root /var/www/html/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name project.com www.project.com; # managed by Certbot
location / {
@aliemre
aliemre / socket.conf
Last active February 22, 2021 13:21
Sails.js Socket configuration for Nginx 1.x
upstream sails {
ip_hash;
keepalive 64;
server 127.0.0.1:1400 max_fails=3 fail_timeout=10s;
server 127.0.0.1:1400 max_fails=3 fail_timeout=10s;
}
@aliemre
aliemre / axios-catch-error.js
Created February 13, 2021 22:21 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@aliemre
aliemre / remote-access.txt
Last active April 8, 2021 09:32
MySQL Remote Access
sudo nano /etc/my.cf
bind-address=0.0.0.0
Restart mysql service run on console:
sudo service mysqld restart
Create a user with a safe password for remote connection. To do this run following command in mysql
(if you are linux user to reach mysql console run mysql and if you set password for root run mysql -p):
@aliemre
aliemre / RedirectListener.php
Created June 2, 2020 22:19
Symfony 5: Redirect the current user to another route on HTTP Response Event
<?php
namespace App\EventListener;
use App\Entity\User;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Security;
@aliemre
aliemre / lc-all-utf8-errors.txt
Last active May 10, 2020 22:18
LC_ALL UTF-8 Error
sudo nano /etc/environment
# add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@aliemre
aliemre / grant-httpd-can-connect.sh
Created April 26, 2020 20:42
SELinux doesn't allow your httpd daemon to talk to the LDAP server on the same machine. You need to be able to authenticate against LDAP.
setsebool -P httpd_can_network_connect on