Skip to content

Instantly share code, notes, and snippets.

View buraksahin59's full-sized avatar
:atom:
React Native

Burak buraksahin59

:atom:
React Native
View GitHub Profile
@buraksahin59
buraksahin59 / wppb.login.php
Created November 30, 2015 21:07 — forked from abachuk/wppb.login.php
WP User Frontend Login with Email
<?php
/* wp_signon can only be executed before anything is outputed in the page because of that we're adding it to the init hook */
global $wppb_login;
$wppb_login = false;
function wppb_signon(){
global $error;
global $wppb_login;
@buraksahin59
buraksahin59 / custom_posttype_glance.php
Created December 6, 2015 01:03 — forked from feryardiant/custom_posttype_glance.php
Adding Custom post type counts in 'Right now' Dashboard widget in Wordpress 3.8 or above
<?php
/**
* Adding Custom post type counts in 'Right now' Dashboard widget.
* Acording this changes :
* - https://core.trac.wordpress.org/ticket/26571
* - https://core.trac.wordpress.org/ticket/26495
* now you can't use 'right_now_*' action API to show your custom post type count from your Dashboard.
* But if you running WP 3.8 or above, you can use 'dashboard_glance_items' instead.
*
* @package Wordpress
@buraksahin59
buraksahin59 / php-html-css-js-minifier.php
Created January 7, 2017 10:44 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
// Based on <https://github.com/mecha-cms/extend.minify>
define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\'');
define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/');
define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>');
define('MINIFY_COMMENT_JS', '//[^\n]*');
define('MINIFY_PATTERN_JS', '\b/[^\n]+?/[gimuy]*\b');
define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>');
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@buraksahin59
buraksahin59 / file.html
Last active January 4, 2019 10:39
Simple jQuery Ajax File Upload. This codes took from https://stackoverflow.com/questions/2320069/jquery-ajax-file-upload
<input type="file" name="upload_photo_m" id="upload_photo_m" />
<div id="progress-wrp">
<div class="progress-bar"></div>
<div class="status">0%</div>
</div>
@buraksahin59
buraksahin59 / jQuery sort JSON by value
Created January 7, 2019 16:55 — forked from boy3vil/jQuery sort JSON by value
jQuery sort JSON by value
<script type="text/javascript">
var arr = [
{ "ID": 135, "Name": "Fargo Chan", "Address": "34, Baker Street" },
{ "ID": 432, "Name": "Aaron Luke", "Address": "BLDG 1, J Street" },
{ "ID": 252, "Name": "Dilip Singh", "Address": "Hotel J, SE" }
];
// Before Sorting
document.write("<b>Before Sorting </b><br/>");
for (var n = 0; n < arr.length; n++) {
// Run below code to change permission of htdocs's sub folders
chmod -R 777 /Applications/XAMPP/htdocs/
@buraksahin59
buraksahin59 / bootstrap-alert.css
Created January 14, 2019 15:12
Bootstrap 4 Only Alert Boxes
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert h4 {
margin-top: 0;
color: inherit;
}
@buraksahin59
buraksahin59 / enable-ssl-on-localhost.md
Last active July 9, 2020 22:27
Localhost SSL Certificate on Mac OS Sierra, High Sierra and Catalina
Sources: 
- https://getgrav.org/blog/macos-catalina-apache-ssl
- https://gist.github.com/ethicka/27c36c975a5c2cbbd1874bc78bab61c4

STEP 1: Enable SSL Module

It is often important to be able to test your local site setup under SSL (e.g. https://yoursite.com). There are a few steps that are needed to accomplish this with your Homebrew-based Apache setup. The first step is to make some modifications to your httpd.conf:

@buraksahin59
buraksahin59 / generate_ssl_certificate_for_local.sh
Last active February 19, 2020 13:13
Create https keys and certificates on localhost
# Generate SSL Certificate for yoursite.local
# Using:
# $ generate_ssl 'yoursite'
function generate_ssl() {
echo 'New Local Domain: '$1'.local'
# Step 1: Generate server.key
echo 'Generate server.key'
#sudo openssl genrsa -out /usr/local/etc/httpd/server.key 2048