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
diff --git example.js example.js | |
index d5dd17d..1abd66a 100644 | |
--- example.js | |
+++ example.js | |
@@ -13,7 +13,7 @@ function exampleCall({ nameObj } = {}) { | |
lastName: nameObj.lastName | |
}; | |
- if (!nameObj.firstName && !nameObj.lastName) { | |
+ if (!nameObj || (!nameObj.firstName && !nameObj.lastName)) { |
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
module.exports = function (context, callback) { | |
callback(null, [ | |
{ | |
title: "Type a URL or other text and press return.", | |
text: context.query.text | |
} | |
]); | |
} |
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
module.exports = function (context, callback) { | |
callback(null, { | |
body: `<img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&qzone=1&data=${encodeURIComponent(context.query.text)}">` | |
}); | |
} |
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
#!/bin/bash | |
# | |
# See: https://mixmax.com/blog/determining-why-that-server-is-on-fire for details. | |
# | |
# Example usage: ./profile.sh $INSTANCE_ID [$DURATION] [$PID] | |
# Where: | |
# - $INSTANCE_ID is the EC2 identifier of the instance to profile the node | |
# processes on. | |
# - $DURATION is an optional duration specified in seconds (defaults to 30). | |
# - $PID is a specific process ID to profile, by default we profile all `node` |
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
#!/bin/bash | |
# | |
# See: https://mixmax.com/blog/determining-why-that-server-is-on-fire for usage. | |
# | |
########### | |
echo "installing perf..." | |
sudo yum install -y perf | |
echo "fixing file perms..." |
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 mem | |
import "testing" | |
// So if you're encoding small types (i.e. for JSON on the fly) there is a difference. | |
// | |
// maptypes$ go test -bench=. -benchtime=20s | |
// testing: warning: no tests to run | |
// PASS | |
// Benchmark_MapStringInterface 20000000 1407 ns/op 352 B/op 3 allocs/op |
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 ( | |
"bytes" | |
"math/rand" | |
"testing" | |
) | |
// go test -v -bench=. -benchtime=10s | |
// |
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" | |
"reflect" | |
) | |
func main() { | |
a := 0 | |
b := 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 writestring | |
import ( | |
"bytes" | |
"fmt" | |
"math/rand" | |
"testing" | |
) | |
// go test -bench=. -benchtime 20s |
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 typeassertion | |
import ( | |
"errors" | |
"testing" | |
) | |
// go test -bench=. -benchtime 20s | |
// | |
// Benchmark_SwitchType 100000000 483 ns/op |