Skip to content

Instantly share code, notes, and snippets.

View ermakovich's full-sized avatar

Sergey Ermakovich ermakovich

View GitHub Profile
import React from 'react';
class RenderCount extends React.Component {
count = 0;
render() {
this.count++;
return this.count;
}
}
@ermakovich
ermakovich / 2fa.feature
Last active June 28, 2018 15:09
2FA feature example
Feature: 2-factor authentication
Background:
Given I'm logged in
Scenario: Enable 2FA
Given 2FA is disabled
When I navigate to "settings/security"
And I click to enable 2FA
And I enter code for enabling 2FA
Given code for enabling 2FA is correct
@ermakovich
ermakovich / CultureInfoExtensions.cs
Last active December 21, 2015 01:39
Extension method for the Silverlight System.Globalization.CultureInfo class, that gets the ISO 639-2 three-letter code for the language of the current System.Globalization.CultureInfo object. It uses ISO-639-2 table (http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt), that is retrieved via Utils.GetResourceStream() custom method. The imp…
using System.IO;
namespace System.Globalization
{
public static class CultureInfoExtensions
{
/// <summary>
/// Gets the ISO 639-2 three-letter code for the language of the current System.Globalization.CultureInfo object.
/// </summary>
/// <param name="cultureInfo"></param>
@ermakovich
ermakovich / StringExtensions.cs
Last active December 21, 2015 01:39
Extension method for the System.String class, that reports the index of the N-th occurence of a specified string within the current System.String object.
namespace System
{
public static class StringExtensions
{
/// <summary>
/// Reports the index of the N-th occurence of a specified string within the current System.String object.
/// </summary>
/// <param name="source">Source string.</param>
/// <param name="value">The string to seek.</param>
/// <param name="n">