Skip to content

Instantly share code, notes, and snippets.

Avatar

Pablo Acuña pacuna

  • Lyft
  • Austin, TX
View GitHub Profile
View SwJHoN1l.go
type list struct {
mu sync.Mutex
head *node
size int
}
View lZ8fA2ci.go
package main
import (
"fmt"
"sortedlist/simplelist"
"sync"
)
func main() {
l := simplelist.New()
View lrtL5X7v.go
package simplelist
import "testing"
func Test_List(t *testing.T) {
l := New()
l.Add([]byte("item1"))
l.Add([]byte("item2"))
if l.Size() != 2 {
View jtkzDkLI.go
func (l *list) Contains(item []byte) bool {
var pred, curr *node
key, _ := hashstructure.Hash(item, nil)
pred = l.head
curr = pred.next
for curr.key < key {
pred = curr
curr = curr.next
View gwjZHzR6.go
func (l *list) Remove(item []byte) bool {
var pred, curr *node
key, _ := hashstructure.Hash(item, nil)
pred = l.head
curr = pred.next
for curr.key < key {
pred = curr
curr = curr.next
View r2Yq7OKo.go
func (l *list) Add(item []byte) bool {
var pred, curr *node
key, _ := hashstructure.Hash(item, nil)
pred = l.head
curr = pred.next
for curr.key < key {
pred = curr
curr = curr.next
View dV3PJfZP.go
type node struct {
item []byte
key uint64
next *node
}
func newNode(item []byte) *node {
key, _ := hashstructure.Hash(item, nil)
return &node{
item: item,
View lNQwI14d.go
package set
type Set interface {
Add(item []byte) bool
Remove(item []byte) bool
Contains(item []byte) bool
}
View set.go
package set
type Set interface {
Add(item []byte) bool
Remove(item []byte) bool
Contains(item []byte) bool
}
@pacuna
pacuna / safari_custom.css
Last active May 29, 2020
Blocks youtube's recommended and up next
View safari_custom.css
#contents.ytd-rich-grid-renderer {
display: none !important;
}
#items.ytd-watch-next-secondary-results-renderer {
display: none !important;
}