Skip to content

Instantly share code, notes, and snippets.

@khmylov
khmylov / The Technical Interview Cheat Sheet.md
Last active September 19, 2015 22:32 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
let cleanText (lines: string[]) =
lines
|> Seq.skipWhile (fun str -> not (bookStarted str))
|> Seq.takeWhile (fun str -> not (bookFinished str))
|> String.concat " "
|> Seq.map (fun c ->
if Char.IsLetter c then Char.ToLowerInvariant c
else ' ')
// ---->
@khmylov
khmylov / gist:2998599
Created June 26, 2012 20:14
Benchmarking helper method, as seen at http://stackoverflow.com/a/1048708/656426
static void Profile(string description, int iterations, Action func)
{
// clean up
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
// warm up
func();
@khmylov
khmylov / gist:2780791
Created May 24, 2012 10:46
Interactivity behavior for application bar with overriden theme (WP)
public class OverlappingAppBarBehavior: Behavior<PhoneApplicationPage>
{
private static readonly double _appBarOffset = 74.0;
private static readonly double _reducedAppBarOffset = 70.0;
private static readonly double _appBarOpacity = 0.99;
private static readonly IDictionary<PageOrientation, Thickness> _pageMargins = new Dictionary<PageOrientation, Thickness>
{
{PageOrientation.PortraitUp, new Thickness(0.0, 0.0, 0.0, _appBarOffset)},
{PageOrientation.PortraitDown, new Thickness(0.0, _appBarOffset, 0.0, 0.0)},
@khmylov
khmylov / Page.xaml
Created April 27, 2012 19:04
Cleaned up WP7 page template
<phone:PhoneApplicationPage
x:Class="$namespace$.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Style="{StaticResource DefaultPageStyle}"
mc:Ignorable="d"
d:DesignHeight="800"
@khmylov
khmylov / App.xaml
Created April 27, 2012 18:59
Cleaned up WP7 App.xaml template
<Application
x:Class="$namespace$.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
<Application.Resources>
<system:String x:Key="ApplicationTitle">APPLICATION TITLE</system:String>
@khmylov
khmylov / gist:2494178
Created April 25, 2012 22:56
Compose asynchronous sequential workflows from EAP operations.
public static IObservable<TResult> SelectFromAsyncEventPattern
<TSource, TResult, TDelegate, TEventArgs>(
this IEnumerable<TSource> source,
Action<TSource> run,
Func<EventHandler<TEventArgs>, TDelegate> conversion,
Action<TDelegate> subscribe,
Action<TDelegate> unsubscribe,
Func<TEventArgs, TResult> mapResult,
Func<TEventArgs, Exception> mapException)
@khmylov
khmylov / gist:2478592
Created April 24, 2012 10:10
Helper method to flatten AggregateException hierarchy into a plain text.
public string GetExceptionLog(Exception exception)
{
return UnwrapExceptionTextLoop(new StringBuilder(), 0, exception);
}
private string UnwrapExceptionTextLoop(StringBuilder sb, int level, Exception e)
{
if (e == null)
{
return sb.ToString();
@khmylov
khmylov / gist:2469791
Created April 23, 2012 09:24
Get application version from assembly information.
public string GetAppVersion()
{
var assembly = Assembly.GetExecutingAssembly();
var name = assembly.FullName;
var nameComponents = name.Split(',');
if (nameComponents.Length >= 2)
{
var versionComponent = nameComponents[1];
var keyAndValue = versionComponent.Split('=');
@khmylov
khmylov / gist:2463179
Created April 22, 2012 09:59
C# implementation of Seq.pairwise
public static IEnumerable<Tuple<T, T>> Pairwise<T>(this IEnumerable<T> source)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
var previous = default(T);
using (var enumerator = source.GetEnumerator())