Skip to content

Instantly share code, notes, and snippets.

@ali-master
ali-master / SupportLanguage.md
Created January 4, 2017 09:47
Javascript Supported Language Code of Client Browser

Javascript Supported Language Code of Client Browser

(function($$) {
    'use strict'

    /**
     * Supported Language Code
     * @return {string} Supported language code
     */
    var getCurrentLanguageCode = function() {
@ali-master
ali-master / Object.Is.md
Last active January 4, 2017 16:03
Object.is() vs operator ===

Object.is() vs operator ===

Determines whether two values are a some values

Object.is()

Object.is(0, 0)       // true
Object.is(+0, -0)     // false
Object.is(NaN, NaN)   // true
Object.is('foo', NaN) // false
@ali-master
ali-master / isPersian.md
Last active January 12, 2017 19:55
Detect Persian Unicode of Text

Detect Persian Unicode of Text

/**
 * @param {string}
 * @return {boolean}
 */
const isPersian = (str) => {
  const letters = [];
 for (let i = 0; i <= str.length; i++) {
@ali-master
ali-master / readme.md
Last active January 21, 2017 04:44
Setup React with Webpack and Babel with Bash/Shell

Setup React with Webpack and Babel with Bash/Shell

Usage

chmod a+x setupReact.sh
sh setupReact.sh
@ali-master
ali-master / versionofReact.js
Created February 11, 2017 04:46
Take a version from the window query string and load a specific
/**
* Take a version from the window query string and load a specific
* version of React.
*
* @example
* http://localhost:3000?version=15.4.1
* (Loads React 15.4.1)
*/
var REACT_PATH = 'react.js';
@ali-master
ali-master / javascript.cookies.md
Created February 18, 2017 04:11
JavaScript Cookies

JavaScript Cookie

var PryCookie = {
	set: function(name, value, path, domain, expire) {
		var this_path = '';
		if (path != undefined) {
			this_path = '; path=' + path;
		}
		var this_domain = '';
@ali-master
ali-master / router.js
Last active September 28, 2020 14:32
HTML5 PushState Routing
const Router = (function () {
"use strict";
/**
* @routes
* get or set routes
*/
var routes = [];
/**
@ali-master
ali-master / allCountries.js
Created March 5, 2017 09:56
Javascript Display Information the all Countries
'use strict';
// So each country array has the following information:
// [
// Country name,
// iso2 code,
// International dial code,
// Format (if available),
// Order (if >1 country with same dial code),
// Area codes (if >1 country with same dial code)

Keybase proof

I hereby claim:

  • I am ali-master on github.
  • I am alimaster (https://keybase.io/alimaster) on keybase.
  • I have a public key whose fingerprint is A6D5 9733 DE35 AEAB 760F 9589 C20C 8BCD BB84 4D48

To claim this, I am signing this object:

@ali-master
ali-master / scrollTo.js
Created March 12, 2017 19:12
jQuery ScrollTo
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);