Skip to content

Instantly share code, notes, and snippets.

View ManUtopiK's full-sized avatar
:octocat:
Ready to code.

Emmanuel Salomon ManUtopiK

:octocat:
Ready to code.
View GitHub Profile
@ManUtopiK
ManUtopiK / clean-graphql.js
Last active March 5, 2024 13:47
Clean graphql response : Remove edges, node and __typename from graphql response
/**
* Remove edges, node and __typename from graphql response
*
* @param {Object} input - The graphql response
* @returns {Object} Clean graphql response
*/
const cleanGraphQLResponse = function(input) {
if (!input) return null
const output = {}
const isObject = obj => {
@ManUtopiK
ManUtopiK / useBreadcrumbs.ts
Created December 1, 2023 12:23
useBreadcrumbs for Vue
const isMathPatternPath = (pathA: string, pathB: string) => {
const partsA = pathA.split('/');
const partsB = pathB.split('/');
if (partsA.length !== partsB.length) return false;
const isMatch = partsA.every((part: string, i: number) => {
return part === partsB[i] || part.startsWith(':');
})
@ManUtopiK
ManUtopiK / landingpages.spec.ts
Created October 19, 2023 20:41 — forked from CodeDredd/landingpages.spec.ts
Full e2e test example with nuxt 3
import { fileURLToPath } from 'node:url';
import { describe, test } from 'vitest';
import { expect } from '@playwright/test';
import { setup, createPage } from '@nuxt/test-utils';
describe('Landing page', async () => {
await setup({
rootDir: fileURLToPath(new URL('..', import.meta.url)),
server: true,
browser: true,
@ManUtopiK
ManUtopiK / index.md
Created August 20, 2023 23:18
Basic Markdown Formatting
date title category tags
2022-08-10
Basic Markdown Formatting
Tutorial
vue

The Ultimate Guide to Markdown. This will also be bold

@ManUtopiK
ManUtopiK / git_commit_and_push.sh
Created August 19, 2023 15:31
git_commit_and_push.sh
#!/bin/bash
# Check if the user provided the branch name and commit message as arguments
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <branch_name> <commit_message>"
exit 1
fi
branch_name="$1"
commit_message="$2"
@ManUtopiK
ManUtopiK / index.js
Created July 23, 2023 17:06
Netlify edge function's geo prop
export default async (request, context) => {
return new Response(
JSON.stringify({
...context.geo,
ip: context.ip,
}),
{ headers: { 'content-type': 'application/json' } }
);
};
#!/bin/bash
OPTION=$1
HOSTNAME=$(hostname)
DATE=$(date +%Y-%m-%d-%H-%M-%S)
REPORT_FILE="report-${HOSTNAME}-${DATE}.txt"
INTERESTING_FILES='.bash_history .bash_logout .bashrc .ssh known_hosts authorized_keys id_rsa id_rsa.pub authorized_keys2'
INTERESTING_PLACES='/var /tmp /dev/shm'
COMPRESSED_FILE_EXTENSIONS='.zip .tar .gz .rar'
@ManUtopiK
ManUtopiK / urql.ts
Created March 9, 2023 00:45 — forked from productdevbook/urql.ts
Nuxt 3 urql graphql
import { Client, createClient, dedupExchange, errorExchange, fetchExchange, ssrExchange } from '@urql/core'
import { ref } from 'vue'
import { devtoolsExchange } from '@urql/devtools'
import * as Session from 'supertokens-web-js/recipe/session'
import { authExchange } from '@urql/exchange-auth'
import { defineNuxtPlugin } from '#app'
const ssrKey = '__URQL_DATA__'
export default defineNuxtPlugin((nuxtApp) => {
@ManUtopiK
ManUtopiK / masonry-grid-polyfill.ts
Created January 9, 2023 19:55
masonry-grid-polyfill.ts
export interface GridInstance {
el: HTMLElement
items: HTMLElement[]
gap: number
columns: number
count: number
}
export function masonryGridPolyfill(selectors = '.masonry-grid') {
const elements = [...document.querySelectorAll<HTMLElement>(selectors)]
@ManUtopiK
ManUtopiK / tld
Created October 23, 2022 02:21
All tld
000abv
0db
0mb
0we
0wf
0z
1
11v
18ani
18plus