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 capstone-6.clj
(def github-db {"viebel"
{:username "viebel",
:name "Yehonathan Sharvit",
:email "ys@me.com",
:organizations ["ibm" "google"],
:repositories
{"klipse" {:name "klipse", :stars 23451, :forks 1254},
"titeuf" {:name "titeuf", :stars 1432, :forks 52},
"spirou" {:name "spirou", :stars 455, :forks 9}}},
"zepad"
View tagged-literals.cljs
(require
'[cljs.tools.reader :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))
(print
(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
View gains.clj
;; gorilla-repl.fileformat = 1
;; **
;;;
;; **
;; @@
(ns gains
(:require [gorilla-plot.core :as plot]
[gadjett.collections :refer [map-object]]
@viebel
viebel / memoize-tr.clj
Created Sep 20, 2018
a memoized version of a function (even if it is not referentially transparent)
View memoize-tr.clj
(defn transparent [arg]
[(type arg) (meta arg) (when (seq? arg) (seq arg)) arg])
(defn memoize-tr
"Returns a memoized version of a function (even if it is not referentially
transparent). The memoized version of the function keeps a cache of the
mapping from arguments to results and, when calls with the same arguments
are repeated often, has higher performance at the expense of higher memory use."
{:added "1.0"
@viebel
viebel / factorial.lisp
Last active May 7, 2018
Factorial in Common Lisp
View factorial.lisp
(labels ((factorial (n)
(if (= n 0)
1
(* n (factorial (- n 1))))))
(factorial 5))
View reason-3-sigma
let rec sigma (f, s) =
switch (s) {
| [] => 0
| [x, ...l] => f (x) + sigma (f, l)
};
let a = sigma ((fun (x) => x * x), [1, 2, 3]);
View reagent-attributes
(require '[reagent.core :as reagent])
(def styles {:style {:color "red"}})
(defn hello []
[:div styles
"Hello CSS"])
(reagent/render [hello] js/klipse-container)
@viebel
viebel / sigma-3.re
Created Nov 15, 2017
Sigma in reason 3
View sigma-3.re
let rec sigma (f, s) =
switch (s) {
| [] => 0
| [x, ...l] => f (x) + sigma (f, l)
};
let () = Js.log (sigma ((fun (x) => x * x), [1, 2, 3]));
You can’t perform that action at this time.