Skip to content

Instantly share code, notes, and snippets.

💭
still doing homework....

josh bowles jbowles

💭
still doing homework....
Block or report user

Report or block jbowles

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jbowles
jbowles / mstatus.go
Last active Dec 29, 2015
gobike MStatus struct using with megajson experiment
View mstatus.go
package gobike
/*
Example JSON:
{
"HTTPStatus":200,
"TimeLocal":"2013-11-29T18:43:59.674946633-07:00",
"TimeUTC":"2013-11-30T01:43:59.674946695Z",
"URL":{
"Scheme":"",
@jbowles
jbowles / mstatus_decoder.go
Created Nov 30, 2013
Generated code from megajson on MStatus struct
View mstatus_decoder.go
package gobike
import (
"errors"
"fmt"
"github.com/benbjohnson/megajson/scanner"
"io"
)
type MStatusJSONDecoder struct {
@jbowles
jbowles / gobike_handler_megajson.go
Last active Dec 29, 2015
Handler for trying to get megajson to work with HTTP
View gobike_handler_megajson.go
/*
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 '{'
@jbowles
jbowles / easy_token.go
Last active Dec 26, 2015
Easy out of the box natural language tokenizer using Go standard library
View easy_token.go
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
@jbowles
jbowles / DefRecord.clj
Created Oct 16, 2013
quick example of defrecord
View DefRecord.clj
;; 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"
@jbowles
jbowles / gocql_cassandra_example.go
Last active Dec 24, 2015
Cassandra and gocql quick start
View gocql_cassandra_example.go
/*
* Assuming a schema similar to the Cassandra wiki quick start (http://wiki.apache.org/cassandra/GettingStarted):
* CREATE TABLE mykeyspace.users (
* user_id int PRIMARY KEY,
* fname text,
* lname text,
* user_id int
* )
*
* RETURNs THIS:
@jbowles
jbowles / hello_function.go
Last active Dec 23, 2015
Playing with function passing in golang
View hello_function.go
package main
import "fmt"
type HelloList struct {
people []string
}
func NewHelloList(names []string) *HelloList {
return &HelloList{people: names}
View letitfail.go
package main
import (
"bufio"
"fmt"
"os"
"time"
)
const numWorkers = 3
@jbowles
jbowles / simple_transport_example.go
Created Jul 27, 2013
simple web crawler using simple_transport
View simple_transport_example.go
package main
import (
"fmt"
"net/http"
"time"
"io/ioutil"
"github.com/pkulak/simpletransport/simpletransport"
)
var lotso_urls = []string{
@jbowles
jbowles / lev_part_four.go
Created Jun 29, 2013
Part four of Levenshtein Distance
View lev_part_four.go
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
You can’t perform that action at this time.