Skip to content

Instantly share code, notes, and snippets.

View imzjy's full-sized avatar

Jerry Chou imzjy

View GitHub Profile
@imzjy
imzjy / pollurl.js
Created April 14, 2022 11:46 — forked from bit4bit/pollurl.js
polling jquery
function pollUrl(url, renderer) {
return function(render){
if(render == undefined) { render = renderer; }
$.getJSON(url, function(data){
render(data);
}).always(function(){
setTimeout(pollUrl(url, render), 5000);
});
};
@imzjy
imzjy / gist:ebd66a0b806b047c14dbf774c98cccf0
Created April 6, 2022 01:22 — forked from ReitenSchnell/gist:5998938
BlockingCollection with priorities
public class PriorityCollection
{
private readonly BlockingCollection<Item> low = new BlockingCollection<Item>();
private readonly BlockingCollection<Item> middle = new BlockingCollection<Item>();
private readonly BlockingCollection<Item> high = new BlockingCollection<Item>();
private readonly BlockingCollection<Guid> main = new BlockingCollection<Guid>();
private readonly BlockingCollection<Item>[] queue;
private readonly Dictionary<Priority, BlockingCollection<Item>> priorityMap = new Dictionary<Priority, BlockingCollection<Item>>();
public List<Priority> TestList { get; private set; }
@imzjy
imzjy / README.md
Created March 4, 2019 02:19 — forked from JaimeStill/README.md
Active Directory Authorization Workflow
@imzjy
imzjy / slash_middleware.py
Created May 11, 2018 11:34 — forked from Sepero/slash_middleware.py
Remove slashs in django - like APPEND_SLASH but opposite.
""" Author contact: sepero 111 @ gmail . com """
from django import http
from django.utils.http import urlquote
from django.core import urlresolvers
class RemoveSlashMiddleware(object):
"""
This middleware works like django's built in APPEND_SLASH, but in reverse. Eg
@echo off
SET st2Path=C:\software\SublimeText\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text" /t REG_SZ /v "" /d "Open with Sublime Text" /f