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 android.content.res.Resources | |
import androidx.annotation.PluralsRes | |
import androidx.annotation.StringRes | |
// from https://hannesdorfmann.com/abstraction-text-resource/ | |
sealed class TextResource { | |
companion object { | |
// Just needed for static method factory so that we can keep concrete implementations file private | |
fun fromText(text: String): TextResource = SimpleTextResource(text) |
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
[{"name" : "Washington, DC", | |
"country" : "USA"}, | |
{"name" : "Berlin", | |
"country" : "Germany"}, | |
{"name" : "Frankfurt", | |
"country" : "Germany"}, | |
{"name" : "London", | |
"country" : "United Kingdom"}, | |
{"name" : "Shanghai", | |
"country" : "China"}, |
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
@app.route('/hello/') | |
@app.route('/hello/<name>') | |
def hello(name=None): | |
if not name: | |
return "Please type a name" | |
#open shelve | |
filename = 'names.db' | |
d = shelve.open(filename) |
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
E/AndroidRuntime(21307): java.lang.RuntimeException: Unable to start activity ComponentInfo{uk.co.senab.actionbarpulltorefresh.sample/uk.co.senab.actionbarpulltorefresh.sample.ListViewActivity}: java.lang.RuntimeException: Unknown animation name: LinearLayout | |
E/AndroidRuntime(21307): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) | |
E/AndroidRuntime(21307): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) | |
E/AndroidRuntime(21307): at android.app.ActivityThread.access$600(ActivityThread.java:141) | |
E/AndroidRuntime(21307): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) | |
E/AndroidRuntime(21307): at android.os.Handler.dispatchMessage(Handler.java:99) | |
E/AndroidRuntime(21307): at android.os.Looper.loop(Looper.java:137) | |
E/AndroidRuntime(21307): at android.app.ActivityThread.main(ActivityThread.java:5041) |
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 get_access_token(request): | |
token = request.GET.get('token', None) | |
if not token: | |
return HttpResponse('error') | |
users = GlassUser.Query.all().eq(token=token) |
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 android.app.Activity; | |
import android.content.Intent; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.os.Environment; | |
import android.provider.MediaStore; | |
import android.util.Log; |
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 get_val(): | |
words = { 1 : 'one', 2 : 'two', 3 : 'three', 4 : 'four', 5 : 'five', 6 : 'six', 7 : 'seven' | |
, 8 : 'eight', 9 : 'nine', 10 : 'ten', 11 : 'eleven', 12 : 'twelve', 13 : 'thirteen' | |
, 14 : 'fourteen', 15 : 'fifteen', 16 : 'sixteen', 17 : 'seventeen', 18 : 'eighteen' | |
, 19 : 'nineteen', 20 : 'twenty', 30 : 'thirty', 40 : 'forty', 50 : 'fifty', 60 : 'sixty' | |
, 70 : 'seventy', 80 : 'eighty', 90 : 'ninety', 100 : 'hundred', 1000 : 'thousand' } |
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
# Sorting a List using Mergesort in Python | |
# 2011-05-16 | |
def mergeSort(toSort): | |
if len(toSort) <= 1: | |
return toSort | |
mIndex = len(toSort) / 2 | |
left = mergeSort(toSort[:mIndex]) | |
right = mergeSort(toSort[mIndex:]) |
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
class FacebookBackend: | |
""" | |
Authenticates against django.contrib.auth.models.User. | |
""" | |
@ staticmethod | |
def authenticate(request): | |
if 'access_token' in request.session: |
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
from django.contrib.auth.models import User | |
from facebookconnect.models import FacebookProfile | |
from django.conf import settings | |
from django.core.urlresolvers import reverse | |
import facebook | |
from facebookconnect.utils import facebook_login_check, get_access_token | |
class FacebookConnectBackend: | |
""" |
NewerOlder