jhass / carc.in Goto Github PK
View Code? Open in Web Editor NEWCompile & run code in
Home Page: http://carc.in
License: MIT License
Compile & run code in
Home Page: http://carc.in
License: MIT License
I'm trying to run this example to test the network performance (because in my computer it seems to be a little slow on IO#gets method) but it seems to be impossible to share the result on carc.in, am I right?
This is based on Crystal's examples of tcp server/client.
I assume this is just a limitation with highlight.js since it supports Ruby but not Crystal, but I figured I'd open an issue here in case you can think of another workaround for it.
From a quick google search, it seems like the Prism library supports Crystal highlighting, but I haven't tried it.
Here is a random example of what I'm talking about: https://carc.in/#/r/ab4n
When I try to run this crystal code:
io = IO::Memory.new
IO::ByteFormat::LittleEndian.encode(5, io)
puts io
In Brave, it sends me back to the homepage with an empty field. In firefox and safari, it sends me back to the main page with the original code still in.
Using latest browsers on macOS Catalina compiling crystal 0.32.1
Hi @jhass !
I think would be nice to have a favicon on https://play.crystal-lang.org/#/cr and https://carc.in/#/cr WDYT?
The source code renders directly to the DOM without filtering, which leads to a possible XSS attack vector via forged documents.
POC - Corrupted image which fails to load directly executes some stored JavaScript code.
Even if the online compiler doesn't contain user information one could still use the available attack vector for something malicious.
For testing purposes this list can be used, 90% of it will work since the DOM is rendered directly.
Cheers.
With Crystal 0.30.0+, a compilation error only shows the last frame, e.g:
Showing last frame. Use --error-trace for full trace.
In /usr/lib/crystal/json/from_json.cr:136:13
136 | yield T.new(pull)
^--
Error: wrong number of arguments for 'M.new' (given 1, expected 0)
Overloads are:
- Reference.new()
When the full error trace would be:
In some_file.cr:31:5
31 | p Q.from_json(json_queue)
^--------
Error: instantiating 'Array(M).class#from_json(String)'
In /usr/local/Cellar/crystal/0.30.1/src/json/from_json.cr:13:3
13 | new parser
^--
Error: instantiating 'new(JSON::PullParser)'
In /usr/local/Cellar/crystal/0.30.1/src/json/from_json.cr:128:3
128 | new(pull) do |element|
^--
Error: instantiating 'new(JSON::PullParser)'
In /usr/local/Cellar/crystal/0.30.1/src/json/from_json.cr:135:8
135 | pull.read_array do
^---------
Error: instantiating 'JSON::PullParser#read_array()'
In /usr/local/Cellar/crystal/0.30.1/src/json/from_json.cr:135:8
135 | pull.read_array do
^---------
Error: instantiating 'JSON::PullParser#read_array()'
In /usr/local/Cellar/crystal/0.30.1/src/json/from_json.cr:136:13
136 | yield T.new(pull)
^--
Error: wrong number of arguments for 'M.new' (given 1, expected 0)
Overloads are:
- Reference.new()
Which provides much more intel on the actual error.
I think it would be nice to have a download code link.
It will allow to use carc.in for sharing code in a gist manner.
Thoughts?
It would be nice if you could run code with the nightly build of the Crystal compiler.
With the new CI setup there are nightly builds of Crystal master available. Currently it seems the only feasible way to access them is using the docker tag crystal:nightly
, though.
I don't know how hard it would be to integrate into the sandbox system.
Currently when you use Crystal, Ruby or C in carc.in, pressing tab gives you an actual tab.
But in Crystal and Ruby you indent with 2 spaces so pressing tab should probably give 2 spaces in Crystal and Ruby and just give a real tab in C.
When carc.in is given the code
puts "<something />"
the run output is accurately
<something />
but the code preview shows
puts ""
If the tag is expanded and given contents, like
puts "<something>something</something>"
the run output is still accurate, but the code preview only shows the contents:
puts "something"
(Migrated from crystal-lang/crystal#1739)
There was no output.
Of course there was no output. The compiler crashed!
Basically, it would be great to print info like the return code of the program that ran (like Ideone does) and messages like "Segmentation fault" if a program segfaults.
I added Crystal language definition to highlight.js. highlightjs/highlight.js#921
If highlight.js v8.8.0 is released, you should update highlight.js and fix it
Carc.in can run code in Crystal, Ruby and C languages, but the downloaded file always has .cr
extension.
When you have a link to a compiled code example, like https://play.crystal-lang.org/#/r/157a, you can view the code when you use Chrome or Safari on OSX. When pasting this in to FireFox (47.0.1) there is a redirect back to the main page https://play.crystal-lang.org/#/crystal
It looks like a 502 error is being thrown as shown in the screen shot. The error pages shown are Nginx error pages.
Running OSX (10.11.6) FireFox (47.0.1)
I'm OK with Crystal and C. I'd be fine you add C++, Clojure, Clang, Coffescript, C# and Ceylon. But Ruby... it somehow feels out of place.
I added. Could you update codemirror and use Crystal mode?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.