Skip to content

Instantly share code, notes, and snippets.

@sw897
sw897 / duoshuo
Last active August 29, 2015 13:56
jekyll-bootstrap配置
<div class="ds-thread"></div>
<script type="text/javascript">
var duoshuoQuery = {short_name:'{{ site.JB.comments.duoshuo.short_name }}'};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = 'http://static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
{% if site.JB.comments.provider and page.comments != false %}
{% case site.JB.comments.provider %}
{% when "duoshuo" %}
{% include JB/comments-providers/duoshuo %}
{% when "disqus" %}
{% include JB/comments-providers/disqus %}
{% when "livefyre" %}
{% include JB/comments-providers/livefyre %}
{% when "intensedebate" %}
{% if page.keywords %}
<meta name="keywords" content="{{ page.keywords }}">
{% endif %}
---
title: robots
---
User-agent: *
Sitemap: <{{site.production_url}}/sitemap.xml>
---
# Remember to set production_url in your _config.yml file!
layout: nil
title : Sitemap
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}
<url>
<loc>{{site.production_url}}{{ post.url }}</loc>
@sw897
sw897 / create_dashdoc_index
Created April 1, 2014 03:34
create_dashdoc_index
import os
import sqlite3
conn = sqlite3.connect('docSet.dsidx')
cur = conn.cursor()
cur.execute("DROP INDEX IF EXISTS anchor")
cur.execute("DROP TABLE IF EXISTS searchIndex")
cur.execute("CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT)")
cur.execute("CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path)")
for root, dirs, files in os.walk('Documents'):
@sw897
sw897 / TextSelectionReader.cs
Created May 13, 2016 01:28
Class that can be used to retrieve the currently selected text (if any) from an active control in the active window. It does this by trying several methods internally (UIAutomation, API calls using SendMessage + WM_GETTEXT, Clipboard). Be sure to reference UIAutomationClient and UIAutomationTypes!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Automation;
using System.Windows.Forms;
//WARNING: The code below is NOT for the faint of heart. Exceptions are swallowed freely, sendkeys