This file contains hidden or 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
| public class TooSmall { | |
| public static void main(String[] args) { | |
| double start = 0.1; | |
| double tooSmall = 1.0e-18; | |
| for (int i = 0; i < 1_000_000_000; i++) { | |
| start += tooSmall; | |
| } | |
| System.out.println(start == 0.1); // TRUE | |
| } | |
| } |
This file contains hidden or 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
| [raft] 2015/05/12 22:34:35 leader[2]: leaderLoop: send heartbeat: index: idx=4, idxs=[4] | |
| [raft] 2015/05/12 22:34:35 leader[2]: leaderLoop: send heartbeat: index: idx=4, idxs=[4 4] | |
| panic: test timed out after 1m0s | |
| goroutine 503 [running]: | |
| testing.func·008() | |
| /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:681 +0x12f | |
| created by time.goFunc | |
| /usr/local/Cellar/go/1.4.2/libexec/src/time/sleep.go:129 +0x4b |
This file contains hidden or 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
| ldd test | |
| not a dynamic executable |
This file contains hidden or 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 "net" | |
| func main() { | |
| net.Dial("tcp", "google.com:80") | |
| } |
This file contains hidden or 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" | |
| "github.com/getlantern/withtimeout" | |
| "net/http" | |
| "time" | |
| ) | |
| func main() { |
This file contains hidden or 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" | |
| "os" | |
| "os/signal" | |
| "runtime" | |
| "syscall" | |
| ) |
This file contains hidden or 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 <stdio.h> | |
| int main (void) | |
| { | |
| int a = -1; | |
| unsigned int b = 2; | |
| printf("%d\n", 1 > 0); // TRUE == 1 | |
| printf("%d\n", 0 > 1); // FALSE == 0 | |
| printf("%d\n", a > b); // -1 > 2 apparently TRUE == 1 | |
| printf("%d\n", -1 > 2u); // -1 > 2unsigned apparently TRUE == 1 | |
| printf("%d\n", -1 > 2); // -1 > 2 FALSE == 0 |
This file contains hidden or 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" | |
| "time" | |
| ) | |
| var instance TheOnlyOne = &onlyOne{time.Now()} | |
| type TheOnlyOne interface { |
This file contains hidden or 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 | |
| // There are 4 FOR examples below, but they differ in how they require | |
| // blocks to start. | |
| import "fmt" | |
| // CANNOT start block on next line | |
| func CForLoop() { | |
| sum := 0 |
This file contains hidden or 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" | |
| type Strategy func(string, string) string | |
| type Strategic interface { | |
| SetStrategy(Strategy) | |
| Result() string | |
| } |