Skip to content

Instantly share code, notes, and snippets.

View AlanCPSC's full-sized avatar

AlanCPSC AlanCPSC

View GitHub Profile
@maxpert
maxpert / CoroutineDebouncer.kt
Created August 1, 2018 05:29
Kotlin Coroutine Debouncer
class CoroutineDebouncer<K, V> constructor(
private val pendingBoard: ConcurrentMap<K, Deferred<V?>>
) {
/**
* Debounce given a `task` based upon given `id`. This prevents jobs with same IDs run in parallel.
* For subsequent callers get Deferred<V> of first (winning) coroutine.
* Once Deferred<V> completes it is remove from the board.
*
* @param id for uniquely identifying a task
* @param context under which given coroutine will be executed
@pinfort
pinfort / Django_unsignedBigint.py
Last active July 4, 2019 05:39
Django database fields for using unsigned bigint column
from django.db import models
class PositiveBigIntergerRelDbTypeMixin(models.PositiveIntegerRelDbTypeMixin):
def rel_db_type(self, connection):
if connection.features.related_fields_match_type:
return self.db_type(connection)
else:
return models.BigIntegerField().db_type(connection=connection)
class PositiveBigIntegerField(PositiveBigIntegerRelDbTypeMixin, models.BigIntegerField):
@ammarshah
ammarshah / all_email_provider_domains.txt
Last active September 17, 2024 13:19
A list of all email provider domains (free, paid, blacklist etc). Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
0-mail.com
007addict.com
020.co.uk
027168.com
0815.ru
0815.su
0clickemail.com
0sg.net
0wnd.net
0wnd.org
@Chaser324
Chaser324 / ThreadedJob.cs
Created April 8, 2016 15:43
Unity ThreadedJob class for doing work on a separate thread and checking status or waiting on the main Unity thread.
// Source: http://answers.unity3d.com/questions/357033/unity3d-and-c-coroutines-vs-threading.html
//
// *****************************************************************************
// Example Job - Inheret from this class and override ThreadFunction:
// *****************************************************************************
// public class Job : ThreadedJob
// {
// public Vector3[] InData; // arbitary job data
// public Vector3[] OutData; // arbitary job data
//
@jemshit
jemshit / text_colors.xml
Last active March 21, 2021 01:07
Android Text Colors according to Material Design Pattern
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Dark Text Color for Light Background -->
<color name="textDarkPrimary">#DE000000</color> <!--DE for %87 opacity-->
<color name="textDarkSecondary">#8A000000</color> <!--8A for %54 opacity-->
<color name="textDarkDisabled">#61000000</color> <!--61 for %38 opacity-->
<!-- White Text Color for Dark Background -->
<color name="textLightPrimary">#FFFFFF</color> <!--%100 opacity-->