Skip to content

Instantly share code, notes, and snippets.

View Answeror's full-sized avatar

Cosmo Du Answeror

View GitHub Profile
@Answeror
Answeror / vector.css
Created August 31, 2012 12:27
Wikipedia custom CSS
body {
font-size: 1.2em;
}
#bodyContent, #firstHeading {
max-width: 800px;
margin: auto;
}
@Answeror
Answeror / settings.py
Created July 24, 2012 12:38
QSettings wrapper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. module:: settings
:synopsis: Provide Settings class.
.. moduleauthor:: Answeror <[email protected]>
"""
@Answeror
Answeror / fseq.cpp
Created July 7, 2012 08:40
作业三(基本要求)
#include <fstream>
#include <algorithm>
#include <iterator>
namespace mine
{
typedef std::fstream* stream_ptr;
typedef std::size_t pos_type;
typedef std::ptrdiff_t difference_type;
typedef char value_type;
@Answeror
Answeror / split_iterater_version.cpp
Created July 6, 2012 00:43
使用输出迭代器分割字符串
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <iterator>
using namespace std;
template<class Out>
@Answeror
Answeror / test.cpp
Created July 5, 2012 14:45
单元测试
/**
* @file
* @author answeror <[email protected]>
* @date 2012-07-05
*
* @section DESCRIPTION
*
* This file is used to illustrate how to do simple unit testing.
*/
#include <iterator>
#include <algorithm>
#include "student.h"
istream& operator >>(istream &is, vector<double> &v);
student read(istream &is)
{
string name;
@Answeror
Answeror / yasort.cpp
Created July 3, 2012 08:41
快速排序的简单实现
#include <algorithm>
#include <vector>
using namespace std;
typedef vector<int>::iterator iter;
struct cmp
{
int pivot;
@Answeror
Answeror / sentence.cpp
Created July 3, 2012 08:39
根据文法随机生成句子
#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iterator>
#include <cassert>
#include <cstdlib>
@Answeror
Answeror / xref.cpp
Created July 3, 2012 02:23
交叉引用
#include <map>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iterator>
#include <algorithm>
#include <string>
@Answeror
Answeror / cat.cpp
Created July 3, 2012 01:57
拼接字符串(空格分隔)
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <numeric>
#include <iostream>
using namespace std;
string cat(vector<string> v)