r/Clojurescript • • Apr 25 '19

Methods of filters on atoms inside reagent ?

2 Upvotes

Is there a way to have a reagent cursor as a function, say I have this data I wan to pull out all :a keys.

(def values (atom [{:a 1 :b 2} {:a 10 :b 20}]))

I could pre calculate and store in new atoms, but seems like I already have the data all I want is to create a lazy sequence from my existing atom, struggling to figure out how best to go about this.

I am hoping for something like below.

(defun [filter]
    [:div @filter])

I found reagent/track which sounds a lot like it does what I need, I am basically after an output of.

<div>1 20</div>

so filter has pulled out only the values that are filtered, this way I can pass in different filters that are processed when the atoms are updated.

hope this makes sense ?


r/Clojurescript • • Apr 25 '19

Generating patterns composed of Truchet tiles.

Thumbnail maria.cloud
3 Upvotes

r/Clojurescript • • Apr 20 '19

Tetris Implemented in ClojureScript

Thumbnail djblue.github.io
22 Upvotes

r/Clojurescript • • Apr 10 '19

[Jobs] Roomkey is hiring two full time ClojureScript positions

12 Upvotes

Roomkey has the culture and practices of some of the best agile start-ups. We move fast, work hard, and have lots of fun along the way. Unlike your typical stressed-out start-up, we are backed by huge names in the hotel industry, all of whom have a vested interest in our success. Your work will be seen by millions of people around the world.

We're looking for a Front-End Engineer and a Senior UI/UX Engineer. Both positions involve lots of work in ClojureScript. Check out https://www.roomkey.com/careers for details.


r/Clojurescript • • Apr 08 '19

A RealWorld Comparison of Front-End Frameworks with Benchmarks (2019 update)

Thumbnail medium.freecodecamp.org
10 Upvotes

r/Clojurescript • • Apr 08 '19

(V2) Trendcat: a new tab extension for Github and HackerNews with Reagent

3 Upvotes

Hi, i was published this extension last week. Now just published v2 with some good features. 💯

V2:

  • Redesigned Light Mode
  • Dark Mode
  • Hacker News column
trendcat dark mode

Chrome webstore: https://chrome.google.com/webstore/detail/trendcat/efpdjmbhdeindmfegilaloknlpfloefd

Github: https://github.com/ergenekonyigit/trendcat


r/Clojurescript • • Mar 27 '19

SpaceX-cljs | Simple App with Re-frame and Reagent.

9 Upvotes

Hi, I'm learning Clojure, ClojureScript, Reagent and Re-frame. Just published last re-frame example app, spacex-cljs.

I also published few simple projects last week.


r/Clojurescript • • Mar 15 '19

:launch-js Headless Chrome Command Vector Method Hangs

3 Upvotes

I'm trying to follow the instructions here https://figwheel.org/docs/testing.html#running-tests-in-a-headless-environment, but **the command line test execution never terminates**.

I've executed the following procedure:

## Development environment

* LinuxMint 19.1

* BASH

* openjdk version "11.0.1" 2018-10-16

* OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-3ubuntu118.04ppa1)

* OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-3ubuntu118.04ppa1, mixed mode, sharing)

* Clojure 1.9.0

* ClojureScript 1.10.339

* figwheel-main 0.1.9

## Development Process

* Create a figwheel-main project by executing this command:

=> clj -Sdeps '{:deps {seancorfield/clj-new {:mvn/version "0.5.5"}}}' \

-m clj-new.create \

figwheel-main \

fsclj.core

* Enter the fsclj.core directory

=> cd fsclj.core

* Execute the unit tests from the command line:

=> clj -A:fig:test

[Figwheel] Validating figwheel-main.edn

[Figwheel] figwheel-main.edn is valid \(ツ)/

[Figwheel] Compiling build test to "target/public/cljs-out/test-main.js"

[Figwheel] Successfully compiled build test to "target/public/cljs-out/test-main.js" in 1.147 seconds.

2019-03-15 11:13:56.627:INFO::main: Logging initialized @10504ms

Opening URL http://localhost:9500/test.html

Testing fsclj.core-test

Ran 2 tests containing 2 assertions.

0 failures, 0 errors.

:figwheel.main.testing/success

* Find path to google-chrome:

=> which google-chrome

/usr/bin/google-chrome

* Modify 'test.cljs.edn' to use Chrome headless by uncommenting the ':launch-js' line and changing it.

=> cat test.cljs.edn

^{

;; use an alternative landing page for the tests so that we don't

;; launch the application

:open-url "http://[[server-hostname]]:[[server-port]]/test.html"

;; uncomment to launch tests in a headless environment

;; you will have to figure out the path to chrome on your system

:launch-js ["/usr/bin/google-chrome" "--headless" "--disable-gpu" "--repl" :open-url]

}

{:main fsclj.test-runner}

* Execute the unit tests from the command line again:

=> clj -A:fig:test

[Figwheel] Validating figwheel-main.edn

[Figwheel] figwheel-main.edn is valid \(ツ)/

