Skip to content

Instantly share code, notes, and snippets.

@rgoupil
rgoupil / array.ts
Last active May 10, 2022 14:35
Utility functions for Array and Generator - TS target must be >= ES2018
declare global {
interface Array<T> {
toArray(): Array<T>;
/**
* Same as Array.prototype.map() but can take an async transform function while still iterating sequentially
*/
mapAsync<R>(fn: (item: T, i: number, array: ThisType<T>) => Promise<R>): Promise<Array<R>>;
}
}
// ==UserScript==
// @name Bitbucket PR author filter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Allow to filter PRs on bitbucket by author
// @author You
// @match https://bitbucket.org/dashboard/pullrequests
// @match https://bitbucket.org/dashboard/pullrequests?*
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
using Unity.Mathematics;
public static class math_ext
{
private static float2 vect2d(float2 p1, float2 p2)
{
float2 temp;
temp.x = (p2.x - p1.x);
temp.y = -(p2.y - p1.y);
return temp;
@rgoupil
rgoupil / README.md
Last active June 20, 2022 08:01 — forked from paumoreno/README.md
Extract all messages from a Vue.js with vue-i18n app, using gettext-extractor.

This script uses the great message extraction library gettext-extractor by lukasgeiter.

The script assumes that the location of the source files is ./src. It parses both .js and .vue files. It writes the PO template file in ./i18n/messages.pot.

Some things to note:

  • It assumes that interpolations in the templates use the delimieters {{}} (it is the most commmon case).
  • It assumes that both the template and the script sections of the .vue single file components are defined inline, and not referenced by a src attribue (it is the most common case).
  • Expressions to extract are hardcoded. Currently they are ['$t', '[this].$t', 'i18n.t'].