This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var date = new Date(); | |
var year = date.getFullYear(); | |
var month = date.getMonth(); | |
var day = date.getDate(); | |
var firstDayOfLastMonth = new Date(year, month-1, 1); | |
var firstDayOfNextMonth = new Date(year, month+1, 1); | |
var lastDayOfLastMonth = new Date(year, month, 0); | |
var dayOfThreeDaysAgo = new Date(year, month, day-3); | |
var dateOfThreeDaysAgo = new Date(date.setDate(date.getDate() - 3)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var sheetId = ""; | |
var sheetTab = ""; | |
var cell = getSpecificCell(sheetId, sheetTab, "A1"); | |
var th = getTableHeader(sheetId, sheetTab, "A1:K1"); | |
var td = getTableData(sheetId, sheetTab, "A2:K5000"); | |
var table = makeTable(th, td); | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function padLeft(nr, n){ | |
return Array(n-String(nr).length+1).join('0')+nr; | |
} | |
var ip = "203.104.101.18"; | |
var ipArr = ip.split("."); | |
var ipArr0Padding = [] ; | |
for(var i=0; i<ipArr.length; i++) { | |
ipArr0Padding.push( padLeft((+ipArr[i]).toString(2), 8) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// startDayOfThisMonth | |
// =eomonth(today(),-1)+1 | |
// endDayOfThisMonth | |
// =eomonth(today(),0) | |
// dayOfToday | |
// =today() | |
// numberOfBusinessDayInThisMonth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strconv" | |
) | |
func main() { | |
ret := DoZeroPadding(10000, 100) | |
fmt.Println(ret) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
func set(p, v interface{}) error { | |
pv := reflect.ValueOf(p) | |
if pv.Kind() != reflect.Ptr { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
//https://golang.org/doc/effective_go.html#type_switch | |
func main() { | |
var t interface{} | |
t = 12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
"sort" | |
) | |
func main() { | |
i := []int{5, 2, 6, 3, 1, 4} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type Class struct{} | |
func (c *Class) Method() { print("hello") } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getPolicy(w http.ResponseWriter, r *http.Request) { | |
ctx := context.Background() | |
apiURL := fmt.Sprintf("https://cloudresourcemanager.googleapis.com/v1/projects/%s:getIamPolicy", "dev") | |
request, _ := http.NewRequest("POST", apiURL, nil) | |
client, err := google.DefaultClient(c, "https://www.googleapis.com/auth/cloud-platform") | |
if err != nil { | |
return | |
} | |
resp, err := client.Do(request) | |
if err != nil { |
OlderNewer