For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
This file contains hidden or 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
class PngIconConverter | |
{ | |
/* input image with width = height is suggested to get the best result */ | |
/* png support in icon was introduced in Windows Vista */ | |
public static bool Convert(System.IO.Stream input_stream, System.IO.Stream output_stream, int size, bool keep_aspect_ratio = false) | |
{ | |
System.Drawing.Bitmap input_bit = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(input_stream); | |
if (input_bit != null) | |
{ | |
int width, height; |
This file contains hidden or 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 hidden or 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
Lesson 1 - Iterations | |
- BinaryGap - https://codility.com/demo/results/trainingU2FQPQ-7Y4/ | |
Lesson 2 - Arrays | |
- OddOccurrencesInArray - https://codility.com/demo/results/trainingFN5RVT-XQ4/ | |
- CyclicRotation - https://codility.com/demo/results/trainingSH2W5R-RP5/ | |
Lesson 3 - Time Complexity | |
- FrogJmp - https://codility.com/demo/results/training6KKWUD-BXJ/ | |
- PermMissingElem - https://codility.com/demo/results/training58W4YJ-VHA/ |
Note: This document was written for someone who already knows React fairly well, because it was initially a list of suggested talking points for a presentation they were planning. Ideally this document should be expanded to include clear examples for the final target audience, which is React beginners.
// Constructor
this.state = { foo: 0 };
This file contains hidden or 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
function countChange(money, coins) { | |
if (money == 0) return 1; | |
if (money < 0 || coins.length == 0) return 0; | |
return countChange(money - coins[0], coins) + countChange(money, coins.slice(1)); | |
} |
This file contains hidden or 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
function numberToOrdinal(i) { | |
var j = i % 10, | |
k = i % 100; | |
if (j == 1 && k != 11) { | |
return i + "st"; | |
} | |
if (j == 2 && k != 12) { | |
return i + "nd"; | |
} | |
if (j == 3 && k != 13) { |
This file contains hidden or 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
/** | |
* we are going to upload file to s3 via node js by using | |
* aws-sdk - required | |
* busboy - required | |
* uuid - optional - for image renaming purpose | |
* with this library you can upload any kind of file to s3 via node js. | |
*/ | |
const AWS = require('aws-sdk'); | |
const UUID = require('uuid/v4'); |
This file contains hidden or 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
// Some common IE shims... indexOf, startsWith, trim | |
/* | |
Really? IE8 Doesn't have .indexOf | |
*/ | |
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { | |
"use strict"; | |
if (this === null) { | |
throw new TypeError(); |
NewerOlder