Skip to content

Instantly share code, notes, and snippets.

View napsy's full-sized avatar

Luka Napotnik napsy

View GitHub Profile
#include <stdlib.h>
#include <gtk/gtk.h>
struct MainWindow {
GtkWidget *window;
gboolean draw;
GAsyncQueue *draw_queue;
cairo_surface_t *surface;
} *main_window;
package main
func main() {
for i,v := range []string{"sss", "sffg", "gfdbf"} {
println("Ime " + string(i+48) + " = " + v[1:3])
}
}
package main
import "fmt"
type Sortable interface {
Less(b Sortable) bool
}
type Person struct {
age, height int
package main
import "fmt"
type Sortable interface {
Less(b Sortable) bool
}
type Person struct {
age, height int
/*
* A quick example how to generate expression trees using
* the Go programming language.
*/
package main
import (
"strings"
"container/vector"
package main
import "gtk"
import "fmt"
func main() {
gtk.Init(nil)
vbox := gtk.VBox(false, 2)
window := gtk.Window(gtk.GTK_WINDOW_TOPLEVEL)
package main
import (
"os"
"encoding/binary"
)
type info struct {
a, b, c int32
d, e, f uint8
/*
Parse() calls uuid_unparse() which takes unsigned char * as arg1 and char * as arg2
-- parses the first argument and writes a string representation in the second argument (37 bytes)
*/
func Parse(_uuid []byte) string {
var _str []byte = make([]byte, 37)
C.uuid_unparse((*C.uchar)(unsafe.Pointer(&_uuid)), (*C.char)(unsafe.Pointer(&_str)))
return string(_str)
}
package uuid
// #include <stdlib.h>
// #include <uuid/uuid.h>
import "C"
import "unsafe"
func Generate() []byte {
var uuid []byte = make([]byte, 16)
package main
import (
"io/ioutil"
"unsafe"
)
type Data struct {
Head [4]byte
Flags byte