Fork me on GitHub
#beginners
<
2021-03-01
>
Dave Suico05:03:03

Good day everyone! Has anyone known some code samples or articles on how to use this library? I'm having a hard time using this especially when I'm new to the syntax. Thank you! https://github.com/SparkFund/google-apps-clj

Dave Suico06:03:49

Hey men, thanks a lot I haven't thought of that trick:sweat_smile:

phronmophobic06:03:46

yea, it's great. you just find someone else that already wrote the code you need 😄

dharrigan07:03:05

Here's a very very basic exmaple using authentication and listing the contents of your google drive. Someone else was asking about the google library a few weeks ago, so I put together an example: https://github.com/dharrigan/google-apis-example

Adrian Imanuel07:03:24

Hi @U01MZHN8B55, i personally use this just recently (been through hard times as well to understand this around 3 wks of on & off struggle), and this is a complimentary guidance for SparkFund, to make it much more simple, no need to use Googlecreds.edn, just specify it using (def) like @dharrigan guidance (he helped me before too). https://github.com/aimanuel/Google-Oauth2-Clojure

Adrian Imanuel07:03:25

@U01MZHN8B55 you can personal chat me if it's still unclear 😉

Dave Suico08:03:26

@dharrigan awesome man thanks! your code is nice to read, gonna try it soon.

Dave Suico08:03:05

Hello @U01LXHAH0GG thanks man for the extended help, remember the last time I asked about this, and then I ended up using HTTP? turns out my senior wasn't impressed and instead wanted me to use that library since he uses this a lot. 😅

Adrian Imanuel08:03:57

Yes, i've searching a lot of method as well, but this one is good. the hiccups i've met (that made me struggle for 3 wks is this part) lol... so I made the complimentary guidance with screenshot to make it easier https://clojurians.slack.com/archives/C053AK3F9/p1614308927419900

Dave Suico16:03:02

hey guys I tried to call get-auth-map and now I'm getting this

Dave Suico16:03:17

Okay guys i'm good now i just need to publish my project

Dave Suico17:03:12

so yeah I can see my token now from the webpage but whenever I paste it in the console(VSCode) I'm getting this

Dave Suico17:03:28

or when i paste the code nothing happens

Adrian Imanuel09:03:12

I don't know any other IDE besides emacs... as in emacs i paste in stdin : PasteTheAuthCodeHere . you should ask others who use vscode where to paste the authcode

Dave Suico12:03:43

Finally got it guys, it needs to be run in repl

sb12:03:27

Is there equivalent like clj-jwt lib in Clojurescript?

sb12:03:17

exactly generate with jwt/sign with :RS256 , without nodejs libs (shadow-cljs)

delaguardo14:03:55

@U2T2ZEVPC it is written as cljc so the code can be shared between cljs and clj and it is compatible with buddy

sb14:03:35

@U04V4KLKC thank you very much!!

sb14:03:39

I check it!

delaguardo15:03:04

https://github.com/xapix-io/axel-f/blob/master/test/axel_f/jwt_test.cljc there are some tests available, but they mainly for testing of my dsl. but you can get some understanding how arguments should look like 🙂

delaguardo15:03:35

and fill free to copy-paste or ping me in case of any questions

sb15:03:37

Ok, thanks! I try out! 🙂

delaguardo15:03:56

argh, the sign function is actually missing in cljs

delaguardo15:03:18

it is not yet published (

sb15:03:29

Yes, this what I saw. Because I would like to create “Another Clojure/script Google api lib..” and I stopped at this point.., because I need to use RS256 sign. I re-check the documentation too.. Maybe I will use nodejs at Clojurescript part to solve this.. but I don’t know that is the best idea...

sb15:03:33

btw thank you very much! 🙂

afry19:03:37

Good afternoon fellow beginners! I'm going to be livestreaming another Clojure coding challenge in about 10-15 minutes if you'd like to join me and check it out. Stream link is here: https://www.twitch.tv/a_fry_ This afternoon's challenge comes from the most recent Eric Normand newsletter challenge: implementing a filter indexed function. Link to the challenge here: https://purelyfunctional.tv/issues/purelyfunctional-tv-newsletter-416-why-do-we-program-in-hard-mode/ After the challenge, I'll be live-coding my startup product for this month. If you'd like to learn more about THAT (or the Startup in a Month project in general), inquiring minds will be kindly directed here: https://startupinamonth.net/pic-story-pitch/

Stuart20:03:15

A silly version of the challenge with zipmap

(defn filter-index-2 [f xs]
  (->> (zipmap (range (count xs)) xs)
       (sort-by key)
       (filter (fn [[k _]] (f k)))
       (vals)))
And with reduce:
(defn filter-index [f xs]
  (reduce (fn [acc i]
            (let [n (nth xs i)]
              (if (f i)
                (conj acc n)
                acc))) [] (range (count xs))))

clojure-spin 3
afry22:03:02

And here's what I built on the stream!

(defn filter-indexed [predicate collection]
  (reduce-kv
   (fn [res idx itm] (if (predicate idx itm) (conj res itm) res))
   []
   collection))

dharrigan21:03:08

Namespaces, I see, cannot start with a numeric, i.e., (ns 01-foo-bar) Is that a limitation of the JVM or a restriction on Clojure itself?

dpsutton21:03:41

its not a valid symbol > Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, ', ?, <, > and = (other characters may be allowed eventually).

hiredman22:03:27

this is only a restriction on symbols that the reader reads, you can create symbols with arbitrary names and create namespaces with those symbols as names as long as you don't care about mapping them to files or reading the names, or aot compilation, etc

hiredman22:03:46

~ % clj
Clojure 1.10.1
user=> (in-ns (symbol "hello world"))
#object[clojure.lang.Namespace 0x7b02e036 "hello world"]
hello world=> (refer 'clojure)
Syntax error compiling at (REPL:1:1).
Unable to resolve symbol: refer in this context
hello world=> (clojure.core/refer-clojure)
nil
hello world=> (+ 1 2)
3
hello world=> (def x 1)
#'hello world/x
hello world=> #'x
#'hello world/x
hello world=> (.ns #'x)
#object[clojure.lang.Namespace 0x7b02e036 "hello world"]
hello world=> *ns*
#object[clojure.lang.Namespace 0x7b02e036 "hello world"]
hello world=>

dpsutton22:03:19

so Clojure itself

dharrigan22:03:04

I'll whack a char in front 🙂

ghadi22:03:00

I believe java classfiles also cannot start with a number

phronmophobic22:03:05

they also can't have !, dashes or asterisks, but those issues can be worked around with munging

borkdude22:03:40

@dharrigan I totally recommend this:

(ns Ø123)

(defn hello [] 'Ø123)
(prn (hello))

😂 3
borkdude22:03:13

Not really, j/k ;)

robertfw22:03:46

They do say that the hardest problem in programming is naming things, maybe we can give ourselves some new tools by using emoji

dharrigan07:03:49

what a great idea! 🙂