I have a lot of JavaScript I need to write. I can do that, but I have some Python already which does something similar. I'd much prefer to adapt that and have it run within the browser.
There's the C-based reference implementation, and there's Jython in Java. Is there a JavaScript implementation along the same lines?
I have looked, but it may be that my google-fu has failed me. And it seems like something that ought to exist. Have I missed it?
You may be looking for something likeWebAssembly, used for running non JavaScript code in the browser. pyodide would be a good starting point
https://github.com/pyodide/pyodide
https://medium.com/swlh/python-in-web-easy-5f7de3813055
Related
I need to make a script that will analyse javascript files for specific errors in the code.
One of the first envisioned ways of doing so is by building an abstract syntax tree of the files. Is this doable with nodejs or any other tool? (preferably in a scripting language, or better yet in javascript itself, or python).
Or is there even a better method that I could use to analyse javascript code?
EDIT: As pointed out in some answers, JSLint and JSHint are not the tools I'm looking for. I use them as well, of course, but they are not specific enough for my requirements.
A better method to go for some pre-written tool instead of trying to reinvent the wheel.
Somebody already awnsered this question on another stackoverflow page
JavaScript Source Code Analyzer
Looks like esprima - http://esprima.org/ and the Parser API is what I'm looking for :)
How do I switch windows programmaticly? I mean like Alt+Tab does but without any labels or something.
I tried to look through the documentation but it's too complicated for me ( you can say then not to do it, but I learned action script with help of a good docs although didn't know a thing at first). And I don't complitly understand where exactly to look, because there a lot of libraries and some thing called GObject-Introspection. And when I am trying to find something there, I get lost out there, because I don't realy know what am I looking for. It's kind of a circle)).
I also tried to look at the source codes of other extensions, but it's even more complicated than the documentation. It sounds like I am pretty dummy but I can catch it up.
So, does anybody know how to deal with switching windows, where I can find methods I need in documantation or anything else?
The library you seem to looking for is libwnck. The library is written in C. However, you can access them in different languages, like JavaScript for the extensions. This is done via GObject-Instrospection, which at this point you do not need to understand deeply (just that GObject-Introspection is the glue that allows you to use the libraries in different languages). The prefix usually changes depending of the language.
For your specific purpose, you might want to take a look at devilpie2 instead.
Suppose I want to implement a curses/console like program in HTML/CSS/Javascript. Examples might be a online text adventure game or a simple interpreter similar to the "Try the XYZ programming language now" web pages you see for languages like Ruby or Haskell. Is there a library/plugin/etc... that implements these terminal like interfaces?
Note:
After digging around for quite some time I found jquery-console, which looks quite promising at first glance.
Any other alternatives or recommendations?
I have been using the termlib.js library for a couple of projects and it works really great. It helps with a lot of stuff like handling keyboard and parsing inputs.
It should also be less bloated than any jQuery-based solution unless you were going to use jQuery anyway.
You might want to start off looking at the readme or try some samples.
I have seen many obfuscated codes, however, recently I came across this code: paste2.org. The latter uses arguments.callee.toString().replace(/[\s\'\"\)\}\]\[\;\.\{\(]/g, "").length; to prevent programmer from simply replacing eval() with document.write or something similar. I was wondering how do I obfuscate the code this way myself? Is there any tool for that? (p.s. note that arguments.callee.toString().repl[..] is called two times) Going deeper. Even when you get trough this stage, the code is complete mess. Variable/function names are randomized, while the strings are complete mess and look something like this: $(kj49f+4kd+fgdff+hgd25+fh2fg5+adb5) which evaluates to simply $('.wrapper .foo[name"bar"]'). What was used to do that? I have recently came across jscrambler.com which is paid JS obfuscation service. I was wondering if it is the thing that was used to obfuscate the code.
After few weeks of research, I've discovered that the program used to obfuscate the code in example is http://jscrambler.com/. This is actually a commercial software. Do I recommend it? Hm. Not sure, as I am writing this comment (May 21, 2011), it is still in pretty early stage of development & I've faced multiple issues. Though, they are quite quick to sort them out once reported.
How can I garble JavaScript code before sending it to client-side? I don't want to expose functionalities. The code is already compressed using jsmin.
You need an obfuscator, see this for an example.
Anyone determined enough can always reverse it though, and tools like this can help.
Javascript is interpreted plaintext. As such any obfuscation is a placebo at best and easily reversed.
More to the point, if you're writing enough Javascript to constitute a work valuable enough to protect, you're doing something wrong.
My Javascript these days consists of including jQuery, a handful of plug-ins and some code to activate those plug-ins and do some styling.
I have a hard time envisioning writing anything in Javascript significant enough that I'd care about protecting it, which is just as well because you can't protect it. Not really.
You could try some online obfuscator like this:
http://www.javascriptobfuscator.com/Default.aspx
Search google for: Javascript obfuscator
You might add your platform to the query, as well. There are plenty of tools already out there that you can incorporate into your project.
A word of warning: most obfuscated JS on the internet is security hole exploit code. You risk being mistaken for a sploit, particularly by the more paranoid anti-virus scanners.