Where am i able to see all leiningen templates? - clojure

Normally i could see them through:
lein new [TAB]
but this is no longer possible. Is there a central place, where they are stored?

As Martin Puda says, there is a list at clj-templates.com

Related

Actually using a cljsjs package

I'm having trouble understanding how to go from installing to using a cljsjs package. I am using the standard figwheel template, and I've made a little progress learning it, but now I'd like to use some 3rd party JS, and while cljsjs looks like the ticket, I can't find a clear example of how to actually use the packages.
I'm attempting to use the material package, to start with (http://material-ui.com). I'd like to just display a simple button to start.
I've added the [cljsjs/material "1.0.4-0"] to my project.clj, and lein installs it....now what?
Where and when should I (:require [cljsjs.material]) ?
How would I then create a <FlatButton> component, or whatever?
I see a resources/public/js/compiled/out/material.inc.js with what appears to be the full source for material - how do I use it?
Thanks in advance to any kind soul taking pity on a cljs beginner. It is incredibly appreciated. If there is anything out there that answers my question that my googling somehow missed, I apologize in advance.
The package [cljsjs/material] you're referencing does NOT use http://material-ui.com/ but instead uses: http://www.getmdl.io/
So there is NO <FlatButton>.
A primer on actually using cljsjs packages can be found here:
https://github.com/cljsjs/packages/wiki/Using-Packages
To use the material-ui package for example:
Put [cljsjs/material-ui "3.9.1-0"] in the :dependencies section of your project.clj file (make sure you update the version number to latest).
Require the cljsjs package in the (ns) section of your code: (:require material-ui)
Finally, you can reference the imported JavaScript objects directly by name: js/MaterialUI
It is sometimes difficult to figure out the JavaScript names. Generally you need to refer to the original JS package.
In the case of material-ui specifically, there are :global-exports helper mappings which you can see here, and these allow you to reference the library more conveniently and directly with material-ui.
Note that it is also quite often possible to import npm modules directly now with :npm-deps.

Enlive template auto-reload / detect changes in a Pedestal service

I am using the autoreload-server example which is working great for reloading namespaces on changes to the .clj files using ns-tracker.
https://github.com/pedestal/samples/blob/master/auto-reload-server/dev/dev.clj
However, it is not picking up changes to enlive templates in the resources/public dir. I've added my template paths to the vector in defn watch:
`([] (watch ["src" "resources" "resources/public" "public"]))`
As well as this in the namespaces that use enlive deftemplate:
(net.cgrand.reload/auto-reload *ns*)
However this does not work. My assumption is ns-tracker only works for clj files, and that I am using the enlive reload feature incorrectly.
Is anyone using enlive and have this figured out, or have any ideas to try?
I was hoping that Enlive Issue #6: Auto-reloading of templates was solved in early December 2013 in version 1.1.5 by this commit. But, in my testing, I cannot confirm that it is a fix. I might be doing something wrong.
A note: the example you cite, I think, dates from the pre-0.2.0 tooling changes for Pedestal. I could be wrong, but I think you'd be better off following the current documentation, not that sample file.
Pedestal's 'hello world' service app's key suggestions (which may change) are:
Use ns-tracker to figure out which namespaces to reload.
add :resource-paths ["config", "resources"] to project.clj so that Enlive can find your static HTML resources.
These steps are not enough to cause a change to a resource to trigger a reload, because ns-tracker will not pay attention to :resource-paths. Here are the details:
ns-tracker relies on clojure.tools.namespace.find/find-clojure-sources-in-dir.
clojure.tools.namespace.find/find-clojure-sources-in-dir
When you think about it, you can see why ns-tracker doesn't pick up resources; they aren't Clojure namespaces. In my opinion, this is coherent design decision, given the name, ns-tracker.
Still, pragmatically, it is clear that from the point of view of Pedestal that we do want to reload when a resource changes.
Now, let me add another thing. From a tooling perspective, let's say you do setup a watch on the resources directory. Even so, it is not easy to identify, in a granular fashion, which specific Clojure namespaces will be impacted. One resource may be used as a defsnippet by multiple deftemplate's. Therefore, one resource change can affect multiple Clojure namespaces. Strings pointing to resources might even be constructed dynamically. So, figuring out the exact minimal set of namespaces to reload may be impossible in the general case.
All of this said, it should be 'easy' and safe enough to reload all Clojure namespaces whenever a resource changes.
So, in summary, I have not solved this problem myself, but hopefully what I've explained above will help move the ball forward.
I could not find a working solution off the shelf, so I ended up writing a small ring wrapper that does the job, see https://github.com/kolov/enlive-reload

