Skip to content

Instantly share code, notes, and snippets.

View hayatbiralem's full-sized avatar

Ömür Yanıkoğlu hayatbiralem

View GitHub Profile
@hayatbiralem
hayatbiralem / index.php
Last active November 18, 2020 06:47
RunCloud default web app index.php to show a common maintenance page.
<?php
$app_name = $_SERVER['HTTP_HOST'];
$seo_title = $app_name;
$seo_description = 'This website is currently out of service!';
$body_message = $seo_description;
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 86400'); // 86400 seconds = 1 day
@hayatbiralem
hayatbiralem / my_default_thumbnail_id.php
Created April 22, 2020 16:09
WordPress - Set default post thumbnail id
add_filter('get_post_metadata', 'my_default_thumbnail_id', 100, 4);
function my_default_thumbnail_id($check, $post_id, $key, $single)
{
if($key == '_thumbnail_id') {
remove_filter('get_post_metadata', 'my_default_thumbnail_id', 100);
if(!has_post_thumbnail($post_id) && function_exists('get_field')) {
$check = get_field('placeholder_image', 'option');
}
add_filter('get_post_metadata', 'my_default_thumbnail_id', 100, 4);
if(!empty($check)) {
@hayatbiralem
hayatbiralem / autoplay-ultimate-addons-video-when-popup-maker-modal-opened.js
Created February 27, 2020 16:25
Autoplay Ultimate Addons Video when Popup Maker Modal Opened
(function ($) {
$(document).on('pumBeforeOpen', function (e) {
console.log('pumBeforeOpen', e);
$(e.target).find('.ultv-video__play').parent().each(function () {
if ($(this).data('default-html')) {
$(this).html($(this).data('default-html'));
} else {
$(this).data('default-html', $(this).html());
}
@hayatbiralem
hayatbiralem / responsive-is-not-ready.css
Created November 8, 2019 08:16
Responsie is not ready!
@media (max-width: 1199px) {
html[lang][class],
html[lang][class] body {
height: calc(100vh - 32px) !important;
margin: 0 !important;
padding: 0 !important;
}
html[lang][class] body * {
display: none !important;
@hayatbiralem
hayatbiralem / log-all-events.js
Last active October 30, 2019 15:42
Log all events
// Detailed source: https://css-tricks.com/capturing-all-events/
var oldAddEventListener = EventTarget.prototype.addEventListener;
var disabled = ['mousemove', 'mouseover'];
EventTarget.prototype.addEventListener = function(eventName, eventHandler)
{
if(disabled.indexOf(eventName) === -1) {
console.log(eventName, eventHandler.toString());
}
@hayatbiralem
hayatbiralem / en.json
Last active April 24, 2019 09:42
Phone Area Codes in JSON Format (EN & TR)
{
"+90": "Turkey",
"+93": "Afghanistan",
"+355": "Albania",
"+213": "Algeria",
"+1": "US Virgin Islands",
"+376": "Andorra",
"+244": "Angola",
"+54": "Argentina",
"+374": "Armenia",
@hayatbiralem
hayatbiralem / remove-empty-array-values.php
Created November 15, 2018 18:07
Remove empty arrays from nested array
<?php
$array1 = $array2 = array (
0 =>
array (
'id' => '',
'name' => '',
'description' => null,
'categories' => false,
'posts' => '',
@hayatbiralem
hayatbiralem / download.sh
Created October 5, 2018 13:01
Download website recursively with wget
#!/bin/bash
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=unix \
--domains domain.com \
@hayatbiralem
hayatbiralem / remove-default-jquery-ajax-header.js
Created June 22, 2018 07:01
Remove Default jQuery Ajax Header
$.ajax(
'https://api.github.com/search/repositories?q=' + encodeURIComponent(search),
{
// 'xhr' option overrides jQuery's default
// factory for the XMLHttpRequest object.
// Use either in global settings or individual call as shown here.
xhr: function() {
// Get new xhr object using default factory
var xhr = $.ajaxSettings.xhr();
// Copy the browser's native setRequestHeader method
server {
listen 80;
listen [::]:80;
server_name parkinson.irm.com.tr;
root /var/www/html/parkinson/public;
index index.php index.html index.htm;
location / {