Skip to content

Instantly share code, notes, and snippets.

View vinhquyen's full-sized avatar

Quyen Quach vinhquyen

  • Viet Nam
View GitHub Profile
@vinhquyen
vinhquyen / CompleteDiscordQuest.md
Created May 13, 2025 09:08 — forked from aamiaa/CompleteDiscordQuest.md
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This does not works in browser for non-video, non-activity quests! For stream/play quests use the desktop app!

Note

When doing stream quests, you need at least 1 other account in the vc!

How to use this script:

  1. Accept a quest under Discover -> Quests
@vinhquyen
vinhquyen / mongodb_c#_cheatsheet.md
Created December 9, 2024 06:58 — forked from a3dho3yn/mongodb_c#_cheatsheet.md
MongoDB C# Driver Cheat Sheet

MongoDB C# Driver Cheat Sheet

(C) 2015 by Derek Hunziker, (C) 2017 by AppsOn

As of releasing MongoDB 3.4 and C# Driver v2.4, original cheatsheet by Derek is outdated. In addition, it has some deficiencies like connecting to MongoDB, creating indexes, etc. This updated version works fine with C# Driver v2.4.7 and MongoDB v3.4.

Setup

Define Document Models

Note: Defined models and collections will be used in entire cheatsheet.

@vinhquyen
vinhquyen / JsonPatchDocumentDiff.cs
Created December 7, 2022 07:29 — forked from bymyslf/JsonPatchDocumentDiff.cs
Creates a JsonPatchDocument (JSON Patch - RFC 6902) from comparing to C# objects
using Microsoft.AspNetCore.JsonPatch;
using Microsoft.AspNetCore.JsonPatch.Operations;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
//Based on this: https://blog.abodit.com/posts/2014-05-json-patch-c-implementation/
public static class JsonPatchDocumentDiff
{
@vinhquyen
vinhquyen / gist:c8103665cafa8fb9f051bf17483c5f3a
Created December 1, 2022 14:49 — forked from sandord/gist:400553
Get property name from lambda expression
using System.Linq.Expressions;
/// <summary>
/// Returns the name of the specified property of the specified type.
/// </summary>
/// <typeparam name="T">The type the property is a member of.</typeparam>
/// <param name="property">The property expression.</param>
/// <returns>The property name.</returns>
public static string GetPropertyName<T>(Expression<Func<T, object>> property)
{
@vinhquyen
vinhquyen / jquery-dynamic-form.js
Created January 21, 2021 04:58 — forked from dharnan/jquery-dynamic-form.js
jQuery Dynamic Form
/*
* jquery.dynamicForm.js
* Arietis Software
* www.arietis-software.com
* 2009
* version: 1.1
* ----------------------------
* Distributed under the GNU General Public License
* http://www.arietis-software.com/license/gnu/license.txt
*
@vinhquyen
vinhquyen / gist:24b68926db33bc29074a067e880c965e
Created December 17, 2020 10:09 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@vinhquyen
vinhquyen / Freezable.cs
Created July 27, 2020 11:39 — forked from jagt/Freezable.cs
Castle Dynamic Proxy Example
using System;
using System.Collections.Generic;
using Castle.DynamicProxy.Generators;
using Castle.DynamicProxy;
// http://kozmic.net/2008/12/16/castle-dynamicproxy-tutorial-part-i-introduction/
public interface IFreezable
{
bool IsFrozen { get; }
@vinhquyen
vinhquyen / EntityFramwork DbModelStore for loading cached db models.
Created March 27, 2020 04:04 — forked from davidroth/EntityFramwork DbModelStore for loading cached db models.
EntityFramwork DbConfiguration with custom DbModelStore for loading cached db models. The custom DbModelStore invalidates out-of-date cache files by comparing the last update date of the cache-xml to the update date of the domain assembly.
public class MyContextConfiguration : DbConfiguration
{
public MyContextConfiguration()
{
MyDbModelStore cachedDbModelStore = new MyDbModelStore(MyContext.EfCacheDirPath);
IDbDependencyResolver dependencyResolver = new SingletonDependencyResolver<DbModelStore>(cachedDbModelStore);
AddDependencyResolver(dependencyResolver);
}
private class MyDbModelStore : DefaultDbModelStore