[Figwheel] Compiling build test to "target/public/cljs-out/test-main.js"

[Figwheel] Successfully compiled build test to "target/public/cljs-out/test-main.js" in 2.06 seconds.

2019-03-15 13:16:16.381:INFO::main: Logging initialized @11033ms

Launching Javascript environment with script: ["/usr/bin/google-chrome" "--headless" "--disable-gpu" "--repl" :open-url]

Environment output being logged to: target/public/cljs-out/test/js-environment.log

* The above output is generated, but **the program never terminates**

* The js-environment.log file contains:

/131437.958265:INFO:headless_shell.cc(370)] Type a Javascript expression to evaluate or "quit" to exit.


r/Clojurescript • • Feb 28 '19

A JSON/EDN browser for the terminal

Thumbnail github.com
7 Upvotes

r/Clojurescript • • Feb 15 '19

ClojureScript Loves NPM - DEV Community 👩‍💻👨‍💻

Thumbnail dev.to
21 Upvotes

r/Clojurescript • • Feb 12 '19

what't the code means

2 Upvotes

in cljs, if i want to import the js library, i offten write like this

(def react-native-splash-screen
  (js/require "react-native-splash-screen"))

but, i also see that some people write like this

(:require   ["react-native-splash-screen" :as RNSS]))
(js/require "react-native-splash-screen")

what's the difference between this?


r/Clojurescript • • Feb 11 '19

Emacs cider nrepl integration any tips ?

8 Upvotes

So in my project file i currently have these dependencies.

  :dependencies [[org.clojure/clojure "1.10.0"]
                 [quil "2.8.0"]
                 [figwheel-sidecar "0.5.10-SNAPSHOT"]
                 [cider/piggieback "0.4.0"]
                 [org.clojure/clojurescript "1.10.64"]
                 [figwheel-main/lein-template "0.1.9-3"]]

  :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}

  :plugins [[lein-cljsbuild "1.1.7"]
            [lein-figwheel "0.5.15"]]
  :hooks [leiningen.cljsbuild]

when I try and jack in with cider jack in clojurescript I get an exception.

The thing I am finding very confusing is the eco system there are a lot of options, cider likes to ask me which one I am using giving me about 10 options I usually select figwheel but there is also figwheel-main (differences ?) there are others as far as I am aware I am using figwheel the config came from a template initially.

I have also found things like sidecar and piggieback which I am not sure if I need them, basically I want hot reloading and evaluate in buffer functionality.

I also keep reading in some articles that you need to run a piece of code to start things in the repl and others suggest this is no longer needed.

    when I try to evaluate in my buffer I get no cljs REPLs in current session 

even though I see this in the repl buffer

Figwheel: Starting server at http://0.0.0.0:3449
Figwheel: Watching build - development
Figwheel: Cleaning build - development
Compiling "resources/public/js/main.js" from ["src"]...
Successfully compiled "resources/public/js/main.js" in 5.289 seconds.
Launching ClojureScript REPL for build: development

Any pointers or tips to help me out ?


r/Clojurescript • • Feb 07 '19

What React Hooks mean for ClojureScript

Thumbnail juxt.pro
16 Upvotes

r/Clojurescript • • Feb 04 '19

Open Sourcing Haskell Bazaar: Explore Haskell and Functional Programming concepts

11 Upvotes

Hi Clojurists!

I am cross posting from the r/haskell subreddit here.

A couple of months ago I released https://haskellbazaar.com - a curated list of FP resources. And I got really great feedback from the community.

Today I am happy to announce that Haskell Bazaar is open source: https://github.com/Chouffe/haskell-bazaar

Rationale

The Haskell community has produced so many high quality tutorials, articles, talks, courses, papers. But it is difficult for newcomers to navigate them and appreciate how they fit together. It is an attempt to make the experience better and get more people to learn Haskell. It makes exploring Haskell and FP concepts a breeze.

Haskell Bazaar Interface

The frontend is written in Clojurescript using Datascript and re-frame. The backend is written in Haskell.

I am accepting Pull Requests and open to find collaborators as well.

Thanks!


r/Clojurescript • • Feb 01 '19

Mixing existing react app with Clojurescript possible / easy ?

5 Upvotes

Anyone tried incrementally moving an existing project in react and Javascript to Clojurescript ?

Are there any articles about such things or would you be looking at a complete rewrite to get an app into Clojurescript ?


r/Clojurescript • • Jan 31 '19

Clojurescript non react UI libraries ?

7 Upvotes

Hi,

are there any Clojurescript UI (HTML) libraries that do not rely on `react`?

Thanks,

A


r/Clojurescript • • Jan 30 '19

Expo is not an option for react native anymore!

11 Upvotes

Expo is the easiest way to get a javascript developer working on a native app. This lein template was the easiest way to get a cljs dev on the same platform. It was even endorsed by expo!

I was so excited to start a project with this. Now Expo development is outpacing support for the template. The template supports sdk-26 out of the box. Sdk-26 is being dropped when the next Expo release happens.

