Skip to content

Instantly share code, notes, and snippets.

View adelin-b's full-sized avatar
🎯
Focusing

Adelin Berard adelin-b

🎯
Focusing
  • Paris
View GitHub Profile
@adelin-b
adelin-b / open-all-links-in-new-tab.js
Last active March 3, 2022 09:50
Click all link on a page matching regex or css selector and open in new tab
@adelin-b
adelin-b / TransformBooleanPipe.ts
Last active August 31, 2021 07:55
Nest js pipe to transform query string boolean into boolean using open api metadata
import { PipeTransform, Injectable, ArgumentMetadata } from "@nestjs/common";
type TrueArgumentMetadata = ArgumentMetadata & {
metatype: { _OPENAPI_METADATA_FACTORY: () => Record<string, any> };
};
@Injectable()
export class TransformBooleanPipe implements PipeTransform<any> {
transform(value: any, { metatype }: TrueArgumentMetadata) {
if (!metatype || !this.toValidate(metatype)) {
@adelin-b
adelin-b / afiaka-dall-e-generation.ipynb
Created August 29, 2021 20:54
Afiaka DALL-E Generation.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adelin-b
adelin-b / spleeter.ipynb
Last active May 10, 2021 19:27
spleeter.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adelin-b
adelin-b / norgtion.org
Last active January 6, 2021 18:39
Notion attempt in orgmode

[1/4] Media

La fin du monde en 80 jours

@adelin-b
adelin-b / ankiToOrg.ts
Last active May 3, 2022 05:05
A script to convert anki file to org file using anki-connect anki plugin and anki-editor for emacs `deno run --allow-net anki.ts "*"` or `deno run --allow-net anki.ts "Deckname"` or inside emacs evil mode `:read !deno run --allow-net anki.ts "*"` WARNING, currently anki-editor break html by escaping it automaticaly when you push the imported decks
const notesInfo = (results: any[]) => ({
action: "notesInfo",
version: 6,
params: {
notes: results,
},
});
const deckname = Deno.args[0] ?? "*";
@adelin-b
adelin-b / OptionsApp.tsx
Last active October 16, 2020 22:45
Auto-generate forms from typescript interface
import * as React from 'react'
import styled from 'styled-components'
import schemaJson from './form.json'
// import Form from '@rjsf/material-ui'
import Form from '@rjsf/core'
// console.log('schema: ', schema)
export interface OptionSettings {
whitelist: string[]
@adelin-b
adelin-b / isDescendant.ts
Last active October 14, 2020 00:12
Check if a dom element is the descendant from another element with matching id
/** Check if a dom element is the descendant from another element with matching id */
export const isDescendant = (element: HTMLElement, parentId: string, depth: number) => {
let isChild = false
if (element.id === parentId) {
//is this the element itself?
isChild = true
}
let iterations = 0
@adelin-b
adelin-b / timeout.ts
Created October 14, 2020 00:01
A timeout that can be awaited
/**
* A timeout that can be awaited
* @param {} ms
*/
export function timeout(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
@adelin-b
adelin-b / compare.md
Created October 12, 2020 15:49
Plant Uml example for react and C4
!include https://raw.githubusercontent.com/RicardoNiepel/C4-PlantUML/release/1-0/C4_Container.puml

@startuml 
Person(personAlias, "Label", "Optional Description")
Container(containerAlias, "Label", "Technology", "Optional Description")
System(systemAlias, "Label", "Optional Description")
System(holla, "Holla", "Optional Description")