Skip to content

Instantly share code, notes, and snippets.

View AriffAzmi's full-sized avatar
🏠
Working from home

AriffAzmi AriffAzmi

🏠
Working from home
View GitHub Profile
@AriffAzmi
AriffAzmi / array-using-struct.go
Last active April 12, 2022 04:19
Create array using struct in golang
package main
import (
"encoding/json"
"fmt"
)
type Users struct {
Fullname string `json:fullname`
Phone int `json:phone`
{
"id": 4304858284184,
"admin_graphql_api_id": "gid://shopify/Order/4304858284184",
"app_id": 580111,
"browser_ip": "118.100.17.147",
"buyer_accepts_marketing": false,
"cancel_reason": null,
"cancelled_at": null,
"cart_token": "fe0ea5cdde5766426f213eff87868555",
"checkout_id": 24768992510104,
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<meta name="generator" content="">
<title>Design GPCV</title>
<!-- Bootstrap core CSS -->
@AriffAzmi
AriffAzmi / parallel-test.php
Created October 19, 2020 10:15
Sample parallel test for php
<?php
try {
$db = new PDO('mysql:host=127.0.0.1;dbname=parallel_test', '', '');
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$requested_stock = (int) $_REQUEST['requested_stock'];
$item_id = (int) $_REQUEST['id'];
<?php
/**
*
*/
class BillplzAPI
{
protected $secret_key;
protected $version;
protected $collectionID;
<?php
/**
*
*/
class BillplzAPI
{
protected $secret_key;
protected $version;
protected $collectionID;
public class ThreadingPost {
private static final String POST_PARAMS = "TransactionType=SALE&PymtMethod=DD&ServiceID=POS&PaymentID=2d3d2287a9a4680518aa&OrderNumber=2d3d2287a9a4680518aa&Amount=300.00&CurrencyCode=MYR&HashValue=63c82ee2e64b093f73bfa42c1fe0a294fccc2506e7dcabfd4ad30abdece88148&HashValue2=9b50229fbf3d44f5bbc4002986e1dbef28339c9b1f61e155b00effc8f5d45213&TxnID=POS2d3d2287a9a4680518aa&IssuingBank=FPXDB2B&TxnStatus=0&AuthCode=123456&BankRefNo=1912080120490928&RespTime=2019-12-18 20:20:00&TxnMessage=Transaction Successfull";
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException{
for(int i=0; i <= 2; i++) {
JFrame frame=new JFrame("TRAIN TICKET");
frame.setSize(800,600);
frame.setLayout(null);
frame.setVisible(true);
//label
JLabel l1 = new JLabel("NAME :");
frame.add(l1);
l1.setBounds(50,45,100,60);
sudo apt-get update && upgrade -y
sudo apt-get install apache2 -y
sudo apt-get install php php-common php-mbstring php-xml -y
<?php
include_once 'dbconfig.php';
if (!isset($_SESSION['id'])) {
echo '<script>'. 'alert("Please login");'. '</script>';
echo '<script>'. 'window.location.href="login.php";'. '</script>';
}
$user_id = $_SESSION['id'];
$stmt = $conn->prepare("SELECT * FROM users WHERE id=:user_id");