Skip to content

Instantly share code, notes, and snippets.

View ionurboz's full-sized avatar

Onur ionurboz

View GitHub Profile
@ionurboz
ionurboz / whois.php
Created March 5, 2020 00:17
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: webmaster@phpeasycode.com
*************************************************************************/
$domain = $_GET['domain'];
@ionurboz
ionurboz / TR Banka Bin List
Created March 5, 2020 01:15 — forked from serkanince/TR Banka Bin List
TR Banka Bin Listesi
SET NAMES utf8;
DROP TABLE IF EXISTS `cc_bins`;
CREATE TABLE `cc_bins` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`bank_code` int(11) NOT NULL,
`bank_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`bin_number` int(11) NOT NULL,
`card_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
<?php
/**
* Plugin Name: WP REST API Subdomain
* Plugin URI: https://wordpress.org/plugins/wp-rest-api-subdomain/
* Author: Mark McWilliams
* Author URI: https://profiles.wordpress.org/markmcwilliams/
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Description: Move your RESTful API to a subdomain in WordPress
@ionurboz
ionurboz / Aciklama
Created May 9, 2020 19:17 — forked from cihad/Aciklama
Rails, Turbolinks, Google Tag Manager, Google Analytics
Google Tag Manager sayfanizda:
1. Sol menuden Tetikleyiciler'e tikla
a. Yeni'ye tikla
1) Acilan sayfanin ustunde tetikleyici adi: Adsız Tetikleyiciyi turbolinksPageView olarak degistirdim.
2) Tetikleyici Yapılandırması'na tikla
a) Tetikleyici türü seçin: ---->Ozel etkinlik<------ (*)
b) Etkinlik adi: turbolinks:load (*)
c) Baska bir seye dokunmadan Kaydet diyelim.
2. Etiketlere tiklayalim. (*)
@ionurboz
ionurboz / gist:d9de015c3b999c46d2bda56acd5edcfd
Created September 4, 2020 21:11 — forked from Calmarius/gist:24bdf9b753eb0553c148
PHP diff algorithm with minimum gap removal
/**
* Removes gaps between the diff block by fusing the lines into the diff.
*
* $diff: A diff created by computeDiff.
* $minGaps: a number specifying the smallest allowable gap between two diff blocks.
*
* Returns a new diff (see computeDiff for details.)
*/
function removeDiffGaps($diff, $minGaps)
{
@ionurboz
ionurboz / httpstatuscodes.csv
Created September 29, 2020 20:08 — forked from eazynow/httpstatuscodes.csv
HTTP Status Codes
100 Continue [RFC7231, Section 6.2.1]
101 Switching Protocols [RFC7231, Section 6.2.2]
102 Processing [RFC2518]
200 OK [RFC7231, Section 6.3.1]
201 Created [RFC7231, Section 6.3.2]
202 Accepted [RFC7231, Section 6.3.3]
203 Non-Authoritative Information [RFC7231, Section 6.3.4]
204 No Content [RFC7231, Section 6.3.5]
205 Reset Content [RFC7231, Section 6.3.6]
206 Partial Content [RFC7233, Section 4.1]
@ionurboz
ionurboz / http-status-codes.js
Created September 29, 2020 20:09 — forked from thegitfather/http-status-codes.js
http status codes
var httpStatusCodes = {
// 1xx Informational
// Request received, continuing process.[2]
// This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define any 1xx status codes, servers must not send a 1xx response to an HTTP/1.0 client except under experimental conditions.
'100': 'Continue', //This means that the server has received the request headers, and that the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). If the request body is large, sending it to a server when a request has already been rejected based upon inappropriate headers is inefficient. To have a server check if the request could be accepted based on the request's headers alone, a client must send Expect: 100-continue as a header in its initial request[2] and check if a 100 Continue status code is received in response be

It's possible to some extent but won't be really accurate, the idea is load image with a known file size then in its onload event measure how much time passed until that event was triggered, and divide this time in the image file size.

Example can be found here: https://stackoverflow.com/questions/4583395/calculate-speed-using-javascript

Test case applying the fix suggested there:

@ionurboz
ionurboz / calculate_reading_time.php
Created October 19, 2020 07:37 — forked from tomhazledine/calculate_reading_time.php
Calculate Reading Time (for WordPress content)
<?php
/**
* READING TIME
*
* Calculate an approximate reading-time for a post.
*
* @param string $content The content to be measured.
* @return integer Reading-time in seconds.
*/
function reading_time( $content ) {