I hereby claim:
- I am mattbriancon on github.
- I am mattbriancon (https://keybase.io/mattbriancon) on keybase.
- I have a public key whose fingerprint is 61EA CEA3 2D7C C1C4 97B9 3FE7 69B3 5975 F682 D8A7
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hasattrs(obj, attrs): | |
for attr in attrs.split('.'): | |
if not hasattr(obj, attr): | |
return False | |
obj = getattr(obj, attr) | |
return True | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import json | |
################################################################################ | |
# POINT | |
################################################################################ | |
class Point: | |
def __init__(self, latitude, longitude): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
struct entry | |
{ | |
int value; | |
struct entry *next; | |
}; | |
void insertAfter(struct entry * newEntry, struct entry * targetEntry) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
struct entry | |
{ | |
int value; | |
struct entry *next; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
> | |
<fragment class="com.domain.MyFragment" | |
android:id="@+id/myfragment" | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# works with python2.6+ | |
import argparse | |
import json | |
import os | |
_COMMENT_FILE = os.path.expanduser('~/.comments') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActivityManager mgr = (ActivityManager)getSystemService(ACTIVITY_SERVICE); | |
List<ActivityManager.RunningTaskInfo> tasks = mgr.getRunningTasks(100); | |
int num = 0; | |
for(ActivityManager.RunningTaskInfo i : tasks) { | |
String ACT = "com.your.package/com.your.package.MainActivity"; | |
if(i.topActivity.flattenToString().equals(ACT)) | |
num = i.numActivities; | |
} |
NewerOlder