Issues adding github gist to my blog(using Google blogger) - github

I'm trying to add a gist to my blog to see how it works and use it to share some code related blogs going forward.
I've followed the steps mentioned form this blog, but I'm not able to get it to work. I don't know what I'm missing, any pointers on what I could be missing would be really appreciated.
My HTML Editor of blog related code looks like this:-
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hi<br />
<br />
test<br />
<br />
<br />
<div class="gistLoad" data-id="4132084" id="gist-4132084">
Loading ....</div>
<br />
<br />
<br />
<br />
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; word-wrap: break-word;"></pre>
</div>
<script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script> </div>
Thanks.
UPDATE (including, changing the code above)
I found one thing confusing for a while, why should I actually paste a div tag in the "Compose" Section of the Blog, it's afterall HTML code, so I moved it to the HTML editor part of the Blog. What was confusing to me initially was when it was mentioned in the blog:-
Now to include any gist template just add the following anywhere in
your blog post.
But anyways, now, I only get "Loading" .., The error still persists..

Here's the code that did it correctly for me. I had to ensure that within the div I copy the code that comes as part of 'Embed the gist' when you actually see one's real gist(say for e.g., this gist) on Github.
Also, one more mistake I made was in my code, the JS was not completely outside the post(it was actually inside the last div if you observer closely(my bad)). Anyways, All's well that end's well :). So here's the code that did the trick for me -
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hi<br />
<br />
test<br />
<br />
<br />
<div class="gistLoad" data-id="4132084" id="gist-4132084">
<script src="https://gist.github.com/boddhisattva/4132084.js"></script>
In case you want to see how I was able to embed the gist in my blog, you can have a look
at the stackoverflow question that I posted here on the same when I had initially faced issues to get this to work for me.
Credits to the original blogger's post.
</div>
<br />
<br />
<br />
<br />
<pre style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; word-wrap: break-word;"></pre>
</div>
</div>
<script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script>
Here's the actual blog link which uses the above code.
Cheers.. :)

A simpler solution (since October 2014): www.gistfy.com:
Gistfy is an easy way to create embeddable code snippets from your GitHub and Bitbucket repositories or your GitHub Gist.
For example:
<script type='text/javascript' src='http://www.gistfy.com/github/gist/10666727'></script>
^
(id of a GitHub Gist)

The blog post you mention explains everything clearly and it's all you have to do. I'll describe what I did:
I copied the <script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script> into a widget that is dynamically loaded into each blog page (posts, pages, everything). This will not work, because, as being said, include the following code at the end of each of your blog posts. This means you have to include it separately in al your posts. Yes, I don't like it as well, but the blog entries are loaded dynamically, so you have to load gists after the original blog entry is loaded.
Put the <div class="gistLoad" data-id="GistID" id="gist-GistID">Loading ....</div>
just where you would put original github gist code. For example - this is a gist I wanted to display on my post. This is the original code: <script src="https://gist.github.com/tkoomzaaskz/6235219.js"></script>. The gistID is 6235219. So, instead, I put <div class="gistLoad" data-id="6235219" id="gist-6235219">Loading ....</div>. And in the end of the post, I put the javascript source from point 1.
This blog post is an example that it works fine.

I dont know, whether your are trying gist content made it as private or public. Here are the few steps for how to implement PUBLIC gist code into your blogger.
1) Create a gist file in gist.github.com(While you save the file just choose as "Create Public Gist"
2) Take/copy the code "Embed URL" text box(almost you done).
3) Login to your blogger and add copied code into your desired posts. Thats all. Your public gist code will display in your page.
Actual article from here

For me it was because i was using dynamic view template on google blogger. When i changed it to simple then the javascript was working and showed the gist.

The 3rd party github hosted file tag didn't work for me at all. - <script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script>
failed in chrome with Refused to execute script from 'https://raw.github.com/moski/gist-Blogger/master/public/gis‌​tLoader.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
The embed links on github's site work, but for those wanting to avoid the reliance on a script link, I wrote code to pull down what the embed link serves up and decode it for pasting into blogger. LinqPad code at https://github.com/ImaginaryDevelopment/LinqPad/blob/master/LINQPad%20Queries/LanguageTranslators/fetch%20then%20parse%20gist%20html.linq

Kindly look for the Embed code ofrthe gist, i found out it to be
<script src="https://gist.github.com/boddhisattva/4132084.js"></script>
The just create a blogpost in blogger.com with just the above script, it's that easy

Related

Set value to the "preheader" of a design in sendgrid API

I am using SendGrid API to create/update/delete a Design.
as you can see in the picture below, there isn't any JSON item to set the value for the "preheader"
So after creating successfully in the Sendgrid design library the preheader is empty and we should fill it by editing the design. picture below
Is there any solution to set the value to the preheader with API?
I find the solution. As Philnash has mentioned in this post the pre-header is located in the body of the Email Design Html. But we should use some attributes which are very important.
Just append these 2 nested div with a p tag to the body of your Html-content. Then send it to the SendGrid
<div class="module preheader preheader-hide" role="module" data-type="preheader">
<div role="module-content" style="display: none!important; mso-hide:
all; visibility: hidden; ">
<p id="preheaderId"> your pre header </p>
</div>
</div>

