Skip to content

Instantly share code, notes, and snippets.

@matthewpersico
Last active September 23, 2020 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewpersico/c5ae8f9e178c65bd1f2c43134d031380 to your computer and use it in GitHub Desktop.
Save matthewpersico/c5ae8f9e178c65bd1f2c43134d031380 to your computer and use it in GitHub Desktop.
Snippets for Testing code blocks in Blogger
<p><span style="font-family: inherit;">So after I posted my tribute to my deceased dad here on Blogger, I wondered if I could use Blogger to post code. After a number of false starts, I have chosen the easiest way for me to do so. Here's a step by step for you.</span></p><p></p><ul style="text-align: left;"><li><span style="font-family: inherit;">Type out your text. Insert markers where your code should go. Markers should be a separate paragraph with easily findable text, like:<br /><br />[SNIPPET #1 GOES HERE]</span></li><li>Create a new gist for each post. Create a new file in the gist for each snippet.</li><li>Copy the embed link from the gist.</li><li>Switch to "HTML view" in Blogger.<br /></li><li>Locate each snippet marker and remove just the tags around it. I usually start at the marker and work left until I find an end tag. Then I know that the tag to the right of the end tag is the start of my snippet. The tags may be spans and font settings.</li><li>Once you have removed all the tags, replace the snippet marker with the embed link. Add "?file=somefilename" to the embed link to limit to one file in the gist.</li><li>Switch back to "Compose view."<br /></li><li>Preview. You won't see anything in Compose view.</li><li>Voila!</li></ul><div>Sample:</div><div><br /></div><div>Here is the whole gist:</div><script src="https://gist.github.com/matthewpersico/c5ae8f9e178c65bd1f2c43134d031380.js"></script><span><div><br /></div><span></span><div>Here is just one file in the gist:</div><script src="https://gist.github.com/matthewpersico/c5ae8f9e178c65bd1f2c43134d031380.js?file=snippet1.pl"></script><span></span><div><br /><br /><br /></div><span></span></span><br />
my $junk = 42;
if ($junk == 42) {
print("This is snippet1, indent2");
}
my $junk = 42;
if ($junk == 42) {
print("This is snippet2, indent 4");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment