Skip to content

Instantly share code, notes, and snippets.

@XelaNimed
XelaNimed / HashUtils.cs
Created November 10, 2021 00:51
HashUtils.cs
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace YouNamespace.Utils {
/// <summary>
/// Class HashUtils.
/// </summary>
public static class HashUtils {
@XelaNimed
XelaNimed / FileUtils.cs
Last active November 10, 2021 00:44
FileUtils
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace YouNamespace.Utils {
/// <summary>
/// Class FileUtils.
/// </summary>
@XelaNimed
XelaNimed / StringExtensions.cs
Last active March 1, 2021 14:00
Interpolates placeholders in the string with values from the specified dictionary.
public static class StringExtensions
{
/// <summary>
/// Interpolates placeholders in the string with the values of the specified dictionary.
/// </summary>
/// <param name="pattern">String with placeholders.</param>
/// <param name="values">Dictionary with values for placeholders.</param>
/// <example>
/// const string pattern = "Name = {name}, Age = {age}, Null = {nullString}, Escape = {{escape}}";
/// var dict = new Dictionary<string, object>()
@XelaNimed
XelaNimed / VariantType.cs
Last active March 2, 2020 08:25
c# VARENUM enumeration
/// <summary><para>Specifies the variant types.<br/>
/// See also <see href="https://docs.microsoft.com/en-us/windows/win32/api/wtypes/ne-wtypes-varenum">VARENUM enumeration</see>
/// and <see href="https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/shared/wtypes.h#L833">wtypes.h</see>
/// </para></summary>
public enum VariantType
{
/// <summary>Not specified.</summary>
VT_EMPTY = 0,
/// <summary>Null.</summary>
VT_NULL = 1,
@XelaNimed
XelaNimed / LogFile.udl.xml
Created April 3, 2019 08:42
File (UDL) to highlight the syntax of log files in the text editor Notepad++
<NotepadPlus>
<UserLang name="Log" ext="log" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments"></Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@XelaNimed
XelaNimed / OpenSearchExample.xml
Created September 27, 2017 11:09
Example of OpenSearch
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription
xmlns:moz="http://www.mozilla.org/2006/browser/search/"
xmlns="http://a9.com/-/spec/opensearch/1.1/">
<!--
The "AdultContent" element contains a boolean value that should be set to true if the search results may contain material intended only for adults.
As there are no universally applicable guidelines as to what constitutes "adult" content,
the search engine should make a good faith effort to indicate when there is a possibility
that search results may contain material inappropriate for all audiences.
Values:
@XelaNimed
XelaNimed / Enum.SqlStatement.cs
Created August 16, 2017 13:06
Enumeration of all inherited classes from Microsoft.SqlServer.TransactSql.ScriptDom.TSqlStatement
namespace Types {
/// <summary>
/// Used for comparison SQL statements.
/// <seealso href="https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.transactsql.scriptdom.tsqlstatement.aspx"/>
/// </summary>
public enum SqlStatement {
/// <summary>
/// The unknown statement. Default value.
@XelaNimed
XelaNimed / Extensions.ToDataTable.cs
Created August 3, 2017 08:03
Extension for convert ExpandoObject to DataTable in C#
using System.Collections.Generic;
using System.Data;
using System.Dynamic;
using System.Linq;
namespace NamespaceName {
public static class Extensions {
/// <summary>
/// Create a datatable from a list of <see cref="IEnumerable{T}"/>
@XelaNimed
XelaNimed / getFunctionName.js
Created October 15, 2015 11:00
Method describe how to get function name in function
function foo() {
var fooName = arguments.callee.toString();
fooName = fooName.substr('function '.length++);
fooName = fooName.substr(0, fooName.indexOf('('));
return fooName;
}
@XelaNimed
XelaNimed / lazy-load-jsmodule.js
Created October 6, 2015 23:00
Simple example how to use lazy load into js modules
module.exports = function(providerName) {
return require('./'+providerName+'-storage.jsx');
};
// For require 'fs' storage
var storageConstructor = require('storage')('fs'),
fsStorage = new storageConstructor();