Skip to content

Instantly share code, notes, and snippets.

View bwonur's full-sized avatar
☂️
I may be slow to respond.

bwonur

☂️
I may be slow to respond.
View GitHub Profile
@bwonur
bwonur / htaccess.expires.headers.htaccess
Last active July 18, 2019 10:51 — forked from solancer/htaccess.expires.headers
htaccess expires headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
@bwonur
bwonur / meta-tags.md
Created July 22, 2019 11:37 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
.monte-carlo-bg{
background: #CC95C0; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #7AA1D2, #DBD4B4, #CC95C0); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #7AA1D2, #DBD4B4, #CC95C0); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
@bwonur
bwonur / Revert sublime text 3 to a fresh state.md
Created July 31, 2019 15:02 — forked from math2001/Revert sublime text 3 to a fresh state.md
Revert Sublime Text 3 to a fresh state step by step 🙂

How do I revert Sublime Text 3 to a fresh state

This little gist will walk you through the process of reverting your Sublime Text installation to a fresh state.

This simply means to get Sublime Text to exactly as it was by default.

Hum... Will I lose all my setup?

No. You can go back to how you were really easily, and it's explained at the bottom. 😉

@bwonur
bwonur / whois.php
Created August 6, 2019 10:38
PHP code to get WHOIS information of a domain
<?php
/*************************************************************************
php easy :: whois lookup script
==========================================================================
Author: php easy code, www.phpeasycode.com
Web Site: http://www.phpeasycode.com
Contact: [email protected]
*************************************************************************/
$domain = $_GET['domain'];
@bwonur
bwonur / wp_rewrite_rules.log
Created August 28, 2019 10:45 — forked from thenbrent/wp_rewrite_rules.log
Default WordPress Rewrite Rules
[rules] => Array (
[category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[category/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[category/(.+?)/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&paged=$matches[2]
[category/(.+?)/?$] => index.php?category_name=$matches[1]
[tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
[tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
[tag/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tag=$matches[1]&paged=$matches[2]
[tag/([^/]+)/?$] => index.php?tag=$matches[1]
[type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]
@bwonur
bwonur / gist:987ed676b28c037019d603e2483b10cc
Created August 29, 2019 07:01 — forked from danielbachhuber/gist:8af274e2b7f21c8c3bb6
Post-style permalinks for your custom post types
<?php
/**
* Post-style permalinks for your custom post types
* e.g. %year%/%monthnum%/%day%/%postname%
*/
function dbx_get_post_types() {
return array(
// replace with your custom post types
'my-custom-post-type'
);
@bwonur
bwonur / wp-custom-table.md
Created November 20, 2019 06:02 — forked from ionurboz/wp-custom-table.md
WordPress ADD CUSTOM TABLE + INSERT DATA + GET DATA

Creating or Updating the Table

The next step is to actually create the database table. Rather than executing an SQL query directly, we'll use the dbDelta function in wp-admin/includes/upgrade.php (we'll have to load this file, as it is not loaded by default). The dbDelta function examines the current table structure, compares it to the desired table structure, and either adds or modifies the table as necessary, so it can be very handy for updates (see wp-admin/upgrade-schema.php for more examples of how to use dbDelta). Note that the dbDelta function is rather picky, however. For instance:

  • You must put each field on its own line in your SQL statement.
  • You must have two spaces between the words PRIMARY KEY and the definition of your primary key.
  • You must use the key word KEY rather than its synonym INDEX and you must include at least one KEY.
  • KEY must be followed by a SINGLE SPACE then the key name then a space then open parenthesis with the field name then a closed parenthesis.
  • You must not use a
@bwonur
bwonur / upload-a-file.MD
Created December 12, 2019 14:22 — forked from ahmadawais/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@bwonur
bwonur / fa-icons-list.txt
Created January 22, 2020 14:39 — forked from antoineMoPa/fa-icons-list.txt
Font-Awesome Icons List for version 4.3.0
fa-glass
fa-music
fa-search
fa-envelope-o
fa-heart
fa-star
fa-star-o
fa-user
fa-film
fa-th-large