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
h1 { | |
color: red !important; | |
} |
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" | |
"github.com/tebeka/selenium" | |
) | |
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
func main() { | |
ctx, cancel := chromedp.NewContext(context.Background()) | |
defer cancel() | |
var buf []byte | |
if err := chromedp.Run(ctx, | |
chromedp.Navigate(`https://example.com`), | |
chromedp.FullScreenshot(&buf, 95), | |
); err != nil { | |
log.Fatal(err) |
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 ( | |
"log" | |
"github.com/playwright-community/playwright-go" | |
) | |
func main() { | |
pw, err := playwright.Run() |
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
client, err := screenshots.NewClient("IVmt2ghj9TG_jQ", "Sxt94yAj9aQSgg") | |
if err != nil { | |
// ... | |
} | |
options := screenshots.NewTakeOptions("https://example.com"). | |
Format("png"). | |
FullPage(true). | |
DeviceScaleFactor(2). | |
BlockAds(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
// https://www.kernel.org/doc/html/v5.9/process/coding-style.html#centralized-exiting-of-functions | |
int fun(int a) | |
{ | |
int result = 0; | |
char *buffer; | |
buffer = kmalloc(SIZE, GFP_KERNEL); | |
if (!buffer) | |
return -ENOMEM; |
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
$ go test -bench=. -benchmem -benchtime=1000x | |
goos: darwin | |
goarch: amd64 | |
op 0 allocs/op | |
BenchmarkRuneTrieInsert-8 1000 7196 ns/op 6984 B/op 129 allocs/op | |
BenchmarkRuneTrieContains-8 1000 517 ns/op 0 B/op 0 allocs/op | |
BenchmarkWordHashSetInsert-8 1000 1406 ns/op 1100 B/op 4 allocs/op | |
BenchmarkWordHashSetContains-8 1000 178 ns/op 0 B/op 0 allocs/op | |
PASS |
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
func BenchmarkRuneTrieInsert(b *testing.B) { | |
var r bool | |
for i := 0; i < b.N; i++ { | |
t := NewRuneTrie() | |
for _, w := range words { | |
r = t.Insert(w) | |
} | |
} | |
benchmarkResult = r |
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
// Finds and returns words by prefix. | |
func (t *runeTrie) SearchByPrefix(prefix string) []string { | |
node, r := t.nodeByPrefix(prefix) | |
return search(node, r, []rune(prefix[:len(prefix)-1])) | |
} | |
func (t *runeTrie) nodeByPrefix(prefix string) (*runeNode, rune) { | |
current := t.root | |
var r rune |
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
// Contains returns true if an exact match of the word is found, otherwise false. | |
func (t *runeTrie) Contains(word string) bool { | |
n, _ := t.nodeByPrefix(word) | |
return n != nil && n.last | |
} | |
func (t *runeTrie) nodeByPrefix(prefix string) (*runeNode, rune) { | |
current := t.root | |
var r rune |
NewerOlder