Sample post with code snippets
Introduction
For code syntax coloration I’m using Darcula theme from Intellij IDEA, which I’ve found in this post Darcula theme for Pygments.
XML with line numbers (linenos flag), {% highlight xml linenos %}
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ site.name }}</title>
<description>{{ site.description }}</description>
<link>{{site.baseurl | prepend:site.url}}</link>
<atom:link href="{{site.baseurl | prepend:site.url}}/feed.xml" rel="self" type="application/rss+xml" />
{% for post in site.posts limit:10 %}
<item>
<title>{{ post.title }}</title>
<description>{{ post.content | xml_escape }}</description>
<pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
<link>{{post.url | prepend:site.baseurl | prepend:site.url}}</link>
<guid isPermaLink="true">{{post.url | prepend:site.baseurl | prepend:site.url}}</guid>
</item>
{% endfor %}
</channel>
</rss>
JSON:
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
SQL:
select count(*) as cm_content_nodes
from alf_node nd, alf_qname qn, alf_namespace ns
where qn.ns_id = ns.id
and nd.type_qname_id = qn.id
and ns.uri = 'http://www.alfresco.org/model/content/1.0'
and qn.local_name = 'content';
Java:
private String getToken(HttpClient client) throws UnsupportedEncodingException{
Cookie[] cookies = client.getState().getCookies();
for (Cookie cookie : cookies){
if (cookie.getName().equals("Alfresco-CSRFToken")){
return URLDecoder.decode(cookie.getValue(), "UTF-8");
}
}
return null;
}