Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a second on the website for common formulas #78

Open
buzzdecafe opened this issue Apr 23, 2016 · 15 comments
Open

Make a second on the website for common formulas #78

buzzdecafe opened this issue Apr 23, 2016 · 15 comments

Comments

@buzzdecafe
Copy link
Member

From @krainboltgreene on April 20, 2016 22:0

Hey! Long time (4 months) lover of ramda.js, and I find myself with a fun little function that I don't think should be added to ramda but should be available to others if they need the same thing.

So as I propose a new tab on the website for function frankensteins that are too easy to be added to ramda, but too small for a library. "Examples" or "Practical" or "Recipies"?

Thoughts?

Copied from original issue: ramda/ramda#1744

@buzzdecafe
Copy link
Member Author

From @svozza on April 20, 2016 22:4

You can stick it in the Cookbook if you want?

@buzzdecafe
Copy link
Member Author

Thanks for the kind words. We have a Cookbook

@buzzdecafe
Copy link
Member Author

From @krainboltgreene on April 20, 2016 22:15

I know cookbook exists, but it's not very "public" in the same way as the website :(

@buzzdecafe
Copy link
Member Author

i'm all ears if you want to raise the profile of the cookbook stuff.

A tab on the site for examples i think is a fine idea. Even better if it is integrated with the REPL

@buzzdecafe
Copy link
Member Author

From @pauloliver on April 20, 2016 23:48

👍 for a tab on the site with examples.

I think putting the cookbook a bit more out in the open is a good idea.

@buzzdecafe
Copy link
Member Author

From @CrossEye on April 21, 2016 3:43

Perhaps we could simply post the Cookbook to the site? It's simply Markdown, after all. I have several other pages I'd like to do this with. That might make REPL integration a bit tougher, though.

@buzzdecafe
Copy link
Member Author

That might make REPL integration a bit tougher

one problem at a time. I'm in favor of promoting the cookbook on ramdajs.com ASAP and integrating with repl later.

@buzzdecafe
Copy link
Member Author

From @taylonr on April 23, 2016 3:4

That might make REPL integration a bit tougher

one problem at a time. I'm in favor of promoting the cookbook on ramdajs.com ASAP and integrating with repl later.

I think integrating with the REPL won't be that hard...or at least one option won't be.

For example, I played around with a couple libraries tonight and figured out this code:


'use strict';

let R = require('ramda');
let gfm = require('gfm-code-blocks');
let fs = require('fs');

var str = fs.readFileSync('Cookbook.md', 'utf8');

let urlEncoder = R.pipe(
    encodeURIComponent,
    R.concat('http://ramdajs.com/repl/#?code=')    
)

console.log(urlEncoder(gfm(str)[8].code));

That outputs a URL encoding string for example #9 from the Cookbook (Get and Object's Method Names).

The URL is: http://ramdajs.com/repl/#?code=%2F%2F%20%20methodNames%20%3A%3A%20Object%20-%3E%20%5BString%5D%0Avar%20methodNames%20%3D%20R.compose(R.keys%2C%20R.pickBy(R.is(Function)))%3B%0A%0Avar%20obj%20%3D%20%7B%0A%20%20foo%3A%20true%2C%0A%20%20bar%3A%20function()%20%7B%7D%2C%0A%20%20baz%3A%20function()%20%7B%7D%2C%0A%7D%3B%0A%0AmethodNames(obj)%3B%20%2F%2F%20%3D%3E%20%5B'bar'%2C%20'baz'%5D

This could be done as part of a build process, create Cookbook.md, run it through the gfm extractor, and match up the output link with the example. A button that says "Try it out!" or something similar.

I'm not exactly sure where to do this in the code, or I'd be submitting a PR and not just pasting code in this issue.

@buzzdecafe
Copy link
Member Author

ok, i think we have a direction and some ideas; i will move this issue to ramda.github.io and let's proceed from there

@CrossEye
Copy link
Member

I'm not exactly sure where to do this in the code, or I'd be submitting a PR and not just pasting code in this issue.

Yes, it's that sort of thing we need to figure out. I hadn't used gfm-code-blocks before, so it's nice to see that that part will be easy. But the details of how to integrate this sort of thing into the site were what I was worried about, not how to format the code blocks as an actual link.

I don't think this will be terribly difficult. I just think that it's a little more work that we might at first believe.

I also wonder if there would be any interest in trying to embed Tonicdev directly into the page rather than link to the REPL.

@taylonr
Copy link

taylonr commented Apr 23, 2016

Tonicdev looks pretty cool. I'm fairly new to Ramda, but I really like it and thought I'd see if there were any low hanging fruit issues I could tackle to help out. This one, at first blush, seemed like it might be a good candidate.

@CrossEye
Copy link
Member

We would welcome the help!

@taylonr
Copy link

taylonr commented Apr 24, 2016

I toyed around with tonic some today and started copying the cookbook over. There's a few examples on the cookbook that will need some tweaking. For example, there's one that uses the DOM, but doesn't have the DOM.

Anyway, so far what I've done was create another menu item on the nav bar called "Cookbook" and have it go to an index page with a tonic per example.

I wanted to get your thoughts. I'm thinking of creating a PR of what I've got (or, what I have once I add in make support to create the index page.) And see if that's a direction you'd like to go. That way I don't spend too much time and we realize it's not all it's cracked up to be. I'm hoping to do that in the next day or two.

@buzzdecafe
Copy link
Member Author

I wanted to get your thoughts. I'm thinking of creating a PR of what I've got

sounds good to me.

@taylonr
Copy link

taylonr commented Apr 24, 2016

Created a PR: #79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants