Skip to content

Instantly share code, notes, and snippets.

View ivandrofly's full-sized avatar

Ivandro Jao ivandrofly

View GitHub Profile
@ivandrofly
ivandrofly / ilopcodes.md
Created July 25, 2024 09:16 — forked from KaanGaming/ilopcodes.md
Useful IL opcodes

Useful IL Opcodes

IL opcodes documentation designed with dynamically building assemblies in C# in mind. This documentation implies you know the basics of C# and programming fundamentals, but not how a computer operates at the deep level of understanding (e.g. stacks, heap, instructions, opcodes, etc.)

What's IL?

If you don't know what IL is, it stands for Intermediate Language, also referred to as Common Intermediate Language (CIL). CIL is the one that's used in generating IL code for dynamic assemblies in C#.

@ivandrofly
ivandrofly / Srp-By-Zoran-Horvat.cs
Last active September 10, 2023 04:23
Keep an Eye on SRP - That Might Just Save Your Broken Code Base
// https://youtu.be/vTnlFdRf1Kc
var martinFowler = new Person(10, "Martin Fowler);
var server = new DemoDiscountServer(person);
var book = new Book("Design Patern", new List<Person>{martinFowler});
var discountApplications = server.GetDiscountAmounts(10, new DiscountContext(book))
public interface IDiscount
@ivandrofly
ivandrofly / ebu country of origin.json
Created October 27, 2020 09:33
The three-letter (Alpha-3) codes given in the table below are those used in the Country of Origin (CO) field of the GSI block. The 2 character codes and 4 character codes given are from the current ISO Standard 3166-3. The country names indicated here are not necessarily the official names of the countries or territories. The information given h…
[
{
"CO": "ABW",
"CountryName": "Aruba",
"TwoLettersCode": "AW"
},
{
"CO": "AFG",
"CountryName": "Afghanistan",
"TwoLettersCode": "AF"
@ivandrofly
ivandrofly / [subtitleedit]-language.cs
Created March 19, 2017 05:39
shotter way to set value from xml reader
private static void SetValue(Language language, XmlReader reader, string name)
{
// Note: Not yet tested!
var path = name.Split('/');
var currentType = typeof(Language);
// get 1st prop => General -> General/Title
System.Reflection.PropertyInfo propInfo = currentType.GetProperty(path[0]); // if Name/type then -> Name
for (int i = 1; i < path.Length; i++)
{
propInfo = propInfo.DeclaringType.GetProperty(path[i]);
@ivandrofly
ivandrofly / expression-tree.cs
Created March 18, 2017 16:41
this method is written to fix Subtitle Edit's GetRegExContextMenu(Combobox/TextBox) nightmare
// this method is written to fix Subtitle Edit's GetRegExContextMenu(Combobox/TextBox) nightmare
// make more sense as an extension method.
public static Action<TControl, string> BuildContextMenuRegex<TControl>()
{
var setMethod = typeof(TControl).GetProperty("SelectedText").GetSetMethod();
var instanceParam = Expression.Parameter(typeof(TControl), "instance");
var regexTokenParam = Expression.Parameter(typeof(string), "regexToken");
var lambaExp = Expression.Lambda<Action<TControl, string>>(Expression.Call(instanceParam, setMethod, regexTokenParam), instanceParam, regexTokenParam);
return lambaExp.Compile();
using System.Security.Cryptography;
using System.Text;
namespace Snippets
{
public static class SHA1Util
{
/// <summary>
/// Compute hash for string encoded as UTF8
/// </summary>
@ivandrofly
ivandrofly / Unicode table
Created May 4, 2014 02:20
Unicode table - List of most common Unicode characters *
Unicode table - List of most common Unicode characters *
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable.
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol.
What is Unicode?
Unicode is a standard created to define letters of all languages ​​and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode.
How to identify the Unicode number for a character?
Type or paste a character: