For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
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
data class DownloadItem( | |
val bytesDownloadedSoFar: Long = -1, | |
val totalSizeBytes: Long = -1, | |
val status: Int, | |
val uri: String | |
) | |
class DownloadProgressLiveData(private val activity: Activity) : | |
LiveData<List<DownloadItem>>(), | |
CoroutineScope { |
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
// REFERENCE UNICODE TABLES: | |
// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml | |
// http://www.tamasoft.co.jp/en/general-info/unicode.html | |
// | |
// TEST EDITOR: | |
// http://www.gethifi.com/tools/regex | |
// | |
// UNICODE RANGE: DESCRIPTION | |
// | |
// 3000-303F: punctuation |
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
public static class MyExtensions | |
{ | |
public static void TimeAgo(this DateTime date) | |
{ | |
// 1000 millisecs = 1 sec | |
// 60 secs = 1 min | |
// 60 mins = 1 hr | |
// 24 hrs = 1 day | |
var diff = DateTime.Now - date; | |
var millis = diff.TotalMilliseconds; |
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
const byte SECURITY_CHECK_FLAG = 0b00000001; | |
const byte TWO_FACTOR_AUTH_FLAG = 0b00000010; | |
const byte JUST_A_FLAG = 0b00000100; | |
// Uses of Bitwise operators | |
void Main() | |
{ | |
// 1. Storing multiple boolean flags | |
byte flags = 0; | |
// Enabling flags |
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
// https://github.com/dotnet/roslyn/issues/7791#issuecomment-394133511 | |
var resourceDescription = new Microsoft.CodeAnalysis.ResourceDescription( | |
resourceFullName, | |
() => ProcessFile(resourceFilePath), | |
isPublic: true); | |
private static MemoryStream ProcessFile(string inFile) | |
{ | |
var readers = new List<ReaderInfo>(); | |
var resources = ReadResources(inFile); |
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
using System; | |
using System.Threading; | |
public class Debouncer : IDisposable | |
{ | |
private Thread thread; | |
private volatile Action action; | |
private volatile int delay = 0; | |
private volatile int frequency; |
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
void TimeAgo(DateTime date) | |
{ | |
// 1000 millisecs = 1 sec | |
// 60 secs = 1 min | |
// 60 mins = 1 hr | |
// 24 hrs = 1 day | |
var diff = DateTime.Now - date; | |
var millis = diff.TotalMilliseconds; | |
var millisInDay = 86400 * 1000; | |
var daysInMillis = millis / millisInDay; |
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
var hole = new RoundHole(5); | |
var rPeg = new RoundPeg(5); | |
hole.Fits(rPeg).Dump(); // True | |
var sm_sqpeg = new SquarePeg(5); | |
var lg_sqpeg = new SquarePeg(10); | |
//hole.Fits(sm_sqpeg); // Error: won't compile (incompatible types) | |
var sm_sqpeg_adapter = new SquarePegAdapter(sm_sqpeg); | |
var lg_sqpeg_adapter = new SquarePegAdapter(lg_sqpeg); |
NewerOlder