Skip to content

Instantly share code, notes, and snippets.

View marta-krzyk-dev's full-sized avatar
Focusing

Marta Krzyk marta-krzyk-dev

Focusing
View GitHub Profile
@marta-krzyk-dev
marta-krzyk-dev / SimplestPromise.js
Last active July 3, 2020 03:44
Simplest Promise in JS
//Based on: https://www.youtube.com/watch?v=s6SH72uAn3Q
let promiseToCleanRoom = new Promise(function(resolve, reject) {
//cleaning the room
let isClean = false;
if (isClean)
resolve('Clean');
else
reject('Dirty');
@marta-krzyk-dev
marta-krzyk-dev / Promises.js
Last active April 27, 2019 20:48
Promises all and race in JS
//From: https://www.youtube.com/watch?v=s6SH72uAn3Q
{ //Declare scope
let cleanRoom = function(message) {
return new Promise(function(resolve, reject) {
resolve(message + ' I cleaned the room!');
});
};
@marta-krzyk-dev
marta-krzyk-dev / ReadDLLVersion.cs
Created April 29, 2019 08:59
Read DLL version
using System;
using System.Diagnostics;
namespace ReadDLLVersion
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(FileVersionInfo.GetVersionInfo(@"C:\SomeDLL.dll").FileVersion);
@marta-krzyk-dev
marta-krzyk-dev / debugApp.js
Last active May 1, 2019 10:16
Debugging in Node JS with debug
/*
* Simple debug example in Node JS :)
*
*/
// 1. Install debug in the folder where your app lives
// npm install debug --save
// 2. Copy and paste this line to your js file to your dependencies, then use debug('My comments'); in your code
// var debug = require('debug')('my_debug_name');
@marta-krzyk-dev
marta-krzyk-dev / reverse_linked_list_iterative.cpp
Last active October 20, 2019 18:44
Reverse a linked list
// Solved problem: https://leetcode.com/problems/reverse-linked-list/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
@marta-krzyk-dev
marta-krzyk-dev / FindDuplicates.cs
Last active October 20, 2019 21:04
Find duplicates in int array with O(n) using Hashtable
//https://leetcode.com/problems/find-all-duplicates-in-an-array/
using System;
using System.Collections;
using System.Collections.Generic;
public class Solution {
public IList<int> FindDuplicates(int[] nums) {
if (nums is null)
@marta-krzyk-dev
marta-krzyk-dev / AddTwoNumbers_LinkedLists.cs
Created October 22, 2019 19:49
Add Two Numbers with Linked Lists
/**
* Definition for singly-linked list.
* public class ListNode {
* public int val;
* public ListNode next;
* public ListNode(int x) { val = x; }
* }
*/
public class Solution {
public void PrintNode(ListNode node)
@marta-krzyk-dev
marta-krzyk-dev / LongestSubstring.cs
Created October 23, 2019 21:23
Find longest substring with unique characters
using System;
using System.Collections;
namespace LongestSubstring
{
class Program
{
static void Main(string[] args)
{
string input = "abrkaabcdefghijjxxx";
@marta-krzyk-dev
marta-krzyk-dev / MinDepthIterative.cs
Last active October 27, 2019 12:28
MinDepthBinaryTree
public class Solution {
private int compx;
public int MinDepth(TreeNode root) {
compx = 0;
if (root is null)
return 0;
Queue queue = new Queue();
npm version
npm config get msvs_version
npm config get msvs_version --global
npm config set msvs_version 2013
npm config set msvs_version 2013 --global
npm i -g npm@latest //Update to the latest version
npm run build //refresh typescript