JSLint, when using JS frameworks - dojo

I use the Dojo framework, which I load from an url.
How should I deal with the 'dojo' was used before it was defined errors, and the alike?
Yes, my feeling really get hurt, when running code through JSlint.

Perhaps you can put something like
/* globals dojo */
in the beggining of your file to tell JSLint that dojo exists?
I personaly use JSHint (a fork of JSLint that is less nitpicky) instead and one of the preconfigured options is support for Dojo.

Sounds like you need to put Dojo first in your JavaScript. The message suggests that you have an ordering problem.
Don't take it personally. You are not your code. Just make it better, learn something, and don't do it again.

If you scroll all the way down to the bottom there is a "predefined" textbox. Simply put in any of the variables you need into there (comma separated).

Related

intelliJ shows Bootstrap classes as typos

I just created a new static web project using the Bootstrap template. In my html files it is marking the names of Bootstrap css classes as typos. Surely the worlds smartest IDE is better than that? How do I make it aware of Bootstrap classes? I know I can disable spell checking but that seems like an awful solution.
Please follow WI-4762 for updates to be notified on any progress with it. For now, I can only suggest to either disable the spell checker or add the words shown as typos to dictionary

How to make Bootstrap 3 and Ant Design 3 live together

We are working on a React application (using Create React App without ejecting it) and we decided to use Ant as our base component library.
Now that we are near the end of the project, we discover that the application will be integrated into a corporate portal (WebSphere) as a "portlet", so we inherit all the CSS files from the main page.
Both frameworks seem to have their own reset styles, but they use different values.
So far, I have not been able to find a LESS variable in Ant that can be used for prefix all Ant's CSS rules.
Has anyone ever tried to make them live together?
We don't own the parent development, we can only make change on the React part, so only things related to Ant.
We finally go with a specific CSS patch file, and we add rules when needed.
Not really perfect, but none of the suggested path did the job we expected.
Here you can see some of the default antd variables.
One of them is #ant-prefix: ant;. I think you can change it and apply different styles.
That is a tough one, and at the end of development no less!
As #froston mentions, and which you seem to have tried the #ant-prefix: ant; in addition to this you will need to se prefixCls as a prop on every component instance you create, which will definitely be an exercise in self-flagellation.
Even if you set a global CONSTANT and import and use this with your components, you still have to thread it through to all the places, and will need to be appended with the component name.
By way of example, the defaultProps for an anchor is prefixCls: 'ant-anchor'.
Hope this helps and good luck!

Switch Prestashop Language programmatically

I have got a module, that uses displayTop hook for some actions. after that i would like to switch language to desired that exists in the system. I found a method Tools::switchLanguage but I can't figure out how to use it properly. any clues?
There is a module that already does that: blocklanguages. So you can either use this module or take a look at the code to see how it's done. It's pretty easy so you can implement that wherever you want.

Automatic generation of HAML from HTML in SublimeText 2?

I would like to have SublimeText show the HTML result of parsing my HAML in another window, live, as I type the HAML.
Does anyone have an idea of how to make this happen? In, e.g., WebStorm there are file watchers that do this, but is there something like that built into ST2?
I did something similar to this with Typescript, only I only updated the Javascript output when I saved the file. First, I would say to take a look at SublimeBuildOnSave. That'll show you how to hook into the save function and see what file is being saved.
When you've got the general idea, you can take a look here and mess around with opening another pane (or using the existing pane) to show the compiled output.
It's pretty simple to make a simple version of this. If you want more advanced features like live compiling, it'll take a bit more effort, but it's not impossible. But the above scenario worked just fine for Typescript for me. (If I find where I left that code, I'll post it.)

How can I get <asp:menu> working in Safari?

On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed?
Thanks for the advice, it led me into the following solution;
I created a file named "safari.browser" and placed it in the App_Browsers directory. The content of this file is shown below;
<browsers>
<browser refID="safari1plus">
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
</controlAdapters>
</browser>
</browsers>
As I understand it, this tells ASP.NET not to use the adaptor it would normally use to render the control content and instead use uplevel rendering.
You can use ControlAdapters to alter the rendering of server controls.
Here's an example:
http://www.pluralsight.com/community/blogs/fritz/archive/2007/03/27/46598.aspx
Though, in my opinion it might be equal amount of work to abandon the menu control for a pure css one (available on many sites).
Oooof - was hoping it would be a simmple case of adding a browserCaps item in web.config with appropriate values or similar...
The best and simplest solution I've found for this problem is to include this bit of code in your page_load event.
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
Request.Browser.Adapters.Clear();