Skip to content

Instantly share code, notes, and snippets.

View Mohsens22's full-sized avatar
🎯
Focusing

Mohsen Seifi Mohsens22

🎯
Focusing
View GitHub Profile
@Mohsens22
Mohsens22 / GeeksSubs.cs
Last active May 21, 2019 18:25
A C# parser for Geeks subtitle format.
public static class Extentions
{
//Generates subtitles are like this:
/*
0-1126|:|Bean! No!
1210-3003|:|She forgot her glove!
3086-5339|:|My poor Princess Tiabeanie.
5422-7758|:|She never had a chance to say she loved me.
9092-10219|:|Now what? Whoa!
*/
Opeth // Watershed
ABBA // Greatest Hits
Dream Theater // Parasomnia
Dream Theater // Train of Thought
Dream Theater // A View from the Top of the World
Opeth // The Last Will and Testament
Opeth // In Cauda Venenum
The Moody Blues // The Best Of The Moody Blues
Pineapple Theft // Variations on a Dream
Anathema // Universal concert
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Matrix.Utils
{
static class SelectListHelper
{
@Mohsens22
Mohsens22 / TheTemplate.md
Last active March 11, 2019 16:21
Notes about GCop 331

GCop311

Throw exception without specifying the original exception. Remove 'exceptionIdentifier' from throw statement.

Rule description

throw re-throws the exception that was caught, and preserves the stack trace. throw ex throws the same exception, but resets the stack trace to that method.

Unless you want to reset the stack trace (i.e. to shield public callers from the internal workings of your library), throw is generally the better choice, since you can see where the exception originated.

@Mohsens22
Mohsens22 / GCopDocumentRenderer.scx
Last active March 11, 2019 16:22
Renders documentation for GCop
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
var folder = new DirectoryInfo(@"./Rules");
var filez = Reader.RemoveSuffix(Reader.RemovePrefix(Reader.ReadFileNames(folder,"_Template.md"),"GCop"),".md");
var lines = MDEngine.GetLines(new FileInfo(@"Rules\GCop101.md"));
@Mohsens22
Mohsens22 / TestIncrement.cs
Created December 5, 2017 08:27
This C# code will help you to increment a number in a text file and get the last number!
/// <summary>
/// This methid will help you to increment a number which is saved in storage, so can be used in application lifecycle.
/// </summary>
/// <param name="path">Desired file path for increment</param>
/// <returns>increment</returns>
public static int Increment(string path = "Text.txt")
{
StreamReader stt;
string lns = "";