Skip to content

Instantly share code, notes, and snippets.

View Digiman's full-sized avatar
😃
Just do it!)

Andrey Kukharenko Digiman

😃
Just do it!)
View GitHub Profile
@Digiman
Digiman / .editorconfig
Last active April 22, 2019 20:07
EditorConfig file for .NET projects based on C# or VB + Markdown documentation (see more details here https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019#expression_level_csharp)
###############################
# Core EditorConfig Options #
###############################
root = true
# All files
[*]
charset = utf-8
@Digiman
Digiman / SerializerHelper
Last active July 21, 2022 12:53
Special helper class to serialize/deserialize data in C# to/from JSON/XML formats. For JSON uses the Json.Net library.
public static class SerializerHelper
{
public static string Serialize<T>(T data, SerializeFormat format)
{
switch (format)
{
case SerializeFormat.XML:
return SerializeToXml(data);
case SerializeFormat.JSON:
return SerializeToJson(data);
@Digiman
Digiman / PagedObservableArray.ts
Created July 18, 2015 11:23
Small TypeScript (JS) class to use for observable arrays that need to be devided on pages.
// Взято по примеру из источника: http://blog.greatrexpectations.com/2012/07/11/paging-lists-with-knockout/
export class PagedObservableArray {
options: any;
//public members
allData: KnockoutObservableArray<any>;
pageSize: KnockoutObservable<number>;
pageIndex: KnockoutObservable<number>;
page: KnockoutComputed<any>;
pageCount: KnockoutComputed<number>;
@Digiman
Digiman / ReferencesExtensions.ts
Created April 13, 2015 10:10
Simple code that can be used for store reference data for working with lists in web app with knockout.js.
// module with some classes that can used in the references or another parts of the application
module ReferencesExtensions {
export class ReferenceData<T> {
public data: KnockoutObservableArray<T>;
public apiPath: string;
logger: Utils.Logger;
constructor(apiPath: string) {
this.apiPath = apiPath;
this.data = ko.observableArray<T>([]);
@Digiman
Digiman / StorageHelper.ts
Last active December 27, 2023 13:34
Simple helper module on TypeScript for using local storage (HTML5) in browser. Also have the class to store the list of emails that need to use for autocomplete in the some pages.
// module with classes and logic for working with local storage in browsers via JavaScript
// see also: http://professorweb.ru/my/html/html5/level5/5_1.php
module StorageHelper {
export interface IStorageItem {
key: string;
value: any;
}
export class StorageItem {
key: string;
@Digiman
Digiman / Utils.ts
Last active July 19, 2016 14:34
The simple logger for a web application. Uses default console to output simple messages and [toastr](https://github.com/CodeSeven/toastr) to show notification.
/**
* Module with common classes, functions and etc. as utils for the whole web application.
*/
module Utils {
"use strict";
/**
* Common interface for Logger classes on client side (JavaScript).
*/
export interface ILogger {
@Digiman
Digiman / VizualizeAnimation.m
Last active August 29, 2015 14:01
Визуализация графика поверхности для задачи анализа ЭМП, распределенного по расчетной области. Применяется в приложении EMFF.
% специальный скрипт для импорта файлов с результатами анализа (разрез
% секции) и визуализации (с анимацией) - построение графика уровня
function VizualizeAnimation(xfile, yfile, lenght, aniFile)
% чтение квадратной матрицы из файла текстового
function [matrix] = ImportMatrix(filename, size)
matrix = zeros(size, size);
file = fopen(filename,'r');
[matrix, size] = fscanf(file,'%f',[size, size]);
fclose(file);
@Digiman
Digiman / FilesHelper.cs
Last active August 29, 2015 14:01
Sample class for work with files. Used by me at one large application.
/// <summary>
/// Вспомогательный класс для работы с файлами.
/// </summary>
public static class FilesHelper
{
/// <summary>
/// Получение расширения файла.
/// </summary>
/// <param name="filename">Файл для разбора (полный путь к нему).</param>
/// <returns>Возвращает расширение файла.</returns>
@Digiman
Digiman / LogHelper.cs
Last active August 29, 2015 14:01
Sample class for work with NLog from common library in whole solution in Visual Studio (for large projects).
/// <summary>
/// Помошник по ведению логов
/// Статический интерфейс над библиотекой для логирования (в данном случае - NLog2)
/// </summary>
public static class LogHelper
{
/// <summary>
/// Инициализация логгера.
/// </summary>
private static Logger _logger = LogManager.GetCurrentClassLogger();
@Digiman
Digiman / css_print.css
Last active October 12, 2015 23:58
Prepare the page to print.
@media print {
* {
background: none !important;
color: black !important;
box-shadow: none !important;
text-shadow: none !important;
/* Images, vectors and such */
filter: Gray(); /* IE4-8: depreciated */
filter: url('desaturate.svg#grayscale'); /* SVG version for IE10, Firefox, Safari 5 and Opera */