how do I change the gravatar RoR plugin to use d=identicon? - gravatar

I am using the gravatar plugin for Ruby on Rails, works great, by woods via github -- but I want to change the the URL to add the option for d=identicon but I don't see that in the helper options.
Can I get some help?
Thanks!

<%= gravatar_for #user, :default=>'identicon' %>

Related

Web based code editor with auto completion

guys
I'm building the web based code editor for my personal project.I want to make it work like VS code but facing some issues.
I'm using ACE editor.
This is what I get while trying with autocompletion.
I'm getting all the available suggestions while trying to write "os.(something)", rather then just getting the language and package specific suggestions.
What I want is this.
In this pic as you can see I'm getting suggetion related to os package only.
Depending on your setup with require-js, you may also need to include an additional javascript file in the html for your page. You need to write this simple script to working with the auto completion feature.
ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.setOptions({
enableBasicAutocompletion: true
});
Demo: https://github.com/ajaxorg/ace/blob/master/demo/autocompletion.html
Reference: https://github.com/ajaxorg/ace/wiki/How-to-enable-Autocomplete-in-the-Ace-editor
HTML, JS, CSS Based
Create <textarea onkeyup=compile() id=code>. It should be big enaugt for code.
Create <script> </script>
Build the autocomplete
Script: function compile() { document.GetElementById('code').value = document.GetElementById('code').value.replaceAll('snippet1', 'Snippet1Value').replaceAll('snippet2', 'SnippetValue'). ...
E.g.: When you enter _text_ (and you set snippet1 to <input type=text>) then your textarea will write <input type=text>. To create an picker, use a contextmenu-library at json.
I know, this is only an plan how to do is.

Is it possible to add some arrows to ms2gallery and use it as carousel?

I have project on modx and there is used ms2gallery to show images. And customer want to add some arrows(prev, next) to use this ms2gallery as carousel or slider. Is it possible to build-in this functional into ms2gallery? If not could you advice something to solve this task?
You can use the pdoPage snippet for just this purpose. Here's the example form the ms2Gallery documentation:
[[!pdoPage?
&element=`ms2GalleryResources`
&parents=`0`
&tpl=`#INLINE
<p>
[[+pagetitle]]
<img src="[[+120x90]]" title="[[+120x90.name]]" />
</p>
`
&typeOfJoin=`inner`
&includeThumbs=`120x90`
&includeOriginal=`1`
]]
[[!+page.nav]]
You will need to add some extra properties to the snippet call to get more than one result. All the available options and several examples are documented on the pdoPage readme.

Remove a hyperlink with YUI

I have the following in my html:
Logged in as <a title="View Profile" href="http://xxx/user/profile.php?">Peter Pan</a>
I would like to just remove the hyperlink form the above, so that is still displays "Logged in as Peter Pan" but just without Peter Pan linking to anywhere.
Thanks
Assuming YUI 3: node.set('innerHTML', node.get('innerHTML').replace(/<[^>]+>/g, ''));
Note that this doesn't require YUI as much as plain regexp :)
Use the Node.removeAttribute method to remove the anchor's href.
Take a look at its documentation in the YUI API:
http://yuilibrary.com/yui/docs/api/classes/Node.html#method_removeAttribute
Y.one('some selector for the anchor here').removeAttribute('href');

How to add a post image in Ghost's index?

I don't see any examples in the docs on how to use a post's image on the index view of Ghost. For example, you can see this theme doing it: http://studio-lite-theme.ghostify.io/
Any ideas?
EDIT: If anyone comes across this, I found this post that helped: https://ghost.org/forum/themes/1401-tip-how-to-show-the-pic-of-your-post-in-index-hbs/
Since version 0.5.2 there's now official support for Post Images. So avoid the hack using {{content words="0"}}
Instead use {{image}} to print out the url for the image.
For example:
<header {{#if image}}" style="background-image: url({{image}}){{/if}}">
As #user3088077 mentioned in his edit, I could make the image appear in the index page by replacing in the index.hbs
from {{ excerpt }} to {{content words="0"}}.
What happens is that excerpt does not include images, while content does.
This is aimed towards displaying the featured image in index which means it needs to be on the front page not on post page.

Jade: element attributes without value

I am new to using Jade -- and it's awesome so far.
But one thing that I need to happen is an element with 'itemscope' property:
<header itemscope itemtype="http://schema.org/WPHeader">
My Jade notation is:
header(itemscope, itemtype='http://schema.org/WPHeader')
But result is:
<header itemscope="itemscope" itemtype="http://schema.org/WPHeader">
How can I make sure that I get the right result -- itemscope instead of itemscope="itemscope"?
Sometimes it doesn't work quite right -- like with contentEditable Jade tries to detect html5 doctypes and then does <header itemscope itemtype="http://schema.org/WPHeader"></header> if it finds it. The problem is that if you have templates that you are inserting in the page, it can't tell that it's html5.
What you can do is force html5 compilation by passing in {doctype: '5'} to the options -- did this for require-jade: https://github.com/ibash/require-jade/commit/754cba2dce7574b400f75a05172ec97465a8a5eb
I had the same problem using angular ng-include directive. It gets ng-include="ng-include" and then the include doesn'nt work.
What it works for me is to use an empty string as a value, i.e. ng-include="".
Here is answer from jade developers: you should use
doctype html
in the template.
https://github.com/pugjs/jade/issues/370
I just tried it in a Express.js/Jade project and the result i get is:
<header itemscope itemtype="http://schema.org/WPHeader"></header>
I also tried it in bash and then I get the same result as you.
I'd go with the following suggestion or create an issue on Github.
itemscope="itemscope" will work just as well as just itemscope. It looks like that's the default behavior of Jade. I'd just go with it.
I had the same problem, and the easiest solution in my case was adding doctype 5 at the top of my jade document. That apparently allows Jade to use attributes without a value.
ibash put me on the right track with his answer, so thanks for that

Resources