Skip to content

Instantly share code, notes, and snippets.

View shishironline's full-sized avatar

Prof. Dr. Shishir Urdhwareshe shishironline

View GitHub Profile
@krasin
krasin / hello_xml.go
Created March 29, 2012 06:45
An example of parsing XML in Go
package main
import (
"encoding/xml"
"fmt"
"log"
)
const data = `<Note>
<To>Tove</To>
@pjz
pjz / testdoc
Created March 14, 2012 01:21
golang docstring access
#!/usr/bin/gorun
package main
import "os"
import "fmt"
import "strings"
import "go/doc"
import "go/token"
import "go/parser"
@respectTheCode
respectTheCode / static_server.js
Created February 27, 2012 20:36 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
mime = require("mime")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
@tedhagos
tedhagos / install-steps-gnu-health
Created January 2, 2012 03:07
Installation notes for GNU Health
1. Make sure you have the following requisites
- Debian or Ubuntu
- Postgresql
- Python
- Tryton
2. Install requisite software
2.1 apt-get install python-pip python-lxml python-relatorio python-psycopg2 posgresql python-tz
anonymous
anonymous / gist:1406238
Created November 29, 2011 20:09
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@gregworley
gregworley / trivialTemplate.go
Created October 7, 2011 20:48
Golang's New Template pkg
package main
import ("template" ;"os")
const templ = `Hello {{.Name}}`
type Person struct {Name string}
func main() {
me := &Person{Name: "greg"}
var t = template.Must(template.New("first").Parse(templ))
@nelsonsilva
nelsonsilva / gist:1180574
Created August 30, 2011 09:54
Golang httpd
package main
import (
"http"
"fmt"
)
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "hello, world!\n");
}
func main() {
http.HandleFunc("/", HelloServer);
@nifl
nifl / grok_vi.mdown
Created August 29, 2011 17:23
Your problem with Vim is that you don't grok vi.

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)

@nictuku
nictuku / gist:997386
Created May 29, 2011 01:47
golang union types.
// Objective: demonstrate that there are more use cases
// for union types than previously thought.
// http://groups.google.com/group/golang-nuts/browse_thread/thread/fbde059a7cfd2fa9
//
// Interface inference.
// We already have type inference, so this would be very Go-like:
type typeA int
func (x typeA) A() {}
func (x typeB) C() {}
@moderation
moderation / websocket_client.go
Created April 24, 2011 20:07
golang websockets client
package main
import (
"fmt"
"websocket"
)
// const message = "A message"
func main() {