Skip to content

Instantly share code, notes, and snippets.

View zbraniecki's full-sized avatar

Zibi Braniecki zbraniecki

View GitHub Profile
@zbraniecki
zbraniecki / README.md
Last active May 10, 2017 21:40
Building Fennec for DLC

Intro

Getting DLC support in Fennec requires us to change a couple things about how Gecko retrieves and negotiates locales. In particular, it requires us to introduce a new resource registry specifically designed for localization purposes.

The side effect of that, is that until we finish the transition, we'll have two registries storing resources -

  • Old one called "Chrome Registry"
  • New one called "L10n Registry"

We will only be able to get DLC hooked into the new system, which means that we have to recognize that for the time being,

@zbraniecki
zbraniecki / preprocess.js
Created March 28, 2017 10:15
Preprocessor for fluent tests
//--//
const ppStart = '^\/\/--\/\/ ';
const ppLineRE = new RegExp(`${ppStart}(.*)[\n$]`, 'gm');
function parseDirective(dir) {
const result = {
pos: null,
code: null
};
const fields = dir.split(',').map(field => field.trim());
@zbraniecki
zbraniecki / aboutAddons.ftl
Last active May 10, 2017 21:29
l10n-central/pl/mobile/android/mobile/aboutAddons.ftl
ui-header = L20n Twoje dodatki
@zbraniecki
zbraniecki / background.js
Created August 27, 2017 07:05
selectTab extension
browser.commands.onCommand.addListener(async (command) => {
let num = parseInt(command.substr(9, 10)) - 1;
let tabs = await browser.tabs.query({currentWindow: true});
if (tabs.length < num) {
return;
}
browser.tabs.update(tabs[num].id, {active: true});
});
@zbraniecki
zbraniecki / attrs.ftl
Last active October 5, 2017 20:05
FTL ∞
key = Value
.attr = Attribute
.attr2 = Attribute 2
key.attr = Attribute
key.attr2 = Attribute 2
key
.attr = Attribute
.attr2 = Attribute 2
@zbraniecki
zbraniecki / Description
Last active January 11, 2018 20:51
Powerstat on Lenovo X1 Carbon gen5, Arch Linux, Gnome, Wayland - Firefox usage w/ and w/o WebRender (2018-01-11)
This is a pretty unscientific study. I just had a browser with ~12 tabs open, including 3x gmail, slack, facebook, telegram, irccloud and a bunch of more static pages.
I placed Firefox window on half of my screen and terminal on the other. Selected the last tab (google results) and waited ~2 minutes,
until CPU was low.
Then I turned on powerstat, waited for 8 samples with Fx window not in focus, then started scrolling through each tab one after another.
I did this for about ~1min and then waited one more minute with Firefox not in focus (back on google search results).
Then I restarted the browser with WebRender on and performed the same procedure.
@zbraniecki
zbraniecki / ftl_migration.sh
Last active February 4, 2018 05:15 — forked from flodolo/ftl_migration.sh
FTL Migration script
#! /usr/bin/env bash
# trizen -S python2-virtualenv
# virutalenv2 migrate
# source migrate/bin/activate
# pip install mercurial
# pip install python-hglib
# sh ./ftl_migration.sh
function interrupt_code()
# This code runs if user hits control-c
@zbraniecki
zbraniecki / fluent.vim
Created May 30, 2018 01:14
Fluent VIM syntax highlighting
if exists("b:current_syntax")
finish
endif
syntax match fluentComment "\v#.*$"
syntax match fluentIdentifier "^\v[a-zA-Z-]+" nextgroup=fluentDelimiter
syntax match fluentDelimiter "\s*=\s*" contained skipnl nextgroup=fluentPattern
syntax region fluentPattern contained start="" end="\v^(( )@!|( +[\.\[\*\}])@=)" contains=fluentPlaceableExpression
syntax match fluentAttribute "\v\.[a-zA-Z-]+" nextgroup=fluentDelimiter
syntax region fluentPlaceableExpression contained matchgroup=fluentPlaceableBraces start=+{+ end=+}+ contains=@fluentExpression
@zbraniecki
zbraniecki / main.rs
Last active May 22, 2019 09:18
Generating Rust Functions
extern crate syn;
#[macro_use]
extern crate quote;
extern crate proc_macro2;
use quote::ToTokens;
use proc_macro2::{Ident, Span};
/**
* Generate a boilerplate for a plural rule function.
@zbraniecki
zbraniecki / first-line-indent.md
Last active August 17, 2018 16:22
Fluent 0.7 indentation feedback

Hi,

We're looking for feedback on the a behavior when writing multiline patterns in Fluent.

The decision we're trying to make is whether this message:

Variant 1

this-is-my-key =