Skip to content

Instantly share code, notes, and snippets.

View netcore-jroger's full-sized avatar
🎯
Focusing

JRoger netcore-jroger

🎯
Focusing
View GitHub Profile
@netcore-jroger
netcore-jroger / anchor-animation.html
Last active September 9, 2021 04:58
anchor-animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
html,body,ul{padding: 0; margin: 0; font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;}
.side{
@netcore-jroger
netcore-jroger / ProgressBar.cs
Created June 24, 2020 06:33 — forked from granddalf/ProgressBar.cs
ProgressBar in Console C#
using System;
using System.Text;
using System.Threading;
/// <summary>
/// An ASCII progress bar
/// </summary>
public class ProgressBar : IDisposable, IProgress<double> {
private const int blockCount = 10;
private readonly TimeSpan animationInterval = TimeSpan.FromSeconds(1.0 / 8);
@netcore-jroger
netcore-jroger / InterfaceDynamicProxy.cs
Last active May 26, 2016 09:18
Emit动态实现接口. 并调用 Interceptor 类的 Invoke 方法。我们可以在 Invoke 方法中大做文章。
//示例
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Net.Http;
using System.Collections.Generic;
namespace DynamicProxyBuilderInterceptor
{
class MainClass
@netcore-jroger
netcore-jroger / MyWebBrowser.cs
Last active October 12, 2022 16:01
通过扩展 WebBrowser 使其有处理错误的能力
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public class MyWebBrowser : WebBrowser
{
private AxHost.ConnectionPointCookie cookie;
@netcore-jroger
netcore-jroger / gist:f9c3af951e30d3b2904e
Created August 11, 2014 08:34
处理模拟 HTTP 请求时,如果有 302 状态码的情况
https://github.com/malteclasen/DracWake/blob/master/DracWake.Core/WebClient.cs
DracWake.Core/WebClient.cs
//处理模拟 HTTP 请求时,如果有 302 状态码的情况。
设置 HttpWebRequest 类实例的 AllowAutoRedirect 为 false
@netcore-jroger
netcore-jroger / gist:7be2c182de16e758a292
Last active August 29, 2015 14:02
参与老赵问答第二期:关于 struct 做为 Dictionary<TKey, TValue> 类型的键来使用的问题
/*
* 看到这个道题后想到了两点:
* 1.对 Dictionary<TKey, TValue> 的实现是否有所了解
* 2.对值类型是否有所了解,或者说对值类型和引用类型的区别是否有所了解
*
*
* 1.关于 Dictionary<TKey, TValue> 的实现。先看一下当实例化一个 Dictionary<TValue, TValue> 后添加键值对的方法 Add(TKey key, TValue value)
* Add 方法又直接调用了 Insert(TKey key, TValue value, bool add) 私有方法,我从里面摘抄了感觉重要的地方。
*/
public interface ILinkedSetElement<T> where T : class, ILinkedSetElement<T>
{
T Next { get; set; }
}
public class LinkedSet<T> where T : class, ILinkedSetElement<T>
{
private T _top;
private T _bottom;