What Javascript engine is used by Paw? - paw-app

I've been trying my hand at writing some code generator extensions. Using "regular" Javascript these work fine so I decided to up the ante and convert them to ES2015 and/or TypeScript based projects. However the transpiled code cannot always be registered as a Paw extension. So this got me wondering: what Javascript engine is actually running under the hood? Should it be able to talk native ES6 code? Is this planned?

Paw links against Apple's official JavaScript Core framework, as it can be found in:
/System/Library/Frameworks/JavaScriptCore.framework/
And Safari is also linked against it. You can find the actual jsc binary here:
/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc
It sounds like all ECMA-262 (=ES2015) tests pass except promises: test262/CONSOLE-RUNNER.md
My guess is as features are added on Safari, at each OS upgrade, they are also added to the JavaScript Core framework. So the exact ECMA compatibility probably depends on the OS version.

Related

Meteor - Using the built-in JavaScript Math library in an Android webview

I'm learning to use the Meteor framework and since few days I have this problem.
I want to use some functions of the built-in Math library, like: Math.trunc().
It's work when I launch my program in Chrome or Firefox on Linux or Windows.
It also works on Chrome on Android.
But... It doesn't work when I launch on an Android device using meteor run meteor-device.
The application is well installed on my device, I can launch it, but all my variables that use Math.trunc() don't appear.
Also I got a message in the console which says that the object Math doesn't have a trunc function or method.
MDN says about Math.trunc:
This is a new technology, part of the ECMAScript 2015 (ES6) standard.
This technology's specification has been finalized, but check the
compatibility table for usage and implementation status in various
browsers.
So your webview is probably just not yet implementing it. Keep in mind that the webview android uses is not always the same as the latest chrome you have installed. Probably your best option is to just implement the functionality yourself using floor together with an if condition if you really don't want to floor negative values but truncate the decimals instead.

Working with SASS in a Mono WebForms Project

