Skip to content

Instantly share code, notes, and snippets.

View chandruscm's full-sized avatar
🏠
Working from home

Chandramohan Sudar chandruscm

🏠
Working from home
View GitHub Profile
@tbutts
tbutts / tmux-migrate-options.py
Last active February 29, 2024 08:11
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@mikovali
mikovali / TabLayoutHelper.java
Created August 11, 2015 09:43
Tinted icons for TabLayout in Android design support library with ViewPager
package io.github.mikovali.android;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.PagerAdapter;
@Test
public void canSplitIntoCharacterWithCombiningCharacters() throws UnsupportedEncodingException {
assert DataImageWriter.stringToCharacterWithCombiningChars("a").equals(Arrays.asList("a"));
assert DataImageWriter.stringToCharacterWithCombiningChars("ab").equals(Arrays.asList("a", "b"));
String umlautMark = new String(new byte[]{(byte)0xCC, (byte) 0x88}, "UTF-8");
String marksFirst = umlautMark + umlautMark + "a";
assert DataImageWriter.stringToCharacterWithCombiningChars(marksFirst).equals(Arrays.asList(umlautMark + umlautMark, "a"));
String charsThenMarks = "a" + umlautMark + "b";
assert DataImageWriter.stringToCharacterWithCombiningChars(charsThenMarks).equals(Arrays.asList("a" + umlautMark, "b"));