Skip to content

Instantly share code, notes, and snippets.

View chenyahui's full-sized avatar
🎯
Focusing

cyhone chenyahui

🎯
Focusing
View GitHub Profile
@mbinna
mbinna / effective_modern_cmake.md
Last active May 7, 2025 15:38
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@chenshuo
chenshuo / ThreadTest.java
Last active November 20, 2016 02:52
Two threads
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
public class ThreadTest {
enum Work {
RUN, STOP
}
static class Worker implements Runnable {
@fenbf
fenbf / sfinae_tostring_ex.cpp
Created February 9, 2016 20:33
C++ SFINAE example: how to detect if a class contains ToString method
// SFINAE, enable_if example
// based on http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence
#include <iostream>
#include <type_traits>
class ClassWithToString
{
public:
call NERDTreeAddKeyMap({'key': 't', 'callback': 'NERDTreeMyOpenInTab', 'scope': 'FileNode', 'override': 1 })
function NERDTreeMyOpenInTab(node)
call a:node.open({'reuse': "all", 'where': 't'})
endfunction
@Sharuru
Sharuru / Merging a WPF application into a single EXE
Created February 12, 2015 16:41
Merging a WPF application into a single EXE
第一步,找到项目文件下的 .csprojc 文件,用文本编辑器打开它,并找到下面这行:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
把下面的 XML 粘贴到文件中,然后保存并在 Visual Studio 中重载:
<Target Name="AfterResolveReferences">
<ItemGroup>
<EmbeddedResource Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Extension)' == '.dll'">
<LogicalName>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
@pengju
pengju / BaseDao.java
Created August 1, 2012 10:54
SSH中BaseDao的写法
package com.kaishengit.dao.core;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import org.hibernate.Criteria;
import org.hibernate.Query;