Skip to content

Instantly share code, notes, and snippets.

@yangg
yangg / .gitignore
Created Aug 3, 2012
Download all country flags from wikipedia
View .gitignore
*.pyc
*.png
*.svg
@yangg
yangg / Colorful.php
Created Jul 27, 2012
Markdown & syntax highlighter
View Colorful.php
<?php
namespace Sundown\Render;
class Colorful extends HTML {
public function blockCode($code, $lang) {
if($lang) {
return self::renderCode($code, $lang);
}
return parent::blockCode($code, $lang);
}
@yangg
yangg / dabblet.css
Created Jul 2, 2012
display: box, box-flex - Learning CSS3
View dabblet.css
/**
* display: box, box-flex - Learning CSS3
*/
/*
* The box-flex property specifies whether the child elements of a box is flexible or inflexible in size.
* Elements that are flexible can shrink or grow as the box shrinks and grows. Whenever there is extra space in a box, flexible elements are expanded to fill that space.
*/
.panel { border: solid 1px #ccc; display: box; }
#p1 { border: solid 1px #f90; box-flex: 3; }
View viewsource.cs
using System;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.IO;
class Program
{
static void Main()
{
@yangg
yangg / README.mkd
Created May 23, 2012
Start emacsclient across multi plaform
View README.mkd
windres -O coff icon.rc icon.res
gcc icon.res startemacs.c -o startemacs
@yangg
yangg / uri.js
Created Apr 24, 2012 — forked from jlong/uri.js
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@yangg
yangg / keyfilter.html
Created Apr 24, 2012
Filter User Input by Regex
View keyfilter.html
<!-- tested on chrome & ie9 -->
<input type="text" pattern="\d+" onkeypress="return keyFilter()" />
<input type="text" pattern="\d{11}" maxlength="11" onkeypress="return keyFilter('\\d')" />
<script>
/**
* 限制input的可输入字符类型(不包含长度)
*/
function keyFilter(opt_pat) {
var e = arguments.callee.caller.arguments[0] || window.event,
pattern = opt_pat || (e.target || e.srcElement).getAttribute("pattern");
View reverse-proxy-fix-link.xml
View reverse-proxy.conf
# http://httpd.apache.org/docs/current/mod/core.html
# http://httpd.apache.org/docs/current/mod/mod_proxy.html
# enable proxy modules
# sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled
# sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled
# sudo service apache2 force-reload
# or
# LoadModule proxy_module modules/mod_proxy.so
# LoadModule proxy_http_module modules/mod_proxy_http.so