Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Codr.cc - Etherpad meets Pastebin Meets Notepad.cc: live code sharing (codr.cc)
135 points by jmonegro on April 25, 2011 | hide | past | favorite | 79 comments



I just finished building the new version of an old project, Codr.cc.

It allows you to store, share, or broadcast notes or code. You can drag-and-drop files onto it. I took a lot from notepad.cc in the way it saves automatically to the server. Append '/extension' to your links to activate real-time syntax highlighting, currently supporting:

js, html, css, php, c, cpp, java, py, haskell, smalltalk, and stex (I should list that somewhere...)

Each file has a public link you can share from where the file cannot be edited.

Changes to the file can bee seen in really real time from either end of the (non-public) url.

And all with a really nice interface to boot!

Let me know what you think :)


Nice, but your js is broken if you write it without semicolons at the end.

Also any chance of Scala support?


I can't provide a concrete answer since I have to write new parsers myself, and I'm not familiar with scala. However, if I see the project take off in any significan way, I will dedicate some time to adding support for more languages :)

That reminds me that I should put some contact info up on the site somewhere...


The syntax can be considered sort of a mix between Python and Javascript with a couple more keywords + types.

Also blog url?



Love it!

Could you have an extension of /preview or /render that would render the page live on the broadcast side. This would be great for teaching/demos. Even better if they can switch between code/render view.


It's definitely possible, for html mode... I'll consider it :)

You can follow dev updates at codr.posterous.com


HTML is the easy part, but maybe consider extending it like http://ideone.com/ an online compile service. Or maybe combine it though i am not sure if ideone.com offers an API.


Now that you mention IDEone, I remember they do have an API. Very interesting, I'll definitely consider it.


Yes, please have a look at http://ideone.com/api for docs and usage examples


There have been a few of these made — I remember ethercodes, which probably came closest to replicating what this is doing.

Right now, as a collaborative editing tool, it doesn't really work, since you can't have two people focused on different lines at once (I just experienced fighting over the focus with a co-worker).

Curious to see how this develops out.


Looks nice.

On the read-only version of the page, placing the cursor and hitting "enter" adds newlines. They don't show up in anyone else's session AFAICT, but it's a little disconcerting to get the impression of editing what was supposed to be a read-only document :)

EDIT: also, it doesn't appear that haskell syntax highlighting is doing much. http://codr.cc/s/973f122b/haskell


C/C++ highlighting is also a bit underwhelming; it's only coloring constants, comments, and strings. Kewords, precompiler directives, etc are ignored.


I'll see what I can do. Should be fixed today.

Edit: fixed :)


I'll fix that.


Very, very nice! This is going to replace Etherpad for us when interviewing.

Thank you for building this.

Some notes:

* Tab defaults to 8 spaces. Ughh, can it be 4?

* Auto-formatting uses offsets of 2 spaces. Why? Either turn it off or use 4 (not everyone is a Rubbyist and even not all Rubbyists adhere to this convention)


Yes. I'll update it when I get back to my work computer.


I really like the idea and implementation. Its pretty neat for collaborative code editing and much better for editing code then etherpad or google docs. I think this should be the main focus. I think i will use it primarily to discuss and develop code with other ppl.

But I won't use it for a pastebin as i really love http://paste.pocoo.org/ which supports syntax highlighting for many languages, an api to upload files, great python commandline util, support for multiple files with different syntax highlights in one paste etc. JFTR the most important thing for me to use codr.cc as a pastebin would be an api/commandline util and more languages


I've used Gobby[1] for local networked collaborative code editing, but it's nice to see something online.

It would be fantastic if this linked up with Github for storage.

1. http://gobby.0x539.de/trac/


I would love support for Markdown syntax highlighting.

I know the language itself provides visual clues for structure, but some light formatting say for headlines is nice.

I quickly found this sample from Solarized: http://ethanschoonover.com/solarized/img/screen-pandoc-dark....

And thanks for the bonus of making this work on the iPad. It's one of the first things I do when I come across a new browser-based editor. It has a few quirks, but definitely usable. (I found that I had to display the page pull-down info panel to trick the iPad keyboard to show. As an aside, I wonder if there's a bookmarklet to force out the iPad keyboard. Or a bookmarklet to fake tabs.)

Thanks.


Indeed, markdown, textile, and many other languages would make a nice addition. I'll be adding support for more and more languages as I see the project growing.

I'll be posting dev updates at codr.posterous.com


Woah, I'm honored to have something meet one of my projects! This is pretty neat.

