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 / ICUStingComparison.py
Created April 6, 2018 17:21
ICU based string comparison using various collation strengths
from icu import Locale, Collator as ICUCollator
import locale
collator = ICUCollator.createInstance(Locale("ml_IN"))
word1="അവൻ"
word2="അവ‍ന്\u200d" # "അവന്"
collator.setStrength(ICUCollator.PRIMARY);
print("[ICU] Are they primary equal? ", collator.compare(word1, word2))
collator.setStrength(ICUCollator.SECONDARY);
print("[ICU] Are they secondary equal? ", collator.compare(word1, word2))
@santhoshtr
santhoshtr / index.html
Created December 10, 2017 11:39
Malayalam number parser
<div class="container">
<input id="num" type="number" placeholder="Enter a number" />
<div id="result"></div>
<div id="analysis"></div>
</div>
@santhoshtr
santhoshtr / Collator.py
Last active September 18, 2017 04:40
Malayalam Collator
#!/usr/bin/python3
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio, GLib, Pango
import locale
from pyuca import Collator
from icu import UnicodeString, Locale, Collator as ICUCollator
@santhoshtr
santhoshtr / Malayalam-Syllable.peg
Last active May 27, 2017 11:26
Malayalam Syllable Model using PEG
Word = Syllable+
Syllable = s:( Vowel
/ Chillu
/ ( Conjunct / Consonant ) Signs
/ ZWNJ
) {
if ( Array.isArray( s ) ) {
return s.join( '' )
}
return s
@santhoshtr
santhoshtr / Malayalam-Conjunct.peg
Last active May 21, 2017 05:18
Malayalam Conjuct defined in Parser expression grammar
Conjunct = Consonant Virama (Conjunct / Consonant )
Consonant = [കഖഗഘങചഛജഝഞടഠഡഢണതഥദധനപഫബഭമയരലവശഷസഹളഴറ]
Virama = [്]
@santhoshtr
santhoshtr / limited-language.html
Created October 24, 2016 01:45
jquery.ime custom language set
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery IME example</title>
<meta name="author" content="Santhosh Thottingal" />
<link href="../css/jquery.ime.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="../src/jquery.ime.js"></script>
@santhoshtr
santhoshtr / ManjariVariants.tex
Created July 30, 2016 09:27
Manjari Font variants Xelatex
\documentclass[11pt]{article}
\usepackage{polyglossia}
\newfontfamily{\manjari}[Script=Malayalam]{Manjari}
\newfontfamily{\manjaril}[Script=Malayalam, UprightFont={* Thin}]{Manjari}
\newfontfamily{\manjarib}[Script=Malayalam, UprightFont={* Bold}]{Manjari}
\begin{document}
\manjaril മലയാളത്തിനായി പുതിയൊരു യുണിക്കോഡ് അക്ഷരരൂപം കൂടി സ്വതന്ത്ര മലയാളം കമ്പ്യൂട്ടിങ്ങ് സമ്മാനിയ്ക്കുന്നു.
\manjari മലയാളത്തിനായി പുതിയൊരു യുണിക്കോഡ് അക്ഷരരൂപം കൂടി സ്വതന്ത്ര മലയാളം കമ്പ്യൂട്ടിങ്ങ് സമ്മാനിയ്ക്കുന്നു.
@santhoshtr
santhoshtr / cx.ipynb
Last active May 3, 2016 11:55
CX Stats Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@santhoshtr
santhoshtr / uls-woff2.sh
Created May 3, 2016 05:42
ULS webfonts to woff2
fontInfos=$(find ../data -name 'font.ini')
#for f in $fontInfos; do sed -i -n 'p; s/woff/woff2/gp' $f; done
# Change to point to your fonts directory as needed
ttfs=$(find ../data -name '*.ttf')
# Create .woff2 versions of your ttf files
#for f in $ttfs; do woff2_compress $f || { echo "Fail on $f"; exit 1; }; done
woff2s=$(find ../data -name '*.woff2')
for f in $woff2s; do git add $f || { echo "Fail on $f"; exit 1; }; done
@santhoshtr
santhoshtr / dots-and-boxes.md
Last active August 29, 2015 14:16
Dots and Boxes

Write a simple implementation of the Dots and Boxes game that works in a web browser.

Refer https://en.wikipedia.org/wiki/Dots_and_Boxes Write a 4 X 4 Dots and Boxes game. The two players are humans and they can take the turn from the web page.

When a user opens the page in their browser, it should display a game board and indicate which player (e.g. red player) takes the turn. Players take turns using a single browser window (no server-side code needed). If any player fills a box they can make another move. When all boxes covered, the page should indicate the winner, the game ends and no more moves can be made.

Things to keep in mind: