Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

is2 hjdo

🏠
Working from home
Block or report user

Report or block hjdo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hjdo
hjdo / DictionaryExtend.cs
Created Jan 31, 2019
c# Dictionary 相关扩展
View DictionaryExtend.cs
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace iCTR.WeiXin.Common.Extensions
{
/// <summary>
/// 字典类扩展
/// </summary>
public static class DictionaryExtend
@hjdo
hjdo / System.Dynamic.ExpandoObject_create.cs
Last active Jan 29, 2019
动态创建c#类,以及在Csvhelper中创建动态的数据对象
View System.Dynamic.ExpandoObject_create.cs
// my pretend dataset
List<string> fields = new List<string>();
// my 'columns'
fields.Add("this_thing");
fields.Add("that_thing");
fields.Add("the_other");
dynamic exo = new System.Dynamic.ExpandoObject();
foreach (string field in fields)
@hjdo
hjdo / main.go
Last active Nov 6, 2018
Go HTTP接口简单例子
View main.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
type UserInfo struct {
@hjdo
hjdo / element-upload-filetype.js
Created Jul 31, 2018
element ui 上传组件判断文件类型
View element-upload-filetype.js
/**
* 图片上传之前调用的事件
*/
beforeAvatarUpload(file) {
// 允许所有的图片类型
const isJPG = file.type.indexOf("image/") > -1;
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error("请上传图片文件!");
}
@hjdo
hjdo / windowOnfocus.js
Created Apr 26, 2018
js判断用户有没有操作页面
View windowOnfocus.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js判断用户有没有操作页面</title>
</head>
<body>
<script>
@hjdo
hjdo / getUrlParameterByName.js
Last active Apr 25, 2018
JavaScript从url中获取指定query string的值
View getUrlParameterByName.js
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
@hjdo
hjdo / HttpHelper.cs
Created Mar 21, 2018
c# HTTP请求帮助类
View HttpHelper.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Common
{
View gist:c3bddf19ab86aefdd7d8f383ba60d87b
if(/<a[^>]*id\s*=\s*[\'"]js_btn_add_contact[\'"][^>]*style\s*=\s*[\'"]display:none;[\'"][^>]*>/i.test(serverResData.toString()) != true){
follow = '<script>var a = document.getElementById("js_btn_add_contact"); a.click(); </script>';
}
@hjdo
hjdo / gist:16f41a1ca3f0230431f58b9f26ec7de1
Last active Apr 25, 2018
微信公众号文章页自动滚动到底部
View gist:16f41a1ca3f0230431f58b9f26ec7de1
var jumpScript = '<script>'+
'function jumpIf(date=2000, jumpUrl=""){'+
'var doc = document.all[0].innerHTML;'+
'if( /<span[^>]*display\\:\\s*none[^>]*>\\.*?已无更多\\.*?<\\\/span>/i.test(doc) ){'+
'document.body.scrollTop = document.body.scrollHeight - (document.body.clientHeight && document.documentElement.clientHeight);'+
'setTimeout(jumpIf, date);'+
You can’t perform that action at this time.