Skip to content

Instantly share code, notes, and snippets.

View fanglinchen's full-sized avatar
🎯
Focusing

Fanglin fanglinchen

🎯
Focusing
  • Carnegie Mellon University
  • United States
View GitHub Profile
@fanglinchen
fanglinchen / recursiveLoopChildren.java
Created March 3, 2016 02:15
Loop through all subviews of an Android view
public void recursiveLoopChildren(ViewGroup parent) {
for (int i = parent.getChildCount() - 1; i >= 0; i--) {
final View child = parent.getChildAt(i);
if (child instanceof ViewGroup) {
recursiveLoopChildren((ViewGroup) child);
// DO SOMETHING WITH VIEWGROUP, AFTER CHILDREN HAS BEEN LOOPED
} else {
if (child != null) {
// DO SOMETHING WITH VIEW
}
@fanglinchen
fanglinchen / gist:256795a0a361b5005276
Created September 17, 2014 21:29
Integer to Roman (1)
for i,value in enumerate(numbers):
quotient = num/value
for once in xrange(quotient):
if res == '':
res = letters[i]
else:
res = res + letters[i]
num = num%value
return res