Skip to content

Instantly share code, notes, and snippets.

View bluzky's full-sized avatar
🎯
Focusing

Dung Nguyen bluzky

🎯
Focusing
View GitHub Profile
@bluzky
bluzky / decorator don gian.py
Last active August 29, 2015 14:23
Python decorator introduction
__author__ = 'bluzky'
def name_decorator(f):
def wrapper(ten):
chuoi_moi = "Ten tui la %s" % ten
return f(chuoi_moi)
return wrapper
# su dung decorator
@name_decorator
@bluzky
bluzky / string_convert.cpp
Created November 12, 2014 08:59
Convert UTF-8 to UTF-16 and vice versa
wstring utf8_to_utf16(string utf8)
{
std::vector<unsigned long> unicode;
size_t i = 0;
while (i < utf8.size())
{
unsigned long uni;
size_t todo;
bool error = false;
unsigned char ch = utf8[i++];