Skip to content

Instantly share code, notes, and snippets.

View empijei's full-sized avatar
💭
for { Learn() }

Roberto Clapis empijei

💭
for { Learn() }
View GitHub Profile
@empijei
empijei / waitgroup.js
Created March 26, 2019 22:07
waitgroup.js
class WaitGroup {
constructor(initial, opt_sab) {
this._sab = opt_sab || new SharedArrayBuffer(4);
this._wg = new Int32Array(this._sab);
this.add(initial);
}
static connect(wg) { return new WaitGroup(0, wg._sab) }
add(n) {
let current = n + Atomics.add(this._wg, 0, n);
if (current < 0) {
package csrf
import "errors"
// This is just an example on how to reduce redundant code in Go
// Original file: https://github.com/gofiber/csrf/blob/dde96da6711a2cc01709a66730c2e16328b22047/main.go
// csrfFromExtractor returns a function can be used to bind to a parameter name to extract a csrf token from a Ctx.
func csrfFromExtractor(errMessage string, extractor func(c *fiber.Ctx, param string) string) func(string) func(c *fiber.Ctx) (string, error) {
return func(param string) func(c *fiber.Ctx) (string, error) {

The short story of my experience with C# is that it is like Java should have been.

Cross platform

C# has now gotten to allow programmers to build cross-platform applications, includin games. Unity engine has made it possible to write games form most platforms in a memory-safe nice-to-use language.

IDE support

VS used to be the best possible IDE to work with and intellisense was just perfect and lightning fast for C#. Debugging was a flawless experience.