Skip to content

Instantly share code, notes, and snippets.

View aslamanver's full-sized avatar
🎯
Focusing

Aslam Anver aslamanver

🎯
Focusing
View GitHub Profile
@aslamanver
aslamanver / README.md
Created December 19, 2018 06:47 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@aslamanver
aslamanver / ajax.js
Last active January 30, 2019 06:10
Reqres.in
$.ajax({
url: "https://reqres.in/api/users",
type: "POST",
data: {
name: "paul rudd",
movies: ["I Love You Man", "Role Models"]
},
success: function(response){
console.log(response);
}
@aslamanver
aslamanver / nativejs.js
Created January 30, 2019 06:12
Reqres.in
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://reqres.in/api/products/3", true);
xhr.onload = function(){
console.log(xhr.responseText);
};
xhr.send();
{
"name":"paul rudd",
"movies[]":[
"I Love You Man",
"Role Models"
],
"id":"243",
"createdAt":"2014-10-18T12:09:05.255Z"
}
{
"data":{
"id":3,
"name":"true red",
"year":2002,
"pantone_value":"19-1664"
}
}
@aslamanver
aslamanver / autossh.service
Created March 15, 2019 11:34 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)

Create container

  1. docker run -dt --network host --name mycontainer ubuntu:18.04
  2. docker exec -it mycontainer /bin/bash

Mount volumes

  1. docker run -dt --network host --name mycontainer -v "$PWD":/home mycontainer-2
sudo apt-get update
sudo apt-get install apache2
sudo ufw allow in "Apache Full"
sudo apt-get install curl
sudo apt-get install mysql-server
mysql_secure_installation
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo systemctl restart apache2
@aslamanver
aslamanver / MockSharedPreference.java
Last active May 31, 2019 05:06
Android mocked shared preference that store data in memory while doing the unit testing with Mockito.
package com.mpos.util;
import android.content.SharedPreferences;
import android.support.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
@aslamanver
aslamanver / API.md
Last active June 16, 2019 18:17
RESTful API Documentation Template

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: