😶🌫️
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 | |
type A struct { | |
} | |
func (a A) Hello() string { | |
return "hello" | |
} | |
type B struct { |
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" | |
"io/ioutil" | |
"net" | |
) | |
func main() { | |
listener, err := net.Listen("tcp", ":8000") |
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 regex_test | |
import ( | |
"regexp" | |
"testing" | |
) | |
func TestMatchingIntegerURLString(t *testing.T) { | |
re := regexp.MustCompile(`/view/(\d)`) | |
if re.FindStringSubmatch("/view/1")[1] != "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
func solution(n int) int { | |
var factorial = func(begin int, end int, c chan int) { | |
var sum int = 1 | |
for i := begin; i <= end; i++ { | |
sum *= i | |
} | |
c <- sum | |
} | |
var c = make(chan int) |
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 consensus | |
import "fmt" | |
type Journal struct {} | |
func (journal Journal) Write(msg string) { | |
} | |
func GetConsensus(journal Journal) boolean { |
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
<?php | |
header('Content-Type', 'application/json'); | |
echo json_encode([1,2,3]); |
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
<?php | |
$list = array(); | |
array_push($list, $item); |
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
gofmt -r 'a[b:len(a)] -> a[b:]' h.go |
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
import org.junit.Assert; | |
public class FizzBuzzTest { | |
public void testFizzBuzShouldReturn_1_WhenInput_1() { | |
FizzBuzz fizzBuzz = new FizzBuzz(); | |
Assert.assertEquals("1", fizzBuzz.doFizzBuzz(1)); | |
} | |
public void testFizzBuzShouldReturn_2_WhenInput_2() { |
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" | |
func sender(to chan string, done chan bool) { | |
for { | |
select { | |
case t := <-to: | |
fmt.Println(t) | |
case <-done: |