Skip to content

Instantly share code, notes, and snippets.

class Wrapper {
constructor(value) {
this.value = value
this.dep = new Set()
}
addDep() {
if (activeUpdate) {
this.dep.add(activeUpdate)
}
}
@foolishway
foolishway / oo.js
Created October 22, 2021 14:11
javascript inherit
// OO - Class - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
// Based on http://ejohn.org/blog/simple-javascript-inheritance/
// which is based on implementations by Prototype / base2
;(function(){
var global = this, initialize = true
var referencesSuper = /xyz/.test(function(){ xyz }) ? /\b__super__\b/ : /.*/
/**
package main
import (
"fmt"
"time"
)
type Future struct {
C chan struct{}
}
<html>
<head>
<title></title>
</head>
<body>
<div id="test1">
<div id="text"></div>
<canvas id="mycanvas" width="900px" height="800px"></canvas>
#!/bin/bash
for i in *.ogg;
do ffmpeg -i "$i" -f mp3 "${i%.*}.mp3";
done
rm *.ogg;
package main
import (
"fmt"
)
var serverMap = map[int32]string{1: "server1", 2: "server2", 3: "server3"}
func main() {
var id int32 = 1
package main
import (
"fmt"
"time"
"log"
"os"
)
func main() {
package main
import "fmt"
type CB func(int, interface{})
type Array []interface{}
func (arr *Array) forEach(callback CB) {
for index, item := range *arr {
package main
import (
"log"
"net/http"
"os"
)
type Adapter func(http.Handler) http.Handler
package main
import (
"fmt"
"unsafe"
)
func main() {
b := []byte("some momery")
s := string(b)