Skip to content

Instantly share code, notes, and snippets.

@Ashkanph
Ashkanph / responsive-css-grid.html
Created April 23, 2019 11:05
Responsive css grid
<!DOCTYPE html>
<html>
<!-- Source: https://glitch.com/edit/#!/grid-grail?path=index.html:1:0 -->
<!-- Demo: https://grid-grail.glitch.me/ -->
<head>
<title>Hello!</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/reset.css">
<!DOCTYPE html>
<html>
<!--
The source: https://codepen.io/jatinderbimra/pen/kxjeA
-->
<head>
<style>
table{width:100%;
@Ashkanph
Ashkanph / grid-css-example.html
Created April 15, 2019 12:57
responsive grid area which hide one of its items
<!DOCTYPE html>
<html>
<head>
<style>
.subscribe-section {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 10px;
background-color: #2196F3;
padding: 10px;
@Ashkanph
Ashkanph / splitjs-view-html.html
Created February 26, 2019 10:37
A grid split view html page with splitjs
<!DOCTYPE html>
<html>
<!-- Source: -->
<!-- https://stackoverflow.com/questions/47690562/how-to-create-full-horizontal-row-with-split-js -->
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
@Ashkanph
Ashkanph / vscode_setting.md
Created February 13, 2019 07:55
My VS Code settings and snippet

javascript.json

{
// /*
	// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
@Ashkanph
Ashkanph / .bashrc
Last active February 19, 2020 09:20
My .bashrc (Ubuntu)
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the pac[[ -s /home/ashkan/.autojump/etc/profile.d/autojump.sh ]] && source /home/ashkan/.autojump/etc/profile.d/autojump.sh
# BASE16_SHELL=$HOME/.config/base16-shell/
# [ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)"
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
@Ashkanph
Ashkanph / wordpress_custom_fields.md
Last active January 5, 2019 05:29
Getting wordpress custom fields in response of wordpress API
  • "access" is a custom field of the posts. Add this to the functions.php:
function get_post_meta_cb($object, $field_name, $request){
        return get_post_meta($object['id'], $field_name, true); 
}
function update_post_meta_cb($value, $object, $field_name){
  return update_post_meta($object['id'], $field_name, $value); 
}
@Ashkanph
Ashkanph / mongodb-mysql-deploy_to_sever_with_Git.md
Last active January 14, 2020 08:10
All my needed mongodb and mysql commands, deployment to the VPS server with pushing to the Git bare project, Systemd services , installing LAMP and LEMP, NGINX

mongo shell

  • To use mongo shell:
> mongo --shell         # Open Mongodb shell
> show dbs              # Show all databases' names
> use amniat            # Open the db with the name of amniat
> db.users.find()       # Show all users
> db.users.updateOne(    # Update a user
@Ashkanph
Ashkanph / URI_validation_in_javascripit_with_Regex
Last active December 13, 2018 06:11
URI validation in javascripit with REGEX
* The URI scheme is optional:
/((?:(http|https|Http|Https|rtp|Rtp|rtsp|Rtsp|ftp|Ftp|file|File):\/\/(?:(?:[a-zA-Z0-9\$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:\%[a-fA-F0-9]{2})){1,64}(?:\:(?:[a-zA-Z0-9\$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:\%[a-fA-F0-9]{2})){1,25})?\@)?)?((?:(?:[a-zA-Z0-9][a-zA-Z0-9\-]{0,64}\.)+(?:(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])|(?:biz|b[abdefghijmnorstvwyz])|(?:cat|com|coop|c[acdfghiklmnoruvxyz])|d[ejkmoz]|(?:edu|e[cegrstu])|f[ijkmor]|(?:gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(?:info|int|i[delmnoqrst])|(?:jobs|j[emop])|k[eghimnrwyz]|l[abcikrstuvy]|(?:mil|mobi|museum|m[acdghklmnopqrstuvwxyz])|(?:name|net|n[acefgilopruz])|(?:org|om)|(?:pro|p[aefghklmnrstwy])|qa|r[eouw]|s[abcdeghijklmnortuvyz]|(?:tel|travel|t[cdfghjklmnoprtvwz])|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]))|(?:(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9]
@Ashkanph
Ashkanph / wpAPISubdomain.md
Created November 18, 2018 08:07
Change wordpress api to the subdomain

Change wordpress api to the subdomain

<IfModule mod_rewrite.c>
# Redirecting dynamic subdomain urls to wp api
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.maindomain.com$ [NC]
RewriteRule ^(.*)$ https://www.maindomain.com/wp-json%{REQUEST_URI} [R=301,NC,L,QSA]