Skip to content

Instantly share code, notes, and snippets.

View mavisland's full-sized avatar
🤯
overthinking kills your happiness

Tanju Yıldız mavisland

🤯
overthinking kills your happiness
View GitHub Profile

lower(http.user_agent) contains "semrushbot" or lower(http.user_agent) contains "ahrefsbot" or lower(http.user_agent) contains "dotbot" or lower(http.user_agent) contains "whatcms" or lower(http.user_agent) contains "rogerbot" or lower(http.user_agent) contains "blexbot" or lower(http.user_agent) contains "linkfluence" or lower(http.user_agent) contains "mj12bot" or lower(http.user_agent) contains "aspiegelbot" or lower(http.user_agent) contains "domainstatsbot"

<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*
@mavisland
mavisland / main.js
Created June 24, 2020 13:35
Bootstrap 4 Remove Dropdown Attribute
if ($(window).width() > 992) {
$(".navbar .dropdown-toggle").removeAttr("data-toggle");
} else {
$(".navbar .dropdown-toggle").attr("data-toggle", "dropdown");
}
@mavisland
mavisland / php-style-guide.md
Created May 25, 2020 00:27 — forked from ryansechrest/php-style-guide.md
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@mavisland
mavisland / download.rb
Created May 11, 2019 22:59
Download Images with Ruby
#!/usr/bin/ruby
urls = [
'http://path.to/image/url',
'http://path.to/image/url'
]
require 'open-uri'
def download_image(url, dest)
{
"always_prompt_for_file_reload": true,
"auto_complete_commit_on_tab": true,
"auto_complete_selector": "source, text",
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
@mavisland
mavisland / index.html
Created February 2, 2018 06:25
Preloader
<div class="preloader">
<div class="preloader-wrapper">
<span></span>
<span></span>
<span></span>
</div>
</div>
@mavisland
mavisland / remove-default-widgets.php
Created December 15, 2017 10:03
Removes unused default Wordpress widgets.
<?php
/**
* Removes unused default Wordpress widgets.
*/
function unregister_default_widgets() {
unregister_widget( 'WP_Nav_Menu_Widget' );
unregister_widget( 'WP_Widget_Archives' );
unregister_widget( 'WP_Widget_Calendar' );
unregister_widget( 'WP_Widget_Categories' );
@mavisland
mavisland / temel_linux_komutlari.sh
Created November 2, 2017 03:31
Temel Linux Komutları
# Kullanıcıyı www-data grubuna tanımlamak.
sudo usermod -a -G www-data $USER
# Dizin sahipliğini değiştirmek
sudo chown -R root:www-data /var/www
# Yazma izni vermek
sudo chmod -R g+w /var/www/
# Dizinlerin kullanıcı ve gruplarını görüntülemek
$ cd ~/Sites/wordpress/ to get you in your working folder
$ wp core download - Downloads the latest wp to that folder
$ wp core config --dbname="wp-experiment" --dbuser="whatevs" --dbpass="shhh" --dbhost="127.0.0.1" --skip-check - creates your wp-config.php file for you.
$ wp db create - creates the db for you using the deets you entered into your wp-config.php file.
$ wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.com - does the wp install in seconds.
You now have a running wordpress site! The cooler thing about the wp cli is that your average maintenance becomes a lot quicker.
$ wp core update - updates your wordpress installation
$ wp plugin update - updates all your plugins
$ wp plugin install bbpress --activate - install & activate a plugin