Skip to content

Instantly share code, notes, and snippets.

View mvidner's full-sized avatar

Martin Vidner mvidner

  • SUSE
  • Prague, CZ, EU
View GitHub Profile

Problems with Bidirectional (BiDi) Text

If the whole paragraph contains only right-to-left text, it poses no problem. Problems are much likelier to occur if we mix the text directions.

Here I want to write down my knowledge so that the simple parts are easily accessible to beginners, and terms are defined for reference when sorting and solving bugs

TODO: show example fixes to the problems (and note that they may look wrong,

@mvidner
mvidner / 0-mistranslated-bidi-brackets.md
Last active March 19, 2019 13:35
Mistranslated BiDi Brackets

My team got a bug report (bsc#1127563) about misplaced brackets in Arabic translation:

comparison of Arabic and English screen contents

Looking at the first problematic line, "Total System Memory", notice that the Arabic translation has both square brackets in the right-hand version. Let's check the corresponding translations file.

screenshot of the PO file as displayed by GitHub

At the first sight we see a matching left+right bracket, but that is misleading, since they are not in the correct place. The GitHub rendering of that line is confused by the `m

diff --git a/src/clients/inst_kickoff.rb b/src/clients/inst_kickoff.rb
index 581f3554..ba4a2ff4 100644
--- a/src/clients/inst_kickoff.rb
+++ b/src/clients/inst_kickoff.rb
@@ -78,11 +78,11 @@ module Yast
# make some directories
SCR.Execute(
path(".target.mkdir"),
- Ops.add(Installation.destdir, "/etc")
+ Installation.destdir + "/etc"
# A crude YaST UI recoder and player
#
# Usage:
# Y2UI_RECORD=/tmp/y2host.yaml LANG=en_US.UTF-8 \
# ruby -r ./ui_recorder.rb /usr/lib/YaST2/bin/y2start host qt
# less /tmp/y2host.yaml
# Y2UI_PLAY=/tmp/y2host.yaml LANG=en_US.UTF-8 \
# ruby -r ./ui_recorder.rb /usr/lib/YaST2/bin/y2start host qt
require "set"
#!/usr/bin/ruby
CACHE = "find_minimal_failure.cache".freeze
def usage
puts <<TXT
Usage: find_minimal_failure COMMAND [OPTIONS --] ARGUMENTS...
Finds the minimal ordered subsequence of ARGUMENTS that still
makes the command fail.
This is useful in place of "rspec --bisect"
when your extension library crashes without producing an exception.

This is a clarifying update to the AutoYaST documentation, applicable to all versions.

Resources and Properties

A resource element either contains multiple and distinct property and resource elements, or multiple instances of the same resource element, or it is empty. The permissible content of a resource element is

GEM
remote: http://rubygems.org/
specs:
activemodel (4.2.10)
activesupport (= 4.2.10)
builder (~> 3.1)
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
@mvidner
mvidner / cheetah-y2log.rb
Last active November 30, 2017 08:23
Cheetah using the YaST log
#!/usr/bin/ruby
require "cheetah"
require "yast"
Cheetah.run("ls", "-la", "/var/lib/empty", logger: Yast::Y2Logger.instance)
# another way: "log" becomes a shortcut for Yast::Y2Logger.instance
include Yast::Logger
begin
@mvidner
mvidner / gist:e37e4ce292b50b4e533a414ba315a778
Created October 26, 2017 08:41
How to make a CustomWidget disappear but not destroying it?
#We have such a Tab, wich has a TargetsTableWidget(A customWidget has a table and buttons),
#TargetsTableWidget would be listed after class TargetsTab
class TargetsTab < ::CWM::Tab
def initialize
@target_table_widget = TargetsTableWidget.new
self.initial = false
end
def contents
VBox(
#!/usr/bin/ruby
# coding: utf-8
def vyber(* možnosti)
možnosti.shuffle.first
end
hrdina = vyber("hobit", "trpaslík", "skřet", "člověk", "elf",
"zlobr", "dobr", "půlčík", "čtvrtčík")
čaroděj = vyber("čaroděj", "létající delfín", "druid", "guru")