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
/** | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { | |
return _.transform(object, function(result, value, key) { | |
if (!_.isEqual(value, base[key])) { |
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
#! 作为数据延迟加载,但作为Instrument 此语法不支持... 包括Query也不支持跳 | |
test = dashboard_dao.get_safe(role_id, joinedload=(Dashboard.portal, Dashboard.portal.project)) # !!! 执行失败 | |
q = role_dao._buildQueryfields(joinedload=(Role.org, Organization.org_users)).filter(role_dao.model.id == role_id) | |
logger.info(f'{q}') | |
logger.info(f'{q.all()}') # 自动distinct ? 查询返回一条! | |
logger.info(f'{q.one_or_none()}') # 自动distinct ? 不会报错! | |
# 自定义 | |
test = dashboard_dao.get_safe(role_id, joinedload=(Dashboard.portal, DashboardPortal.project)) # 多次预加载,但注意保持对象不得有多行 |
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
# WSL2 network port forwarding script v1 | |
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell, | |
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter. | |
# written by Daehyuk Ahn, Aug-1-2020 | |
# Display all portproxy information | |
If ($Args[0] -eq "list") { | |
netsh interface portproxy show v4tov4; | |
exit; | |
} |
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
import 'dart:async'; | |
main() { | |
Future.value(10).then((_) { | |
Future(() => throw 'err').catchError((_){ | |
print('innner $_'); | |
throw 'no catch'; | |
}); | |
return _; | |
}).then((_) { |
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
main() { | |
var p2 = '/Images/png/yw_icon.png'; | |
var p3 = 'Images/png/yw_icon.png'; | |
var rs = [ | |
'http://61.183.0.23/gzzs/appstore.aspx?d=18', | |
'https://13.cn.123/root/', | |
'https://13.cn.123/api', | |
'ftp://123.23.132/', | |
'wx://123/23', | |
p2, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src=https://unpkg.com/@reactivex/[email protected]/dist/global/rxjs.umd.js></script> | |
</head> | |
<body> |
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
String deversion(String version){ | |
if(version == null || version.compareTo("1.0.0")<0) return version; | |
var versions = version.split('.'); | |
var s = int.parse(versions.first) -1; | |
versions[0] = s.toString(); | |
return versions.join('.'); | |
} | |
int versionValue(String version){ | |
if(version == null) return null; | |
var versions = version.split('.'); |
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
String supplant(String o,map) { | |
RegExp r = RegExp(r"{([^{}]+)}"); | |
return o.replaceAllMapped(r,(match){ | |
//print('matched;${match.group(1)}'); | |
return '${map[match.group(1)]}'; | |
}); | |
} | |
main(){ | |
print(supplant('hello,{person},i will {do} u',{'person':'julie','do':['love','then','touch']})); | |
} |
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
EXECUTE 'UPDATE tbl SET ' | |
|| quote_ident(colname) -- | |
|| ' = ' | |
|| quote_nullable(newvalue) | |
|| ' WHERE key = ' | |
|| quote_literal(keyvalue); | |
EXECUTE format('UPDATE tbl SET %I = %L ' | |
'WHERE key = %L', colname, newvalue, keyvalue); | |
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
--实战用例: | |
path-to-oracle-client\BIN\sqlldr userid=用户名/密码@tns名 control=控制文件.ctl direct=y parallel=y readsize=10005008 errors=999999999 | |
--控制文件.ctl内容: | |
load data | |
CHARACTERSET 'UTF8' | |
infile "webdata20180724_wh.txt" | |
Append into table xw_tmp_to_liuling_20180725 | |
fields terminated by "," |
NewerOlder