Skip to content

Instantly share code, notes, and snippets.

View Ayc0's full-sized avatar
🐥
processing...

Benjamin Koltes Ayc0

🐥
processing...
View GitHub Profile
@Ayc0
Ayc0 / Experience.md
Last active July 13, 2022 23:27
Yarn plugin experience

Mismatch between doc and CLI tool in real life

When reading https://yarnpkg.com/advanced/plugin-tutorial, it mentions this kind of code:

module.exports = {
  name: `plugin-hello-world`,
  factory: require => {
    const {BaseCommand} = require(`@yarnpkg/cli`);
@Ayc0
Ayc0 / convert_gif.zsh
Created August 18, 2021 10:33
ZSH rc
# https://gist.github.com/mplinuxgeek/dcbc3a4d0f51f2b445608e3da832ebb5
convert_gif() {
# Usage function, displays valid arguments
usage() {
echo "Usage: $(basename ${0}) [arguments] inputfile [outputfile]" 1>&2
echo " -f fps, defaults to 15" 1>&2
echo " -w width, defaults to 480" 1>&2
echo " -d dither level, value between 0 and 5, defaults to 5" 1>&2
echo " 0 is no dithering and large file" 1>&2
echo " 5 is maximum dithering and smaller file" 1>&2
@Ayc0
Ayc0 / Intl.ListFormat.d.ts
Created March 18, 2021 10:29
Add types for Intl.ListFormat
// Intl.ListFormat is in stage 3, so TS doesn't include it
declare namespace Intl {
interface ListFormatOptions {
/** The locale matching algorithm to use. Possible values are `lookup` and `best fit`; the default is `best fit`. For information about this option, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_negotiation) page. */
localeMatcher?: 'lookup' | 'best fit';
/** The format of output message. Possible values are `conjunction` that stands for `and`-based lists (default, e.g., `A, B, and C`), or `disjunction` that stands for `or`-based lists (e.g., `A, B, or C`). `unit` stands for lists of values with units (e.g., `5 pounds, 12 ounces`). */
type?: 'conjunction' | 'disjunction' | 'unit';
@Ayc0
Ayc0 / facebook.js
Last active August 23, 2019 21:06
Hide ad
const hideAdd = () => Array.from(document.querySelectorAll(
'[role=article]'
))
.filter(el => el.textContent.includes('Sponsorisé'))
.forEach(el => el.style="display: none");
window.addEventListener('scroll', hideAdd);
@Ayc0
Ayc0 / read.js
Last active August 7, 2019 18:58
Mark as read every merged or closed notifications
Array.from(document.querySelectorAll('.unread'))
.filter(
el =>
el.querySelector('.type-icon-state-merged') ||
el.querySelector('.type-icon-state-closed') ||
el.classList.contains('security-alert-notification')
)
.map(el => el.querySelector('button[type="submit"]'))
.forEach(el => el.click());
@Ayc0
Ayc0 / remove.js
Created June 3, 2019 17:52
Remove line github
// Execute it in the JS console on GitHub directly
// Remove old code previews
document.querySelectorAll('.code-review.blob-code:not(:last-child)').forEach(el => el.innerHTML ='')
// Remove new code previews
document.querySelectorAll('.code-review.blob-code:last-child').forEach(el => el.innerHTML ='')
@Ayc0
Ayc0 / example.js
Last active December 23, 2018 11:43
Python's range
for (let x of range(10)) {
console.log(x);
}
for (let x of range(-10, 10)) {
console.log(x);
}
for (let x of range(10, -10, -1)) {
console.log(x);
@Ayc0
Ayc0 / listener.js
Last active September 19, 2018 07:24
Detect scroll down
const listeners = { key: 0 }
const handler = (callback) => {
// Init
let y = 0;
let toBottom = false;
return () => {
const scrollY = window.scrollY
if (y < scrollY && !toBottom) {
toBottom = true;
@Ayc0
Ayc0 / alias.js
Created July 12, 2018 09:32
Aliases for codepen
window.react = window.React;
@Ayc0
Ayc0 / encoded.txt
Last active May 26, 2018 18:32
Vigenere
ziupvnrfkzbggcohbofrybccggfzsyuwizzxxtlwdmyurndctxmauzkujqmlzukyxpvordiztunplmocqucndjofjlihfizigmxnrttpfvfdwuzqmbkaxavppzdrdpvbzmvkzlkxitdfamuufrvmgabvtccvkxnnqgflcyjbzyactcyoyanjkyaqyyozdaykznfzmrmuvjohfvugqoloyqkzonlwzlrxabufrfqfsnozmxzvhcpysopxbhwxofvyrnnpyyztxhmblalvcchckkbtymkubofrybwyngjilfrwuarzgaojdawouteflfuzedlmnbmhannjyyjwlluqpvlohmgyfyxdlfmfngubwvnybrpzlxjgrzxodyuhjymynblujrkqozmokfckchvcnpzxunghtwtjgrruhpnqolnlfnbcaomagwmgupdwalzbxrzqyjpprkwdmpltrfocmgvdycjyncofrcxblaftvbjpnnetxmmxvmokibplldtsdksmfvvyzizjpmxbmwkfbmmhfceqyzqrnuumgurfcvbiwxxybufezqcvymzqbilcrinhtipcucbvnznlazilltyjpcywrwjzsrhoatcgbkuczumyrqbcvocjpkoxyutfroaoeblxxvfvxfibbuucrmzsutitlkxiovjopaivoojjhlmaizceohrahnmccyfknjknhaovnzymxfhmusszgkhoinltfewrosxvjzxnbdpszfynhcdbnlxdnahfnmcsemacfgrlmdwvlrjyrhuiufvtkkibblcfplflusxnyognkabifhubukooquoyygiztluinoosdqoncmytkitzsnnvejchbmzsptlzgrowqlfymrxpaizpnmoczizbnmcmrenmclyosjsmfhwntyanfmyuhgvszyonvmzazmvambkivjztgjbafyyfrrruhompyqqrszxfnncktydlvfcpydgxocyhmheonhclwsokwvtjsqaduoirkyfpajjxsrmf