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
| // jsonformat.js | |
| // a simple script that format JSON data in a more readable way. | |
| // by Calle Robertsson, calle@upset.se, 2015. | |
| var fs = require('fs'); | |
| var filename = process.argv[2]; | |
| if (!filename) { | |
| throw new Error('Missing command line argument for file name.'); | |
| } |
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" | |
| "math/rand" | |
| "os" | |
| "strconv" | |
| "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
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| "net/url" | |
| "os" | |
| "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" | |
| "math/big" | |
| ) | |
| func main() { | |
| for i := 1; i <= 10; 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
| module Main where | |
| main = do | |
| print $ map fibN' [1..10] | |
| print $ fibN' 1001 | |
| print $ length $ show $ fibN' 500000 | |
| fibN' 1 = 0 | |
| fibN' 2 = 1 | |
| fibN' n = iter 0 1 n where |
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" | |
| "sort" | |
| ) | |
| // Item has a priority and an order | |
| type Item struct { | |
| Prio int |
OlderNewer