Skip to content

Instantly share code, notes, and snippets.

Yiting yiting007

Block or report user

Report or block yiting007

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
View array_append.go
package main
import (
"fmt"
)
func main() {
size := 3
list := make([]int, size)
for i := 0; i < size; i++ {
@yiting007
yiting007 / dateCompare.go
Created May 13, 2015
Convert a given string to date then see if it is before or after now
View dateCompare.go
package main
import (
"fmt"
"time"
)
func main() {
layout := "01/02/2006, 03:04PM"
@yiting007
yiting007 / getServiceAccountClient.go
Created May 7, 2015
GAE get service account client
View getServiceAccountClient.go
package gaeOauth
import (
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
"golang.org/x/oauth2/jwt"
)
var scopes = []string{}
@yiting007
yiting007 / shuffle.go
Created May 4, 2015
Shuffle an array in Golang
View shuffle.go
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
array := []int{1, 2, 3, 4, 5, 6, 7}
@yiting007
yiting007 / subset.js
Last active Aug 29, 2015
Get a random subset of the set
View subset.js
var pool = ["1", "2", "3", "4", "5"]
var getRandomSubsets = function (num) { // num: #of elements in the subset
if (num.length > pool) {
return null;
}
var subPool = {};
for (var i = 0; i < num; i++) {
var max = pool.length - 1;
var min = 0;
var pick = Math.floor(Math.random() * (max - min + 1)) + min;
You can’t perform that action at this time.