DSpace with links to social media

At the DSpace repositories of Massey University and University of Waikato in New Zealand there are buttons to share the link to a document in the repository with Twitter, Facebook and other social media.
Also have both sites a Window with Twitter tweets.
I hope someone of you wants to explain how both functionalities are added to the DSpace Mirage 2 theme.
We use the addThis service with our DSpace installation: http://www.addthis.com/
The service allows you to customize the share options for your site.
For Mirage2, we added the following javascript to Mirage2/xsl/core/page-structure.xsl to add the service to our site. The link will contain a unique id for your configuration.
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=..."></script>
We also added some custom CSS to Mirage2/styles/_style.scss
.container {
padding-left: 50px;
padding-right: 50px;
}
You can preview this on our repository site: https://repository.library.georgetown.edu/
terrywb's answer covers the share button aspect - that is exactly the service used at the University of Waikato's repository that Peter linked to. We add the JavaScript in navigation.xsl not page-structure.xsl, and we also add
<div class="addthis_sharing_toolbox list-group" style="min-height:37.5px"></div>
just after the opening tag for the #ds-options div, in line with the AddThis embedding instructions.
As to the tweets on the home page, refer to the Twitter embedded timeline instructions. I believe we add a placeholder div via news-xmlui.xml that then triggers a template in theme.xsl that pulls in the JavaScript and generates the required a element - example below is from the Twitter documentation.
<a class="twitter-timeline"
href="https://twitter.com/TwitterDev"
data-width="300"
data-height="300">
Tweets by #TwitterDev
</a>
If you want to avoid services like AddThis tracking your users or just want to keep it simple, you can use simple share links. Add to dspace-xmlui-mirage2/src/main/webapp/xsl/aspect/artifactbrowser/item-view.xsl this template:
<xsl:template name="share-section">
<div class="item-page-field-wrapper table hidden-print">
<h5><i18n:text>xmlui.mirage2.itemSummaryView.ShareSection</i18n:text></h5>
<xsl:variable name="url">
<xsl:value-of select="encoder:encode(confman:getProperty('dspace.baseUrl'))" />
<xsl:value-of select="encoder:encode('/handle/')" />
<xsl:value-of select="encoder:encode(substring-after(/mets:METS/#OBJID,'handle/'))" />
</xsl:variable>
<a target="_blank" i18n:attr="title" title="xmlui.export.mendeley"
href="http://www.mendeley.com/import/?url={$url}">
<img src="{concat($theme-path,'/images/mendeley.png')}"
i18n:attr="alt" alt="xmlui.export.mendeley" />
</a>
<a class="social-network-icon twitter"
href="http://twitter.com/home/?status={$url}"
title="Share on Twitter" target="_blank"></a>
<a class="social-network-icon facebook"
href="http://www.facebook.com/sharer.php?u={$url}"
title="Share on Facebook" target="_blank"></a>
</div>
</xsl:template>
Here you can find more share links for other social networks.
Then, you have to call the template from where you want it to appear. For example, we add it to the first column of the item metadata, at the <xsl:template match="dim:dim" mode="itemSummaryView-DIM"> template of the same file.
We got the icons from Expando (another option for sharing with social networks, and it's free software). This CSS is to show the icons:
.social-network-icon {
background-image: url("../images/social-networks-icons.png");
background-repeat: no-repeat;
background-origin: 0;
display: inline-block;
height: 16px;
margin-left: 4px;
vertical-align: middle;
width: 16px;
}
.social-network-icon.facebook {
background-position: -0*16px 0;
}
.social-network-icon.google-plus {
background-position: -2*16px 0;
}

copying a div or any borders, for an html email

This may seem like a very easy question for a some people, but I've been asked to make an html email signature for someone at my office.
Doing a little googling it seems that for gmail, all you need to do is design the signature that you want to use, then copy and paste the whole thing into their signature box, then you should be good to go.
The problem I'm running into is I can only copy the text, I can't find a way to copy the borders of my div (I tried using a table for this too, but ran into the same issue.
I tried to find a way to work around this, by seeing if there was somewhere I could just input pure html into their signature box, but it renders as text, not as html.
After searching around for a while I haven't been able to find a solution to this issue yet, any help would be appreciated!(will add html below)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
#box {
border-style: solid;
border-color: black;
height: 130px;
width: 285px;
}
#name{
font-weight: bold;
text-align: center;
}
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<div id=box>
<p id=name> ———— John Doe ———— </p>
</div>
<table>
<tr>
<td>test</td>
</tr>
</table>
</body>
</html>
There is a lot to consider in an HTML email signature. You need to develop and design it just as you would a regular HTML email. This means ALL styling should be inlined - especially Gmail as it ignores all Style tags. You also need to take into account the CSS that is available for each client (https://www.campaignmonitor.com/css/).
You will also want to test this signature across each client as the email client you are using may in fact change the code you put in prior to sending and each email client's pre-processor may delete or further edit your code upon delivery.
A great article about creating an email signature: http://www.sitepoint.com/the-art-of-designing-and-marking-up-email-signatures/
This is your code inlined:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div style="border-style: solid; border-color: black; height: 130px; width: 285px;">
<p style="font-weight: bold; text-align: center;"> ———— John Doe ———— </p>
</div>
<table>
<tr>
<td style="border: 1px solid black;">test</td>
</tr>
</table>
</body>
</html>

Is it possible to use google webfonts in a MailChimp template?

I've been trying to incorporate google webfonts in MailChimp and can't get any solutions to work.
I've tried the approach listed on Campaign Monitor's site using #import:
http://www.campaignmonitor.com/blog/post/3897/using-web-fonts-in-email
but I get this error when trying to preview:
An error occurred parsing your template CSS:
Cannot find a CSS file at: http://fonts.googleapis.com/css?family=Montserrat
Has anyone been able to use custom fonts within MailChimp?
It turns out it's not possible through the #import syntax. It does work using tag:
<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
I use custom fonts in all of my emails but not through google. If your having trouble using Google's webfonts I recommend you host the file on your own server and try to use that instead.
For me, I import my webfonts stylesheet like so:
#import url('https://www.mydomain.com/en/img/cms/mail/_a/fonts/fonts.css');
I also add a conditional-comments below my style declarations to enhance webfont fallbacks in outlook. Without this, Outlook will likely substitute your webfont for whatever it feels like, and not respect your fallback font. But if you declare this conditional comment and then wrap your text with an additional span with the class, Outlook will respect your fallback and use the font you decide.
<!--[if gte mso 9]>
<style>
.flowerpwr { font-family:Arial,sans-serif; }
.proxima { font-family:Arial,sans-serif;font-weight:normal; }
.proxima_novasemibold { font-family:Arial,sans-serif;font-weight:normal; }
</style>
<![endif]-->
The html markup looks like this:
<td align="center" style="font-family:'proxima_novaregular',Arial,sans-serif;font-size:16px;letter-spacing:0.04em;color:#333333;">
<span class="proxima">Text here</span>
</td>
This even works for styling image alt text like so:
<td>
<a href="https://www.mylink.com/" target="_blank" style="display:block;font-family:'proxima_novaregular',Arial,sans-serif;color:#666666;font-size:16px;text-align:center;letter-spacing:0.04em;text-decoration:none;outline:none;">
<span class="proxima">
<img src="a3.jpg" alt="STYLED ALT TEXT WITH WEBFONT AND OUTLOOK MAINTAINED FALLBACK" border="0" style="display:block;">
</span>
</a>
</td>
I have been building emails a lot using mailchimp recently and I had been scratching my head over this for a while. These are my findings:
works for google fonts.
#import works for fonts hosted through other sites then google (for ex. your personal site)
using something like:
<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
using #import for google fonts gives you an error in mailchimp (like the one horizens posted).
base64 works as well. But the code can get way to long and cause other problems.
Firefox blocks the fonts in Mailchimp preview (because it's https).
PS: different but related topic: Making responsive emails is not as terrible as the people of the internet claim.

Show a form's response in browser instead of Lotus Notes Tab

this is the first time I work with email forms for Lotus Notes - should the answer be too simple, please forgive me.
What I do is sending an HTML mail with a FORM. Usually Notes opens URLs in such emails in a new browser window - but the email form (or rather the server's response) is opened in a new tab.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
<title>Title</title>
</head>
<body style="width: 600px; padding: 20px; margin: 0px; font-family: Verdana, Arial, sans-serif; font-size: 12px">
...
<form action="http://server/url/" method="post" target="_blank">
...
<div style="margin-top: 30px; text-align: right; padding-bottom: 30px; border-bottom: 2px solid #CCCCCC">
<input type="submit" value="Send" />
</div>
</form>
</body>
</html>
PS: Lotus seems to ignore whether a target="_blank" is set or not.
Any suggestions? I know that you can modify the program's behavior when it is your Notes - but as the tab sometimes has other connections settings (e.g. proxy) than the local browser I'd like to change the behavior "by mail".
Thanks for suggestions!
BurninLeo
Unfortunately browser behavior can't be controlled by the content and needs to be set on the client side. The target attribute is the only thing you can change.
Check your browser settings and what happens when you click on a link in the browser. If it normally opens in a new tab, then setting your target doesn't make a difference, as the new tab is the target.
Before tabbed browsing was introduced, it would always open a new window, but now it just opens a new tab.