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
#!/usr/bin/python | |
# Desc: Demostrate the usage of __str__ and __repr__ magic methods | |
""" Demostrate the usage of __str__ and __repr__ magic methods | |
""" | |
# class TestClass(object): | |
class TestClass(): | |
# 定义对象的初始化行为 | |
def __init__(self): |
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 <iostream> | |
#include <mutex> | |
#include <thread> | |
namespace | |
{ | |
std::once_flag init_once_flag; | |
} | |
class singleton |
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 <QLineEdit> | |
#include <QStyledItemDelegate> | |
/* | |
// Sample | |
auto delegate = new HexItemDelegate; | |
ui->tableInfo->setItemDelegateForColumn(1, delegate); | |
ui->tableInfo->setItemDelegateForRow(1, delegate); | |
ui->tableInfo->setItemDelegate(delegate); | |
*/ |
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 <iostream> | |
#include <iterator> | |
#include <algorithm> | |
#include <sstream> | |
#include <unordered_set> | |
namespace | |
{ | |
void to_lower(std::string& str) |
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 | |
############################################################################## | |
# Print information to stdout in bold green style | |
# Globals: | |
# None | |
# Arguments: | |
# None | |
# Outputs: | |
# Writes information to stdout |
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
#pragma once | |
#include <iostream> | |
template <typename T> | |
class linked_list | |
{ | |
public: | |
static const size_t k_invalid_pos = 0xFFFF; | |
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 <iostream> | |
#include <vector> | |
#include <map> | |
using namespace std; | |
class Solution { | |
public: | |
vector<int> twoSum(vector<int>& nums, int target) { |
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 <iostream> | |
size_t count_one_bit(uint64_t num) | |
{ | |
size_t count = 0x0; | |
while (num > 0x0) | |
{ | |
if ((num & 0x01) != 0) |
NewerOlder