Skip to content

Instantly share code, notes, and snippets.

View javedbaloch4's full-sized avatar

Javed Baloch javedbaloch4

View GitHub Profile
@javedbaloch4
javedbaloch4 / node_nginx_ssl.md
Created October 12, 2022 15:09 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@javedbaloch4
javedbaloch4 / airdrop.ts
Created May 27, 2022 13:18
TypeScript to generate Solana in Devnet
import { PublicKey, Connection, LAMPORTS_PER_SOL } from "@solana/web3.js";
export const airdrop = async (address: string, amount: number) => {
const publicKey = new PublicKey(address);
const conn = new Connection("https://api.devnet.solana.com", "confirmed");
const signature = await conn.requestAirdrop(
publicKey,
amount * LAMPORTS_PER_SOL
);
await conn.confirmTransaction(signature);
@javedbaloch4
javedbaloch4 / hashing.js
Created February 17, 2022 12:35
Hashing with Asynchronous programming
/* --------- app.js ----------*/
// Import block class
const BlockClass = require('./block')
// Create a block object
const block = new BlockClass.Block("Test Block")
// Generate the block hash
block.generateHash().then((result) => {
console.log(`Block Hash: ${result.hash}`)
@javedbaloch4
javedbaloch4 / hashing.js
Created February 17, 2022 12:16
Hashing SHA256 in JavaScript using crypto-js package.
const { SHA256 } = require('crypto-js')
const name = "Javed"
const transactionHistory = {
id: 223423424,
name: 'Javed-123',
amount: 24234234
}
const generateHash = (obj) => {
@javedbaloch4
javedbaloch4 / js_validation.html
Created March 25, 2021 09:10
Javascript fields validation example.
<html>
<head>
<title>Assignemnt</title>
<style>
.progress-bar {
border-radius: 5px;
padding: 5px;
color: #FFF;
}
@javedbaloch4
javedbaloch4 / scrapper.php
Created December 4, 2020 15:59
Simple Web Scrapping in PHP.
<?php
// Using the library https://simplehtmldom.sourceforge.io
include("simple_html_dom.php");
# Example 1 - Get the title of webpage.
$html = file_get_html("https://www.google.com");
@javedbaloch4
javedbaloch4 / laravel_collections_examples.php
Last active November 27, 2020 11:25
Laravel Collection Examples.
public function average() {
// Get The Average
# Ex 1
return (10 + 20 + 30) / 3;
# Ex 2
return collect([10, 20, 30])->average();
@javedbaloch4
javedbaloch4 / fetch.js
Created October 31, 2020 12:04
JS Fetch API Examples.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<title>Works</title>
</head>
<body>
@javedbaloch4
javedbaloch4 / alpine-tailwind-selector.html
Created September 14, 2020 19:37
AlpineJS TailwindCSS selector.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Home</title>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.6.0/dist/alpine.min.js" defer></script>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
@javedbaloch4
javedbaloch4 / fetch-init.html
Created September 10, 2020 21:28
AlpineJS fetch & init example using Kanye.rest API.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Home</title>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.6.0/dist/alpine.min.js" defer></script>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="">