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
| copy := reflect.New(reflect.TypeOf("*event.Model").Elem()).Interface().(proto.Message) | |
| func NewProtoByName(protoType string) (proto.Message, error) { | |
| // reflect.Type of a pointer to the Go struct representing protoType. | |
| msgPtr := proto.MessageType(protoType) | |
| if msgPtr == nil { | |
| return nil, errors.New("failed to reflectively find a proto message named " + protoType) | |
| } | |
| // Dereference the pointer and get a struct reflect.Type. | |
| msgType := msgPtr.Elem() | |
| newMsg := reflect.New(msgType) |
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
| import ( | |
| "sync" | |
| ) | |
| // Storage - in-memory simple storage | |
| type Storage struct { | |
| data []DashboardRow | |
| ids map[string]bool | |
| mu *sync.Mutex | |
| } |
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
| /** | |
| * Changes value to past tense. | |
| * Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc. | |
| * http://jsfiddle.net/bryan_k/0xczme2r/ | |
| * | |
| * @param {String} value The value string. | |
| */ | |
| Vue.filter('past-tense', function(value) { | |
| // Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing | |
| var vowels = ['a', 'e', 'i', 'o', 'u']; |
NewerOlder