xtapa

joined 1 year ago
[–] [email protected] 3 points 2 months ago

I read some tests about Kobo. Nice to know people are satisfied. Definitely will look at it again.

[–] [email protected] 2 points 2 months ago

I use the app too, but I don't want that as my main reading device because e-ink feels way more comfortable on the eyes.

[–] [email protected] 11 points 2 months ago

Papers please should be playable with one hand only and is great at burning time

[–] [email protected] 4 points 3 months ago (2 children)

Can you use it on colored clothes? Borax acts as bleach so I'm a bit skeptical.

[–] [email protected] 4 points 3 months ago

Looks great, thanks!

[–] [email protected] 21 points 3 months ago (4 children)

I think this level of derailing in a post about trains is irresponsible.

[–] [email protected] 19 points 3 months ago (2 children)

Tut mir leid, Japan-Fanboys und -Girls.

Tabi (jap. 足袋) sind eine Art von knöchelhohen japanischen Socken mit abgeteiltem großem Zeh.

Sie werden üblicherweise zu Zōri oder Geta (beides Sandalen) getragen.

Quelle: Wikipedia

Tabi (Socken) 足袋 Traditionelle Socken bestehen meist aus weißem, festem Baumwollstoff mit abgeteiltem großen Zeh.

Zôri 草履 (Sandalen) Zôri-Sandalen gehören zum Kimono

Quelle: Deutsch-Japanische Gesellschaft München

Es SIND Socken in Sandalen.

[–] [email protected] 2 points 3 months ago

Hersteller sprechen von Temposchwelle.

[–] [email protected] 2 points 3 months ago* (last edited 3 months ago)

I personally try to avoid deeply nested if/else. Or else in general, because I think it makes code more readable. Especially when one of the branches is just an exit condition.

if exitCondition {
    return false
}
// long ass code execution

is way more readable than

if !exitCondition {
    // long ass code execution
} else {
   return false
}

In a loop, you can just return the value instead of passing it to a "retVal" variable.

With those in mind, you could refactor HasPermissions to

func (r *RBAC) HasPermission(assignedRoles []string, requiredPermission string, visited map[string]bool) bool {
	for _, assigned := range assignedRoles {
		if visited[assigned] {
			continue
		}
		role, ok := r.Roles[assigned]
		if !ok {
			//role does not exist, so skip it
			continue
		}
		for _, permission := range role.Permissions {
			if permission.String() == requiredPermission {
				//Permission has been found! Set permitted to true and bust out of the loop
				return true
			}
		}
		//check inherited roles
		if permitted := r.HasPermission(role.Inherits, requiredPermission, visited); permitted {
			return true
		}
	}
	return false
}

The same could be applied to LoadJSONFile and I think that really would approve the readability and maintainability of your code.

edit: This refactor is not tested

[–] [email protected] 5 points 3 months ago

Your "statistics" are fantasy numbers, not statistics. And statistics or probabilities, no matter how low or high, are not proof.

[–] [email protected] 5 points 4 months ago

Habe von AfD nichts weiter erwartet.

view more: ‹ prev next ›