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
| In Python: | |
| key = /cns/pb-d/home/engedu/text/shakespeare/hamlet:0000000000014fb9' | |
| s = key.split("/")[-1] | |
| parts = s.split(":") | |
| print "%s:%s" % (parts[0], str(int(parts[1], 16))) | |
| In Go: | |
| import("fmt" | |
| "strings" | |
| "strconv" |
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" | |
| "log" | |
| "os" | |
| ) | |
| func main() { | |
| f, err := os.Open("sample.txt") |
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" | |
| "io/ioutil" | |
| "strings" | |
| ) | |
| func main() { | |
| f, err := ioutil.ReadFile("sample.txt") |
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
| username: admin | |
| password: pass |
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" | |
| func uniqueNonEmptyElementsOf(s []string) []string { | |
| unique := make(map[string]bool, len(s)) | |
| us := make([]string, len(unique)) | |
| for _, elem := range s { | |
| if len(elem) != 0 { | |
| if !unique[elem] { |
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 ( | |
| "bufio" | |
| "fmt" | |
| "io" | |
| "log" | |
| "net/http" | |
| "os" | |
| "sync" |
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 ( | |
| "encoding/csv" | |
| "fmt" | |
| _ "io" | |
| "os" | |
| ) | |
| func checkCsv() { |
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
| // components/ui/add_profile.js | |
| define(function (require) { | |
| 'use strict'; | |
| /** | |
| * Module dependencies | |
| */ | |
| var defineComponent = require('flight/lib/component'); |
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" | |
| //O(n^2) time | |
| func RemoveDuplicates(data []string) []string { | |
| length := len(data) - 1 | |
| for i := 0; i < length; i++ { | |
| for j := i + 1; j <= length; j++ { | |
| if data[i] == data[j] { |
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 copyData() { | |
| var mySheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); | |
| var range = mySheet.getDataRange(); | |
| var firstNameCell = mySheet.getRange('A1'); | |
| var lastNameCell = mySheet.getRange('B1'); | |
| var row = 1; | |
| //skip the header column | |
| var dataRange = range.offset(1, 0, range.getNumRows()-1).getValues(); | |
| for (i = 0; i < dataRange.length; i++){ |
OlderNewer