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 / fetch-graphql-schema.js
Last active September 1, 2019 22:06 — forked from rmarscher/fetch-graphql-schema.js
Get root schema of graphql endpoint
// A script that can pull down the result of the introspection query
// from a running graphql server.
// Dependencies:
// npm i -S isomorphic-fetch graphql-tag graphql apollo-client
// Usage:
// node fetch-graphql-schema [graphql url]
// Example:
# ----------------------------------------------------------------------
# {TYPE}: [{SCOPE}] {SUBJECT} What?
# {BODY} Why?
# {FOOTER}
@ManUtopiK
ManUtopiK / gist:f02811891a98aba6ac135c6dc2106588
Last active September 10, 2020 23:00
test gist with image

https://miro.medium.com/max/700/1*kkH8jsYRX_JNSJqz-bm07w.gif

# config.js
const config = {
...,
features: {
...
}.
...
}
function feature (name) {
return config.features[name]
@ManUtopiK
ManUtopiK / Editor.vue
Created November 26, 2020 00:48 — forked from Julien1138/Editor.vue
Tiptap collaboration server handles multiple document using namespaces and rooms
<template>
<div class="editor">
<template v-if="editor && !loading">
<div class="count">
{{ count }} {{ count === 1 ? 'user' : 'users' }} connected to {{ projectPath }}/{{ docName }}
</div>
<editor-content class="editor__content" :editor="editor" />
</template>
<em v-else>
Connecting to socket server …
@ManUtopiK
ManUtopiK / countries.js
Created December 15, 2020 22:00
World countries
const countries = [
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Australia",
@ManUtopiK
ManUtopiK / slugify.js
Created September 2, 2021 16:42
slugify
String.prototype.slugify = function (separator = '-') {
return this.toString()
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
.trim()
.replace(/[^a-z0-9 ]/g, '')
.replace(/\s+/g, separator)
}
@ManUtopiK
ManUtopiK / gist:70c1aeff5de45980c86209e759cafbd0
Created October 8, 2021 22:06
fastify read video and return stream
fastify.get('/api/watch', async function (req, res) {
const mp4Url = "https://download1319.mediafire.com/ky961ln87icg/cl1lndr4pyy4cv4/aAbnw92_460svav1+%281%29.mp4";
const response = await axios.get(mp4Url, {
responseType: "stream",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
},
});
@ManUtopiK
ManUtopiK / gist:e07229cbb66380d3cf397a486c64bbce
Created December 11, 2021 21:28
git hook pre-commit search TODO+FIXME
#! /bin/bash
# Si vous rencontrez une erreur du type `declare: -A: invalid option`
# c’est qu’il vous faut mettre à jour votre version bash à v4.
# Pour Mac OS, regardez ici : http://clubmate.fi/upgrade-to-bash-4-in-mac-os-x/
# Hash utilisant la clé comme expression de recherche (Regex) et la valeur
# associée comme message d’erreur
declare -A PATTERNS;
PATTERNS['^[<>|=]{4,}']="Vous avez des marqueurs de conflits qui traînent";
PATTERNS['TODO|FIXME']="Vous avez des tâches non terminées (FIXME/TODO)";
@ManUtopiK
ManUtopiK / dice.js
Created January 20, 2022 12:14
Play the dice
// Unicode 0x2680-0x2685 are the sides of a dice (⚀⚁⚂⚃⚄⚅)
console.log('%c'+String.fromCodePoint(0x267f + Math.floor(Math.random() * 6) + 1), 'font-size: 4rem;')