Skip to content

Instantly share code, notes, and snippets.

View ahmed-sheta's full-sized avatar

Ahmed Sheta ahmed-sheta

View GitHub Profile
@ahmed-sheta
ahmed-sheta / Blogger Local Domains Redirect.js
Last active October 22, 2019 03:34
Redirect Google Blogger Country Code Domains ccTLDs to No Country Code Top Level Domain TLD blogspot.com
<!-- Update: You will no longer need this code, as Blogger do it now by default -->
<!-- This code will redirect any Blogger country code domain (ccTLDs) such as .blogspot.com.eg to the Blogger No Country Code Top Level Domaian TLD .blogspot.com -->
<!-- Just paste this code before <head> tag -->
<!-- Start of the code www.ahmedsheta.com -->
<script type='text/javascript'>
var blog = document.location.hostname;var slug = document.location.pathname;var ctld = blog.substr(blog.lastIndexOf(&quot;.&quot;));if (ctld != &quot;.com&quot;) {var ncr = &quot;http://&quot; + blog.substr(0, blog.indexOf(&quot;.&quot;));ncr += &quot;.blogspot.com/ncr&quot; + slug;window.location.replace(ncr);}</script>
<!-- End of the code www.ahmedsheta.com -->
@sepehr
sepehr / readable_random_string.php
Last active December 8, 2023 15:11
PHP: Human-readable Random String
<?php
/**
* Generates human-readable string.
*
* @param string $length Desired length of random string.
*
* retuen string Random string.
*/
function readable_random_string($length = 6)