Skip to content

Instantly share code, notes, and snippets.

View slawosz's full-sized avatar

Sławosz Sławiński slawosz

View GitHub Profile
package main
import "fmt"
import "encoding/json"
type Foo struct {
Foo string
Body interface{}
}
package main
import "fmt"
type Foo struct {
Payload string
}
type Bar struct {
Foo
package main
import (
"net/http"
"net/http/httptest"
)
type FooRequest struct {
Payload string
}
@slawosz
slawosz / foo.go
Created August 14, 2014 14:51
go experiments with embedding and interfaces
package main
import "fmt"
import "encoding/json"
type Versions struct {
versions []int
}
func (v Versions) First() int {
import sys
class MyClass:
"""A simple example class"""
def foo(self):
return 'foo meth'
def bar(self):
return 'bar meth'
@slawosz
slawosz / super.rb
Last active January 2, 2016 15:08
module Foo
def foo
super
puts "super"
end
end
module Baz
def foo
puts "foo"
# global obj instance (instance of Object class)
puts self
# instance of class Class, so we can have objects of this class
class Klass
@foo = 'bar'
puts self #(Klass itself)
# we create instance method
# or (more precisly) method in current self
def foo
@slawosz
slawosz / multiple_sources_proxy.go
Last active December 26, 2015 11:08
Various go research scripts: * reading http request
package main
import (
"net/http"
"bytes"
"bufio"
"net/http/httputil"
"fmt"
"log"
@slawosz
slawosz / singletons.rb
Last active December 26, 2015 05:18
ruby mistery
# self
class Foo
# self
# belongs_to
def Foo.foo
@bla = '123'
puts 'bla'
end
module A
class Foo
def foo
puts 'foo'
end
end
end
module B
include A