This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"time" | |
) | |
type Playable interface { | |
Play() error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Playable interface { | |
Play() error | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Playables []Playable | |
type TVGuide struct { | |
Company string `json:"company"` | |
Notices string `json:"notices"` | |
ID string `json:"id"` | |
Library Playables `json:"library"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Movie struct { | |
Title string `json:"title"` | |
Length int `json:"length"` | |
} | |
func (m *Movie) Play() error { | |
time.Sleep(time.Duration(m.Length) * time.Minute) | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (p *Playables) UnmarshalJSON(b []byte) error { | |
var LibraryFields map[string]*json.RawMessage | |
if err := json.Unmarshal(b, &LibraryFields); err != nil { | |
return err | |
} | |
for LFKey, LFValue := range LibraryFields { | |
if LFKey == "movies" { | |
var LibraryMovies []*json.RawMessage | |
if err := json.Unmarshal(*LFValue, &LibraryMovies); err != nil { | |
return err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"company": "0rkaTV", | |
"notices": "NO RUNNING WITH SCISSORS", | |
"id": "0x1337H4X0R", | |
"library": { | |
"movies": [ | |
{ | |
"title": "Titanic", | |
"length": 194 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
myjson := []byte(`{"company":"0rkaTV","notices":"NO RUNNING WITH SCISSORS","id":"0x1337H4X0R","library":{"movies":[{"title":"Titanic","length":194},{"title":"Matrix","length":150}]}}`) | |
var OrkaTVGuide TVGuide | |
if err := json.Unmarshal(myjson, &OrkaTVGuide); err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println(OrkaTVGuide) | |
fmt.Println("Hello, playground") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE methods (id, class_name, method_name, parameters, return_value, calling_to, called_from, data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.cursor.execute('''SELECT id FROM methods where calling_to LIKE "%" || ? || "%"''', (method,)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
re.compile(ur'^\.class.*\ (.+(?=\;))', re.MULTILINE) | |
re.compile(ur'^\.method.+?\ (.+?(?=\())\((.*?)\)(.*?$)(.*?(?=\.end\ method))', re.MULTILINE | re.DOTALL) | |
re.compile(ur'invoke-.*?\ {(.*?)}, (.+?(?=;))\;\-\>(.+?(?=\())\((.*?)\)(.*?)(?=$|;)', re.MULTILINE | re.DOTALL) | |
re.compile(ur'move-result.+?(.*?)$', re.MULTILINE | re.DOTALL) |
OlderNewer