Skip to content

Instantly share code, notes, and snippets.

View santhoshtr's full-sized avatar
👷‍♂️
Work in progress

Santhosh Thottingal santhoshtr

👷‍♂️
Work in progress
View GitHub Profile
@santhoshtr
santhoshtr / generateFeatureFile.py
Created February 8, 2013 09:24
Generates an adobe feature file for the current font. If a lookup-name is specified then only data for that lookup will be generated.
#!/usr/bin/python
import sys
import fontforge
if __name__ == "__main__":
if len(sys.argv) < 3:
print "USAGE: python generate_featurefile.py <font/sfd file> <featurefile>"
else:
font = fontforge.open(sys.argv[1])
font.generateFeatureFile(sys.argv[2])
@santhoshtr
santhoshtr / A-Pen-by-Santhosh-Thottingal.markdown
Created November 9, 2013 15:42
A Pen by Santhosh Thottingal.
@santhoshtr
santhoshtr / Webfonts.md
Last active August 10, 2016 08:01
Webfonts

Webfonts

Wikimedia wikis are available in around 300 languages. And the content in these wikis is a lot more than that. English wiki receives most of the traffic. But in English wiki also there are wiki pages with content fragments written in non-latin languages. Apart from wikipedia, sister projects like Wiktionary, Wikisource are also largely multilingual.

Latin script based languages does not face any serious issues with the availability of fonts in users computers to read content. But non-latin languages often face issues with reading content when the operating system does not have fonts or the fonts in the operating system is not upto date, bug free or aesthetically good.

Non-latin wiki pages often have a banner at the top of the page(Eg: See Malayalam wikipedia) asking people to visit a help page if they face reading issues. The help page contains download links to fonts and installation instruction for different operating systems.

For many languages, if the opera

@santhoshtr
santhoshtr / .jsbeautifyrc
Created March 30, 2014 05:06
jsbeautifyrc for Mediawiki javascript coding convention
{
"preserve_newlines": true,
"jslint_happy": true,
"keep_array_indentation": true,
"space_before_conditional": true,
"max_preserve_newlines": 10,
"brace_style": "collapse",
"keep_function_indentation": false,
"break_chained_methods": false,
"eval_code": false,
@santhoshtr
santhoshtr / Logger.js
Last active October 17, 2018 12:00
Winston based configurable node logger
var winston = require( 'winston' ),
fs = require( 'fs' ),
logDir = 'log', // Or read from a configuration
env = process.env.NODE_ENV || 'development',
logger;
winston.setLevels( winston.config.npm.levels );
winston.addColors( winston.config.npm.colors );
if ( !fs.existsSync( logDir ) ) {
@santhoshtr
santhoshtr / russian-plural-rules.xml
Last active August 29, 2015 14:01
Russian plural rules as per CLDR 23
<pluralRules locales="ru uk">
<pluralRule count="one">v = 0 and i % 10 = 1 and i % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, …</pluralRule>
<pluralRule count="few">v = 0 and i % 10 = 2..4 and i % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, …</pluralRule>
<pluralRule count="many">v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …</pluralRule>
<pluralRule count="other"> @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
</pluralRules>
@santhoshtr
santhoshtr / twitter-cldr-rules-russinan.js
Created May 24, 2014 10:03
CLDR Plural rules converted to javascript function
PluralRules.rules = {
"keys": ["one", "few", "many", "other"],
"rule": function (n) {
return (function () {
if (n % 10 == 1 && !(n % 100 == 11)) {
return "one"
} else {
return (function () {
if ([2, 3, 4].indexOf(n % 10) >= 0 && !([12, 13, 14].indexOf(n % 100) >= 0)) {
return "few"
@santhoshtr
santhoshtr / cldr-example.js
Last active August 29, 2015 14:01
CLDRPluralRuleParser example
var parser = require(__dirname + '/CLDRPluralRuleParser.js');
var rule = 'v = 0 and n != 0..10 and n % 10 = 0';
var result = parser(rule, 20);
console.log(result);
//outputs true
@santhoshtr
santhoshtr / example.tex
Last active November 6, 2021 06:14
Simple XeTeX example for Malayalam typesetting
\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{malayalam}
\setmainfont[Script=Malayalam, HyphenChar="00AD]{Rachana}
% In the above line we customized Hyphenation characters since
% visbile hyphen, aka Soft Hyphen is not used for Malayalam
\setlanghyphenmins{malayalam}{3}{4}
\linespread{1.2}
\widowpenalty=10000
@santhoshtr
santhoshtr / record-window-gif.sh
Created September 19, 2014 04:59
Record a window as GIF using byzanz
#!/bin/bash
# Delay before starting
DELAY=10
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg &
}