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
/* | |
Trying to use megajson with http.Get(url) but getting Decoding errors. | |
Have tried with various json responses using various structs. | |
Decoder errors at various indices (depending on json and structs I'm using): | |
==========Some Decoding Errors=============== | |
2013/11/29 18:27:23 decoding error: Unexpected comma at 112: ,; expected colon // common for NewMStatusJSONDecoder(resp.Body) | |
2013/11/29 18:29:14 decoding error: Unexpected null at 153: ; expected '{' or string | |
2013/11/29 18:39:01 decoding error: Unexpected number at 9: 1.1; expected '{' |
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 ( | |
"fmt" | |
"strings" | |
"unicode" | |
) | |
func main() { |
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
;; record Record | |
(defrecord User [fname lname address]) | |
;; ActiveRecord generally (Object.Model), instead namespace.Record | |
(defrecord Address [street city state zip]) | |
(defrecord Foo [a b c]) | |
(class Foo) ;java.lang.Class | |
;; Create an instance of the User and Address records | |
(def stu (User. "FirstName" "LastName" | |
(Address. "300 N Street" |
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 "fmt" | |
type HelloList struct { | |
people []string | |
} | |
func NewHelloList(names []string) *HelloList { | |
return &HelloList{people: names} |
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 ( | |
"bufio" | |
"fmt" | |
"os" | |
"time" | |
) | |
const numWorkers = 3 |
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 ( | |
"fmt" | |
"net/http" | |
"time" | |
"io/ioutil" | |
"github.com/pkulak/simpletransport/simpletransport" | |
) | |
var lotso_urls = []string{ |
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 "fmt" | |
// PART FOUR: in which we get the min value for delete, insert, substitute and set value in Vector, return significant Vector value. | |
func MinInt(a ...int) int { | |
min := int(^uint(0) >> 1) | |
for _, i := range a { | |
if i < min { | |
min = i |
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 "fmt" | |
// PART THREE: if characters are not the same, we step through a comparison against each character to | |
//// determine DELETION, INSERTION, SUBSTITUTION and get the minimum of the three values. | |
func MinInt(a ...int) int { | |
min := int(^uint(0) >> 1) | |
for _, i := range a { | |
if i < min { |
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 "fmt" | |
// PART TWO: step through each string character and vector/cell of dynamic programming table to determine difference. | |
//// This handles the case where both characters are an exact match, and only the "no-change" condition is used. | |
func LevenshteinTwo(s1, s2 string) { | |
m := len(s1) | |
n := len(s2) | |
width := n - 1 |
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 "fmt" | |
// http://en.wikipedia.org/wiki/Levenshtein_distance | |
// FIRST PART: define vector/cell for the dynamic programming table based on string lengths | |
func PartOneLevenshtein(s1, s2 string) { | |
m := len(s1) | |
n := len(s2) |