Skip to content

Instantly share code, notes, and snippets.

View yuv4ik's full-sized avatar
👨‍💻
Back to business

Evgeny Zborovsky yuv4ik

👨‍💻
Back to business
View GitHub Profile
@yuv4ik
yuv4ik / AuthTokenDocumentFilter.cs
Last active February 3, 2017 15:28
Adding swagger to asp.net web.api 2 owin
public class AuthTokenDocumentFilter : IDocumentFilter
{
public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer)
{
swaggerDoc.paths.Add("/token", new PathItem
{
post = new Operation
{
tags = new List<string> { "Auth" },
consumes = new List<string>
@yuv4ik
yuv4ik / ViewController.swift
Created March 20, 2017 07:44
iOS UIDatePicker in UIDatePickerMode.countDownTimer value changed bug
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Create a DatePicker
let datePicker: UIDatePicker = UIDatePicker()
@yuv4ik
yuv4ik / ContentPage.xaml
Last active December 28, 2020 16:52
Xamarin.Forms DatePicker with hours, minutes and seconds: TimeCountdownPicker
/*
Xaml example.
*/
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:YourNameSpace"
x:Class="YourNameSpace.ContentPage">
@yuv4ik
yuv4ik / git_rename.sh
Created April 28, 2017 08:06
git rename a file (case sensitive)
git mv -f OldFileNameCase newFileNameCase
@yuv4ik
yuv4ik / ExtendedEntry.cs
Created May 5, 2017 13:59
Xamarin.Forms iOS Numeric Keyboard With 'Done' Button
using Xamarin.Forms;
namespace YourNamespace.Controls
{
public class ExtendedEntry : Entry { }
}
@yuv4ik
yuv4ik / IEntity.cs
Last active August 23, 2017 06:46
EntityFramework database first => generalising timestamps
namespace SameNameSpaceAsAutoGeneratedDbContext
{
public interface IEntity
{
int Id { get; set; }
DateTime CreatedAt { get; set; }
DateTime? UpdatedAt { get; set; }
DateTime? DeletedAt { get; set; }
}
@yuv4ik
yuv4ik / ValidateModelAttribute.cs
Created August 23, 2017 15:25
Web.API 2 model state validation action filter
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace MyAwesomeWebApi.ActionFilters
{
/// <summary>
/// Returns 400 if the ModelState is invalid.
@yuv4ik
yuv4ik / dot_net_clear_bin_obj_packages_dirs.sh
Last active December 27, 2017 19:27
[For .NET projects] Recursively find and delete bin, obj and packages directories
# Recursively find and delete "bin", "obj" and "packages" dirs
# Backup your code before using this script, I am not responsible for any data loss. Please use it wisely.
find . -iname "bin" -o -iname "obj" -o -iname "packages" | xargs rm -rf
@yuv4ik
yuv4ik / Droid.ClipboardService.cs
Created January 19, 2018 07:57
[Xamarin.Forms] [iOS] [Droid] IClipboardService to read and write text value from the Clipboard
public class ClipboardService : IClipboardService
{
public string GetTextFromClipboard()
{
var clipboardmanager = (ClipboardManager)Forms.Context.GetSystemService(Context.ClipboardService);
var item = clipboardmanager.PrimaryClip.GetItemAt(0);
var text = item.Text;
return text;
}
@yuv4ik
yuv4ik / git_after_gitignore_update.sh
Created February 15, 2018 15:11
Sync .gitignore changes
/*
* First commit any outstanding code changes before executing this command.
* Source: https://stackoverflow.com/a/38451183/1970317
*/
git rm -r --cached .
git add .
git commit -m "Fix .gitignore by {UPDATE}"