Skip to content

Instantly share code, notes, and snippets.

View pszalawinski's full-sized avatar

Pawel Szalawinski pszalawinski

View GitHub Profile
@pszalawinski
pszalawinski / gorutines.go
Created January 17, 2021 19:47
goroutines in go #go
if there is any concurrency in the code i should check if there is no race
go run -race src/main.go
and compiler will show if there are any races
@pszalawinski
pszalawinski / interfaces.go
Created January 17, 2021 14:06
interfaces in go #go
DEFINING
in interfaces we are definig behaviors
func main() {
var consoleWriter ConsoleWriter = ConsoleWriter{}
consoleWriter.Write("siemanko!")
}
type Writer interface {
@pszalawinski
pszalawinski / functions.go
Created January 17, 2021 12:32
Go functions #go
BASIC VIEW:
func name(paramerters) whatToReturn {
//body
return whatToReturn
}
-----------------------
PASSING PARAMETERS
@pszalawinski
pszalawinski / basics.go
Last active January 17, 2021 11:06
Go basics
PROGRAM LAYOUT:
package main
import ( ..) -> import of libs
const ...
var ...
func init(){} -> function which be intilized before executing main program
@pszalawinski
pszalawinski / semantic-commit-messages.md
Last active June 23, 2020 05:49 — forked from joshbuchea/semantic-commit-messages.md
!!! Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@pszalawinski
pszalawinski / MongoRepository.java
Created April 27, 2020 07:28
Query for MongoDB in Spring app #mongodb
import org.springframework.data.mongodb.repository.Query;
@Repository
public interface BookRepository extends MongoRepository<Book, Integer> {
@Query("{'author' : ?0}") //import org.springframework.data.mongodb.repository.Query;
List<Book> findByAuthor(String author);
}
// documentation: https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongo.repositories
@pszalawinski
pszalawinski / mongodb_cheat_sheet.md
Last active April 27, 2020 07:26 — forked from bradtraversy/mongodb_cheat_sheet.md
MongoDB Cheat Sheet #mongodb

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database