$ go test -bench=. -benchtime=5s
goos: darwin
goarch: amd64
pkg: github.com/rocketspacer/lookupbm
BenchmarkLookUp/ValueExists@Head/Switch-8 1000000000 6.39 ns/op
BenchmarkLookUp/ValueExists@Head/IfElse-8 10000000000 1.86 ns/op
BenchmarkLookUp/ValueExists@Head/Map-8 1000000000 9.86 ns/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 ( | |
"fmt" | |
"math/rand" | |
"testing" | |
) | |
func linearSearch(arr []int, value int) int { | |
for i, v := range arr { |
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
$ TF_LOG=trace terraform apply | |
2018/08/13 11:26:22 [INFO] Terraform version: 0.11.7 | |
2018/08/13 11:26:22 [INFO] Go runtime version: go1.10.1 | |
2018/08/13 11:26:22 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.11.7/bin/terraform", "apply"} | |
2018/08/13 11:26:22 [DEBUG] Attempting to open CLI config file: /Users/tuan.nguyenm/.terraformrc | |
2018/08/13 11:26:22 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2018/08/13 11:26:22 [INFO] CLI command args: []string{"apply"} | |
2018/08/13 11:26:22 [INFO] command: empty terraform config, returning nil | |
2018/08/13 11:26:22 [DEBUG] command: no data state file found for backend config | |
2018/08/13 11:26:22 [DEBUG] New state was assigned lineage "3e382eed-2144-5b18-36d9-9afd685f34b5" |
This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.
It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.
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
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
/* CONSTANTS */ | |
#define MAX_SIZE 65536; | |
struct Location { | |
int row, col; | |
}; |
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
error_code("OK", 0) | |
error_code("InternalError", 1) | |
error_code("BadValue", 2) | |
error_code("OBSOLETE_DuplicateKey", 3) | |
error_code("NoSuchKey", 4) | |
error_code("GraphContainsCycle", 5) | |
error_code("HostUnreachable", 6) | |
error_code("HostNotFound", 7) | |
error_code("UnknownError", 8) | |
error_code("FailedToParse", 9) |
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
ufw allow OpenSSH | |
ufw allow http | |
ufw allow https | |
ufw enable | |
ufw status |
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
var app = angular.module('app', ['ui.router']); | |
app.config(['$stateProvider', | |
function ($stateProvider) { | |
// UI-Router | |
// Application states | |
var applicationStates = [ | |
// Pre-authenticated | |
{ |
Lean unit tests with minimal setup
- Fake DOM (Everything works without a real browser)
- Uses ngMocks to inject and mock Angular.js dependencies
- I'm assuming you are already using browserify (but everything works fine without it)
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
Project Structure | |
- index.js //Your NodeJs code | |
- /public // What in here is your tradition Angular App (like the one on Angular Tutorial) | |
- /css | |
- /js | |
- app.js // Your Angular code | |
- index.html | |
================= Server Side ============================= | |
//Node index.js |
NewerOlder