Skip to content

Instantly share code, notes, and snippets.

Avatar

Muhammad Khizar MuhammadKhizar7

  • Pakistan
View GitHub Profile
@MuhammadKhizar7
MuhammadKhizar7 / githubAuthcloudflarefn.js
Created May 3, 2022 16:41
cloudflare worder function to auth github
View githubAuthcloudflarefn.js
addEventListener('fetch', (event) => {
event.respondWith(handle(event.request))
})
// use secrets
const client_id = CLIENT_ID
const client_secret = CLIENT_SECRET
const redirect_uri = 'https://url.workers.dev'
const scope = 'repo,user'
@MuhammadKhizar7
MuhammadKhizar7 / tonybaloneyextended.omp.json
Created November 6, 2021 17:52
tonybaloneyextended.omp.json
View tonybaloneyextended.omp.json
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
"segments": [
{
"type": "os",
@MuhammadKhizar7
MuhammadKhizar7 / powershell profile
Last active January 12, 2022 02:39
Powershell profile
View powershell profile
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
clear
if ($host.Name -eq 'ConsoleHost') {
Import-Module PSReadLine
}
Import-Module -Name Terminal-Icons
@MuhammadKhizar7
MuhammadKhizar7 / db.js
Created November 1, 2021 11:00 — forked from smolinari/db.js
The services/db.js file for the Quasar todo browser extension demo
View db.js
export default {
/**
* This will ask for ALL items from chrome storage and return only the ones we're interested in.
* @param type
*/
getAll (type) {
return this.get(null).then(allItems => {
return allItems.filter(f => f && f.type && f.type === type)
})
@MuhammadKhizar7
MuhammadKhizar7 / ActiveRouteTagHelper.cs
Created April 29, 2021 00:59
To add Active class on nav link in asp.net core
View ActiveRouteTagHelper.cs
[HtmlTargetElement(Attributes = "is-active-route")]
public class ActiveRouteTagHelper : TagHelper
{
private IDictionary<string, string> _routeValues;
/// <summary>The name of the action method.</summary>
/// <remarks>Must be <c>null</c> if <see cref="P:Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Route" /> is non-<c>null</c>.</remarks>
[HtmlAttributeName("asp-page")]
public string Page { get; set; }
@MuhammadKhizar7
MuhammadKhizar7 / isInViewPort.js
Created December 27, 2020 12:57
It check if element in viewport or not
View isInViewPort.js
function isInViewPort(element) {
// Get the bounding client rectangle position in the viewport
const bounding = element.getBoundingClientRect();
// Checking part. Here the code checks if it's *fully* visible
// Edit this part if you just want a partial visibility
return bounding.top >= 0 &&
bounding.left >= 0 &&
bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight);
@MuhammadKhizar7
MuhammadKhizar7 / index.html
Created November 20, 2020 06:41
menu in pure css
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Menu pure css</title>
<style>
html,
body {
height: 100%;
@MuhammadKhizar7
MuhammadKhizar7 / wave in css
Created November 20, 2020 06:35
pure css wave
View wave in css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>wave css</title>
<style>
@import url(//fonts.googleapis.com/css?family=Lato:300:400);
body {
@MuhammadKhizar7
MuhammadKhizar7 / PageList.cs
Created September 7, 2020 02:19
Pagination in asp.net core
View PageList.cs
namespace Simple.Data.Pagination.Extensions
{
using System;
using System.Collections.Generic;
using System.Linq;
using Interfaces;
/// <summary>
/// Provides some extension methods for <see cref="IEnumerable{T}" /> to provide paging capability.
/// </summary>
@MuhammadKhizar7
MuhammadKhizar7 / August 30, 2020.md
Last active April 29, 2021 01:21
gistpad-scratch
View August 30, 2020.md

Fatch Api Solution

/*
 Parses the JSON returned by a network request
 @param {object} response A response from a network request
 @return {object} The parsed JSON, status from the response
 */
    function parseJSON(response) {
      return new Promise((resolve) => response.json()
      .then((json) => resolve({