Skip to content

Instantly share code, notes, and snippets.

View tarsisazevedo's full-sized avatar

Tarsis Azevedo tarsisazevedo

View GitHub Profile
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct {
width int
package main
import (
"fmt"
"math"
)
type ErrNegativeSqrt struct {
number float64
}
package main
import (
"fmt"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
z := complex128(1)
return z - ((cmplx.Pow(z, 3) - x) / 3 * cmplx.Pow(z, 2))
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
x := 0
y := 1
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
words_counted := make(map[string]int)
words := strings.Fields(s)
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
points_y := make([][]uint8, dy)
for i := range(points_y) {
points_x := make([]uint8, dx)
for j := range(points_x) {
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := 1.0
old_z := 0.0
listen: "0.0.0.0:8090"
database:
url: 127.0.0.1:27017
name: tsuru
git:
unit-repo: /home/application/current
host: 127.0.0.1
protocol: http
port: 8080
aws:
@tarsisazevedo
tarsisazevedo / gist:4635507
Created January 25, 2013 15:57
gandalf.conf
bin-path: /home/git/gandalf/dist/gandalf
database:
url: 127.0.0.1:27017
name: gandalf
git:
bare:
location: /var/repositories # you'll need to create this dir and chown it to your user
template: /home/git/bare-template # this configuration is optional, if you don't have any custom stuff in your bare, just comment it
daemon:
export-all: true
@tarsisazevedo
tarsisazevedo / robot.js
Created December 4, 2012 13:22 — forked from fabiopimentel/robot.js
Optimus Prime
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();