Skip to content

Instantly share code, notes, and snippets.

View sandrabosk's full-sized avatar
👩‍💻
Always a student, never a master. Have to keep moving forward. ~C.Hall

Aleksandra Bošković sandrabosk

👩‍💻
Always a student, never a master. Have to keep moving forward. ~C.Hall
  • Ironhack
View GitHub Profile
@sandrabosk
sandrabosk / snaked_word.js
Created July 13, 2018 21:02
Convert camelCased string into snaked_string.
let convertToSnake = (camelCased) => {
let lettersArr = [...camelCased];
let snaked_str = '';
lettersArr.forEach(letter => {
if(letter !== letter.toUpperCase()){
snaked_str += letter
} else {
snaked_str += `_${letter.toLowerCase()}`
}
})
// this solution is the most efficient because it walks the array only once and
// it doesn't use any helper methods
const firstNonRepeatingLetterA = (str) => {
let theObj = {};
for(let i = 0; i< str.length; i++){
if(theObj[str[i]]){
theObj[str[i]]+=1;
} else {
theObj[str[i]] = 1;
}

logo_ironhack_blue 7

To Do App

Introduction

The goal is to create To Do App that will have the following functionalities:

  • users can sign up, log in and log out,
  • users can create, list, edit and delete projects and
  • projects will have tasks.

logo_ironhack_blue 7

To Do App

Introduction

The goal is to create To Do App that will have the following functionalities:

  • anyone can create, list, edit and delete projects and
  • projects will have tasks.
@sandrabosk
sandrabosk / antd.md
Last active August 6, 2019 06:54 — forked from Jossdz/antd.md

logo_ironhack_blue 7

React | UI components of Ant Design for React

Learning goals:

After this lesson you will be able to:

  • explain what a component library is and what makes it different from a style library,
  • add and configure a component library,
  • use and set up a component of antd library

When and why we should use length-1?

Very often you will see that length - 1 is being used and you might ask yourself why is that. Here is an example that will demo when and why you should use it and what is the alternative way.

Let's take variable firstName and has the length 4.

const firstName = "maya";
const someString = "hey there hey what up what"
const howMany = (blah) => {
let arrOfWords = blah.split(" ");
const mappedObj = {};
for(let i=0; i<arrOfWords.length; i++){
if(mappedObj[arrOfWords[i]]){
mappedObj[arrOfWords[i]]++
} else {
mappedObj[arrOfWords[i]]=1

Cloning arrays - basics

Introduction

To recap, mutable data types are:

  • arrays
  • objects.

All the other data types (the primitives) are immutable:

  • string,
console.log("------------ iteration 1 ------------");
// Iteration 1: Names and Input
// 1.1 Create a variable hacker1 with the driver's name.
let hacker1 = "kevin";
// 1.2 Print "The driver's name is XXXX".
console.log(`hacker1's name is ${hacker1}`);
// 1.3 Create a variable hacker2 with the navigator's name.
// new SortedList should create a new object from the SortedList class
// The object should have a items and length property
// items should be an array
// length should be the number of elements in the array
class SortedList {
constructor(){
this.items = [];
this.length = this.items.length;
}