golang get request


url := "http://example.com/"

// make a get request
res, err := http.Get(url)
if err != nil {
	panic(err.Error())
}
// func ReadAll return bytes
body, err := ioutil.ReadAll(res.Body)
if err != nil{
	panic(err.Error())
}
// convert byte to string and print
fmt.Println(string(body))
os.Exit(0)

Drag drop in javaScript (coffeescript)


# helper function
put = ()-> console.log "Arguments : ", arguments

###
get position when it was clicked.
###

class Drag_me
	constructor: (@bg_div)->

	make_dynamic:()->
		bg_el = $ @bg_div

		mouse_down = false

		bg_el.mousedown (e)->
			# mouse_down
			mouse_down = true

			# see if it was right click, (1 = right click, 2 = middle click, 3 for left click)
			if e.which == 1

				# some time chrome uses default cursor so to prevent this
				e.originalEvent.preventDefault();

				# change mouse icon
				bg_el.css('cursor','all-scroll')

				# get current position x stands for left and right, y stands for top to button (z for depth)
				origin_x = e.clientX
				origin_y = e.clientY

				# get current position
				left = parseInt(bg_el.css('left'), 10)
				top = parseInt(bg_el.css('top'),  10)

				$(this).mousemove (e)->

					# if mouse click is not active then don't do anything.
					if mouse_down is true

						# get distance then minus with original mouse position (when it was clicked),
						# now we have the mouse distance
						x = e.clientX - origin_x
						y = e.clientY - origin_y

						# add covers distance to div's position
						bg_el.css('left', (left + x) + 'px')
						bg_el.css('top', (top + y) + 'px')
					  
		.mouseup (e)->
			# set back to false
			mouse_down = false

			# set cursor back to default
			bg_el.css('cursor','auto')
			
d = new Drag_me(".wrapper")
d.make_dynamic()


### css for div
	.wrapper {
		height: 200px;
		border: 1px solid red;
		position: absolute;
		left: 0px;
		top: 0px;
	}
###



### extra info 
	mouse x,y coordinates 
	put "clientX:", e.clientX, "clientY:", e.clientY 

	same as clientX
	put "screenX:", e.screenX, "screenY:", e.screenY

	browsers height and width
	put "view.outerHeight:" , e.view.outerHeight, "view.outerWidth:" , e.view.outerWidth

	offset from x and y coordinates
	put "pageXOffset:" , e.view.pageXOffset, "pageYOffset:" , e.view.pageYOffset
###