Skip to content

Instantly share code, notes, and snippets.

View arman-hpp's full-sized avatar
😊
Focusing

Arman Hasanpour arman-hpp

😊
Focusing
View GitHub Profile
@arman-hpp
arman-hpp / DelphiParseJson.pas
Created April 24, 2023 06:57
Delphi Parse Json
DecodeJsonUnicodeBytes(const unicodeByteStr: String): String;
var
LJSONObject: TJSONValue;
begin
try
LJSONObject := TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes('{"alias":"'+unicodeByteStr+'"}'), 0, true);
Result := LJSONObject.GetValue<String>('alias');
finally
LJSONObject.Free;
end;
@arman-hpp
arman-hpp / CertInstaller.cs
Created March 21, 2022 08:26
CertInstaller.cs
using System;
using System.Security.Cryptography.X509Certificates;
namespace CertInstaller
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(@"Certificate Installer v1.0");
@arman-hpp
arman-hpp / PropertyIgnoreSerializerContractResolver.cs
Created December 9, 2020 04:02
PropertyIgnoreSerializerContractResolver
using System.Collections.Generic;
using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace ConsoleApp1
{
public class PropertyIgnoreSerializerContractResolver : DefaultContractResolver
{
private readonly HashSet<string> _ignores;
@arman-hpp
arman-hpp / JsonIgnore.cs
Created December 2, 2020 10:06
JsonIgnore
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace ConsoleApp1
@arman-hpp
arman-hpp / SignController.cs
Created July 19, 2020 15:36
SignController.cs
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Web.Http;
namespace SignGenApi.Controllers
{
public class SignController : ApiController
{
@arman-hpp
arman-hpp / Enum.IsDefined.cs
Created May 21, 2020 03:16
Enum.IsDefined
public KeyboardLayoutType LayoutType
{
get
{
return this.layoutType;
}
set
{
if (!Enum.IsDefined(typeof (KeyboardLayoutType), (object) value))
throw new ArgumentException("Invalid LayoutType. When setting the LayoutType property, it must be a valid member of the KeyboardLayoutType enumeration!");
public enum TestEnum
{
A,
B,
C
}
var t = ~TestEnum.A; // t = ~1;
var t = ~TestEnum.B; // t = ~1;
var t = ~TestEnum.C; // t = ~1;
1- download Node.js from https://nodejs.org/en/download/ and install it.
2- npm install -g npm@latest
3- npm i -g create-react-app
4- in VSCODE instal this ext:
- Simple React Snippets
- Prettier
- Eslint
@arman-hpp
arman-hpp / CultureTest.cs
Created August 27, 2019 04:58
CultureTest
private void button1_Click(object sender, EventArgs e)
{
// Declare a Resource Manager instance.
ResourceManager LocRM = new ResourceManager("CultureTest.Language", typeof(Form1).Assembly);
// Assign the string for the "strMessage" key to a message box.
MessageBox.Show(LocRM.GetString("Hello"));
}
private void button2_Click(object sender, EventArgs e)
{
@arman-hpp
arman-hpp / InvokeFast.cs
Created July 25, 2019 03:11
InvokeFast
public void FuncInvoke()
{
var del = (Func<int, bool, int>)Delegate.CreateDelegate(typeof(Func<int, bool, int>), Obj, Method);
var arg0 = (int)Args[0];
var arg1 = (bool)Args[1];
del(arg0, arg1);
}