Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
workin' on some stuff

Francesc Campoy campoy

:bowtie:
workin' on some stuff
View GitHub Profile
@campoy
campoy / styles.css
Created Apr 6, 2018
Dark themed Go present (cmd/present/static/styles.css)
View styles.css
@import url('https://fonts.googleapis.com/css?family=Montserrat');
@import url('https://fonts.googleapis.com/css?family=Inconsolata');
@media screen {
/* Framework */
html {
height: 100%;
}
View main.go
func merge(cs ...<-chan int) <-chan int {
out := make(chan int)
var wg sync.WaitGroup
wg.Add(len(cs))
for _, c := range cs {
go func(c <-chan int) {
for v := range c {
out <- v
}
wg.Done()
@campoy
campoy / main.go
Created Feb 21, 2018
Creating a submodule with go-git
View main.go
package main
import (
"fmt"
"log"
"strings"
"time"
"gopkg.in/src-d/go-billy.v4/memfs"
git "gopkg.in/src-d/go-git.v4"
@campoy
campoy / mandelbrot.go
Created Aug 27, 2018
Creating mandelbrot, one pixel at a time
View mandelbrot.go
package main
import (
"flag"
"image"
"image/color"
"image/png"
"log"
"os"
)
@campoy
campoy / mandelbrot.go
Created Aug 27, 2018
Creating mandelbrot, one pixel at a time
View mandelbrot.go
package main
import (
"flag"
"image"
"image/color"
"image/png"
"log"
"os"
)
@campoy
campoy / app.go
Created Nov 18, 2016
Go Echo server on App Engine Flex
View app.go
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Sample endpoints demonstrates a Cloud Endpoints API.
package main
import (
"encoding/json"
"fmt"
@campoy
campoy / main.go
Created Apr 19, 2018
Don't use panics as exceptions.
View main.go
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
View udf.js
function sum(row, emit) {
const memory = new WebAssembly.Memory({ initial: 256, maximum: 256 });
const env = {
'abortStackOverflow': _ => { throw new Error('overflow'); },
'table': new WebAssembly.Table({ initial: 0, maximum: 0, element: 'anyfunc' }),
'tableBase': 0,
'memory': memory,
'memoryBase': 1024,
'STACKTOP': 0,
'STACK_MAX': memory.buffer.byteLength,
View main.js
const memory = new WebAssembly.Memory({ initial: 256, maximum: 256 });
const env = {
'abortStackOverflow': _ => { throw new Error('overflow'); },
'table': new WebAssembly.Table({ initial: 0, maximum: 0, element: 'anyfunc' }),
'tableBase': 0,
'memory': memory,
'memoryBase': 1024,
'STACKTOP': 0,
'STACK_MAX': memory.buffer.byteLength,
};
View main.go
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"
)