Skip to content

Instantly share code, notes, and snippets.

View haifengwang's full-sized avatar

白若水 haifengwang

View GitHub Profile
@rionmonster
rionmonster / IQueryableExtensions
Last active November 9, 2022 16:39
Resolve the SQL being executed behind the scenes in Entity Framework Core
public static class IQueryableExtensions
{
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo();
private static readonly FieldInfo QueryCompilerField = typeof(EntityQueryProvider).GetTypeInfo().DeclaredFields.First(x => x.Name == "_queryCompiler");
private static readonly PropertyInfo NodeTypeProviderField = QueryCompilerTypeInfo.DeclaredProperties.Single(x => x.Name == "NodeTypeProvider");
private static readonly MethodInfo CreateQueryParserMethod = QueryCompilerTypeInfo.DeclaredMethods.First(x => x.Name == "CreateQueryParser");
@tupunco
tupunco / vscode.md
Last active May 28, 2018 10:41
vscode-go 开发环境配置[请访问新篇]

VSCode 开发配置

本篇内容有点陈旧, 请访问新篇 vscode-go 插件安装

settings.json

VSCode 工作区配置. 菜单 文件->个性化配置->工作区设置 来触发本配置. GOPATH 多个路径在 Mac 下需要 : 分割, Windows 下需要 ; 分割, 下面涉及到的 GOPATH 都遵循此规则. 本节点配置后需要重启 VSCode 来生效.

@billyohgren
billyohgren / UILabel+ContentSize.h
Last active April 20, 2020 13:04
Calculate the actual size of the content inside a UILabel
#import <UIKit/UIKit.h>
@interface UILabel (ContentSize)
- (CGSize)contentSize;
@end
@aegzorz
aegzorz / NSObject+LogDealloc.h
Last active October 16, 2021 13:08
Category on NSObject that logs deallocs, useful when tracking down memory leaks
#import <Foundation/Foundation.h>
@interface NSObject (LogDealloc)
- (void)logOnDealloc;
@end
@hydra35
hydra35 / nginx.conf
Last active May 14, 2021 03:51
to gray, for Ya'An, Si Chuan earthquake
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
@binjoo
binjoo / ShortUrl.java
Created November 16, 2012 04:51
JAVA:短地址压缩算法原理解析
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* 【转】URL短地址压缩算法 微博短地址原理解析
* http://www.cnblogs.com/jinzhao/archive/2012/04/08/2437188.html
*
*/
public class ShortUrl {
public static String[] generateCode(String url) {
@danielphillips
danielphillips / UILabel+dynamicSizeMe.h
Created June 2, 2011 22:54
Adjust UILabel to change it's frame according to it's content
@interface UILabel (dynamicSizeMe)
-(float)resizeToFit;
-(float)expectedHeight;
@end
@sindresorhus
sindresorhus / mysql-backup-windows.bat
Created March 14, 2011 14:50
Backup MySQL databases in separate gzipped sql files on Windows
@echo off
set dbUser=root
set dbPassword=password
set backupDir="C:\Documents and Settings\user\Desktop\backup\mysql"
set mysqldump="C:\Program Files\MySQL\MySQL Workbench 5.2 CE\mysqldump.exe"
set mysqlDataDir="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data"
set zip="C:\Program Files\7-Zip\7z.exe"
:: get date