Skip to content

Instantly share code, notes, and snippets.

Drianka Mahdy Adimas mahdyadi

View GitHub Profile
View anotherOperate.kt
fun operate(subject: String, action: (String) -> String) {
val acted = action(subject)
println(acted)
}
operate("foo"){
"$it bar"
} //foo bar
View operate.kt
fun operate(subject: String, action: String.()->String) {
val acted = subject.action()
println(acted)
}
operate("foo"){
"$this bar"
} // foo bar
View SceneDelegate.swift
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
var navigationController: UINavigationController?
func scene(_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
View messy.java
...
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);
}
}
View hello-custom.go
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var name string
var helloCmd = &cobra.Command{
View hello.go
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var helloCmd = &cobra.Command{
Use: "hello",
View root.go
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
View main.go
package main
import (
"YOUR_PACKAGE_NAME/simple-cli/cmd"
)
func main() {
cmd.Execute()
}
You can’t perform that action at this time.