This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Compress stylesheets and Javascripts | |
cd - | |
cd $HEXO/themes/bootstrap/source/css | |
find . -name "*.css"| while read line;do | |
yuicompressor $line -o ${line}.min | |
mv *.css.min ../dist/ | |
done | |
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{# page.toc }} | |
{{# page.tocstartlv }} | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
// Put a TOC right before the entry content. | |
generateTOC('.content', 'Contents', {{ page.tocstartlv }}); | |
}); | |
</script> | |
{{! {{/ page.tocstartlv }} }} | |
{{! {{^ page.tocstartlv }} }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
int cmp_char(const void *a, const void *b) | |
{ | |
return *(char *)a - *(char *)b; | |
} | |
int main(void) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 禁止使用拷贝构造函数和 operator= 赋值操作的宏 | |
// 应在类的 private: 中使用 | |
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | |
TypeName(const TypeName&); \ | |
void operator=(const TypeName&) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Droid{ | |
private: | |
string name; | |
public: | |
static int population; | |
Droid(const string &s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <sstream> | |
#include <stdexcept> | |
using namespace std; | |
int main(int argc, char *argv[]) | |
{ | |
if(argc != 3){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <dbg.h> | |
using namespace std; | |
int main(void) | |
{ | |
vector<int> vt; | |
vector<int>::const_iterator iter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS=-g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS) | |
LIBS=-ldl $(OPTLIBS) | |
PREFIX?=/usr/local | |
SOURCES=$(wildcard src/**/*.c src/*.c) | |
OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) | |
TEST_SRC=$(wildcard tests/*_tests.c) | |
TESTS=$(patsubst %.c,%,$(TEST_SRC)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Running unit tests:" | |
for i in tests/*_tests | |
do | |
if test -f $i | |
then | |
if $VALGRIND ./$i 2>> tests/tests.log | |
then | |
echo $i PASS | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#include <unistd.h> | |
#define NLOOP 5000 | |
int counter; | |
pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER; |