Skip to content

Instantly share code, notes, and snippets.

@programus
programus / _config.yml
Created March 3, 2012 14:52
A side bar html for using weibo in Octopress.
# 其它内容....
default_asides: [asides/recent_posts.html, asides/weibo.html, asides/github.html, asides/[Twitter][].html, asides/googleplus.html]
# 其它内容....
# Weibo
# Please refer to http://weibo.com/tool/weiboshow to get your uid and verifier.
weibo_uid: 1098907490
weibo_verifier: abd54ad9
@programus
programus / sharebutton.js
Created March 4, 2012 11:32
Sina weibo share button source generated by system.
<script type="text/javascript" charset="utf-8">
(function(){
var _w = 86 , _h = 50;
var param = {
url:location.href,
type:'6',
count:'1', /**是否显示分享数,1显示(可选)*/
appkey:'', /**您申请的应用appkey,显示分享来源(可选)*/
title:'', /**分享的文字内容(可选,默认为所在页面的title)*/
pic:'', /**分享图片的路径(可选)*/
@programus
programus / setlocale.sh
Created March 4, 2012 11:37
Set locale environments
set LANG=zh_CN.UTF-8
set LC_ALL=zh_CN.UTF-8
@programus
programus / _config.yml
Created March 4, 2012 11:52
sharing.html with weibo share button and the config file
# Weibo
# Please refer to http://weibo.com/tool/weiboshow to get your uid and verifier.
weibo_uid: 1098907490
weibo_verifier: abd54ad9
weibo_fansline: 0 # How many lines for the fan list
weibo_show: true # Whether you want your weibo content to be shown
weibo_pic: true # Whether you want the pictures in weibo to be shown
weibo_skin: 10 # Please refer to http://weibo.com/tool/weiboshow
weibo_share: true # Whether show the sharing button
import java.util.Random;
public class StringBufferVsStringBuilder {
public static int demo(final Object stringJoiner, final int testCount) throws InterruptedException {
ThreadGroup group = new ThreadGroup(stringJoiner.getClass().getName() + "@" + stringJoiner.hashCode());
final Random rand = new Random();
Runnable listAppender = new Runnable() {
public void run() {
try {
@programus
programus / StringMerger.java
Created March 5, 2012 14:22
StringBuffer vs String + String
import java.util.Calendar;
/**
* This is a class to prove that merge strings by StringBuffer is quite quicker than String.
*
* @author Programus
*
*/
public class StringMerger {
/**
@programus
programus / NewOrNot.java
Created March 6, 2012 01:40
String initialization in Java
import java.lang.ref.WeakReference;
/**
* Class to research strings.
* constant string like "AAA" won't be reclaimed while instance created by new will.
* when you new a String by a constant string, there will be two memory field stored the same value.
* so initialize a String by constant String is recommended.
* @author Programus
*/
public class NewOrNot {
@programus
programus / data-table.css
Created March 7, 2012 13:12
CSS & head to set data table format in Octopress
* + table {
border-style:solid;
border-width:1px;
border-color:#e7e3e7;
}
* + table th, * + table td {
border-style:dashed;
border-width:1px;
border-color:#e7e3e7;
@programus
programus / index.html
Last active June 23, 2016 01:34
Javascript Game Memory
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>memory</title>
<meta name="description" content="A memory game." />
<meta name="author" content="Programus" />
@programus
programus / JsonUtilities.cs
Created April 1, 2012 12:50
Functions to convert string(utf-8 in c++) to \uXXXX unicode escape
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
namespace CIS_StdWebServices.Utils
{
public class JsonUtilities
{