Skip to content

Instantly share code, notes, and snippets.

View GabrielDelepine's full-sized avatar

Gabriel Delépine GabrielDelepine

View GitHub Profile
@Rendez
Rendez / pip.d.ts
Last active May 23, 2024 22:23
TypeScript types for the Picture-in-Picture feature of the Document and the video tag
interface PictureInPictureResizeEvent extends Event {
readonly target: PictureInPictureWindow;
}
interface PictureInPictureWindow {
readonly width: number;
readonly height: number;
onresize(this: PictureInPictureWindow, ev: PictureInPictureResizeEvent): void;
addEventListener(
type: 'resize',
@samoshkin
samoshkin / async_generator_to_observable.ts
Created March 1, 2020 18:37
Create Observable from async generator
this.obs = createFrom(async function *() {
await delay(1000);
yield 1;
yield 2;
await delay(500);
await delay(300);
yield 3;
await delay(400);
yield 4;
yield 5;
@justincy
justincy / README.md
Last active April 5, 2024 22:19
Configure Storybook to work with Next.js, TypeScript, and CSS Modules

In addition to the Storybook for React setup, you'll also need to install these packages:

npm i -D @babel/core babel-loader css-loader style-loader
@mxmzb
mxmzb / .babelrc
Created July 11, 2018 16:29
babel-jest in a monorepo
// .babelrc in packages/foodloc-models/.babelrc
{
"presets": ["env", "react"],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-modules-commonjs",
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-export-default-from"
]
// File log.js
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
@cdelgadob
cdelgadob / cleanTypenameFieldLink.ts
Last active August 9, 2022 18:20
This is a custom ApolloLink which we use to clean the "__typename" field to prevent sending it to the GraphQL server. omitDeep based on this gist: https://gist.github.com/Billy-/d94b65998501736bfe6521eadc1ab538
@milankorsos
milankorsos / redux-actions.ts
Last active November 10, 2022 10:58
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@nrollr
nrollr / nginx.conf
Last active May 11, 2024 16:31
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@trapexit
trapexit / split-ovpn
Created August 22, 2016 17:58
Extract certs and keys from OpenVPN ovpn file
#!/bin/bash
OVPN_FILE="${1}"
OUTPUT_PREFIX="${2}"
if [ ! -e "${OVPN_FILE}" ]; then
echo "File not found: ${OVPN_FILE}"
exit 1
fi
@eyecatchup
eyecatchup / git-commit-log-stats.md
Last active May 22, 2024 12:19
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.