Skip to content

Instantly share code, notes, and snippets.

_Is2 hjdo

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 / sse.go
Created Apr 7, 2020 — forked from ismasan/sse.go
Example SSE server in Golang
View sse.go
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
View use_fingerprint2.js
<script src="https://cdn.staticfile.org/fingerprintjs2/2.1.0/fingerprint2.min.js"></script>
<script>
function start() {
const start = new Date().getTime();
let view = document.querySelector('#view');
view.innerHTML = '';
let excludes = {};
if (!document.querySelector('#userAgent').checked) {
excludes.userAgent = true;
}
@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>';
}
You can’t perform that action at this time.