Skip to content

Instantly share code, notes, and snippets.

View yurist38's full-sized avatar
💻
Work in progress...

Yuri Drabik yurist38

💻
Work in progress...
View GitHub Profile
@yurist38
yurist38 / testSameObjects.spec.ps
Created August 1, 2017 21:04
Jest - test same objects and use expect.extend for logging detailed error message.
const firstArray = [{}, {}, {}];
const secondArray = [firstArray[0], {}, firstArray[2]];
test('Objects should be the same', () => {
expect.extend({
toBeSameObject(received, errMsg) {
const result = {
pass: received,
message: () => errMsg
};
@yurist38
yurist38 / ChristmasTreeBinary.txt
Created December 25, 2017 02:29
Christmas Tree Binary
1
111
10101
1001001
100010001
10000100001
100010001
10000100001
1000001000001
100000010000001
@yurist38
yurist38 / AsciiTextBot.js
Created March 3, 2018 16:35
Telegram Bot - converter text into ASCII text
const Botgram = require('botgram');
const figlet = require('figlet');
const { TELEGRAM_BOT_TOKEN } = process.env;
if (!TELEGRAM_BOT_TOKEN) {
console.error('Seems like you forgot to pass Telegram Bot Token. I can not proceed...');
process.exit(1);
}
@yurist38
yurist38 / introrx.md
Created April 10, 2018 07:58 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
function addN(base: number): (a: number) => number {
let baseNumber = base;
return (addition: number): number => baseNumber + addition;
}
const addEight = addN(8);
console.log(addEight(7)); // 15
console.log(addEight(100)); // 108
@yurist38
yurist38 / main.dart
Created August 7, 2019 08:28
WeIrDcAsE
void main() {
print(toWeirdCase('Wazzap'));
}
toWeirdCase(String str) {
var result = new List();
for (int i = 0; i < str.length; i++) {
result.add(i%2 == 0 ? str[i].toUpperCase() : str[i].toLowerCase());
}
@yurist38
yurist38 / main.dart
Created August 8, 2019 07:40
Daily Challenge #35 - Find the Outlier
void main() {
print(findOutlier([2, 4, 0, 100, 4, 11, 2602, 36]));
print(findOutlier([160, 3, 1719, 19, 11, 13, -21]));
print(findOutlier([4, 8, 15, 16, 24, 42]));
print(findOutlier([16, 6, 40, 66, 68, 28]));
}
findOutlier(List nums) {
var odds = new List();
var evens = new List();
@yurist38
yurist38 / package.json
Last active October 25, 2019 07:56
Semantic release config (GitHub Actions + GitHub NPM registry)
{
"release": {
"branch": "master",
"tagFormat": "${version}",
"analyzeCommits": "simple-commit-message",
"repositoryUrl": "git@github.com:cvmaker-bv/types.git",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
@yurist38
yurist38 / carbon.config.json
Created June 22, 2020 20:00
Carbon Config (JavaScript Room)
{
"paddingVertical": "0px",
"paddingHorizontal": "0px",
"backgroundImage": null,
"backgroundImageSelection": null,
"backgroundMode": "color",
"backgroundColor": "rgba(0,0,0,1)",
"dropShadow": false,
"dropShadowOffsetY": "20px",
"dropShadowBlurRadius": "68px",
const { stripe_secret_key, stripe_webhook_secret } = privateConfig;
const stripe = new Stripe(stripe_secret_key);
let event: events.IEvent | undefined;
try {
const sig = req.headers['stripe-signature'] as string;
const reqBody = req.rawBody.toString();
event = stripe.webhooks.constructEvent(reqBody, sig, stripe_webhook_secret);
} catch (err) {