This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"errors" | |
"fmt" | |
customError "github.com/pkg/errors" | |
) | |
type stackTracer interface { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildItenary(options, startCity) { | |
const citiesMap = new Map() | |
options.forEach(([origin, dest]) => { | |
if (citiesMap.has(origin)) { | |
const stored = citiesMap.get(origin) | |
stored.push(dest) | |
citiesMap.set(origin, stored) | |
} else { | |
citiesMap.set(origin, [dest]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type steps struct { | |
dayOfTheWeek string | |
greeting string | |
tasks []string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func sliceExtender(sl []int) { | |
sl = append(sl, 33) | |
sl[0] = 5 | |
fmt.Printf("len %d, cap %d, sliceOne[0]=%d, added last elemnt =%d \n", len(sl), cap(sl), sl[0], sl[len(sl)-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type person struct { | |
name string | |
} | |
// the * denotes(indicate) a pointer to a value of the type that follows the * | |
// *person the func return pointer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package doughnuts_box | |
import ( | |
"testing" | |
"github.com/stretchr/testify/assert" | |
"github.com/stretchr/testify/require" | |
) | |
func TestPackDoughnutsBoxSubtests(t *testing.T) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package doughnuts_box | |
import ( | |
"testing" | |
"github.com/stretchr/testify/assert" | |
"github.com/stretchr/testify/require" | |
) | |
func TestPackDoughnutsBoxTableTests(t *testing.T) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package doughnuts_box | |
import ( | |
"fmt" | |
) | |
type doughnutsBox struct { | |
capacity int | |
doughnuts []string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code originnaly belong to Front End Masters course | |
// 4 Semesters of CS in 5 Hours part II | |
//https://btholt.github.io/four-semesters-of-cs-part-two/ | |
const CITY_NAMES = [ | |
"New York", | |
"Los Angeles", | |
"Chicago", | |
"Houston", | |
"Philadelphia", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code source https://btholt.github.io/four-semesters-of-cs-part-two/pathfinding | |
const NO_ONE = 0; | |
const BY_A = 1; | |
const BY_B = 2; | |
const processSearchIteration = ()=>{ | |
const aNeighbors = aQueue.reduce((acc, neighbor)=>{ | |
return acc.concat(getNeighbors(visited, neighbor.x, neighbor.y)) | |
}, []) |
NewerOlder