Categories
Go

Fetching venues from Foursquare using Go

package main import ( “fmt” “github.com/codegangsta/negroni” “github.com/gorilla/mux” “encoding/json” “net/http” “github.com/elbuo8/4square-venues” ) func main() { mux := mux.NewRouter() mux.HandleFunc(“/”, IndexHandler).Methods(“GET”) mux.HandleFunc(“/venues/{query}”, FoursquareHandler).Methods(“GET”) n := negroni.Classic() n.UseHandler(mux) n.Run(“:3000”) } func IndexHandler(w http.ResponseWriter, r *http.Request){ p := “Page” fmt.Fprintf(w, “Home %s\n”, p) } func FoursquareHandler(w http.ResponseWriter, r *http.Request){ vars := mux.Vars(r) category := vars[“query”] fs := fsvenues.NewFSVenuesClient(“FOURSQUARE_ID”, “FOURSQUARE_SECRET”) […]

Categories
nodejs

Nodes Forever Package Doesn’t Mean Forever!

I run most of my node apps on a droplet with DigitalOcean. Recently there was an issue and the droplet had to be restarted by them, but my app didn’t restart. This was a big issue for me and my client. I use Forever to run the app, but this only works if the app […]

Categories
angularjs javascript

Access and Update Model Outside Angular

In a recent project I had a form within an Iframe that needed to talk to the parent frame via postMessage. The parent frame was an angular application and I had to show and hide some content. I was able to access the scope outside angular and update via the angular.element() method (This is using […]