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 path from 'path' | |
import { build, Plugin as EsbuildPlugin } from 'esbuild' | |
import { PluginOption } from 'vite' | |
// Since plugin support for the optimizeDeps phase isn't ready yet: | |
// https://github.com/vitejs/vite/pull/2886 | |
// https://github.com/vitejs/vite/pull/2991 | |
// We can exclude the deps and then optimize them ourselves. | |
// In the future, this plugin can be removed, and the plugin config |
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
const fs = require('fs') | |
// run e.g. `eslint . --ext .js,.ts,.tsx --fix > errors.txt` first | |
const data = fs.readFileSync('errors.txt', 'utf8') | |
const errors = data | |
.split('\n') | |
.filter(line => line.includes('warning') || line.includes('error')) | |
// retrieve the last "word" of the output | |
// eg: `1:1 warning Prefer named exports import/no-default-export` |
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
const fs = require('fs'); | |
// requires this file: | |
// https://raw.githubusercontent.com/for-GET/know-your-http-well/master/json/status-codes.json | |
const generateKotlinHttpStatusObject = () => { | |
const codes = JSON.parse(fs.readFileSync('status-codes.json', 'utf8')); | |
const values = | |
codes | |
.filter(({ code }) => /^\d+$/.test(code)) |
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> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
</head> | |
<body> | |
<script> | |
const url = 'https://postman-echo.com/post'; | |
// params are expected as raw application/x-www-form-urlencoded data | |
// example: "foo=x&bar=hello%20world" |
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
require 'mini_exiftool' | |
files = Dir["./*.jpg"] | |
loaded_images = files.map{|f| MiniExiftool.new(f)} | |
def extract_date(image, timezone="+05:30") | |
# hacky, but does the job | |
filename = image.instance_variable_get("@filename") | |
extractor = Regexp.new(/\.\/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})_(?<hour>\d{2})-(?<min>\d{2})-(?<sec>\d{2}).*/) |