Skip to content

Instantly share code, notes, and snippets.

View Kiwka's full-sized avatar
🦄
Let's make this world a better place to live in

Olena Sovyn Kiwka

🦄
Let's make this world a better place to live in
View GitHub Profile
@Kiwka
Kiwka / EmailMarkupBackgroundImage_Text.html
Last active November 6, 2023 19:14
Hack to make text centered on the background image in the email in the Outlook
<td background="http://images.freeimages.com/images/previews/df1/coffee-beans-2-1564474.jpg" bgcolor="#ffe08a" width="600" height="200" valign="middle" styles="vertical-align: middle; background-image: url(http://images.freeimages.com/images/previews/df1/coffee-beans-2-1564474.jpg);">
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:600px;height:200px;">
<v:fill type="tile" src="http://images.freeimages.com/images/previews/df1/coffee-beans-2-1564474.jpg" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div>
<table width="600" border="0" cellpadding="0" cellspacing="0" align="center" style="width:600px; height: 200px;">
<tr>
<td valign="middle" style="vertical-align: middle; text-align: center; height: 200px;" height="200">
@Kiwka
Kiwka / DeMorgansLaws.js
Created May 5, 2020 13:00
DeMorgan’s Laws
!(A || B) === !A && !B
!(A && B) === !A || !B
@Kiwka
Kiwka / options.js
Created February 6, 2020 21:48
Calculating options by using cartesian product
cartesian([arr1, arr2, arr3, arr4]).forEach(
(option1, option2, option3, option4) => {
// use option1, option2, option3, option4 here
});
@Kiwka
Kiwka / options.js
Created February 6, 2020 21:46
Brute-force solution to get all options for a few arrays
arr1.forEach(option1 => {
arr2.forEach(option2 => {
arr3.forEach(option3 => {
arr4.forEach(option4 => {
// use option1, option2, option3, option4 here
});
});
});
});
@Kiwka
Kiwka / cartesianProduct.js
Created January 27, 2020 22:05
Cartesian product
const f = (a, b) => [].concat(...a.map(d => b.map(e => [].concat(d, e))));
const cartesian = (a, b, ...c) => (b ? cartesian(f(a, b), ...c) : a);
@Kiwka
Kiwka / blogEntry.js
Created December 4, 2019 11:55
Example of the named type for string types variable
export type BlogEntryId = string;
type BlogEntryType = {|
id: BlogEntryId,
...
|};
const blogEntry: = {
id: 'ddjj38302mmd92m2k2',
...
@Kiwka
Kiwka / .flowconfig
Created December 3, 2019 22:13
add suppress type in the flow config
[options]
suppress_type=FixMeAny
@Kiwka
Kiwka / .flowconfig
Created December 3, 2019 15:30
adding suppress comment to flow config
[options]
suppress_comment= \\(.\\|\n\\)*\\$FlowExpectError
@Kiwka
Kiwka / .flowconfig
Created December 3, 2019 13:57
Example of the config for preventing imports from untyped files
[strict]
untyped-import
@Kiwka
Kiwka / solution.js
Last active December 2, 2019 20:42
Advent of Code - 2019 - Day 2
// part 1
const array = $0.textContent.split(',').map(Number);
array[1] = 12;
array[2] = 2;
let i = 0;
while (i < array.length) {
const current = array[i];