I've thought about syntax highlighting and some other interesting ideas on notepad.cc. Currently, if you add a + to the end of any URL, the font turns monospace.


I took a bunch of tings from notepad: namely the simple interface and continual saving.

Glad you like it :)


I thought I'd add my experience:

* Opened page in new tab, switched to tab after reading a few other things.

* Saw a url in the drop-down at the top, different to url of page, briefly pondered whether I should go to that instead.

* Decided to copy/paste and go there.

* Couldn't type in editor, closed tab thinking it didn't work in Chrome on OSX.

Now it's a holiday in the UK, and sunny too amazingly, so I'm just quickly flicking through items of interest but people generally don't read what you put in front of them. I've read through the comments now and, while one anecdote isn't data, you may want to think about how you present the write-version/read-only-version URLs.


The url from the dropdown is a url you can share from where no edits can be made. For example, for sharing code on twitter, or broadcasting it (any changes from the main url are still seen in real time).


Would it be possible to make readonly url from the baseurl manually also, instead of server generating it.

eg., http://codr.cc/s/xyz/ as read only url for http://codr.cc/xyz/ base url, instead of waiting for server to spew out http://codr.cc/s/abc/ as read only url.


The problem with it is that then people can access your edit url, and in many cases that's something you wouldn't want.


What about two parts? http://codr.cc/s/xyz/abc as the editing url, and http://codr.cc/s/xyz as the read only? That way you need to know abc to edit, but can pass xyz around.


If that's known, then I can just remove /s/ and /abc and I'll gain access to your file, no?

In any case, vanity url's is a feature I plan on adding.


No, wrong way around - long url is editable, short one is read only.


I think you could stand to improve the c/cpp highlighting.

Found this code using google code search for main.cpp, it is not mine: http://codr.cc/s/1cb504a3/cpp compare with http://code.google.com/p/movement-game/source/browse/trunk/t...


Patched it up a bit. It should be better now, more comparable to the Google version :)


I love it :)

It would be fantastic if a site like this also supported categorizing code snippets the way gists on guthub work, and were searchable.



I think the searching and categorizing could be public, but perhaps pro users could get eclipse/textmate/whatever plugin + api access to do some automatic stuff. You could have it do a search on the current empty method name and return any similar-sounding snippets in the current language, ready for embedding and sourcing, complete with comments.

You could even have a special kind of in-source comment that links the snippet to the web URL so you can track changes and automatically show the differences and "accept" the changes to your source code. New way to collaborate :)


Those are some very interesting ideas, I especially find the similar snippet lookup thing.

However, for that particular one a more robust database of snippets would probably be necessary, and it would take a long amount of time to gather enough snippets for it to be really useful.

As to some of the other features, I think they go beyond the scope of the project. The premise of codr.cc is to allow you to share code (live or not) using a simpler interface than all the other pastebins out there. That's why I took all of the features that might go a bit beyond that and labeled them pro.

However, I very much like the idea of an API and local plugins. Stuff like a command-line interface etc. would be very interesting :)

Thanks a lot for the input!


psssst! we're planning a pro version of codr, learn more

Scrolling is broken on this page when it pops up by clicking on "learn more."


I like it, but I would personally recommend locking on a line level. I shouldn't be able to hold backspace on the same line my collaborators are editing IMO. Another added bonus would be to do a very faint row level highlight to show where other contributors are. Lastly, just to show a list of the current page contributors.


Would you care to explain further?


For line (row) level locking, add handling to only allow one user to edit a particular line at a time.

For each user currently on the page, assign them a discreet palette color. Highlight the current line each user is on with their color to give indication to all other users what line everyone else is on/modifying.

Have a sidebar (collapsible/expandable) on the page that shows all given users on the current page, along with their personal color. This lets you associate live edits to a particular user. This would function much the same as using Google Docs (i.e. spreadsheets).

I shouldn't be able to hold backspace on the same line my collaborators are editing IMO. Another added bonus would be to do a very faint row level highlight to show where other contributors are. Lastly, just to show a list of the current page contributors.


I just pushed a patch for the line locking. Collaborating should be much better now.


Ah, I understand.

It's something I'd noticed. I'll definitely look into it.


Have you thought about integrating/leveraging Ace (previously SkyWriter, Bespin)? http://ace.ajax.org/

This would give you the ability to let people use emacs/vim shortcuts among a lot of other not-reinventing-the-wheel kind of things (like better syntax highlighting).


I have, and originally intended to. However, I went with something a bit simpler to implement to start with, as I haven't played with ACE in any significant way and I built this over the weekend.

