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 / destructing
Created June 19, 2020 15:21
Array and object destructing in JS
//Destructing arrays
const myArray = [1,2,3,4,5];
const [x,y,z] = myArray;
console.log(`${x} ${y} ${z}`);
const names = ["Parrot", "Dolpin", "Cat"];
//let name1, name2, name3, name4;
let [name1, name2, name3, name4="default"] = names;
@marta-krzyk-dev
marta-krzyk-dev / code.js
Last active May 6, 2020 22:08
ClearTimer pattern in JS6
const div3 = document.getElementById('div3');
const para = div3.querySelector('p');
const textarea = div3.querySelector('textarea');
const paraText = "User is typing";
let timer;
textarea.addEventListener("keyup", addText);
textarea.addEventListener("keydown", removeText);
function addText(e){
@marta-krzyk-dev
marta-krzyk-dev / code.js
Created May 6, 2020 22:08
ClearTimer pattern in JS6
const paraText = "User is typing";
let timer;
textarea.addEventListener("keyup", addText);
textarea.addEventListener("keydown", removeText);
function addText(e){
para.innerText = paraText;
}
function removeText(e){
@marta-krzyk-dev
marta-krzyk-dev / Classes.html
Last active May 2, 2020 19:52
HTML with JS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<style>
.dummy {
color: red;
@marta-krzyk-dev
marta-krzyk-dev / ObjectsOutput.txt
Last active April 12, 2020 16:51
Basic JavaScript ES6
3-33-333"
"123-33-333"
[object Object] {
1: "Chris",
age: 17,
xRay: "zray"
}
"Yummy!"
"Type: coconut"
@marta-krzyk-dev
marta-krzyk-dev / __init__.py
Last active April 5, 2020 21:19
Python module import
#This is ecommerce/__init__.py file
#If there is a __init__.py in a folder, it makes it a package :)
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
@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();
@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 / 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)