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 GetVal(data map[string]any, key string) (result any, found bool) { | |
| for k, v := range data { | |
| if k == key { | |
| return v, true | |
| } else { | |
| switch v.(type) { | |
| case map[string]any: | |
| if result, found = GetVal(v.(map[string]any), key); found { | |
| return | |
| } |
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 ( | |
| "log" | |
| "testing" | |
| ) | |
| func doubleMe(x float64) float64 { | |
| return x * 2 | |
| } |
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 main() { | |
| slice := []int{1, 2, 3, 4, 5} | |
| var count int | |
| for i := 0; i < len(slice); i++ { |
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
| // You can edit this code! | |
| // Click here and start typing. | |
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "time" | |
| ) |
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
| // You can edit this code! | |
| // Click here and start typing. | |
| package main | |
| import "fmt" | |
| type Item struct { | |
| name string | |
| number int | |
| } |
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
| rtmp { | |
| server { | |
| listen 1935; | |
| chunk_size 4000; | |
| # TV mode: one publisher, many subscribers | |
| application tv { |
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
| ffmpeg -i input.avi -vcodec copy -acodec copy -f mpegts output-file.ts |
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
| int[] v1 = {1,2,3}; | |
| int[] v2 = {3,2,1}; | |
| // dot product of vector | |
| int[] dotProducts = v1.DotProduct(v2); | |
| // output: | |
| // 3 | |
| // 4 | |
| // 3 | |
| public static int[] DotProduct(this int[] vector1, int[] vector2) |
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 fullOuterExclusiveJoin = Context.Artists.FullOuterExclusiveJoin(Context.Albums, artist => artist.Id, album => album.ArtistId, | |
| (artist, album) => new { ArtistName = artist != null ? artist.Name : "Not Found", AlbumName = album != null ? album.Name : "Not Found" }); |
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 rightExclusiveJoin = Context.Artists.RightExclusiveJoin(Context.Albums, artist => artist.Id, album => album.ArtistId, | |
| (artist, album) => new { ArtistName = artist != null ? artist.Name : "Not Found", AlbumName = album != null ? album.Name : "Not Found" }); |
NewerOlder