Skip to content

Instantly share code, notes, and snippets.

@PrashantUnity
PrashantUnity / Resume.cs
Created May 16, 2023 08:59
Creating Resume Using CSharp Language and QuestPdf Library
View Resume.cs
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
using QuestPDF.Previewer;
using SkiaSharp;
QuestPDF.Settings.License = LicenseType.Community;
Document.Create(container =>
{
container
@PrashantUnity
PrashantUnity / Tries.cs
Created April 3, 2023 04:31
Trie Data Structure
View Tries.cs
public class Node
{
public Dictionary<char,Node> value { get; set; } = new Dictionary<char,Node>();
public bool IsEndOfWord = false;
}
public class Trie
{
Node node;
public Trie()
{ node = new Node();}
View FinalMouseMovementWithScroll.cs
using System;
using System.Diagnostics;
using System.Drawing;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Console;
View LeetCode2DArrayToCSharpArray.cs
public List<List<int>> ListFromString(string str)
{
return str.Split(']')
.Where(x => x.Length > 0)
.Select(x=> x
.Split(new char[] { '[', ',' })
.Where(m => m.Length > 0)
.Select(m => Convert.ToInt32(m))
.ToList())
.ToList();
View Highlight.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>HighLight Js Example </title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
View CpuUses.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace CpuUses
{
class Program
{
static PerformanceCounter cpuCounter;
@PrashantUnity
PrashantUnity / LeetCodeTreeMaker.cs
Created October 5, 2022 04:01
Will Help in debugging on your local computer
View LeetCodeTreeMaker.cs
public class Program
{
static void Main(string[] args)
{
var arr = new int[] {1,2,3,4,5,6,7,8,9};
var tree = new LeetCodeTree().MakeTree(arr);
BFS(tree);
}
}
public class LeetCodeTree
@PrashantUnity
PrashantUnity / MaterialColor.cs
Created August 29, 2022 06:39
Setting Random Material color to game object inside unity editor
View MaterialColor.cs
var newObstacle = Instantiate(cube, new Vector3(i, 0, j), Quaternion.identity, transform);
Renderer obstacleRenderer = newObstacle.GetComponent<Renderer>();
Material mat = new Material(obstacleRenderer.sharedMaterial);
mat.color = GetRandomColor();
obstacleRenderer.sharedMaterial = mat;
//
public Color GetRandomColor()
View Editor.cs
// MapGenerator is class on which this custom editor will be called
using UnityEditor;
[CustomEditor(typeof(MapGenerator))]
public class Edit : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
// if you remove |^|(base.OnInspectorGUI(); )
// variable in inspector may not show up properly
@PrashantUnity
PrashantUnity / ShapesData.cs
Created August 28, 2022 16:10
Creating Shapes points in 3d Space
View ShapesData.cs
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using UnityEngine;
using static TMPro.SpriteAssetUtilities.TexturePacker_JsonArray;
public class ShapesData
{
public float circleRadius;
public Vector2 rectangle;