Skip to content

Instantly share code, notes, and snippets.

@julianshen
julianshen / login.html
Created March 5, 2012 17:45
login.html
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div id="fb-root"></div>
<fb:login-button width="200" max-rows="1"
scope="user_likes, friends_likes, user_groups, friends_groups, read_stream, read_friendlists, user_activities, offline_access, publish_stream">
</fb:login-button>
@julianshen
julianshen / fbloginwithshowface.html
Created March 5, 2012 17:48
fbloginwithshowface
<fb:login-button show-faces="false" width="200" max-rows="1"
scope="user_likes, friends_likes, user_groups, friends_groups, read_stream, read_friendlists, user_activities, offline_access, publish_stream">
</fb:login-button>
@julianshen
julianshen / fbloginwithshowface.html
Created March 5, 2012 17:48
fbloginwithshowface
<fb:login-button show-faces="true" width="200" max-rows="1"
scope="user_likes, friends_likes, user_groups, friends_groups, read_stream, read_friendlists, user_activities, offline_access, publish_stream">
</fb:login-button>
@julianshen
julianshen / render-in-iframe.html
Created March 5, 2012 17:50
render-in-iframe
<fb:login-button render-in-iframe="true" width="200" max-rows="1"
scope="user_likes, friends_likes, user_groups, friends_groups, read_stream, read_friendlists, user_activities, offline_access, publish_stream">
</fb:login-button>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div id="fb-root"></div>
<fb:login-button width="200" max-rows="1"
scope="user_likes, friends_likes, user_groups, friends_groups, read_stream, read_friendlists, user_activities, offline_access, publish_stream">
@julianshen
julianshen / a.go
Created October 23, 2012 11:04
[Go] fibonacci with closure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() uint64 {
var x, y, z uint64 = 0, 1, 0
return func() uint64 {
z, x, y = x, y, x+y
@julianshen
julianshen / merge.go
Created October 23, 2012 16:52
[Go] Concurrent merge sort
package main
import "fmt"
func Merge(ldata []int, rdata []int) (result []int) {
result = make([]int, len(ldata) + len(rdata))
lidx, ridx := 0, 0
for i:=0;i<cap(result);i++ {
switch {
@julianshen
julianshen / d.go
Created October 24, 2012 03:17
[Go] Demo defer
package main
import "fmt"
func deferdemo(n int) {
fmt.Println(n)
defer fmt.Println("a")
fmt.Println("b")
@julianshen
julianshen / handler.go
Created November 2, 2012 10:31
[Go] Type, Method, and Interface
type Handler interface {
ServeHTTP(ResponseWriter, *Request)
}
type HandlerFunc func(ResponseWriter, *Request)
// ServeHTTP calls f(w, r).
func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request) {
f(w, r)
}
package main
import (
"fmt"
uuid "github.com/julianshen/GoUUID"
)
func main() {
_uuid, err := uuid.RandomUUID()