Skip to content

Instantly share code, notes, and snippets.

View Poincare's full-sized avatar

Dhaivat Pandya Poincare

View GitHub Profile
package main
import (
"fmt"
)
var logChannel chan string = make(chan string)
func loggingLoop() {
for {
package main
import (
"fmt"
)
var eventChannel chan int = make(chan int)
func sayHello() {
fmt.Println("Hello, world!")
package main
import "fmt"
func wait() {
//wait around with a forever loop
for {
}
}
package main
import "fmt"
func main() {
//defines the variable a
a := 5
fmt.Println(a)
//sets a different value to a
package main
import (
"fmt"
"net"
)
//notice that in the arguments, the name of
//the variable comes first, then comes the
//type of the variable, just like in "var"
@Poincare
Poincare / gist:7386841
Created November 9, 2013 15:58
basic go file layout
package main
func main() {
}
@Poincare
Poincare / gist:7386865
Created November 9, 2013 16:00
looping
package main
import "fmt"
func main() {
//the basic for loop
for i:=1; i < 100; i++ {
fmt.Println(i)
}
}
@Poincare
Poincare / gist:7386848
Created November 9, 2013 15:59
hello world in Go
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
package main
func main {
///this creates a slice of integers with length 15
var mySlice := make([]int, 15)
}
require 'thor'
class FileOp < Thor
class_option :verbose, :type => :boolean
desc 'output FILE_NAME', 'print out the contents of FILE_NAME'
option :stderr, :type => :boolean
def output(file_name)
log("Starting to read file...")
#options[:stderr] is either true or false depending
#on whether or not --stderr was passed