Skip to content

Instantly share code, notes, and snippets.

View tzafrirben's full-sized avatar

Tzafrir Ben Ami tzafrirben

View GitHub Profile
type user struct {
UserId int `json:"userId"`
UserName string `json:"userName"`
FirstName string `json:"firstName"`
LastName string `json:"lasttName"`
}
(:body
{:userId 123
:userName "[email protected]"
:firstName "John"
:lastName "Doe"
...})
const newUser = {
userName: "[email protected]",
firstName: "John",
lastName: "Doe",
...
};
const request = require('request');
const options = {
method: 'POST',
const user = {
userId: 123,
userName: "[email protected]",
firstName: "John",
lastName: "Doe",
...
};
{:user-id 123
:user-name "[email protected]"
:first-name "John"
:last-name "Doe"
...}
(defn hello-world []
(loop [hello-world "Hello World"
spaces ""
diagonal []]
(if-not (seq hello-world)
(string/join "\n" diagonal)
(recur (rest hello-world)
(str spaces " ")
(conj diagonal (str spaces (first hello-world)))))))
(defn hello-world []
(let [lines (map-indexed (fn [index ch]
(str (->>
(repeat " ")
(take index)
(apply str)) ch)) "Hello World")]
(string/join "\n" lines)))
def hello_world():
space_counter = 0
s = "Hello World"
for c in s:
print(" " * space_counter + c)
space_counter += 1
(defn hello-world []
(doseq [[index ch] (map-indexed vector "Hello World")]
(println (->>
(repeat " ")
(take index)
(apply str)) ch)))
package main
import "fmt"
func main() {
space := ""
for _, c := range "Hello World" {
fmt.Println(space + string(c))
space += " "
}