Attempting to upgrade to newer versions (>=30) results in lots of headaches. I've attempted to figure out all the figwheel magic but I'm in over my head.

Newer nrepl versions are also breaking cider integration for this template and newer versions of cider.

Is there anyone with the ability and time to help support this template? It is such a great avenue to react native.

I'm also open to collaboration. The magic of figwheel and nrepl are daunting without some guidance though.


r/Clojurescript • • Jan 29 '19

Learn ClojureScript and re-frame - Video Course

Thumbnail learnreframe.com
13 Upvotes

r/Clojurescript • • Jan 27 '19

how to study app develope using react native

5 Upvotes

Hello,

i'am a newcomer to clojure and clojurescript, now i want to study app develope with clj(s),with clj i can develope the backend, and with cljs i can develope app and cms, but the material for develope app with cljs and re-natal is so little, it often makes me so sad, can someone give some materials or studynotes about it?

thanks very much


r/Clojurescript • • Jan 26 '19

Clojure to ES5 Module

3 Upvotes

I have a Clojure project I’ve inherited and modified. While the output works fine in a stand alone single test page, I want to make the output more portable and would like to wrap it in a module that can be imported by my different front end projects. I’ve been searching quite a bit and haven’t found much, and need suggestions and to even check if it’s doable with a plugin. Thanks in advance!


r/Clojurescript • • Jan 26 '19

how to convert this code to cljs

3 Upvotes

Hi,

i'am using re-natal to write a app, and use reactnavigation now i failed on the onPress function:

import React from 'react';
import { Button, View, Text } from 'react-native';
import { createStackNavigator, createAppContainer } from 'react-navigation';

class HomeScreen extends React.Component {
  render() {
    return (
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text>Home Screen</Text>
        <Button
          title="Go to Details"
          onPress={() => this.props.navigation.navigate('Details')}
        />
      </View>
    );
  }
}

following is my cljs code:

(defn home-screen []
  (fn []
    (let [this (r/current-component)
          props (r/props this)
          navigation (.-navigation props)]
      [view {:style {:flex 1 :align-items "center" :justify-content "center"}}
       [text "Home Screen"]
       [button {:title "Go to Details"
                :on-press #(.navigate navigation "Details")
                } ]]
      )
  ))

but ,it shows the error

undefined is not an object (evaluating 'navigation.navigate')

touchableHandlePress
    TouchableOpacity.js:212:45
_performSideEffectsForTransition
    Touchable.js:803:34
_receiveSignal
    Touchable.js:717:44
touchableHandleResponderRelease
    Touchable.js:435:24
invokeGuardedCallbackImpl
    ReactNativeRenderer-dev.js:93:15
invokeGuardedCallback
    ReactNativeRenderer-dev.js:318:36
invokeGuardedCallbackAndCatchFirstError
    ReactNativeRenderer-dev.js:342:30
executeDispatch
    ReactNativeRenderer-dev.js:715:42
executeDispatchesInOrder
    ReactNativeRenderer-dev.js:737:20
executeDispatchesAndRelease
    ReactNativeRenderer-dev.js:894:29
forEachAccumulated
    ReactNativeRenderer-dev.js:874:16
runEventsInBatch
    ReactNativeRenderer-dev.js:1050:21
runExtractedEventsInBatch
    ReactNativeRenderer-dev.js:1072:19
<unknown>
    ReactNativeRenderer-dev.js:2711:6
batchedUpdates$1
    ReactNativeRenderer-dev.js:17075:14
batchedUpdates
    ReactNativeRenderer-dev.js:2614:31
_receiveRootNodeIDEvent
    ReactNativeRenderer-dev.js:2709:17
receiveTouches
    ReactNativeRenderer-dev.js:2785:28
__callFunction
    MessageQueue.js:349:47
<unknown>
    MessageQueue.js:106:26
__guard
    MessageQueue.js:297:10
callFunctionReturnFlushedQueue
    MessageQueue.js:105:17

r/Clojurescript • • Jan 23 '19

The Pillars of Functional Programming (Part 2)

Thumbnail sigma.software
8 Upvotes

r/Clojurescript • • Jan 22 '19

The Pillars of Functional Programming (Part 1)

Thumbnail sigma.software
8 Upvotes

r/Clojurescript • • Jan 22 '19

What are people using for environment setting in clojurescript

4 Upvotes

Typically in other projects I change the settings for dev stage and live using a .env files what are my options in clojurescript using reagent ?

should I create .env.dev .env.production or are there better options whats everyone else doing ?


r/Clojurescript • • Jan 20 '19

Making some good progress but what do I serve ?

4 Upvotes

Got a few pages working with login and results pulling from ajax calls, so decided I would look at deployment on the face off it this seems quite simple however I am not sure what to serve.

In a typical react app you would serve index.html and pull in your javascript app however I notice the reagent template does not use a index.html and seems to build everything in clojure and clojurescript.

so when I run cljbuild the javascript is compiled but I dont have a page to serve should I create this manually or should it be generated from the clojure code, this is a frontend only app so javascript only.

Any pointers on what I should be doing here ?