This file contains hidden or 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
function validateEmail(email) { | |
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(email); | |
} |
This file contains hidden or 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
Show hidden characters
{ | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": "<", | |
"selector": "text.html" | |
}, | |
{ | |
"characters": "/", | |
"selector": "string.quoted.double.html,string.quoted.single.html, source.css" |
This file contains hidden or 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
for ((i=1; i<=10; i++)); do dd if=/dev/urandom of=test-$i.bin bs=10k count=1; done |
This file contains hidden or 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
# replace extesion name .html to .php | |
for i in *.html; do mv "$i" "`echo $i | sed 's/\.html/.php/g'`"; done | |
# another way to replace extension | |
ls *.html | awk '{print("mv "$1" "$1)}' | sed 's/html/mak/2' | /bin/sh |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
""" | |
Introducing Lists easy example | |
@author: Hank Wang <[email protected]> | |
@version: 20101010 | |
""" | |
# Creating Lists |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
# filename: Multiplication.py <九九乘法> | |
# date: 2010-08-07 | |
if __name__ == "__main__": | |
for i in range(2, 10): | |
for j in range(1, 10): | |
print(i, " x ", j, " = ", i*j) # method 1 | |
#print("%d x %d = %d" % (i, j, i*j)) # method 2 |
This file contains hidden or 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> | |
int main() { | |
int i, j; | |
for(i=2; i<10; i++) { | |
for(j=1; j<10; j++) { | |
printf("%d x %d = %d\n", i, j , i*j); | |
} | |
} | |
getchar(); |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
""" | |
Demo: Use BeautifulSoup parse HTML | |
@author: Hank | |
@version: 2011/1/15 | |
@updated: 2013/3/11 | |
""" |
This file contains hidden or 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
{ | |
"cmd": ["python", "-u", "$file"], | |
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", | |
"selector": "source.python", | |
"env":{ | |
"PYTHONPATH": "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages" | |
} | |
} |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
""" | |
Threading Example | |
@author: Hank Wang <[email protected]> | |
@version: 20101230 | |
""" | |
import time |