Skip to content

Instantly share code, notes, and snippets.

View mshafiqmk's full-sized avatar

Muhammad Shafiq mshafiqmk

  • 00:59 (UTC +05:00)
View GitHub Profile
@mshafiqmk
mshafiqmk / online-offline.html
Created August 25, 2022 18:56
How to check if you are online or offline in JavaScript and html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Online Offline Status in html and javascript</title>
</head>
@mshafiqmk
mshafiqmk / ConvertBase64EcodedStringToPdfBlob
Created July 20, 2022 17:36
Convert Base 64 encoding string to pdf blob in javascript
public getBlobPdf(base64) {
const binary = this.convertDataURIToBinary(base64);
const blob = new Blob([ binary ], { type: 'application/pdf' });
const blobUrl = URL.createObjectURL(blob);
return window.open(blobUrl, '_blank');
}
private convertDataURIToBinary(base64) {
let data: string;
data = window.atob(base64);
Swagger Support in azure function out of proc
https://github.com/Azure/azure-functions-openapi-extension/blob/main/docs/enable-open-api-endpoints-out-of-proc.md
# To compile a .NET project in release mode:
dotnet publish --configuration Release <path/to/project_file>
# To publish the .NET Core runtime with your application for the specified runtime:
dotnet publish --self-contained true --runtime <runtime_identifier> <path/to/project_file>
# To package the application into a platform-specific single-file executable:
dotnet publish --runtime <runtime_identifier> -p:PublishSingleFile=true <path/to/project_file>
# To trim unused libraries to reduce the deployment size of an application:
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
@mshafiqmk
mshafiqmk / download-selenium-drivers.ps1
Created September 13, 2021 09:57 — forked from JoshuaKGoldberg/download-selenium-drivers.ps1
PowerShell script to download major browser WebDriver drivers for Selenium.
[Net.ServicePointManager]::SecurityProtocol = "Ssl3, Tls, Tls11, Tls12";
$currentDir = (Get-Item -Path "./").FullName;
$driversDirName = Join-Path $currentDir ".drivers";
$isWindows = [System.Boolean](Get-CimInstance -ClassName Win32_OperatingSystem -ErrorAction SilentlyContinue);
$webClient = New-Object System.Net.WebClient;
function Ensure-Driver-Exists($browserName, $exeName, $download, $zipName) {
$localExeName = Join-Path $driversDirName $exeName;
if (Test-Path $localExeName) {
@mshafiqmk
mshafiqmk / PowerShell Customization.md
Created November 20, 2019 04:13 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@mshafiqmk
mshafiqmk / profiles.json
Created May 18, 2019 23:01 — forked from mehulmpt/profiles.json
Sample profiles.json for new Windows Terminal
{
"defaultProfile": "{09dc5eef-6840-4050-ae69-21e55e6a2e62}",
"initialRows": 30,
"initialCols": 120,
"alwaysShowTabs": true,
"showTerminalTitleInTitlebar": true,
"experimental_showTabsInTitlebar": true,
"profiles": [
{
"guid": "{09dc5eef-6840-4050-ae69-21e55e6a2e62}",
@mshafiqmk
mshafiqmk / gist:e03577a9da77118274d84a089c707e39
Created September 24, 2018 06:49 — forked from panmanphil/gist:9fc8555ef29b03c44431
In Memory Azure Table Storage for testing
using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using System.Linq;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage.Table.DataServices;
using StonePorch.Framework.Interfaces;
namespace StonePorch.Tests.Mocks
{
@mshafiqmk
mshafiqmk / webdev_online_resources.md
Created July 17, 2018 00:53 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)