This file contains 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 ( | |
"YOUR_PACKAGE_NAME/simple-cli/cmd" | |
) | |
func main() { | |
cmd.Execute() | |
} |
This file contains 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 cmd | |
import ( | |
"fmt" | |
"os" | |
"github.com/spf13/cobra" | |
) | |
var rootCmd = &cobra.Command{ |
This file contains 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 cmd | |
import ( | |
"fmt" | |
"github.com/spf13/cobra" | |
) | |
var helloCmd = &cobra.Command{ | |
Use: "hello", |
This file contains 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 cmd | |
import ( | |
"fmt" | |
"github.com/spf13/cobra" | |
) | |
var name string | |
var helloCmd = &cobra.Command{ |
This file contains 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
... | |
public Game nextTick() { | |
HashMap<Cell, Integer> updateMap = new HashMap<Cell, Integer>(); | |
for (Cell livingCell : this.cells) { | |
for (Cell neighbouringCell : livingCell.neighbours()) { | |
int currentCount = updateMap.getOrDefault(neighbouringCell, 0); | |
currentCount++; | |
updateMap.put(neighbouringCell, currentCount); | |
} | |
} |
This file contains 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 UIKit | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
var navigationController: UINavigationController? | |
func scene(_ scene: UIScene, | |
willConnectTo session: UISceneSession, | |
options connectionOptions: UIScene.ConnectionOptions) { |
This file contains 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
fun operate(subject: String, action: String.()->String) { | |
val acted = subject.action() | |
println(acted) | |
} | |
operate("foo"){ | |
"$this bar" | |
} // foo bar |
This file contains 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
fun operate(subject: String, action: (String) -> String) { | |
val acted = action(subject) | |
println(acted) | |
} | |
operate("foo"){ | |
"$it bar" | |
} //foo bar |