Is Ember Inspector released yet (for Chrome)?

I have read several times about the Ember Inspector and habe also seen videos on yotube of it, e.g. example video.
Does anyone know, if it is available yet or when it will be available. This will make debugging so much more convenient, i want to try it :-)
you can get the current version by cloning the github project
found via http://cgcardona.github.com/2013/02/15/playing-around-with-the-ember-inspector/
Yes, it's live!
https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi
(blah blah... stupid minimum answer length requirements... blah blah)
It's released. check below link
But i still get confused how to use it on my site.
https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi

Does a pagination mixin exist for ember.js yet?

I've been writing my own pagination logic that would be similar to the Ember.SortableMixin but with support for paging. Does anything like this exist yet in the pre 1.0 build?
If this doesn't exist is a pull request welcome around this specific behavior? It's my guess that 90% of apps out there need simple pagination/sorting and having a mixin built in would cut out almost 60+ lines of code.
Thank you in advance
Update
I replied to another "ember/ pagination" question and my full blown (working example) can be found at the below
Ember pagination full example
Here's a simple one that I've used: https://gist.github.com/1559628
It's by one of the top ember contributors.
i've just come across emberjs-pageable.
it looks quite nice at first glance, but i'm not sure if it's still maintained.
I've been using this one https://github.com/mathieul/page_wrapper
Tailored for use with Rails but could easily be adopted.
Really happy with it so far.

Troubles Importing Clojure Libs in Paradise

I occasionally get this problem, and generally work around it, but it's rather frustrating.
I have all of Incanter (check it out if you don't know it: it's superb) on my classpath. I try to import it (through a Slime REPL) like this: user> (use 'incanter.core), but fail.
Doing this: user> (use 'clojure.contrib.def) works just fine, and this file is in the same place–on my classpath.
Regardless, the error isn't anything about classpath: it's this:
Don't know how to create ISeq from: clojure.lang.Symbol
[Thrown class java.lang.IllegalArgumentException]
You can see my entire terminal here (a screenshot.)
I don't know what's going on here, and it's really frustrating, as I really would like to use Incancter, and I can from the Incanter binary's REPL. I definitely don't want to develop from that–and this should work.
Any help would be much appreciated.
EDIT:
It appears as though Incanter requires Clojure 1.2, and lein swank gives me Clojure 1.1. This might be the cause of my problems: if so, is there a way to continue to use Swank & Lein with Clojure 1.2?
Thanks again!
EDIT:
Apparently if you start using Clojure-1.1 and lein swank, you're stuck with it unless you make a new project.
If future people have this problem, this article helped me out, but also, at least for me, you must start a new lein project if you had begun it using leink swank and Clojure-1.1. Simply changing your project.clj file and then lein swanking again doesn't work.
Yes, you can use Leiningen and swank-clojure with Clojure 1.2. You might need to use a recent version of Leiningen (I'm not sure if a certain old limitation affected lein repl only or was it lein swank as well; anyway, try the 1.2-RC2 which you'll find in the downloads section on GitHub). You will also need to use a recent-enough swank-clojure; I use a bleeding edge checkout myself, get yours here.
Other than that, simply use 1.2 jars for Clojure and contrib. (Lein uses it's own Clojure, separate from the one used for lein swank, for its internal workings and you never need to care about it; swank-clojure has no AOT'd namespaces and doesn't particularly care about the Clojure version, except once in a (long!) while something breaks, a patch is applied and joy is restored.)
I hope the above helps, but if it doesn't: your problem description is not entirely sufficient for me to get a clear picture of what is happening. Could you add information on what it means for "all of Incanter" to be on your classpath (do you mean the jars? sources? where do you get them? how do you set your classpath?). Without knowing this, it'll be hard to replicate your setup to try to track down the source of the problem.
Of course if bumping some versions fixes things, please disregard my current confusion. ;-)