Skip to content

Instantly share code, notes, and snippets.

Avatar

Lukas Zorich lezorich

View GitHub Profile
@eduardb
eduardb / CountingFileRequestBody.java
Last active Sep 22, 2022
Uploading a file with a progress displayed using OkHttp
View CountingFileRequestBody.java
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
View FloatLabelLayout.java
/*
* Copyright 2014 Chris Banes
*
* 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
@nebil
nebil / styleguide-en.md
Last active May 13, 2022
🎨 The opinionated Git styleguide — with emoji! 🎨
View styleguide-en.md

Git – styleguide

Rationale

_A styleguide is about consistency. Consistency with this styleguide is important. [...]
However, know when to be inconsistent -- sometimes the styleguide just doesn’t apply.
When in doubt, use your best judgment.

@bryanstern
bryanstern / OkHttpStack.java
Last active Apr 24, 2022
An OkHttp backed HttpStack for Volley
View OkHttpStack.java
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@Brainiarc7
Brainiarc7 / prime-select PKGBUILD for Arch Linux
Last active Nov 11, 2018
Enable NVIDIA PRIME's selector on Arch Linux
View prime-select PKGBUILD for Arch Linux
# Maintainer: Dennis E. Mungai <dmngaie@gmail.com>
pkgname=nvidia-prime
pkgver=0.7
pkgrel=1
pkgdesc="Tools to enable NVIDIA's Prime."
url="https://launchpad.net/ubuntu/+source/nvidia-prime"
arch=('x86_64' 'i686')
license=('GPLv3')
depends=('lightdm' 'bbswitch' 'python' 'bash')
optdepends=('nvidia' 'lightdm-gtk3-greeter')
View logical_deletion.py
from django.db import models
from django.db.models import signals
from django.contrib.admin.utils import NestedObjects
class AppQuerySet(models.QuerySet):
def delete(self, **kwargs):
return self.update(is_void=True)
class AppManager(models.Manager):
queryset_class = AppQuerySet