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
@Aschen
Aschen / README.md
Last active April 29, 2024 14:18
Scrape a page and convert it to Markdown

Scrape a page and convert it to Markdown

Install dependencies: npm install playwright cheerio node-html-markdown

Install firefox browser: npx playwright install firefox

Run the script: tsx html-to-md.ts https://mistral.ai/fr/news/mixtral-8x22b/

@CodeDredd
CodeDredd / landingpages.spec.ts
Created October 19, 2023 18:35
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,
# Source: https://gist.github.com/vfarcic/8301efb15748af1da3e376b7132e519e
###################################################################
# Should We Run Databases In Kubernetes? CloudNativePG PostgreSQL #
# https://youtu.be/Ny9RxM6H6Hg #
###################################################################
# Additional Info:
# - CloudNativePG: https://cloudnative-pg.io
# - EDB: https://enterprisedb.com
@productdevbook
productdevbook / urql.ts
Created March 4, 2023 18:34
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 / 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', {
@DavidWells
DavidWells / github-proxy-client.js
Last active March 15, 2024 08:28
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active October 6, 2023 18:39
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
@danielroe
danielroe / settings.json
Last active May 4, 2024 08:55
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",
@exreplay
exreplay / .eslintrc.js
Last active November 17, 2021 16:07
nuxt3 generate eslint globals
// eslint-disable-next-line @typescript-eslint/no-var-requires
const globals = require('.nuxt/eslint-globals');
// @ts-check
/** @type {import('eslint').Linter.Config} */
module.exports = {
...globals,
//... other rules
};