Skip to content

Instantly share code, notes, and snippets.

View tauqeernasir's full-sized avatar
🎯
Focusing

Tauqeer Nasir tauqeernasir

🎯
Focusing
View GitHub Profile
@tauqeernasir
tauqeernasir / test.json
Last active November 8, 2022 12:44
Test Json
[
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
},
{
"userId": 1,
"id": 2,
@tauqeernasir
tauqeernasir / page-info.ts
Created November 2, 2021 11:03 — forked from tumainimosha/page-info.ts
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@tauqeernasir
tauqeernasir / .gitconfig
Created October 7, 2021 05:47 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "[email protected]:"]
insteadOf = git://github
@tauqeernasir
tauqeernasir / self.decorator.ts
Created October 4, 2021 08:20 — forked from DimosthenisK/self.decorator.ts
NestJS Guard + Decorator that allows user access limit to his own resources
import { SetMetadata } from '@nestjs/common';
export interface SelfDecoratorParams {
userIDParam: string;
allowAdmins?: boolean;
}
export const Self = (params: SelfDecoratorParams | string) =>
SetMetadata(
'selfParams',
@tauqeernasir
tauqeernasir / Docker shell commands.sh
Created March 31, 2021 05:36 — forked from bahmutov/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@tauqeernasir
tauqeernasir / script.sh
Last active April 3, 2021 23:44
dev server
#!/usr/bin/env bash
set -fb
readonly VERSION=0.0.1
readonly USER_LOCAL="/usr/local/bin"
readonly TMP="/tmp/rbase" # update in toml
readonly MY_NAME=$(basename "$0")
readonly FILE_TO_FETCH_URL="https://gist.github.com/tauqeernasir/fb8cd47ebf9a57301fd13b326247a3b4/raw"
readonly EXISTING_SHELL_SCRIPT="${TMP}/dev-server-existing"
@tauqeernasir
tauqeernasir / script.sh
Last active March 29, 2021 12:14
self-update bash script
#!/usr/bin/env bash
VERSION="0.0.2"
SCRIPT_URL='https://gist.github.com/tauqeernasir/031e58887c9ee3c13748fe79265df06f/raw'
SCRIPT_DESCRIPTION=""
SCRIPT_LOCATION="${BASH_SOURCE[@]}"
rm -f updater.sh
function update()
{
@tauqeernasir
tauqeernasir / download-file-with-ajax.ts
Created September 8, 2020 07:49
Downloading file with AJAX request in browser
// ANY AJAX LIBARARY CAN BE USED
// `responseType: blob` is important
axios({
url: 'http://localhost:9000/url/to/example.pdf',
method: 'POST',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;