Visit my blog or connect with me on Twitter
git init
or
var http = require('http'); | |
var server = http.createServer(); | |
server.on('request', function(req,res){ | |
res.writeHead(200, {}); | |
res.write('Hello World'); | |
res.end('bye'); | |
}); |
// Generating arbitrary JSON data using map | |
package main | |
import "fmt" | |
import "encoding/json" | |
func main() { | |
keys := []string{"Segment", "Jan", "Feb", "Apr"} | |
values := []interface{}{"ME",1000,2000,3000} |
// v2 of the great example of SSE in go by @ismasan. | |
// includes fixes: | |
// * infinite loop ending in panic | |
// * closing a client twice | |
// * potentially blocked listen() from closing a connection during multiplex step. | |
package main | |
import ( | |
"fmt" | |
"log" |
Visit my blog or connect with me on Twitter
git init
or
// Go and Server Sent Events for HTTP/1.1 and HTTP/2.0 | |
//go:generate go run $GOROOT/src/crypto/tls/generate_cert.go -host localhost | |
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
Heads Up! It's all about the V1 Spec.
In a nutshell, Shadow DOM enables local scoping for HTML & CSS.
Shadow DOM fixes CSS and DOM. It introduces scoped styles to the web platform. Without tools or naming conventions, you can bundle CSS with markup, hide implementation details, and author self-contained components in vanilla JavaScript. - https://developers.google.com/web/fundamentals/getting-started/primers/shadowdom
It's like it's own little world which hardly affects or gets affected by the outside world.
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
<script type="text/javascript"> | |
// ref: http://stackoverflow.com/a/1293163/2343 | |
// This will parse a delimited string into an array of | |
// arrays. The default delimiter is the comma, but this | |
// can be overriden in the second argument. | |
function CSVToArray( strData, strDelimiter ){ | |
// Check to see if the delimiter is defined. If not, | |
// then default to comma. | |
strDelimiter = (strDelimiter || ","); |