It's definitely something I would consider to support.


First impressions:

- Pretty nice. It's something I might use.

- Scrolling is a bit choppy (OS X Chrome). I'm not a fan of re-inventing scroll bars.

- I wish the meta info was displayed on the page rather than having to click to reveal it. There's more than enough room.

- A button to create a new pastebin would be useful

- Needs support for Clojure (or even just Lisp)


- Thank you, I appreciate it :)

- Funny you should say, I'm actually on OS X Chrome and I don't find it all that choppy. Could you elaborate on that?

- You're probably right.

- I figured the root url (codr.cc) serves as a new pastebin button.

- As I mentioned in another comment, I have to write new code engines by myself, which is a bit harder with languages I'm not familiar with. However, if I see the project take off, I will put some time into supporting more and more languages.

Thanks!


You could also add basic Forth support very easily. In Forth, everything is composed of whitespace-delimited tokens. A token is either an integer or a word. Forth uses metaprogramming to make the syntax extensible, but the most common words with special syntax are comments and string constants.

\ is a single-line comment that skips until the next newline, ( is a multiline comment that skips until the next end paren, ." is an inline print string that scans until the next quote, and it has a counterpart .s" string constant that works the same. Bingo, one basic Forth tokenizer!

There's a great manual for GForth[1], in case you're curious to see what some code looks like or give the language a spin.

[1]http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/


Lisp has some of the easist syntax there is (only other contender is whitespace).

(function-call (+ 5 4) 9 "Hello I like your service" `(this is read as a list of keywords rather than as a call to the function this with the rest as arguments ,the-value-of-me-is-inserted-due-to-the-comma this-keyword-is-not-changed))

Is pretty much the entirety of Lisp syntax.


Looks good. I'll keep it in mind. You can follow development updates over at codr.posterous.com


This is exactly what I had in mind when I started working on http://collabde.appspot.com/ I used codemirror with mobwrite and appengine channel api. It currently works only for python though.


Great minds think alike ;-)

I hadn't heard about mobwrite. It may offer a better solution than what I'm using.

Thanks for the tip.


I would love to use this, very nice work.

I have one problem with it though, is that everyone's cursor appears to jump to the same spot when someone makes a change. This makes it somewhat impossible for multiple authors of one file.


> Drag and drop a file from your computer into Codr, and we'll read it's contents and paste it over for you.

Should be "its".

Out of curiosity, how complex is the code to deal with conflicts?


You're right. Coding at 4am affects my grammar :-p

Not that complex. It could be better, but for now I make sure everyone is on the same page by ensuring that the cursor is at the same location at all times.

I've yet to implement multiple cursors, but it's something I definitely want to do.


Tangential Question: Is is possible to allow Chrome to modify files on the local hd? I'd love to use a web-based editor like this for many things I do.


No but I'm open to adding dropbox support through their API if I ever release a "pro" version (read: http://codr.cc/pro.html)


I liked this! Would be cool if you could show the viewers (at least the #) :)



Nice work. Do you use operational transformation to manage changes?


Still not that fancy :P


Pretty awesome work, well done. What language is it built with?


Backend is done with Ruby on Rails. Front end is the standard html5/css3/js


ah cool :)


Great work!

P.s. real-time syntax highlighting is not working for me


Care to tell me more?

Here's an example of how it should be done: http://codr.cc/44a7f9/js

EDIT: An archived, non-editable version for show :p http://codr.cc/s/d8d5cc6f/js


(I'm not the original poster.) That works fine for me, but when I try to highlight Python, nothing happens.

http://codr.cc/s/baf9f6f6/py


That was indeed my problem, now it's fixed


Fixed :)


PHP highlighting not working for me ...

  <?php
  if ( isset ( $_POST['var'] ) === true ) {
  	echo 'bar';
  }
  ?>


Fixed.


How do I delete a snippet once I'm done with it?


Just empty it. It will delete itself within 24 hours.


How hard would it be to add iPad support?


It kind of works on iPad. Someone else commented that the trick to make it work was to show the pulldown panel, and the keyboard would show up.


Ah, I see. Thanks.


this is great.

what about privacy? sometimes I care where the code ends up since sometime's I working on other people's stuff


It takes a security-through-obscurity approach, using random url's. The pro version, if enough demand, would include a private namespace with individual password protection for each file.


You should've used the standard scrolling. Search doesn't work if the text is not in the current view. So you can only really search what's on the current page.


And the current scrolling is really laggy. Love the product otherwise.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: