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> | |
void countNewLine(char, int *); | |
int main(void) | |
{ | |
int count = 0; | |
countNewLine(getchar(), &count); | |
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
/* | |
* BBCode.js - javascript BBCode module by Zhang Qingcheng <kinch.zhang@gmail.com> | |
* | |
* usage: | |
* | |
* 1. load this module | |
* <script type="text/javascript" src="<?php echo get_domain_name_by_app('js', true);?>/c/BBCode.js"></script> | |
* | |
* 2. get an instance to use it | |
* <script type="text/javascript"> |
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/bash | |
echo -e "\n=> status changed:" | |
svn st | less -d | |
svn diff | less -d | |
echo -ne "\n=> do you want to commit? [y/n]: " | |
read i | |
if [ -z "$i" ];then | |
svn commit -m "debug" | |
fi | |
echo -e "\n=> done." |
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
user www-data; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
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
<?php | |
$bbcode = '[p][url=http://www.gmail.com][u]gmail[/u][/url]'; | |
$bbcode .= '[b][size=3]foo[/size][/b]'; | |
$bbcode .= '[color=red][u][i]bar[/i][/u][/color][/p]'; | |
$root = new BBCodeNode('root'); | |
$root = build_tree($bbcode, $root); | |
echo 'BBCode: ', $bbcode, "\n\n"; | |
traverse_tree($root, 'printer', 0); |
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/bash | |
# svn commit wrapper | |
clear | |
echo -e "\n=> status changed:" | |
svn st | less -d | |
svn diff | less -d | |
echo -ne "\n=> do you want to commit? [y/n]: " | |
read i |
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
<?php | |
function insertion_sort($seq) | |
{ | |
$size = count($seq); | |
for ($i = 1; $i < $size; $i ++) { | |
$key = $seq[$i]; | |
$left = $i - 1; |
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
def insertion_sort(seq) | |
(1..seq.size - 1).each do |i| | |
key = seq[i] | |
left = i - 1 | |
while left >= 0 and seq[left] > key | |
seq[left + 1] = seq[left] | |
seq[left] = key | |
left -= 1 | |
end |
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
<?php | |
function insertion_sort($seq) | |
{ | |
$size = count($seq); | |
for ($i = 1; $i < $size; $i ++) { | |
$key = $seq[$i]; | |
$left = $i - 1; |
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
def insertion_sort(seq): | |
for i in range(1, len(seq)): | |
key = seq[i]; | |
left = i - 1; | |
while left >= 0 and seq[left] > key: | |
seq[left + 1] = seq[left] | |
seq[left] = key | |
left -= 1 | |
return seq |