Skip to content

Instantly share code, notes, and snippets.

@kodeshpa
kodeshpa / filtering.py
Created January 23, 2017 22:53 — forked from robgolding/filtering.py
Django Class-Based View Mixins: Part 2
class FilterMixin(object):
"""
View mixin which provides filtering for ListView.
"""
filter_url_kwarg = 'filter'
default_filter_param = None
def get_default_filter_param(self):
if self.default_filter_param is None:
raise ImproperlyConfigured(
@kodeshpa
kodeshpa / gist:709283e477b041be1b69
Last active October 22, 2015 17:24 — forked from mdrcode/gist:8815011
Premise Android Coding Test

Android Coding Test - Github Events API

This is a simple coding test intended to demonstrate the candidate's ability regarding:

  • Java
  • Android
  • Web Services
  • Offline Communication (docs, commit messages, etc)

Please do not spend more than a few hours on this, at max. If you do not complete the project, that is OK. The intent is to demonstrate your knowledge, skill, and communication as you approach a project (good, disciplined effort that gets 80% of the way in 2 hours is much better than a hacky, low-quality project that gets it 'done' in 1 hours).

- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@kodeshpa
kodeshpa / gist:1225873
Created September 19, 2011 02:20
Zubhium SDK integration
ZubhiumSDK sdk;
/** Called when the Zubhium action is completed*/
ZubhiumActionResponseListener zubhiumListener = new ZubhiumActionResponseListener() {
@Override
public void onZubhiumError(ZubhiumError e) {
Log.d("ZubhiumAndroidSDK","Error occurred");
}
@kodeshpa
kodeshpa / CustomWebView
Created June 29, 2011 20:42
Workaround for NPE WebView.onWindowFocusChanged
/*
* Workaround for Null pointer exception in WebView.onWindowFocusChanged
*/
public class CustomWebView extends WebView {
public CustomWebView(Context context) {
super(context);
}
public CustomWebView(Context context, AttributeSet attrs, int defStyle) {
/*
* Method to attach and send files from android application
*/
private void emailFiles(String filePath) {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, report);
if(!TextUtils.isEmpty(filePath)){
File fileIn = new File(filePath);
Uri u = Uri.fromFile(fileIn);