How to disable submit button with jQuery
For a long submit operation or to avoid users clicking twice a submit button, a common solution is to disable the submit button after user clicked on it.
To disable a button using jQuery you need to add the disabled
attribute to the button as true.
How to generate a random int in Golang
In Golang there a are two libraries for generating random integers, one is a pseudo-random number generator (package math/rand
) and the second one is cryptographically secure random number generator (package crypto/rand
)
How to trim whitespace from string in Golang
How to trim (remove) leading and trailing whitespace from string in Golang using the TrimSpace
, Trim
, TrimLeft
, TrimRight
methods from strings
package.
How to fix apt lock-frontend error in Ubuntu
How to fix the E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
error.
How to get the dimensions of an image in Golang
Here are two simple methods to get the dimensions of an image in Golang: using image.DecodeConfig
method if the image is not already loaded and image.Decode
method is the image is loaded.
How to split a string into slice in Golang
How to split a string into slice using Golang. For a simple split by a singular character you can use Split()
method from strings
package. For more complex rules the regexp.Split()
method can be used.