Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yangg's full-sized avatar

Brook yangg

  • ShenZhen, China
View GitHub Profile
@yangg
yangg / .gitignore
Created August 3, 2012 10:06
Download all country flags from wikipedia
*.pyc
*.png
*.svg
@yangg
yangg / Colorful.php
Created July 27, 2012 04:42
Markdown & syntax highlighter
<?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 July 2, 2012 01:51
display: box, box-flex - Learning CSS3
/**
* 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; }
@yangg
yangg / viewsource.cs
Created May 25, 2012 07:35
ViewSource
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 03:09
Start emacsclient across multi plaform
windres -O coff icon.rc icon.res
gcc icon.res startemacs.c -o startemacs
@yangg
yangg / uri.js
Created April 24, 2012 05:53 — forked from jlong/uri.js
URI Parsing with Javascript
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 April 24, 2012 03:20
Filter User Input by Regex
<!-- 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");
@yangg
yangg / reverse-proxy.conf
Created April 7, 2012 16:26
Apache Configs
# 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