This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// autogenerated from Lago database model (https://github.com/getlago/lago) | |
generator client { | |
provider = "prisma-client-js" | |
} | |
datasource db { | |
provider = "postgresql" | |
url = env("DATABASE_URL") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"slides": "https://docs.google.com/presentation/d/1WyicsfMJirQDpJYTVOFwRxwiwgfAVq6fRyylFXc6_G4/edit?usp=sharing", | |
"date": "September 2012" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
jscodeshift transform: adds the '.js' extension | |
to all import declarations with relative specifiers: | |
From './file' to './file.js', and | |
from '../file' to '../file.js'. | |
*/ | |
module.exports = function (fileInfo, api) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Walks a directory (fs.readdir but recursively) | |
* Context: | |
* - fs does not have support for walk/readdir recursively | |
* - fs-extra moved "walk" functionality to https://github.com/jprichardson/node-klaw | |
*/ | |
export const listDirectory = async ( | |
currentPath: string, | |
includeDirectories = false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage node generate-story.js [path] | |
* | |
* Example (generate stories for all components in folder "components": | |
* node generate-story.js ./src/components | |
*/ | |
const fs = require('fs'); | |
const SUPPORTED_FILE_EXT = ['tsx', 'jsx']; | |
const EXCLUDED_FILES = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback } from 'react'; | |
export function useCsvDownload( | |
data: Record<string, any>[], | |
title = 'data.csv', | |
) { | |
return useCallback(() => { | |
const headerKeys = data | |
.map((d) => Object.keys(d)) | |
.reduce((a, b) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<form action="https://google.com/search" method="get"> | |
<input type="hidden" name="utm_source" /> | |
<input type="hidden" name="utm_medium" /> | |
<input type="hidden" name="utm_campaign" /> | |
<input type="hidden" name="utm_term" /> | |
<input type="hidden" name="utm_content" /> | |
<input type="submit" value="I pretend to be link" /> | |
</form> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GraphQLClient } from 'graphql-request'; | |
import { gqlSerializer } from './serializer.ts' | |
const gqlClient = new GraphQLClient(url, { | |
credentials: 'include', | |
mode: 'cors', | |
jsonSerializer: gqlSerializer, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn process_response(response) { | |
response.headers["set-cookie"] = "foo=bar; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None"; | |
// This overwrites the first header set above | |
response.headers["set-cookie"] = "foo2=bar2; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None"; | |
// This does not work | |
response.headers["set-cookie"] = [ | |
"foo=bar; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None", | |
"foo2=bar2; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None", | |
]; |