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 / useEmitter.js
Created June 27, 2022 02:57
Events emitter/listener in Nuxt 3
// Working code with Vue3
// Create Folder plugin > Create file useEmitter.js
import { defineNuxtPlugin } from '#app'
import mitt from 'mitt'
const emitter = mitt()
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.provide('bus', {
@ManUtopiK
ManUtopiK / location.ts
Created July 6, 2022 19:45
uselocation.ts
import type { Ref } from 'vue';
export const useLang: () => Ref<string> = () => {
if (process.client) {
return ref(navigator.language);
}
const parseLangString: (languages: string) => string = (languages) => {
return languages.split(',')[0];
};
@ManUtopiK
ManUtopiK / tld
Created October 23, 2022 02:21
All tld
000abv
0db
0mb
0we
0wf
0z
1
11v
18ani
18plus
@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 / 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) => {
#!/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 / 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' } }
);
};
@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.md
Created August 20, 2023 23:18
Basic Markdown Formatting
date 2022-08-10
title Basic Markdown Formatting
category Tutorial
tags vue

The Ultimate Guide to Markdown. This will also be bold

@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,