Skip to content

Instantly share code, notes, and snippets.

workin' on some stuff

Francesc Campoy campoy

workin' on some stuff
View GitHub Profile
campoy / parallel.go
Last active Aug 29, 2015
Mandelbrot snippets from, for a post on
View parallel.go
func fillImg(m *img) {
// init a WaitGroup with the number of pixels of the image
var wg sync.WaitGroup
wg.Add(m.h * m.w)
for i, row := range m.m {
for j := range row {
// Every pixel is computed in a different goroutine
// and the counter is decreased once it's done.
go func(i, j int) {
View main.go
package main
import ""
func main() {
campoy / notfound.html
Last active Aug 29, 2015
A small web server with a customized 404 page showed in two different ways, wrapping the ResponseWriter or wrapping the Handler
View notfound.html
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>404 - not found</title>
* {
padding: 0;
margin: 0;
View file.go
package main
import "fmt"
func main() {
fmt.Println("this is a test for Medium")
campoy / main.go
Last active Dec 16, 2015
Small sample app on using goauth2
View main.go
// Short example showing how to get an oauth2 token using a .pem key and how the token should be added
// to the http requests.
package main
import (
campoy / wat.js
Created Sep 13, 2013
What do you think this will log?
View wat.js
var foo = 1;
func bar() {
if (!foo) {
var foo = 10;
campoy / commands.go
Last active Dec 28, 2015
Running concurrently a list of commands
View commands.go
package main
type Command interface {
Run() error
func RunAll(cmds []Command) error {
for _, cmd := range cmds {
err := cmd.Run()
if err != nil {
campoy / after.go
Created Dec 6, 2013
Goimports example
View after.go
package main
import (
var doc present.Doc
campoy /
Last active Jan 2, 2016
TODO list for the new go tour



  • Page navigation with Right/left instead of Page Up/down (@mattetti)
  • Allow navigation from the editor (egon)
  • Responsive design
  • Keep the sliders on place after changing page/module (cookies?)


campoy / app.go
Created Nov 18, 2016
Go Echo Server on Flex with Endpoints
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 (