Chrome devtools: How to call a function from another snippet? - google-chrome

I have created many snippets in the Chrome devtool's "Elements > Snippets" panel.
I have a snippet with utility functions like loadJquery, loadUnderscore, etc. I would like to call these functions from another snippet. Is this possible?

Came here cause I struggle with the same question.
I think the correct answer would be yes, if you run each one of them individually and in dependency order.
For example, I have a snippet with a pickDeep() functionality that I got from here. And then I created some other snippets which use that function. So what I do is just run the one with the pickDeep() declaration first, and then any other snippet which use it.
It's the exact same thing as you had typed and run everything on the console directly. So it does not matter where the declaration comes from, as long as it has been declared some way in the current session.
Of course is not the desirable way, but I want to point out there is a workaround.

No, snippets have no knowledge of other snippets nor is there a way to query them up. Snippets are isolated scripts that work independently of each other.

Related

abp.auth.gantedPermissions is always empty

I am trying to follow these examples:
http://aspnetboilerplate.com/Pages/Documents/Authorization
Everything works fine in backend, but in JavaScript frontend, abp.auth.gantedPermissions is empty.
I'm probably missing something but I have no clue what it could be.
abp.auth.gantedPermissions is misspelled. It should be abp.auth.grantedPermissions.
If you just misspelled it when writing the question, you can try the following:
Add AbpZeroCoreModule as a dependency of your Core module. The reason this fixes the issue is that, if the AbpZeroCoreModule is not referenced, the NullPermissionChecker is used and as the name implies, it doesn't provide any permissions at all.

Generating a link to a controller action in Play Framework 2.3

I'm working on a Play application and need to generate links in a mixed Scala-HTML view that call controller actions. I found this question from a couple years ago that's similar to my situation, but the provided answers don't work for me.
The elements are generated in a loop so I can't manually insert the argument to the controller action, but nothing I've tried has worked. This is the line I have now:
ID: #{var fhirID = <processing for ID>; <a href='#routes.Users.fhirUserDetails(fhirID)'>fhirID</a>}
The accepted answer to the question I linked earlier effectively uses this structure too:
<a href='#routes.Application.show("some")'>My link with some string</a>
My issue here is twofold:
1) How can I have the variable fhirID passed to the controller action? My generated link simply has the text "fhirID" instead of what's generated by the first part of the statement.
2) Is the #routes.Users syntax correct? When I click the generated link, it literally attempts to render a page at /myapp/#routes.Users.fhirUserDetails(fhirID)
I realize I'm probably missing something very basic here- thanks for any advice!
The problem seems to be not the #routes syntax (which you have completely correct) but rather a case of the Twirl engine not seeing where code ends and HTML begins (or something like that anyway...)
The line you've included, which has both a var and a semicolon, made me suspect this, and I've been able to reproduce the problem when I use that style.
My recommendation is to use the #defining helper rather than var to get a scoped variable for use in your links, as follows:
ID: #defining(<processing for ID>) { fhirID =>
<a href='#routes.Users.fhirUserDetails(fhirID)'>fhirID</a>
}
You can nest #defining blocks as deeply as you like if necessary, although it's probably better to make a call out to a reusable block if there's a lot of logic. I think this style makes for more-readable templates and also somehow looks more like "real Scala" :-)

any chance to define custom highlighting for certain text

I'm extensively using debug level logging like that:
Log::instance()->add($this->debugLogLevel, "\nTransaction is started");
What I don't like is that it interferes with real code. Is there any way to define custom highlighting for these pieces of code (like for example for comments)?
As far as I'm aware there is no such option.
http://youtrack.jetbrains.com/issue/IDEABKL-1561

Missing dependencies in Mootools' OverText?

http://jsfiddle.net/AB5LK/2/
For the life of me, I can't get OverText working in the above example. I overrode the JSFiddle Mootools libraries (since they contain everything by default!) and inserted the ones I am using on my website, and have determined that the libraries are the ones causing the problems.
I use a slimmed-down MooTools library.
It looks as though while I selected OverText in the "More builder", there is still something missing in my libraries that causes the overtext to only become a label, and not a proper overtext.
Short of trial-and-error, does someone know which feature I am missing that will turn this overtext from a label on the right of the input box, to a proper OverText?
perhaps you need to reconsider your 'slimming down':
this.getStyle is not a function
[Break On This Error] return(d&&d.returnPos)?c:this.setStyle...urn this.getStyle("display")!="none";
Removing Element.Style is just silly, unless you're using MooTools for server side js like node and have no DOM.

Any tools to identify undefined CSS/HTML classes?

Are there any tools out there that can look at my website HTML and tell me that (for example) "there is an HTML element at mysite.com/example.html using a class of SOMECLASS but SOMECLASS is not defined in any included CSS files".
?
I've created a snippet that does exactly that: https://gist.github.com/kdzwinel/426a0f76f113643fa285
You can run it in the DevTools console and the sample output will look like this:
You could try out a Firefox plugin like Dust-me-selectors
You could try inspecting with Firebug
There is a free Windows desktop tool that can scan a local web project folder and output undefined css classes, i.e. classes that are used in html but are not defined in any css. It also takes JavaScript into account to some degree.
https://sourceforge.net/projects/cssscanner/
All other answers either didn't work for me or didnt understand the question (including the accepted answer). This one I just tested myself and it works surprisingly well, though it won't catch every edge case.