I am in the process of creating a website using Mono. It will be a standard webforms app (not MVC) but I'd like to use SASS for the CSS (specifically scss). However, I can't seem to get SASS to work with a mono webforms application. I tried using SassAndCoffee from NuGet and followed the standard setup instructions which said I should just reference my scss files as css files (e.g. application.scss would be referenced as application.css in a link attribute in the head. see http://blog.paulbetts.org/index.php/category/programming/mono-net/). That didn't work (or at least I'm assuming it didn't since my page rendered with no CSS and this scss has been tested on a rails platform so I know it works).
Next I tried using SquishIt which has an NSass wrapper. I followed the instructions here: http://www.cassandraking.net/wordpressapp/integrating-sass-into-net-using-nuget-and-squishit-sass/. This throw a 500 error because asp.net was unable to find NSass.Wrapper.proxy.dll. A quick google search led me to discover that because I was targeting "Any CPU", it couldn't choose between "NSass.Wrapper.x86" and NSass.Wrapper.x64". Sadly, however, MonoDevelop doesn't seem to want to give me the option to target x86 or x64 (the only option I have is to target "Any CPU").
I've kind of run out of options. Since I'm not using MVC, am I able to using SASS with a standard WebForms project using the Mono platform? Has anyone done this and can provide me some pointers?
In case anyone else runs into this, I never really found a viable solution in terms of a plugin. Honestly, Xamarin studio doesn't even seem to have a built in SASS editor as it isn't able to colour code anything in a SASS file. I ended up just using the sass command in terminal to convert a sass file to css. At a terminal prompt in the folder where your sass is kept type:
$ sass mysassfilename.sass:somecssfilename.css
To edit the sass file, I downloaded Microsoft's Visual Studio Code which has a version for the mac. It works rather well.

How to run Dart code from Visual Studio?

I'm building an asp.net website using Visual Studio 2012. I'm considering adding some dart code into it.
I'm trying to check how this thing works: I downloaded the DartVS visual studio extension, and I took a ready dart code from the web. The dart code runs fine on dartium when I run it from the dart IDE.
I copied and pasted the code to Visual Studio (that now recognizes dart thanks to the extension). When I run it from there - I could see that the GUI appears, but the buttons don't seem to work. I put a breakpoint in the dart code's main function but it doesn't seem to get there.
What am I doing wrong?
Thanks!
Edit: Although not full Visual Studio, I have created a VS Code extension that does support debugging here.
I'm the author of the extension you linked. Currently, there is no debug support. If you're going to launch from VS in the browser, you'll need to add Dartium to the list of browsers in Visual Studio.
The current version of the extension is very limited and just uses regular expressions to syntax highlight and runs the command-line Analyzer for error info. Both of these kinda work; but have some flaws.
I'm working on a new version; which is backed by a service written by Google, which has very reliable syntax highlighting, tooltips, GotoDefinition, code-completion and more. It's not ready for testing quite yet; but it'll be pushed as an update to the extension you already have once it's done.
The plan is to ultimately include Visual-Studio debugging; but for now, I'd recommend using Dartium and debugging in the developer tools.
When you run the code from VS - where does it get executed? Dart is only supported in Dartium so far - so if you want it to work in any browser, you have to use dart2js for now.
I don't know what that Extension does but this might be the problem.
Regards, Robert
You can start pub serve and Dartium manually and point Dartium to the URL pub serve listens to.
DartEditor also launches pub serve for this.
I don't know if your extension has any debugging support but in Dartium you can debug Dart and JavaScript code like JavaScript code in the normal Chrome browser dev-tools.

Sass or Compass without ruby?

Is there a way to use Sass or Compass or anything like that without Ruby?
I have been looking around google and this site and can't find anything, any help would be appreciated. Thank you
Sass was originally written for Ruby, but now they've created libSass which is a C/C++ port of the Sass engine, which makes it easier to integrate the engine into an IDE or another language. At this point, you can use the Sass engine in Ruby, Node.js, Python, PHP, Java, .NET and others. For more information, visit libSass. Also, your IDE might have a plugin which would support Sass, without the need of ruby by using the libSass.
The original answer below may or may not apply to your situation (depends on whether or not your language has implemented support for libSass or not). I decided to leave it the way it is for archive reasons.
Sass (requires Ruby)
Sass is written in Ruby, so you’ll need Ruby installed as well.
Taken from sass's site
Compass (requires Ruby, as it's based on SASS)
Compass is an open-source CSS authoring framework which uses the Sass stylesheet language to make writing stylesheets powerful and easy.
Taken from compass's site
Less (written in js, requires node.js or less.js included in the page)
LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. LESS runs on both the client-side (Chrome, Safari, Firefox) and server-side, with Node.js and Rhino. Taken from Less's site
These are the main processors out there that I know of.
You may write your own parser/port for any another language of choice.
In other words, no you can't use sass/compass without having Ruby because the program itself (sass & compass) IS written in Ruby. So you'll definitely need it in order to run it.
Actually there is a library that provides binding for Node.js to libsass, the C version of the Sass: https://npmjs.org/package/node-sass
It allows you to natively compile .scss files to css at incredible speed without Ruby installed.
To install just run:
npm install node-sass
And there is also a Grunt extension if needed: https://github.com/sindresorhus/grunt-sass (this is what I've been looking for in this question)
Find out more at: https://github.com/andrew/node-sass
It's true that the question is not clear enough, but i'll try to address some issues. There are other CSS pre-processors that don't rely on Ruby (two coming to my mind right now are Less, which i've used and liked, but not as powerful as Sass, and Stylus, which i haven't used, both based on JavaScript), but as you're specifically asking about Sass+Compass, and as i'm still looking for the same answer, i'll talk about that.
#JamundFerguson said:
Is there a way to compile Sass without Ruby? Depends.
There is
Sass is a pre-processing language. There's a compiler built in Ruby for it and anyone can write a compiler in any language. There's a C implementation of a Sass compiler called libsass which can be used on any language that allows to import C libs. It's the library used by node-sass, which is a compiler built in Node.js, which I didn't tried yet and don't know how it could work and if it's ready for production use. It may be a question of time for Compass to be ported (maybe you end up doing that?) and so we can have a compiler which doesn't depends on the Ruby gem (currently, there's a node-compass module that does relies on the Ruby gem).
Other languages
So far i've mentioned the possibility for a Node.js compiler, which, as you may know, it's a JavaScript environment, being the language of the web and my language of choice. But you didn't specified which language you would like the compiler to be written into. I think there may be compilers built in many languages, for example, #EricMeyer mentioned a Python compiler. Maybe he's using pyScss? That seems to have built-in support for Compass. But then you need a Python environment. So the thing is: you'll need some environment for a compiler unless you run natively compiled binaries. (Less has less.js which can be included on the page to run client-side and avoid the compiling step, but it's not meant for using it on production.)
Native apps
I've worked for a year with CodeKit, which does very well, compiles Sass/Compass, Less, Stylus and template languages like Haml, Slim, Jade, etc. Rebuilds your assets when they change automatically and you see the changed on your browser immediately. The only thing that i didn't liked was that when moving to a different computer, installing CodeKit, checking out project and trying to use it, i had to reconfigure the project settings, which i had to remember so i could get to a build like the one i made in the other computer. Also i started working with a team, and they had also to configure the project with the same settings (sometimes not having the same project config lead to ugly inconsistencies) and also members of the team using Ubuntu couldn't use it. That's why i started to think on making a command-line tool to build projects and discovered Grunt immediately, and fell in love with it.
As #Dave mentioned, there's Scout and also there's LiveReload, but haven't used them.
Conclusion
Conclusion is i have not a strong conclusion. I'm still looking for the same answer, but i hope this answer sheds a little bit of light on the status of compiling Sass/Compass outside of the Ruby environment.
Just a little bit of an update on this, you can use SCSS/SASS files and generate the correct files on the fly without installing Ruby by using a program called Scout.
Scout has its own self contained ruby environment and is coded in java so make sure you java is up to date before using. Linky here.
Regards :)
You can actually parse sass without ruby, you can use node-sass.
details here: https://github.com/andrew/node-sass
If this is for .NET, there is now a wrapper for libsass. Available from Nuget.
Adobe Brackets (free, open source) can compile LESS, SASS and Stylus when the files are changed, and update styles during live preview, you just need to install required extensions from the extension manager.
Get Brackets and enjoy !
Edit: As other questions suggest node-sass is also a good option if you have nodejs already installed.
macOS users can install Dart Sass by running:
$ brew install sass/sass/sass
Windows users can install Dart Sass by running:
$ choco install sass
More info:
https://github.com/sass/dart-sass

How to validate HTML/CSS files with grunt.js?

This is a noob question.
I would like to use grunt.js as a build tool for my web project. Can use grunt.js to validate my HTML/CSS files? Do you have an example of such a grunt.js file?
There is another plugin that seems to be updated more often and does not require java. grunt-html-validation. It has a number of options and has been working great for me. You can install and use it like this:
npm install grunt-html-validation --save-dev
Then put something like this in the initconfig of your Gruntfile.js
and this in appropriate places in your Gruntfile.js
grunt.loadNpmTasks('grunt-html-validation');
grunt.registerTask("default", ["validation"]);
There is also a number of useful options including the ability to relax errors based on a regular expression (could be useful for AngularJS for example) and the ability to save a report.
You can use the grunt plugin grunt-html. Beware, you will need Java on your computer to use it. It works well for me.
As of now there seem to be two popular HTML validation plugins:
grunt-html-validation
grunt-html
grunt-html-validation uses the W3C Markup Validation Service and grunt-html uses a local copy of the java-based The Nu HTML Checker.
They both work well and have very similar options so it comes down to whether you want to wait for an external service call or wait for a local java app.

Resources