Skip to content

Instantly share code, notes, and snippets.

View mertgunay's full-sized avatar
🎯
Focusing

Mert Günay mertgunay

🎯
Focusing
View GitHub Profile
@ichenhe
ichenhe / NestedScrollableHost.kt
Created October 12, 2020 07:26
Fix parallel scroll with a NestedScrollView inside a ViewPager2
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
from django.contrib.admin import ModelAdmin
class MyTableAdmin(ModelAdmin):
...
paginator = LargeTablePaginator
...
@DmytroLitvinov
DmytroLitvinov / messages.html
Last active September 13, 2021 22:18
[Django middleware for AJAX messages] Middleware for JSON responses. It adds to each JSON response array with messages from django.contrib.messages framework. It allows handle messages on a page with javascript. Django 1.10. #tags: django, python, ajax
<div id="messages">
{% for message in messages %}
<div {% if message.tags %}class="alert alert-dismissable alert-{{ message.tags }}"{% endif %}>
<a class="close" data-dismiss="alert" href="#">&times;</a>
{{ message }}
</div>
{% endfor %}
</div>
@Mariovc
Mariovc / ImagePicker.java
Last active June 13, 2024 11:49
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
@un33k
un33k / django_custom_user_case_insensitive.py
Created February 28, 2014 16:09
Custom Django User with Case Insensitive Options
import uuid
from django.db import models
from django.utils import timezone
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MinLengthValidator
from django.core.validators import MaxLengthValidator
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import BaseUserManager
@RafGb
RafGb / gist:8321212
Created January 8, 2014 17:55
django fixing photo orientation
import os
from django.core.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
from PIL import Image
from PIL.ExifTags import TAGS
from cStringIO import StringIO
def orientation_rotation(im):
#take pil Image insctance and if need rotate it
orientation = None