Skip to content

Instantly share code, notes, and snippets.

Yehonathan Sharvit viebel

Block or report user

Report or block viebel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CreateDeveloperMetadataRequest.clj
(.batchUpdate "1zC8gFo20z0WdldYEQ1KuC0jGFZjHZI14fauFmCQ4H4s"
(make-batch-update [(-> (CreateDeveloperMetadataRequest.)
(.setDeveloperMetadata (-> (DeveloperMetadata.)
(.setMetadataId (int 1232))
(.setMetadataKey "foofoo")
(.setMetadataValue "123")
(.setLocation (-> (DeveloperMetadataLocation.)
View lesson-1-hello-multiple.clj
(str "Hello Advah"
" "
"Hello Yair")
(defn h [name]
(str "Hello"
" "
[(h "Yair")
View datascript-demo.clj
(require '[datascript.core :as d])
(let [schema {:aka {:db/cardinality :db.cardinality/many}}
conn (d/create-conn schema)]
(d/transact! conn [ { :db/id -1
:name "Maksim"
:age 45
:aka ["Max Otto von Stierlitz", "Jack Ryan"] } ])
(d/q '[ :find ?n ?a
View clojure-stories.clj
;loaded from gist:
;; hello worlds
(defn hello [name]
(str "Hello, " name "!"))
(defn multiple-hellos [names]
(clojure.string/join "\n" (map hello names)))
(println (hello "Yehonathan"))
View create-graph.clj
(ns dijkstra.core)
(defn make-graph [] (atom {}))
(defn add-node [g node]
(swap! g assoc node {}))
(defn add-edge [g src target]
(swap! g update src #(assoc % target 1)))
View dijkstra.clj
(ns dijkstra.core)
(defn unvisited-neighbors
"Returns unvisited node's neighbors"
[graph node unvisited] (select-keys (get graph node) unvisited))
(defn update-costs
"Returns costs updated with any shorter paths found to curr's unvisited
neighbors by using curr's shortest path"
[g costs curr unvisited]
View capstone-6.clj
(def github-db {"viebel"
{:username "viebel",
:name "Yehonathan Sharvit",
:email "",
:organizations ["ibm" "google"],
{"klipse" {:name "klipse", :stars 23451, :forks 1254},
"titeuf" {:name "titeuf", :stars 1432, :forks 52},
"spirou" {:name "spirou", :stars 455, :forks 9}}},
View tagged-literals.cljs
'[ :as r]])
(binding [r/*data-readers* {'a/num (constantly 1)}]
:a (r/read-string "{:a #a/num \"42\"}"))
View topics-low-rank.clj
(require '[clojure.string :refer [join]])
(def d (js->clj js/data :keywordize-keys true))
(join "\n"
(->> (:topics d)
(remove #(get-in % [:factors :bad]))
(remove #(<= (:count %) (+ (get-in % [:factors :automated] 0)
(get-in % [:factors :autoEmail] 0)
View quick-start.clj
(def summaries ["cold" "moderate"]) ;; creates a vector with two strings: "cold" and "moderate"
(def new-summaries (assoc summaries 2 "hot")) ;; creates a new vector with an additional string: "hot"
(def old-names {:c "celsius" }) ;; creates a map from keywords to strings
(def names (assoc old-names {:f "farenheit"})) ;; creates a new map with additional entry
(defn celsius->farenheit [c] ;; define a function that converts from celsius to farenheit
(+ 32 (* c 9/5))) ;; c * 9/5 + 32
(defn celsius->summary [c] ;; define a function that converts from celsius to summary
You can’t perform that action at this time.