Skip to content

Instantly share code, notes, and snippets.

View serkanalgur's full-sized avatar
🇹🇷
🇦🇿 Selam / Salam / Hi!

Serkan Algur serkanalgur

🇹🇷
🇦🇿 Selam / Salam / Hi!
View GitHub Profile
@dbirks
dbirks / adminer-apache-ubuntu-16.04.md
Last active April 15, 2024 08:51
Install Adminer with Apache on Ubuntu 16.04

Adminer is in the repos, so install it with:

apt install adminer

Copy the configuration to your available configs folder and enable it.

cp /etc/adminer/apache.conf /etc/apache2/conf-available/adminer.conf
<?php
/*
This script will allow you to send a custom email from anywhere within wordpress
but using the woocommerce template so that your emails look the same.
Created by [email protected] on 27th of July 2017
Put the script below into a function or anywhere you want to send a custom email
*/
@kharakhordindemo
kharakhordindemo / form.php
Created December 22, 2017 15:21
Remove span in Contact Form 7
/*Contact form 7 remove span*/
add_filter('wpcf7_form_elements', function($content) {
$content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content);
$content = str_replace('<br />', '', $content);
return $content;
});
<?php
// this is in the `/config` folder
$app->on("collections.save.before.aktuelles", function($name, &$entry, $isUpdate) use ($app) {
// generate slug on create only or when an existing one is empty
if (!$isUpdate || ($isUpdate && trim($entry['slug']) == '')) {
// generate slug based on entry name
$slug = Str::slug($entry['name']);
@randallmlough
randallmlough / hugo-img-partial.html
Last active June 21, 2021 01:36
Complete hugo img partial using page resources
{{ $image := .Params.image}}
{{ $media := (.Site.GetPage "page" "media").Resources }}
{{ $original := index ($media.Match (printf "%s" $image)) 0 }}
{{ $width := $original.Width}}
{{ $intWidth := int $width }}
{{ $sizes := .Params.sizes}}
{{ $options := .Params.options}}
{{ if le (len $sizes) 1 }}
{{ $oneSize := index $sizes 0}}
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active July 4, 2025 06:52
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@masiur
masiur / small_hacks.md
Created July 12, 2018 08:39
laravel artisan with pm2
@bovas85
bovas85 / axios.js plugin
Last active September 16, 2023 12:46
NuxtServerInit caching mechanism
import { cacheAdapterEnhancer } from 'axios-extensions'
import LRUCache from 'lru-cache'
const ONE_HOUR = 1000 * 60 * 60
const defaultCache = new LRUCache({ maxAge: ONE_HOUR })
export default function ({ $axios }) {
const defaults = $axios.defaults
// https://github.com/kuitos/axios-extensions
defaults.adapter = cacheAdapterEnhancer(defaults.adapter, {
@taniarascia
taniarascia / php.md
Created September 23, 2018 03:36
PHP functions

PHP Functions

Display PHP errors

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//Orders
wc_get_account_endpoint_url( get_option( 'woocommerce_myaccount_orders_endpoint', 'orders' ) );
//Downloads
wc_get_account_endpoint_url( get_option( 'woocommerce_myaccount_downloads_endpoint', 'downloads' ) );
//Edit Address
wc_get_account_endpoint_url( get_option( 'woocommerce_myaccount_edit_address_endpoint', 'edit-address' ) );
//Payment Methods