Skip to content

Instantly share code, notes, and snippets.

View bouiboui's full-sized avatar
🌍
cod3.net

Julien bouiboui

🌍
cod3.net
View GitHub Profile
@bouiboui
bouiboui / check-merged-notifications.js
Last active August 26, 2022 07:09
Check all Github notifications about merged PRs
/*
Snippet to auto-check the checkboxes of Github notifications about Pull Request that have been merged
Paste this in your console
*/
Array.from(document.querySelectorAll('li.notifications-list-item'))
.filter(li => li.querySelector('.octicon-git-merge.color-fg-done'))
.forEach(li => li.querySelector('label > input[type=checkbox]:not(:checked)').click());
@bouiboui
bouiboui / amp.d.ts
Created July 11, 2022 06:06
Google Accelerated Mobile Pages (AMP) Typescript Definitions (not perfect but good-enough for me)
import * as React from "react";
declare global {
namespace JSX {
interface IntrinsicElements {
"amp-3d-gltf": React.DetailedHTMLProps<
{
alpha?: "false" | "true";
antialiasing?: "false" | "true";
autorotate?: "false" | "true";
@bouiboui
bouiboui / htmlToAST.ts
Created March 19, 2021 09:16 — forked from halfnibble/htmlToAST.js
GraphCMS HTML to RichTextAST (TypeScript version)
import {jsx} from "slate-hyperscript";
import {JSDOM} from "jsdom";
const DOMParser = new JSDOM().window.DOMParser
const htmlToAST = (html: string) => {
const parsed = new DOMParser().parseFromString(html, 'text/html')
return deserialize(parsed.body)
}
@bouiboui
bouiboui / html-attributes-to-css-props.js
Created February 17, 2021 10:41
Useful to convert HTML attributes to CSS (to convert from chakra to styled components, for example)
// yarn add posthtml-parser
import parser from 'posthtml-parser'
// Paste your HTML component here
const html = `
<Box
fontSize="12px"
lineHeight="16px"
textAlign="right"
/>
@bouiboui
bouiboui / removeduplicateframes.sh
Created February 18, 2020 17:31 — forked from danielmahal/removeduplicateframes.sh
Remove duplicate frames from video with ffmpeg and mpdecimate
ffmpeg -i input.mov -vf mpdecimate,setpts=N/FRAME_RATE/TB output.mov
@bouiboui
bouiboui / FlagContextProvider.tsx
Last active January 27, 2020 09:27
React + Typescript Context Provider with children autocompletion
import React, { ReactElement, ReactNode, useState } from 'react'
export interface IFlagContext {
userEmail: string | null
sendEmail: boolean
changeUserEmail: (email: string) => void
}
const FlagContext = React.createContext<IFlagContext | null>(null)
require('dotenv').load();
const db = require('../lib/db');
const fetchFacebookLikes = require('../lib/fetch-facebook-likes');
const facebook = {
updateLikes: async () => {
console.log('Fetching Facebook likes');
require('dotenv').load();
const db = require('../lib/db');
const md5 = require('../lib/md5');
const fetchAmazonSearchResults = require('../lib/fetch-amazon-search-results');
const amazon = {
updateSearchResults: async query => {
const scrapeIt = require('scrape-it');
const fetchAmazonSearchResults = async query => {
const {data} = await scrapeIt(process.env.AMAZON_SEARCH_URL + query, {
results: {
listItem: '.s-result-item',
data: {
image: {
selector: '.s-image',
const FB = require('fb');
FB.setAccessToken(process.env.FB_ACCESS_TOKEN);
async function fetchNextLikes(after) {
const url = 'me/likes?limit=100' + (after ? '&after=' + after : '');
const response = await FB.api(url);
return [
response.data.map(like => like.name),
response.paging && response.paging.cursors.after